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

前端 未结 4 1081
清歌不尽
清歌不尽 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:28

    I discovered the problem. The discounted prices display Ok in the store frontend. The problem was that I was developing a script "external" to Magento (thus not a Magento module), something like:

    getStore();
    ...
    

    For everything to work properly it seems that one must follow the proper Magento bootstrap, and develop everything as a module. My script was so simple that I thought it wouldn't be necessary to code a complete module. In other words, everything in Magento should really be a module.

    Concluding, using the module approach, all the methods work as expected:

    $_product->getPrice()
    $_product->getFinalPrice()
    $_product->getSpecialPrice()
    

    Thank you all for your input.

提交回复
热议问题