Skip to main content

Posts

Showing posts from October, 2018

TO Execute Multiple Raw Query In Magento 2

<?php         /*          *          * TO Execute Multiple Raw Query In Magento 2          *          * */ $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $resource = $objectManager->get('Magento\Framework\App\ResourceConnection'); $conn = $resource->getConnection('write'); $sqlScript = file($sqlFile); $query = ''; foreach ($sqlScript as $line) { $startWith = substr(trim($line), 0 ,2); $endWith = substr(trim($line), -1 ,1); if (empty($line) || $startWith == '--' || $startWith == '/*' || $startWith == '//') continue; $query = $query . $line; if ($endWith == ';') { $conn->query($query); $query= ''; } } echo '<div class="success-response sql-import-response">SQL file imported successfully</div>';

Magento Copy Base Image To Thumbnail Image

-------------------------------------------------------------------------------- Copy Base Image To Thumbnail Image -------------------------------------------------------------------------------- UPDATE catalog_product_entity_varchar AS ev,        catalog_product_entity_varchar AS ev2 SET    ev.value = ev2.value WHERE  ev.entity_id = ev2.entity_id AND    ev.attribute_id =        (               SELECT `attribute_id`               from   eav_attribute a               WHERE  attribute_code = 'thumbnail'                             AND    entity_type_id =                      (                       ...