Zend Anwar

Full stack web developer

Disable compilation from command line

Magento Compilation – Compile, Clear, Enable and Disable from Command Line If you have shell access running just got to shell folder $ php shell/compiler.php Usage:  php -f compiler.php — [options] state         Show Compilation State compile      Run Compilation Process clear          Disable Compiler include path and Remove compiled files enable       Enable Compiler include path disable      Disable […]

Read More

How To Export product with Category Names in Magento

<?php ini_set(‘memory_limit’, ‘2048M’); ini_set(‘max_execution_time’, 180000); require_once ‘../app/Mage.php’; umask(0); // output headers so that the file is downloaded rather than displayed header(‘Content-Type: text/csv; charset=utf-8’); header(‘Content-Disposition: attachment; filename=products.csv’); // create a file pointer connected to the output stream $output = fopen(‘php://output’, ‘w’); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $userModel = Mage::getModel(‘admin/user’); $userModel->setUserId(0); $collection = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’); $attributeSetModel = Mage::getModel(“eav/entity_attribute_set”); // $product->getModel(),$product->getProductcode(), […]

Read More

Magento dashboard charts not working

It’s very simple just follow the below code Locate this file: app/design/adminhtml/default/default/template/dashboard/graph.phtml And change: “getChartUrl()” to “getChartUrl(true)”

Read More

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

Bootstrap: How to make dropdown navigation Parent links an active link?

please add below js, hope it will work jQuery(function($) { $(‘.navbar .dropdown’).hover(function() { $(this).find(‘.dropdown-menu’).first().stop(true, true).delay(250).slideDown(); }, function() { $(this).find(‘.dropdown-menu’).first().stop(true, true).delay(100).slideUp(); }); $(‘.navbar .dropdown > a’).click(function(){ location.href = this.href; }); });

Read More

Why Python for Data Analysis?

Python has become one of the most popular dynamic,programming languages, along with Perl, Ruby, and others. Python and Ruby havebecome especially popular in recent years for building websites using their numerous web frameworks, like Rails (Ruby) and Django (Python). Such languages are often called scripting languages as they can be used to write quick-and-dirty small programs,or scripts. […]

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