[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”.

Error Not Found on Magento Admin Page

Posted on 1 CommentPosted in Magento, Programming

When I move the Magento Enterprise to the another server, I found the error on backend page. I update the table : core_store, core_store_group and core_website. [code]SET FOREIGN_KEY_CHECKS=0; UPDATE `core_store` SET store_id = 0 WHERE code=’admin’; UPDATE `core_store_group` SET group_id = 0 WHERE name=’Default’; UPDATE `core_website` SET website_id = 0 WHERE code=’admin’; UPDATE `customer_group` SET […]

Get URL base for Magento

Posted on Leave a commentPosted in Magento, Programming

This is the way to get URL base on Magento Frameworks [code] <?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); // output: http://yoursite.com/ echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); // output: http://yoursite.com/js/ echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); // output: http://yoursite.com/index.php/ echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); // output: http://yoursite.com/media/ echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); // output: http://yoursite.com/skin/</a> ?> [/code]

Magento connection adapter

Posted on Leave a commentPosted in Magento, Programming

Ketika kita ingin memasukkan data ke dalam database, Magento sudah mempermudah para developer dengan penggunaan Model dan Helper yang terdapat pada modul yang digunakan. Tapi kadang, sebagai developer kita sedikit malas untuk menyediakan class model dan helper yang diperlukan, untuk itu saya membuat custom code yang dapat digunakan secara lebih sederhana ketika ingin insert data […]