1

I change the product price by custom rules in custom module. By the Event <catalog_product_collection_load_after> for product list page. And for product view page I override the getPrice() Method of the Mage_Catalog_Model_Product_Type_Price.

My Problem is that price is changed according to the custom rules. But Price slider range is not updated. I also rewrite the layer model and prepareProductCollection() function but nothing change in price range. Price slider is still works on the product price. Not on my custom price. My question is how to change the product price that it effects price ranges. I not want to save the price in product table. I want to change the price like Magento Catalog Rule Change the Price. enter image description here

4
  • Have you Re-index Price after Applying Rules?
    – Keyul Shah
    Mar 30, 2015 at 4:56
  • Yes i reindex the Product Price After Apply my custom rules but no luck Mar 30, 2015 at 5:07
  • something is wrong bro. I have never seen this kind of error lets some one else guide you.
    – Keyul Shah
    Mar 30, 2015 at 5:28
  • Bro This is my custom module and i change the product prices using the events mentioned in my question. And also i am not save the product prices. Mar 30, 2015 at 5:32

1 Answer 1

1

You only made the adjustments for loaded product collections and single products.

The normal prices are still in the price index, which is used directly by the layered navigation.

Catalog price rules change the price index as well and you need to do the same. Have a look into the CatalogRule module to see how it is done.

The following events are observed:

  • prepare_catalog_product_price_index_table to save the custom price in the price index during reindexing
  • catalog_product_save_commit_after to update index after product has been saved
  • catalog_product_import_finish_before and catalog_product_import_after to apply rules after import
  • prepare_catalog_product_collection_prices to load price rules by date, product, website and customer group for loaded product collection. Stores it for later use in other observer:
  • catalog_product_get_final_price to adjust the price on product page, cart and during checkout
  • catalog_entity_attribute_delete_after and catalog_entity_attribute_save_after to update/deactivate rules that use deleted or change attributes (probably not necessary for your custom module)

That being said, I would try to use and extend the CatalogRule module instead of reinventing it. It will be simpler to implement custom actions and conditions and leave all the complex indexing logic to the core module.

Your Answer

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

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