Script to execute upgrade actions without flushing the cache in Magento

When having many different servers I have faced more than once issues related to module installation/upgrades. Here you have a quick script that upgrades all modules from terminal: <?php require_once "../app/Mage.php"; Mage::app(‘admin’); $begin = microtime(true); Mage::log("Upgrade Begin-".$begin); Mage_Core_Model_Resource_Setup::applyAllUpdates(); Mage_Core_Model_Resource_Setup::applyAllDataUpdates(); $end = microtime(true); Mage::log("Upgrade End-".$end); Mage::log("Duree : ".($end – $begin));

Filter product collection by multiple categories in Magento

During the past week I’ve dealed with a very weird and stressing thing with my colleagues: filtering a product collection by multiple categories in Magento. Filter by only 1 category Magento offers a type of filter that can be used directly from the collection: $_category = Mage::getModel(‘catalog/category’)->load($category_id); $collection->addCategoryFilter($_category); Filter by Read more…