如何获得最终价格,在 Magento 中应用价格规则 [英] How can get Final Price, with applied price rule in Magento
本文介绍了如何获得最终价格,在 Magento 中应用价格规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如
$_producte = Mage::getModel('catalog/product')->load(2974);
echo $_producte->getFinalPrice();
插入到 .phtml 时我可以进入前端
I can get in frontend when insert to .phtml
但我无法在管理部分或自定义产品导出文件中获得最终价格(带折扣).
BUT I can not get final price (with discount) in admin section or in custom product export file.
推荐答案
Magento 中的价格计算是一团糟.您需要加载前端事件区域才能触发规则计算(参考 Mage_CatalogRule_Model_Observer::processFrontFinalPrice()
在 Mage_CatalogRule
config.xml 中配置).
Price calculation in Magento is a hot mess. You need to load the frontend event area in order to trigger rule calculation (ref Mage_CatalogRule_Model_Observer::processFrontFinalPrice()
configured in Mage_CatalogRule
config.xml).
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND,Mage_Core_Model_App_Area::PART_EVENTS);
这篇关于如何获得最终价格,在 Magento 中应用价格规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文