Question

Could someone explain to me why whenever I perform a reindex on my magento website any changes I have made within the catalog_product_index_price table get overwritten.

I have created a module that can set custom tier prices for a customer group and when I set a new tier price I can see that it updates within the database to the new value. However, when I perform a reindex on the website the new value gets overwritten with the old value again.

Any help would be appreciated.

Update:

I have just set different values directly into the database and when I reindex they also get overridden and reverted back to their base values. Have I missed a step to make the reindex recognise the changes or is this intended?

Turns out, the table catalog_product_index_price is a frontend table which explains that whenever changes to this is made they are also shown on the frontend without having to reindex. What I think is happening is the reindex is grabbing its values from a EAV table and overwriting the table record. Currently I don't know which EAV table this values are stored in.

Was it helpful?

Solution

I've figured out the problem. Just updating catalog_product_index_price only changes the front end price. And this is the price that gets overwritten when performing a reindex. There is actually another table within the database called catalog_product_entity_tier_price that hold the EAV attributes (essentially the back end data). By overriding the value attribute of this table, this effectively sets a new tier price.

So now I can set a value in to that table, perform a reindex and the front-end value will update to match the changes.

Useful website: https://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-7.html

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top