SyliusCatalogPromotionPlugin icon indicating copy to clipboard operation
SyliusCatalogPromotionPlugin copied to clipboard

Prices are not reset when promotion ends in all cases

Open loevgaard opened this issue 4 years ago • 0 comments

The process promotions command is divided into three phases:

  1. Mark the products we need to handle
  2. Update the multiplier on products based on rules
  3. Update the prices based on the computed multiplier

In phase 1 we set the multiplier to 1 on all products where multiplier != 1. We do this in a loop. This means we can successfully change the multiplier on some products and then the loop can throw an exception or deadlock or whatever. Now these products are in kind of a limbo because they won't be selected the next time the command runs (because it filters on multiplier != 1) and this in turn means that we can have products where the price isn't reset, i.e. phase 3 doesn't reset the prices because those products are not in the bulk of products being processed.

Basically what we need to run somehow is:

UPDATE sylius_channel_pricing SET price = original_price WHERE multiplier = 1 AND manually_discounted = 0 AND original_price is not null

loevgaard avatar Jul 08 '21 13:07 loevgaard