Skip to content

Commit

Permalink
feature #13325 [CatalogPromotion][API][UI] Fixed discount action (GSa…
Browse files Browse the repository at this point in the history
…dee)

This PR was merged into the 1.11-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.9 or 1.10 branch (the lowest possible)
 - Features and deprecations must be submitted against the master branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


Commits
-------

1c4685d [CatalogPromotion][Behat] Add scenarios for new fixed discount action
71ce649 [CatalogPromotion][API] Creating and editing catalog promotions with new fixed discount action
45dc8e3 [CatalogPromotion][UI] Creating and editing catalog promotions with new fixed discount action
b5458fa [CatalogPromotion][API][UI] Add validation for new fixed discount action
7bcb012 [CatalogPromotion][API][UI] Apply new fixed discount action on catalog
3e957b6 [CatalogPromotion][Documentation] Add new fixed discount action to actions reference
ca72095 [CatalogPromotion] Add missing license docblocks
32f4ca5 [CatalogPromotion] Fix editing catalog promotion by changing its action
e9a57c7 [CatalogPromotion] Minor refactor of fixed discount action
ddc21f9 [CatalogPromotion][UI] Fix changing type of scope
969595a [CatalogPromotion] Fixes after rebasing with exclusive promotions feature
  • Loading branch information
Zales0123 committed Nov 26, 2021
2 parents f2a6c1d + 969595a commit 4644f74
Show file tree
Hide file tree
Showing 57 changed files with 1,744 additions and 151 deletions.
2 changes: 2 additions & 0 deletions docs/book/products/catalog_promotions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ Catalog Promotion Actions configuration reference
+-------------------------------+--------------------------------------------------------------------+
| Action type | Action Configuration Array |
+===============================+====================================================================+
| ``fixed_discount`` | ``[$channelCode => ['amount' => $amountInteger]]`` |
+-------------------------------+--------------------------------------------------------------------+
| ``percentage_discount`` | ``['amount' => $amountFloat]`` |
+-------------------------------+--------------------------------------------------------------------+

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@applying_catalog_promotions
Feature: Applying all available types of catalog promotions
In order to see products in best prices
As a Customer
I want to see discounted products in the catalog

Background:
Given the store operates on a channel named "Web-US"
And the store classifies its products as "Clothes"
And the store has a "T-Shirt" configurable product
And this product belongs to "Clothes"
And this product has "PHP T-Shirt" variant priced at "$100.00" in "Web-US" channel
And there is a catalog promotion "PHP sale" that reduces price by "10%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "T-Shirt sale" that reduces price by "10%" and applies on "T-Shirt" product
And there is a catalog promotion "Clothes sale" that reduces price by "10%" and applies on "Clothes" taxon
And there is a catalog promotion "Fixed PHP sale" that reduces price by fixed "$5.00" in the "Web-US" channel and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Fixed T-Shirt sale" that reduces price by fixed "$5.00" in the "Web-US" channel and applies on "T-Shirt" product
And there is a catalog promotion "Fixed Clothes sale" that reduces price by fixed "$5.00" in the "Web-US" channel and applies on "Clothes" taxon

@api @ui
Scenario: Applying multiple catalog promotions
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$100.00" to "$57.90" with 6 promotions
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ Feature: Applying catalog promotion with proper priorities

Background:
Given the store operates on a single channel in "United States"
And the store classifies its products as "Clothes"
And the store has a "T-Shirt" configurable product
And this product belongs to "Clothes"
And this product has "PHP T-Shirt" variant priced at "$100.00"
And there is a catalog promotion "Clothes sale" with priority 10 that reduces price by "30%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Winter sale" with priority 100 that reduces price by "50%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Autumn sale" with priority 10 that reduces price by "25%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "Winter sale" with priority 40 that reduces price by fixed "$10.00" in the "United States" channel and applies on "T-Shirt" product
And there is a catalog promotion "Spring sale" with priority 20 that reduces price by fixed "$5.00" in the "United States" channel and applies on "Clothes" taxon
And there is a catalog promotion "Summer sale" with priority 30 that reduces price by "50%" and applies on "PHP T-Shirt" variant

@api @ui
Scenario: Applying catalog promotion with descending order by their priority
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$100.00" to "$35.00" with "Winter sale" and "Clothes sale" promotions
Then I should see this variant is discounted from "$100.00" to "$30.00" with "Winter sale", "Summer sale", "Spring sale" and "Autumn sale" promotions
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@applying_catalog_promotions
Feature: Applying catalog promotions with fixed discount action
In order to be attracted to specific products
As a Visitor
I want to see discounted products in the catalog

Background:
Given the store operates on a single channel in "United States"
And the store has a "T-Shirt" configurable product
And this product has "PHP T-Shirt" variant priced at "$20.00"
And this product has "Java T-Shirt" variant priced at "$30.00"
And there is a catalog promotion "Winter sale" that reduces price by fixed "$10.00" in the "United States" channel and applies on "T-Shirt" product

