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…

Get customer product alert subscriptions list in Magento

Some things are easy, some things are not. This one is easy-peasy. If you want to get the product list that a customer has been subscribed to (price or stock alert), you need to use the productalert model. Product stock alert list $customer_id = Mage::getSingleton(‘customer/session’)->getCustomer()->getId(); $customer_stock_alerts = Mage::getModel(‘productalert/stock’) ->getCollection() ->addFieldToFilter(‘customer_id’, Read more…