Skip to content

Bundle Product - Duplicate option values with different prices #28

@ivanov-d-a-wrk

Description

@ivanov-d-a-wrk

Preconditions (*)

PHP 8.2 / Adobe Commerce 2.4.7-p7
40 websites with different currency setup
Bundle Products with Dynamic Price configuration

Image

Steps to reproduce (*)

Upgrade data-exporter module to > 103.4.8
Have bundle products with different prices per website
Sync product feed by bin/magento saas:resync --feed products

Actual result (*)

Catalog Service from products request on Bundle product returns too many option values. Like every option-value has duplicates with different price, depending on how many websites your product is assigned to (option value count * website assigned count)

Expected result (*)

Catalog Service returns option values as usual without duplicates.

Solution to review

I guess this incorrect behaviour was implemented in this commit - b3a85aa

Image

Example of prices per website for bundle selection:

Image

So the left join will return every single selection, with prices from different websites. The bundle selection price should be obtained from the related website_id of the joined store in query:

diff --git a/vendor/magento/module-bundle-product-data-exporter/Model/Query/BundleProductOptionValuesQuery.php b/vendor/magento/module-bundle-product-data-exporter/Model/Query/BundleProductOptionValuesQuery.php
--- a/vendor/magento/module-bundle-product-data-exporter/Model/Query/BundleProductOptionValuesQuery.php
+++ b/vendor/magento/module-bundle-product-data-exporter/Model/Query/BundleProductOptionValuesQuery.php	(date 1757062434542)
@@ -123,7 +123,7 @@
                 [
                     'store_selection_price' => $storeSelectionPrice
                 ],
-                'store_selection_price.selection_id = main_table.selection_id',
+                'store_selection_price.selection_id = main_table.selection_id and store_selection_price.website_id = s.website_id',
                 []
             )
             ->where('cpe_parent.entity_id IN (?)', $productIds)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions