Install the Promotions & Discounts feature
Edit on GitHubThe following feature integration guide expects the basic feature to be in place. This document describes how to add the discount prioritization and discount validity period supports HH:MM time definition functionality.
Install feature core
Follow the steps below to install the Promotions & Discounts feature core.
Prerequisites
Install the required features:
NAME | VERSION | INSTALLATION GUIDE |
---|---|---|
Spryker Core | 202404.0 | Install the Spryker Core feature |
1) Install the required modules
Install the required modules using Composer:
composer require spryker-feature/promotions-discounts 202404.0 --update-with-dependencies
Make sure that the following modules have been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
Discount | vendor/spryker/discount |
2) Set up database schema and transfer objects
Apply database changes and generate entity and transfer changes:
console transfer:generate
console propel:install
Make sure that the following changes have been applied by checking your database:
DATABASE ENTITY | TYPE | EVENT |
---|---|---|
spy_discount.priority | column | added |
Make sure that the following changes have been triggered in transfer objects:
TRANSFER | TYPE | EVENT | PATH |
---|---|---|---|
DiscountConfiguratorResponse | class | created | src/Generated/Shared/Transfer/DiscountConfiguratorResponseTransfer |
DiscountAmountCriteria | class | created | src/Generated/Shared/Transfer/DiscountAmountCriteriaTransfer |
Discount.priority | property | created | src/Generated/Shared/Transfer/DiscountTransfer |
Discount.minimumItemAmount | property | created | src/Generated/Shared/Transfer/DiscountTransfer |
Discount.storeRelation | property | created | src/Generated/Shared/Transfer/DiscountTransfer |
CalculatedDiscount.priority | property | created | src/Generated/Shared/Transfer/CalculatedDiscountTransfer |
DiscountGeneral.priority | property | created | src/Generated/Shared/Transfer/DiscountGeneral |
Make sure that the discount form has the PRIORITY field, and the discounts table has the PRIORITY column.
Make sure, that the existing discounts in the spy_discount
DB table have priority set to 9999
.
3) Add translations
Generate a new translation cache for Zed:
console translator:generate-cache
Make sure that all labels and help tooltips in the discount form has English and German translation.
4) Build Zed UI frontend
Enable Javascript and CSS changes:
console frontend:project:install-dependencies
console frontend:zed:build
Make sure that discounts are calculated according to their priorities:
- Create a couple of percentage discounts with different priorities.
- To fulfill the discounts’ requirements, add items to the cart.
- Check that discounts are applied in the correct order and that the calculated discount total is correct.
Make sure that you can submit the Discount Create and Discount Update forms with specified date and time for Valid From and Valid To discount form fields:
- In the Back Office, go to Merchandising > Discount.
- Create a new discount or update an existing one and check that you can see the Discount form.
- To ensure you can see the calendar, click on Valid From and Valid To fields, where you can select a specific date and time.
- Make sure Valid From and Valid To fields can accept the selected date and time (for times not falling on the hour, use keystroke entry—for example, 13:45).
- In the
spy_discount
DB table, make sure Valid From and Valid To date and time are saved correctly.
Thank you!
For submitting the form