move default criteria to catalog promotion provider#13466
Conversation
8fdc42b to
729e3a0
Compare
lchrusciel
left a comment
There was a problem hiding this comment.
Can we cover cases of not reapplying catalog promotion for variants after its price change for catalog promotions that are disabled, ended already or didn't start yet? Similar to "Reapplying catalog promotions on variant once its prices changes" feature
|
TBH, we could cover also taxon change |
2ce2082 to
988c4b9
Compare
| And this catalog promotion is disabled | ||
| And I am logged in as an administrator | ||
|
|
||
| @ui |
There was a problem hiding this comment.
Why these scenarios are only in UI context?
There was a problem hiding this comment.
So, can you tell me how it will behave in API? :)
Maybe we should add some basic implementation o taxons in API WDYT cc @GSadee
There was a problem hiding this comment.
IMO not in this PR as it won't be a simple one, we need to rethink how to manage these entities in API Product <> ProductTaxon <> Taxon
|
|
||
| @ui | ||
| Scenario: Removing the original price of the variant | ||
| When I remove the original price of the "PHP T-Shirt" product variant in "Web-US" channel |
There was a problem hiding this comment.
But the original price is not set if I see correctly in the background 🤔
There was a problem hiding this comment.
The original price is set by applied CP. To be more explicit I added a step with changing the price and removing the original price to show the visitor that there is no discount even if scheduled ( disabled, past ) CP is applied. I hope that makes sense
There was a problem hiding this comment.
But there is no catalog promotion that will be applied as neither of them meet the criteria
988c4b9 to
b7d789a
Compare
| Then the visitor should still see "$50.00" as the price of the "T-Shirt" product in the "Web-US" channel | ||
| And the visitor should still see "$100.00" as the original price of the "T-Shirt" product in the "Web-US" channel |
There was a problem hiding this comment.
| Then the visitor should still see "$50.00" as the price of the "T-Shirt" product in the "Web-US" channel | |
| And the visitor should still see "$100.00" as the original price of the "T-Shirt" product in the "Web-US" channel | |
| Then the visitor should see "$50.00" as the price of the "T-Shirt" product in the "Web-US" channel | |
| And the visitor should see "$100.00" as the original price of the "T-Shirt" product in the "Web-US" channel |
There was a problem hiding this comment.
Similar to one of my other comments, there is no catalog promotion that will be applied as neither of them meet the criteria, and original price is not set in the scenario and in the background, so where is it set? I would expect 50$ here 🤔
|
|
||
| @ui | ||
| Scenario: Removing the original price of the variant | ||
| When I remove the original price of the "PHP T-Shirt" product variant in "Web-US" channel |
There was a problem hiding this comment.
But there is no catalog promotion that will be applied as neither of them meet the criteria
| Then the visitor should still see "$50.00" as the price of the "T-Shirt" product in the "Web-US" channel | ||
| And the visitor should still see "$100.00" as the original price of the "T-Shirt" product in the "Web-US" channel |
There was a problem hiding this comment.
Similar to one of my other comments, there is no catalog promotion that will be applied as neither of them meet the criteria, and original price is not set in the scenario and in the background, so where is it set? I would expect 50$ here 🤔
| @ui | ||
| Scenario: Removing the original price of the variant | ||
| When I change the price of the "PHP T-Shirt" product variant to "$20.00" in "Web-US" channel | ||
| And I remove the original price of the "PHP T-Shirt" product variant in "Web-US" channel |
There was a problem hiding this comment.
Was the original price set somewhere so that it could be removed?
77a8e84 to
a160c1e
Compare
…ange if criteria does not met [Behat] Upgraded scenario
bed68ca to
8275af8
Compare
…ange if criteria does not met
8275af8 to
0260958
Compare
| * @Given /^there is (?:a|another) catalog promotion "([^"]*)" between "([^"]+)" and "([^"]+)" available in ("[^"]+" channel) that reduces price by ("[^"]+") and applies on ("[^"]+" taxon)$/ | ||
| */ | ||
| public function thereIsAnotherCatalogPromotionAvailableInChannelThatReducesPriceByAndAppliesOnVariant( | ||
| public function thereIsACatalogPromotionBetweenAvailableInChannelThatReducesPriceByAndAppliesOnTaxon( |
There was a problem hiding this comment.
This may look strange, I removed entirely there is another catalog promotion method and merged it above with there is (?:a|another) as both methods were the same. Git shows that I changed the variant for a taxon, but in fact, this is a new method
| $catalogPromotion = $this->catalogPromotionExampleFactory->create([ | ||
| 'name' => $name, | ||
| 'code' => $code, | ||
| 'startDate' => $startDate, |
There was a problem hiding this comment.
I made sure that we use cammelCase syntax.
For instance, in:
src/Sylius/Behat/Context/Setup/PaymentContext.php
There was a problem hiding this comment.
So, we are using two different conventions: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/CoreBundle/Fixture/ChannelFixture.php 😢
| $catalogPromotion = $this->catalogPromotionExampleFactory->create([ | ||
| 'name' => $name, | ||
| 'code' => $code, | ||
| 'startDate' => $startDate, |
There was a problem hiding this comment.
So, we are using two different conventions: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/CoreBundle/Fixture/ChannelFixture.php 😢
|
Thanks, Adam! 🥇 |

to avoid potential bugs default criteria should be on the provider level