Zend Anwar

Full stack web developer

Category: Magento

Magento

Programmatically remove order in Magento

<?php require_once ‘app/Mage.php’; umask(0); Mage::app(); Mage::register(‘isSecureArea’, true); $orders = Mage::getModel(‘sales/order’)->getCollection(); foreach ($orders as $order) { $order->delete(); }

Read More

After compilation magento site is broken

It’s very simple. don’t be worry. Just go to includes/config.php and edit with below code. #define(‘COMPILER_INCLUDE_PATH’, dirname(__FILE__).DIRECTORY_SEPARATOR.’src’); #define(‘COMPILER_COLLECT_PATH’, dirname(__FILE__).DIRECTORY_SEPARATOR.’stat’); After edit site will be active.

Read More

Magento get products from category randomly

Just follow the below code $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort() ->addAttributeToSelect(‘small_image’) ->addCategoryFilter(Mage::getModel(‘catalog/category’)->load()); $products->getSelect()->order(new Zend_Db_Expr(‘RAND()’));

Read More

MySQL 5.7 3x Faster than MySQL 5.6

Magento has the biggest slice from the e-commerce cake and it’s a very cleaver but robust system. Any switch/upgrade can be painful even because these systems are customized strongly. This is why business owners and developers don’t upgrade very slowly. But might be the time is here 🙂 In the last few years we can […]

Read More

How to remove decimal price in magento

just need to edit core file of Magento app\code\core\Mage\Directory\Model\Currency.php or you can create a file in local folder Find the following :  public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)     {         return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);     } Replace with:  public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)     {         return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);     }  

Read More

Magento: Automatic Related Products Extension free download

Automatic Related Products Extension free download

Read More

Changes to login.phtml or register.phtml don’t reflect

Please  to edit template/persistent/customer/form/register.phtml. Use the template hints. Also, with any phtml changes you make, make sure that you have caching disabled, and flush all caches (System -> Cache Management).

Read More

Magento admin panel gives 404 when trying to enter CMS pages

You are getting a 404 on CMS pages because of the remains of old store views still hanging around in the database after deleting store views from Magento admin, to clean up ( delete ) old unused CMS pages for store views you have deleted run this MySQL query. DELETE FROM cms_page_store WHERE store_id NOT […]

Read More

Magento2 admin menu panel doesn’t work

It’s very simple solution : line 574  in Magento2.2 remove  <item name=”view_preprocessed” xsi:type=”object”>Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item> refresh, hope it will work.    

Read More

dbModel read resource does not implement Zend_Db_Adapter_Abstract in Magento

It’s very simple solution: just clear /var/cache it’s not yet solved, just make /var/cache &  /var/sessions permission 777  

Read More