magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Bundle product price indexing not calculating tier prices correctly

Open aligent-lturner opened this issue 5 years ago • 12 comments

Preconditions (*)

  1. Magento version 2.x (appears to have been present in all versions)
  2. Magento 2.4-develop

Steps to reproduce (*)

  1. Create a bundle product with a fixed price - e.g. $100
  2. Apply a tier price discount for all websites and all customer groups of 10%
  3. Run bin/magento indexer:reindex catalog_product_price

Expected result (*)

  1. Final price (and min_price, max_price, tier_price) in catalog_product_index_price are set to 90 (100 - 10%)

Actual result (*)

  1. Final price (and others) in catalog_product_index_price are set to 100

Additional Information

https://github.com/magento/magento2/issues/30610#issuecomment-716775736 I have debugged this issue locally, and it appears to be caused by this line: https://github.com/magento/magento2/blob/a1e5689cc6092e40e1ebb975f4eaae32c4d8d1e5/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php#L679 This is getting the minimum value of catalog_product_entity_tier_price.value, but due to: https://github.com/magento/magento2/blob/a1e5689cc6092e40e1ebb975f4eaae32c4d8d1e5/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php#L82 There is no fixed price option for bundle products in the advanced pricing modal. Instead, all values are percentage discounts, which populates the catalog_product_entity_tier_price.percentage_value column. I have patched \Magento\Bundle\Model\ResourceModel\Indexer\Price.php locally to change MIN(tp.value) to MIN(tp.percentage_value), and I then saw the expected values populated in catalog_product_index_price.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [x] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

aligent-lturner avatar Oct 23 '20 05:10 aligent-lturner

Hi @aligent-lturner. Thank you for your report. To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Oct 23 '20 05:10 m2-assistant[bot]

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Oct 23 '20 13:10 m2-assistant[bot]

Hi @aligent-lturner thank you for your report. Looks like bundle product price is displayed correctly on catalog page and product detail page. Manual testing scenario:

  • Create bundle product with simple product as option #30610Bundle #30610BundleOption
  • Set tier price in Advanced Pricing tab for bundle product #30610Pricing Run bin/magento indexer:reindex catalog_product_price and flush cache Go to storefront catalog page Result: :heavy_check_mark: Price is shown with discount correctly: 100 - 100*0.1 = 90 without option image :heavy_check_mark: Price is shown with discount correctly: 100 - 1000.1 + 100 - 1000.1 = 180` with option image

Bundle product price in database: #30610Issue

Could you provide additional information how bundle product was created and clarify issue with tier price as on storefront it is calculated correct?

engcom-Delta avatar Oct 26 '20 09:10 engcom-Delta

@engcom-Delta the price is displayed correctly on the storefront because it's calculated again. The issue is that the price in the catalog_product_index_price table is incorrect - as shown in your screenshot above, the price is given as 100 instead of 90. For most people, this is not going to cause a problem, as the price is recalculated on Catalog pages and when adding to cart, etc., Which is probably why this issue hasn't been picked up before. If you are getting data directly from the index table, however (for example to use in an integration - sending pricing data to another system), then it is not correct.

aligent-lturner avatar Oct 26 '20 19:10 aligent-lturner

:white_check_mark: Confirmed by @engcom-Delta Thank you for verifying the issue. Based on the provided information internal tickets MC-40254 were created

Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

magento-engcom-team avatar Dec 29 '20 13:12 magento-engcom-team

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

stale[bot] avatar Apr 27 '21 22:04 stale[bot]

This is only stale because nobody has worked on it - it's still an issue.

aligent-lturner avatar Apr 27 '21 22:04 aligent-lturner

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 28 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

stale[bot] avatar Sep 26 '21 23:09 stale[bot]

Still an issue - just commenting to keep it open.

aligent-lturner avatar Oct 11 '21 04:10 aligent-lturner

Hi @aligent-lturner,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Screenshot 2024-07-01 at 12 27 27

Final price (and others) in catalog_product_index_price are set to 100

Hence Confirming the issue.

Thanks.

engcom-Bravo avatar Jul 01 '24 06:07 engcom-Bravo

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12312 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jul 01 '24 07:07 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Jul 01 '24 07:07 m2-assistant[bot]

We also had same issue in one of our project. This simple mr should fix the issue. https://github.com/magento/magento2/pull/40057

mahsn avatar Jul 09 '25 14:07 mahsn