2

If I try to print price and final_price from $_product in category page template (product/list.phtml), they have the same value despite the product is affected by a catalog rule. Why?

How can I get the discounted price in there?

1 Answer 1

0

Make sure your price indexes (actually all your indexes) are up to date.
The prices in the product list don't come directly from the product entity. They come from the table catalog_product_index_price where the indexed prices are kept.
If you have a discount rule that you just created but you did not rebuild the indexes you won't see the proper prices in the list.
This does not apply to the product view page because here the prices come from the product entity directly.

4
  • Also in catalog_product_index_price they are the same. You're right. I've tried to update all my indexes (php bin/magento indexer:reindex) but nothing's changed.
    – WaPoNe
    Commented Dec 6, 2016 at 13:54
  • did you clear the cache? Do you have varnish in front of your web server and maybe that is cached.
    – Marius
    Commented Dec 6, 2016 at 13:55
  • Yes, I cleared the cache. But also in the table the final_price didn't changed. I'm not using varnish.. I'm developing in a local environment.
    – WaPoNe
    Commented Dec 6, 2016 at 13:57
  • And then, if I try to get product entity in my block (child of ListProduct in list.phtml) in this way: $this->_productRepository->getById($id); I don't found final_price attribute..
    – WaPoNe
    Commented Dec 6, 2016 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.