[CODE] Get Product That Have “Expired” Special Price on Magento

Posted on Leave a commentPosted in Magento, PHP, Programming

$catalogCol= Mage::getModel(‘catalog/product’)->getCollection(); //get data for special price that expired $catalogCol->addAttributeToSelect(‘name’) ->addAttributeToSelect(‘price’) ->addAttributeToFilter(‘status’, array(‘eq’ => Mage_Catalog_Model_Product_Status::STATUS_ENABLED)) ->addAttributeToFilter(‘special_price’, array(‘gt’ => 0)) ->addAttributeToFilter(‘special_to_date’, array(‘date’ => true, ‘from’ => $todayDate, ‘to’ => $todayDate)); We can select what attribute that we need to be shown and then if we want to filter based on another attribute, we can use “addAttributeToFilter”.

[CODE] Get New Product on Magento

Posted on Leave a commentPosted in PHP, Programming

Below is code for get collection data that contain product with new SKU based on created data.. $catalogCol= Mage::getModel(‘catalog/product’)->getCollection(); //get data that new SKU product $catalogCol->addAttributeToSelect(‘name’) ->addAttributeToSelect(‘price’) ->addAttributeToFilter(‘status’, array(‘eq’ => Mage_Catalog_Model_Product_Status::STATUS_ENABLED)) ->addAttributeToFilter(‘created_at’, array(‘date’ => true, ‘from’ => $todayDate,’to’ => $date)); We can select what attribute that we need to be shown and then if we […]