magento-lts
magento-lts copied to clipboard
Saving product from backend causes destroying category product positions in anchor categories.
I have found an issue in the openmage core which destroys category product positions in anchor categories.
When I save the product from the magento backend we get positions in anchor categories like: 80003 When the "catalog category product" index is processing all products we get positions in anchor categories like: 20003 This different positions calculations generate wrong orders in our catalog. I expect that the positions should be the same, either I save the product in backend or I run the index, but they are not.
I have checked the code and found differences between the catalogProductSave function and the indexer reindexAll function. Both functions have different calculations which should be changed to one way.
catalogProductSave function app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php Line: 559 Code-Line: (cc.position + 1) + (cc.level +1) * 10000 + cp.position
reindexAll function app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php Line: 896 Code-Line: (cc.position + 1) * (cc.level + 1*10000) + cp.position
The way the positions are calculations should be the same and we should decide us for one way. Either from the catalogProductSave of from the reindexAll function.
For me this change fixed my problem, but it also could be that the position calculating in reindexAll is wrong.
Regards, Alexander Herbel
Can you please add some more details? Step by step to reproduce. (?) In which table wrong positions occour?
From reading it makes sense, but i want to verify/test it.
Can you please provide a PR?