Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving product from backend causes destroying category product positions in anchor categories. #4054

Open
alexherbs opened this issue Jun 26, 2024 · 2 comments

Comments

@alexherbs
Copy link

alexherbs commented Jun 26, 2024

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.
grafik

Regards,
Alexander Herbel

@alexherbs alexherbs added the bug label Jun 26, 2024
@sreichel sreichel self-assigned this Sep 17, 2024
@sreichel
Copy link
Contributor

sreichel commented Oct 3, 2024

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.

@sreichel
Copy link
Contributor

sreichel commented Nov 7, 2024

Can you please provide a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants