On this page
  1. Identifiers
  2. Import behavior
  3. Command line import and export

CSV import and export

The Import/Export package adds separate Magento data transfer entities for customer category prices and customer-group category prices.

composer require mageb2b/pricesystem-categoryprice-importexport:*
php bin/magento setup:upgrade
php bin/magento cache:flush

Export each entity from System > Data Transfer > Export and use the resulting file as its template. Customer rows identify a customer; group rows identify a customer group. Both include the category, quantity, value, application type, optional base price, website and dates.

The customer entity uses the columns customer_id, category_id, qty, price, price_application_type, price_attribute_id, website_id, from_date and to_date. The group entity uses group_id instead of customer_id with the same remaining columns.

Identifiers

Column Accepted values
customer_id Numeric customer ID or the account email — both always work on import. With per-website account sharing, the email is resolved within the row's website scope
group_id Numeric customer group ID or the customer group code (for example Wholesale)
category_id Numeric category ID. The group entity additionally accepts a slash-separated category name path
website_id Numeric website ID

There is no product or SKU column — eligibility comes from Magento category membership. For exports, Categoryprice Export > Use Customer ID as under Stores > Configuration > MageB2B > Pricesystem controls whether customer_id is written as the email address (default) or the numeric ID.

Import behavior

The admin import (System > Data Transfer > Import) and the CLI --behavior option accept the standard Magento import behaviors:

Behavior Effect
append / add_update Validate and save the file's rows; existing records stay untouched
replace Deletes every existing record of the entity first, then imports the file
delete Deletes only the records that match rows in the file

replace wipes the whole customer or customer-group category-price table before importing — it is not a per-row upsert. Never run a replace import without a current export or backup.

Command line import and export

The package also registers console commands for automated transfers:

php bin/magento pricesystem:import-categoryprice <import_path>
php bin/magento pricesystem:export-categoryprice
php bin/magento pricesystem:import-categoryprice-customergroup <import_path>
php bin/magento pricesystem:export-categoryprice-customergroup

Imports accept a required file path plus --behavior, --field_separator, --field_multiple_value_separator, --fields_enclosure and --delete_file_after_import. Exports write to var/export/ by default and accept --export_path, --field_separator and --fields_enclosure.

Both admin grids additionally offer an Export mass action for selected rows.

Test one customer record and one group record before importing a full file. After import, verify a product in the selected category, the exact quantity threshold and a customer for whom both record types match.

Display preferences

Adjust how this website is displayed. Changes apply immediately.

Text size
Text spacing
Reading aids

Follows the pointer. Move it with Alt + Up/Down outside input fields. Hidden while a dialog is open.

Uses the voices provided by your browser, which may use an online service. Reading starts only when you press Read aloud.

Your choices are saved in this browser for this website.