MigrateDestinationCommerceProduct

The contrib module Commerce Migrate provides a few destination classes that extend the Entity API destination class provided by Migrate Extras.

When declaring the destination map, use "commerce_product" as the entity type (which is defined by the Commerce module suite), and "my_product_type" as the bundle type.

The following class imports commerce products. "sku" and "commerce_price" mappings are relevant to products. In the following example, "my_product_type" is the machine name of the commerce product type (defined via UI config), "import_database" is the import database name (defined in settings.php), and "import_data" is the table in that database where the import data exists. In the source map, "ItemNumber" is the unique identifier column in the table.

<?php
class AseEndoMigration extends Migration {
/**
* Doc comment.
*/
public function __construct() {
parent::__construct();

// The defintion of the columns.
$columns = array(
'Category',
'Name',
'ItemNumber',
'Description',
'USRetailPrice',
);

// Entity type, and bundle.
$this->destination = new MigrateDestinationCommerceProduct('commerce_product', 'my_product_type');

// Select all endodontic products.

Subscribe with RSS Subscribe to RSS - Migrate Extras