Manage business unit specific prices via data import
Edit on GitHubYou can apply the approaches described in this document only if your project follows the B2B model because the merchant custom prices feature used for these approaches is only for B2B. Also, the behavior described in this document is not compatible with Marketplace.
Let’s assume you have a default price for products, and you have merchants for whom you want to make a certain percentage discount from the default price. You can do this by adding merchant custom prices in the Back Office or by data import. This document explains how you can manage the merchant custom prices with data import.
Data importers for merchant custom prices
In the Spryker B2B Demo Shop, there are two data importers used for managing the merchant custom prices:
- merchant_relationship.csv containing information about merchants and merchant relation keys. The merchant relation keys are identifiers of the relations between sellers and buyers.
- price-product-merchant-relationship.csv containing specific product prices for individual merchant relations.
Assign merchant custom prices using data import
- In the
merchant_relationship.csv
file, define the merchant relation keys. For details, see the example in the Spryker B2B Demo Shop. - Import merchant relations:
console data:import merchant-relationship
-
For each merchant relationship, create separate data import CSV files. For example, you can have a file
price-product-merchant-relationship-mr001.csv
, wheremr001
is the merchant relation key you defined in the previous step. In this file, you specify product prices for this specific merchant. -
Do one of the following:
- Set specific default prices for this merchant manually.
For example, if you provide a 20% discount on a product for the merchant relationmr001
and change the default price for the product in the product price file, you have to go to theprice-product-merchant-relationship-mr001.csv
file and change the price for this merchant as well. Because changing the general default product price does not automatically change the merchant custom price for this product. Thus, with every change of the default product price, you have to manually change every merchant custom price of this product.
This option can work for a relatively small amount of products and merchants you provide the specific prices for. For big amount of this data, to avoid too much manual work, we recommend considering the following option. - Create a custom script that can automatically adjust merchant-specific prices upon the default price change.
In your ERP, you might have the base, or default price, defined along with the percentage of discount for your merchants. The script would handle the relation between the default price and the discount for merchants to define the specific price for the merchants.
For example, if the percentage of discount for a merchant is 20%, the script generates theprice-product-merchant-relationship-mr001.csv
file with the prices for thismr001
merchant. In this example, the price is the default price minus 20%.
This approach is optimal for big amount of data. However, its main drawback is that you need some development effort and that the script runs and processes data outside the Spryker platform.
- Set specific default prices for this merchant manually.
-
Import product prices for merchant relations:
console data:import product-price-merchant-relationship
Thank you!
For submitting the form