lsretailomni / lsmag-two

LS Ecommerce - Magento, an ecommerce interface for integrating Magento with LS Central.
https://www.lsretail.com/
10 stars 16 forks source link

SyncPrice may set the wrong price on variants, depending on the order of the ls_replication_repl_price result #51

Closed henriksjodahl closed 11 months ago

henriksjodahl commented 1 year ago

Preconditions (*)

  1. Magento ver. 2.4.2-p1
  2. [Commerce Service for LS Central DB] & [LS SaaS] & [LS Central WS] 22.1 (LS:22.2.9.1004958 [59761])
  3. Commerce Service for LS Central:2023.05.45
  4. LS Magento: 2.3
  5. LS Retail Partner - Dizparc

Steps to reproduce (*)

  1. Set the Price of the Configurable product in ls_replication_repl_price to 0
  2. Set the Prices of the Child-products to anything other than 0
  3. Run SyncPrices-cron for that configurable + children

Expected result (*)

I've been logging all changes to the "price" attribute on products and this is the log after a "normal" by-design SyncPrice-run

[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008: from: 0, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-000: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-001: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-002: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-003: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-004: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.INFO: 100008-000: from: 0, to: 2499 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.INFO: 100008-001: from: 0, to: 2499 [] []
[2023-10-30 06:43:05] polderPriceHistoryLogHandler.INFO: 100008-002: from: 0, to: 2499 [] []
[2023-10-30 06:43:05] polderPriceHistoryLogHandler.INFO: 100008-003: from: 0, to: 2499 [] []
[2023-10-30 06:43:05] polderPriceHistoryLogHandler.INFO: 100008-004: from: 0, to: 2499 [] []

Actual result (*)

Depending on the order of the rows in ls_replication_repl_price is stored, there may be a problem if the configurable-line comes after the line of a childproduct, because the sync always assumes the child are supposed to have the same price as the configurable.

[2023-10-30 06:43:04] polderPriceHistoryLogHandler.INFO: 100008-000: from: 2000, to: 2499 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008: from: 0, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-000: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-001: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-002: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-003: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.ERROR: 100008-004: from: 2000, to: 0 [] []
[2023-10-30 06:43:04] polderPriceHistoryLogHandler.INFO: 100008-001: from: 2000, to: 2499 [] []
[2023-10-30 06:43:05] polderPriceHistoryLogHandler.INFO: 100008-002: from: 2000, to: 2499 [] []
[2023-10-30 06:43:05] polderPriceHistoryLogHandler.INFO: 100008-003: from: 2000, to: 2499 [] []
[2023-10-30 06:43:05] polderPriceHistoryLogHandler.INFO: 100008-004: from: 2000, to: 2499 [] []

The result of this example is that the new price of 100008-000 is marked as successfully imported, but since the parent is imported after, the price is reset to 0, thus the price of the 100008-000 variant is wrongfully set to 0.

umarusaf902 commented 11 months ago

Hi @henriksjodahl, thanks for opening reporting this issue. This has already been fixed and merged into the master branch and soon will be available in the upcoming release.