magento / data-migration-tool

Magento Data Migration Tool
https://devdocs.magento.com/guides/v2.3/migration/bk-migration-guide.html
Open Software License 3.0
334 stars 200 forks source link

Configurable product prices are summarized for multiple stores (leads to higher prices in M2) #857

Open netzkollektiv opened 3 years ago

netzkollektiv commented 3 years ago

Preconditions

Steps to reproduce

Expected result

Actual result

value_id entity_type_id attribute_id store_id entity_id value summarized_value pricing_value 465928 4 75 0 38025 559.0000 719.0000 80.0000 465932 4 75 2 38025 639.0000 799.0000 80.0000 465931 4 75 3 38025 865.0000 1025.0000 80.0000

719 = 559 + 80 + 80

Additional notes

The problem is the grouping over cs.store_id (having only store_id = 0) instead of mt.store_id (having store_id = 0,2,3). After grouping over mt.store_id the result seems to be correct.

m2-assistant[bot] commented 3 years ago

Hi @netzkollektiv. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

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


netzkollektiv commented 3 years ago

Here's the query for easier testing, just switch mt.store_id and cs.store_id in the group clause to reproduce behavior.

SELECT 
  IF(sup_ap.is_percent = 1, TRUNCATE(mt.value + (mt.value * sup_ap.pricing_value/100), 4), mt.value + SUM(sup_ap.pricing_value)) as summarized_value,
  75,
  supl.product_id as entity_id,
  mt.store_id

FROM catalog_product_entity_decimal as mt
LEFT JOIN catalog_product_super_attribute sup_a ON mt.entity_id = product_id
INNER JOIN catalog_product_super_attribute_pricing sup_ap ON sup_ap.product_super_attribute_id = sup_a.product_super_attribute_id
INNER JOIN catalog_product_super_link as supl ON mt.entity_id = supl.parent_id
INNER JOIN catalog_product_entity_int as pint ON pint.entity_id = supl.product_id and pint.attribute_id = sup_a.attribute_id and pint.value = sup_ap.value_index
INNER JOIN core_store as cs ON cs.website_id = sup_ap.website_id
WHERE mt.attribute_id = 75
AND mt.entity_id BETWEEN 38025 AND 38028
GROUP BY supl.product_id, mt.store_id