@api @ui
Scenario: Applying simple catalog promotion
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$10.00" with "Winter sale" promotion

@api @ui @javascript
Scenario: Applying simple catalog promotion on another variant
When I view "Java T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$30.00" to "$20.00" with "Winter sale" promotion

@api @ui
Scenario: Applying multiple catalog promotions
Given there is a catalog promotion "Christmas sale" that reduces price by fixed "$5.00" in the "United States" channel and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$5.00" with "Winter sale" and "Christmas sale" promotions

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@applying_catalog_promotions
Feature: Applying catalog promotions with taking minimum price into account
In order to avoid too much discount applied on product
As a Visitor
I want to see discounted products in the catalog up to minimum price

Background:
Given the store operates on a single channel in "United States"
And the store has a "T-Shirt" configurable product
And this product has "PHP T-Shirt" variant priced at "$20.00"
And the "PHP T-Shirt" variant has minimum price of "$15.00" in the "United States" channel

@api @ui
Scenario: Applying percentage discount up to minimum price
Given there is a catalog promotion "Winter sale" that reduces price by "80%" and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$15.00" with "Winter sale" promotion

@api @ui
Scenario: Applying fixed discount up to minimum price
Given there is a catalog promotion "Winter sale" that reduces price by fixed "$10.00" in the "United States" channel and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$15.00" with "Winter sale" promotion

@api @ui
Scenario: Not applying promotion if product is priced on same price as its minimum price
Given there is a catalog promotion "Winter sale" that reduces price by "80%" and applies on "PHP T-Shirt" variant
And there is a catalog promotion "T-shirt Sale" that reduces price by "40%" and applies on "PHP T-Shirt" variant
When I view "PHP T-Shirt" variant of the "T-Shirt" product
Then I should see this variant is discounted from "$20.00" to "$15.00" with only "Winter sale" promotion
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ Feature: Creating a catalog promotion
And it should have "winter_sale" code and "Winter sale" name
And the catalog promotion "Winter sale" should be available in channel "United States"

@api @ui @javascript
Scenario: Creating a catalog promotion with fixed discount action
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I add scope that applies on "Clothes" taxon
And I add action that gives "$10.00" of fixed discount in the "United States" channel
And I add it
Then there should be 1 new catalog promotion on the list
And it should have "winter_sale" code and "Winter sale" name
And the "Winter sale" catalog promotion should have "$10.00" of fixed discount in the "United States" channel

@api @ui @javascript
Scenario: Creating a catalog promotion for taxon
When I want to create a new catalog promotion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ Feature: Editing catalog promotion
Then I should be notified that it has been successfully edited
And this catalog promotion should have "40%" percentage discount

@api @ui @javascript
Scenario: Editing catalog promotion action to be a fixed discount
When I edit "Christmas sale" catalog promotion to have "$10.00" of fixed discount in the "United States" channel
Then I should be notified that it has been successfully edited
And this catalog promotion should have "$10.00" of fixed discount in the "United States" channel

@api @ui
Scenario: Being unable to edit catalog promotion if it is currently being processed
Given the catalog promotion "Christmas sale" is currently being processed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,48 @@ Feature: Validating a catalog promotion creation
Then I should be notified that a discount amount should be a number and cannot be empty
And there should be an empty list of catalog promotions

@api @ui @javascript
Scenario: Trying to create a catalog promotion with not configured fixed discount action
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I make it available in channel "United States"
And I specify its label as "Winter -50%" in "English (United States)"
And I describe it as "This promotion gives a $10.00 discount on every product" in "English (United States)"
And I add scope that applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And I add fixed discount action without amount configured
And I try to add it
Then I should be notified that a discount amount should be configured for at least one channel
And there should be an empty list of catalog promotions

@api @ui @javascript
Scenario: Trying to create a catalog promotion with wrong value of fixed discount action
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I make it available in channel "United States"
And I specify its label as "Winter -50%" in "English (United States)"
And I describe it as "This promotion gives a $10.00 discount on every product" in "English (United States)"
And I add scope that applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And I add invalid fixed discount action with non number in amount for the "United States" channel
And I try to add it
Then I should be notified that a discount amount should be configured for at least one channel
And there should be an empty list of catalog promotions

@api
Scenario: Trying to create a catalog promotion with fixed discount action with invalid channel
When I want to create a new catalog promotion
And I specify its code as "winter_sale"
And I name it "Winter sale"
And I make it available in channel "United States"
And I specify its label as "Winter -50%" in "English (United States)"
And I describe it as "This promotion gives a $10.00 discount on every product" in "English (United States)"
And I add scope that applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And I add invalid fixed discount action configured for nonexistent channel
And I try to add it
Then I should be notified that at least one of the provided channel codes does not exist
And there should be an empty list of catalog promotions

@api @ui @javascript
Scenario: Trying to create a catalog promotion with taxon type without taxons
When I want to create a new catalog promotion
Expand Down
Loading

0 comments on commit 4644f74

Please sign in to comment.