Tier prices
Tier price import only
Pacemaker Community Edition (CE) provides a dedicated tier price import and the appropriate command import:products:price:tier
therefore.
You can find more information about how to invoke the command in the usage section.
-
The filename for the dedicated tier price import must match the pattern
<PREFIX>_<FILENAME>_<COUNTER>.csv
. -
The default
<PREFIX>
isproduct-import-tier-price
, the<FILENAME>
is a combination of date and time like20190608-114344
, and the<COUNTER>
is a incremental number with two digits starting with01
. -
As a result, the filename is look like
product-import-tier price_20190608-114344_01.csv
. -
Additionally, the appropriate
.ok
file is needed.
|
The CSV file with the attributes for the Magento 2 CE/EE consists of the following columns:
Column Name | Type | Example | Description |
---|---|---|---|
sku |
|
|
The product SKU to import the tier price for the required Product |
tier_price_website |
|
|
The website code to import the tier price for
|
tier_price_customer_group |
|
|
The customer group for which the tiered price get imported, or 'ALL GROUPS' for all customer groups |
tier_price_qty |
|
|
The quantity the tier price is valid from |
tier_price |
|
|
The tier price itself |
tier_price_value_type |
|
|
The value type can either be
|
If the tier prices are imported with the full product import, read the description below.
Multi Websites/Stores import of products including tier prices
To perform a successful multi websites/stores product import, the field tier_prices
must be added to the
product import data CSV with the data field structure description as followed
-
Admin row:
-
Add additional column
-
The first step is to add the column
tier_prices
to the CSV file with the product data. -
When importing
tier_prices
to multiple store views, thetier_prices
field must be populated with the following given format and separated by a pipe (|)
-
-
No list element escaping required
-
Example store view 1:
qty=5,price=51.000000,value_type=fixed,website=All Websites,customer_group=ALL GROUPS
-
Example store view 2:
qty=15,price=3.00,value_type=fixed,website=additional_base,customer_group=General
-
Example store view 3:
qty=10,price=47.750000,value_type=discount,website=base,customer_group=ALL GROUPS
-
qty=5,price=51.000000,value_type=fixed,website=All Websites,customer_group=ALL GROUPS|qty=15,price=3.00,value_type=fixed,website=additional_base,customer_group=General|qty=10,price=47.750000,value_type=discount,website=base,customer_group=ALL GROUPS
-
There is no limitation in how many rows of tier prices the column contains. THe pipe (|) will separate each row with tier prices, whereas each column of a row including the
attribute_code
to value pairs will be separated by the common comma (,). -
The attribute_code to value pairs itself will use the
=
char for separation. -
Our sample data comes with an example of how the file should look.
Attribute | Example | Description |
---|---|---|
qty |
|
The number entered determines when a tier_price takes effect |
price |
|
The value entered under |
value_type |
|
The value type is defind by a choice of 2 Values * |
website |
|
|
customer_group |
|
The Customer Group defines the associated User Group * [ALL GROUPS|General|Retailer|NOT LOGGED IN|Wholesale] |
|
-
Store row
-
In the field
store_view_code
for each additional store view, except the admin row, the field must be filled with the respective store view code (default,de_de, en_us,…) -
No entry in the field
tier_prices
is required for the following store code related additional product values
-
if you want to track the import more carefully in the directory
Figure 2. Add the Store View Code to the field
store_view_code in your import CSV file (Example: de_de, en_us, …..)
the additional arguments make sure that the imported files and logs are not removed after a import. You will find all processed files after a import in a newly created folder named as timestamp |
store_view_code
in your import CSV file (Example: de_de, en_us, …..)
For testing purpose only: If you want to check the result of a multi-store product import in the Magento backend, please make sure in advance that the following default options are set:
|
Extend Configuration
The second step is to add the listener, the subjects, and the observers that process the tier prices to your configuration file.
An example configuration file for the Pacemaker Community Edition (CE) is part of the Pacemaker Community Edition (CE) command-line tool.
The configuration for the appropriate operations has to be extended with
-
The subject
import_product_tier_price.subject.tier_price
with the observerimport_product_tier_price.observer.tier_price.update
for the add-update and the observerimport_product_tier_price.observer.tier_price
for the replace operation -
The observer
import_product_tier_price.observer.product.tier_price
has to be added after the first observer of thefirst import_product.subject.bunch
subject -
A listener
import_product_tier_price.listener.delete.obsolete.tier_prices
for the eventplugin.process.success
on subject level (only for add-update operation) -
Param
clean-up-tier-prices
on the subject level either with the value true or false, which decides whether or nottier-prices
should be cleaned-up (only for add-update operation)
If the clean-up functionality is activated with the param clean-up-tier-prices set to true, all tier prices that are not anymore part of the SKUs in the CSV file will be removed. |
For the replace operation, the configuration has to look like
{
...,
"operations": [
{
"name" : "replace",
"plugins" : [
...,
{
"id": "import.plugin.subject",
"subjects": [
{
"id": "import_product.subject.bunch",
...,
"observers": [
{
"import": [
"import_product.observer.composite.base.replace",
"import_product_tier_price.observer.product.tier_price"
]
}
]
},
...,
{
"id": "import_product_tier_price.subject.tier_price",
"identifier": "files",
"file-resolver": {
"prefix": "tier-price"
},
"observers": [
{
"import": [
"import_product_tier_price.observer.tier_price"
]
}
]
}
]
}
...,
]
}
]
}
For the add-update
operation, the configuration has to look like
{
...,
"operations": [
{
"name" : "add-update",
"plugins" : [,
{
"id": "import.plugin.subject",
"listeners" : [
{
"plugin.process.success" : [
"import_product_tier_price.listener.delete.obsolete.tier_prices"
]
}
],
"params" : [
{
"clean-up-tier-prices" : true
}
],
"subjects": [
...,
{
"id": "import_product.subject.bunch",
...,
"observers": [
{
"import": [
"import_product.observer.composite.base.add_update",
"import_product_tier_price.observer.product.tier_price"
]
}
]
},
...,
{
"id": "import_product_tier_price.subject.tier_price",
"file-resolver": {
"prefix": "tier-price"
},
"observers": [
{
"import": [
"import_product_tier_price.observer.tier_price.update"
]
}
]
}
]
}
...,
]
}
]
For both operations, it has to be be addeded after the import_product_url_rewrite.subject.url.rewrite
.
The delete
operation configuration does not need any customizations as the tier prices will be cleaned up by their foreign keys.