HowTo: Manage business unit specific prices via data importEdit on GitHub
You 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 via 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.
Assigning merchant custom prices via data import
To assign special product prices to merchants, you can do the following:
- In the
merchant_relationship.csvfile, define the merchant relation keys. For details, see the example in the Spryker B2B Demo Shop.
- To import merchant relations, run
console data:import merchant-relationship
For each merchant relationship, create separate data import CSV files. For example, you can have a file
mr001is the merchant relation key you defined in the previous step. In this file, you specify product prices for this specific merchant.
Then, you can 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 relation
mr001and change the default price for the product in the product price file, you have to go to the
price-product-merchant-relationship-mr001.csvfile 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 next 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 the
price-product-merchant-relationship-mr001.csvfile with the prices for this
mr001merchant. 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 of the Spryker platform.
- Set specific default prices for this merchant manually. For example, if you provide a 20% discount on a product for the merchant relation
To import product prices for merchant relations, run
console data:import product-price-merchant-relationship
For submitting the form