Thanks to visit codestin.com
Credit goes to github.com

Skip to content

move default criteria to catalog promotion provider#13466

Merged
GSadee merged 3 commits into
Sylius:1.11from
AdamKasp:refactor-catalog-promotion-criteria-v2
Jan 27, 2022
Merged

move default criteria to catalog promotion provider#13466
GSadee merged 3 commits into
Sylius:1.11from
AdamKasp:refactor-catalog-promotion-criteria-v2

Conversation

@AdamKasp
Copy link
Copy Markdown
Contributor

Q A
Branch? 1.11
Bug fix? yes
New feature? no
BC breaks? no
License MIT

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

@AdamKasp AdamKasp requested a review from a team as a code owner January 11, 2022 07:56
@AdamKasp AdamKasp force-pushed the refactor-catalog-promotion-criteria-v2 branch 3 times, most recently from 8fdc42b to 729e3a0 Compare January 12, 2022 07:24
Copy link
Copy Markdown
Contributor

@lchrusciel lchrusciel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@lchrusciel
Copy link
Copy Markdown
Contributor

TBH, we could cover also taxon change

@Zales0123 Zales0123 added the Bug Confirmed bugs or bugfixes. label Jan 14, 2022
@Rafikooo Rafikooo force-pushed the refactor-catalog-promotion-criteria-v2 branch from 2ce2082 to 988c4b9 Compare January 20, 2022 09:22
And this catalog promotion is disabled
And I am logged in as an administrator

@ui
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these scenarios are only in UI context?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some investigation, it seems that at that moment there is no possibility to manage the products taxons by API

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the original price is not set if I see correctly in the background 🤔

Copy link
Copy Markdown
Contributor

@Rafikooo Rafikooo Jan 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there is no catalog promotion that will be applied as neither of them meet the criteria

@Rafikooo Rafikooo force-pushed the refactor-catalog-promotion-criteria-v2 branch from 988c4b9 to b7d789a Compare January 24, 2022 11:17
@Rafikooo Rafikooo requested a review from GSadee January 24, 2022 11:31
Comment on lines +24 to +25
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there is no catalog promotion that will be applied as neither of them meet the criteria

Comment on lines +24 to +25
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the original price set somewhere so that it could be removed?

@Rafikooo Rafikooo force-pushed the refactor-catalog-promotion-criteria-v2 branch 3 times, most recently from 77a8e84 to a160c1e Compare January 26, 2022 14:23
…ange if criteria does not met

[Behat] Upgraded scenario
@Rafikooo Rafikooo force-pushed the refactor-catalog-promotion-criteria-v2 branch 2 times, most recently from bed68ca to 8275af8 Compare January 26, 2022 16:25
@Rafikooo Rafikooo force-pushed the refactor-catalog-promotion-criteria-v2 branch from 8275af8 to 0260958 Compare January 26, 2022 16:49
* @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(
Copy link
Copy Markdown
Contributor

@Rafikooo Rafikooo Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made sure that we use cammelCase syntax.
For instance, in:
src/Sylius/Behat/Context/Setup/PaymentContext.php

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$catalogPromotion = $this->catalogPromotionExampleFactory->create([
'name' => $name,
'code' => $code,
'startDate' => $startDate,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GSadee GSadee merged commit 039d249 into Sylius:1.11 Jan 27, 2022
@GSadee
Copy link
Copy Markdown
Member

GSadee commented Jan 27, 2022

Thanks, Adam! 🥇

@AdamKasp AdamKasp deleted the refactor-catalog-promotion-criteria-v2 branch January 31, 2022 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Confirmed bugs or bugfixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants