Install the Promotions & Discounts feature

Edit on GitHub

The 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 202311.0 Install the Spryker Core feature

1) Install the required modules

Install the required modules using Composer:

composer require spryker-feature/promotions-discounts 202311.0 --update-with-dependencies
Verification

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
Verification

Make sure that the following changes have been applied by checking your database:

DATABASE ENTITY TYPE EVENT
spy_discount.priority column added
Verification

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
Verification

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
Verification

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
Verification

Make sure that discounts are calculated according to their priorities:

  1. Create a couple of percentage discounts with different priorities.
  2. To fulfill the discounts’ requirements, add items to the cart.
  3. Check that discounts are applied in the correct order and that the calculated discount total is correct.
Verification

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:

  1. In the Back Office, go to Merchandising > Discount.
  2. Create a new discount or update an existing one and check that you can see the Discount form.
  3. To ensure you can see the calendar, click on Valid From and Valid To fields, where you can select a specific date and time.
  4. 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).
  5. In the spy_discount DB table, make sure Valid From and Valid To date and time are saved correctly.