$layout = Mage::app()->getLayout();
$layout->getUpdate()
->addHandle('default')
->addHandle('checkout_cart_index')
->load();
$layout->generateXml()->generateBlocks();
$cartBlock = $layout->getBlock('checkout.cart')->toHtml();
$cartSidebar = $layout->getBlock('minicart_head')->toHtml();
<?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>';
Comments
Post a Comment