Magento: how to get the price of a product with catalog rules applied

前端 未结 4 1063
清歌不尽
清歌不尽 2020-12-28 17:51

I\'m developing a script (external to Magento, not a module) which aims to output a text list of all available products, their prices and some other attributes. However, cat

4条回答
  •  攒了一身酷
    2020-12-28 18:35

    As catalog price rules heavily depend on time, store and visiting customer, you need to set those parameters when you want to retrieve the product final price with it's price rules applied.

    So, in your case, make sure that provided product is passed with the desired store and customer group id, which can be set as:

    Mage::getModel('catalogrule/rule')->calcProductPriceRule($product->setStoreId('STORE_ID')->setCustomerGroupId('CUSTOMER_GROUP_ID'),$product->getPrice())
    

提交回复
热议问题