data-migration-tool icon indicating copy to clipboard operation
data-migration-tool copied to clipboard

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

Open netzkollektiv opened this issue 4 years ago • 4 comments

Preconditions

  • Magento 1 => Magento 2 Migration
  • Multi Store Setup

Steps to reproduce

  • Create a configurable product with three simple variants
  • Define surcharge for the variants (super attribute pricing)
  • Define different prices for different stores / websites for the configurable products
  • Migrate to M2

Expected result

  • Prices should be same as in Magento 1 for different stores (surcharge should only be added once, not multiple times)

Actual result

  • Surcharge is summarized accross all websites / stores by SUM(mt.value + sup_ap.pricing_value). If there is a configurable product having a $80 surcharge on an option, but different prices in different stores, the surcharge is being summarized:

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.

netzkollektiv avatar Nov 05 '20 13:11 netzkollektiv

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


m2-assistant[bot] avatar Nov 05 '20 13:11 m2-assistant[bot]

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

netzkollektiv avatar Nov 05 '20 13:11 netzkollektiv