2

I need to create a CSV feed importer to import both Commerce products and products category node using single table and I am using Commerce Feed Module... when I create it using two different tables I can easily achieve it using Feeds Tamper Module (using explode plug in)

But when I implement single table structure as mentioned in the image... since the title is not unique it creates multiple nodes for each product... Is there any other table structure to implement this..

But what I actually need is:

Display1- A, SKU1|SKU2|SKU3

Display2- B, SKU4|SKU5|SKU6

Display3- C, SKU7|SKU8|SKU9

Table structure

Is there no one familiar with this or done this before.. ?? or else I have to refine the question.. ??

3

The following CSV template and Feed Import settings will import 1 Product Node with multiple Product Entities being referenced.

Step 1 - Creating The CSV

The following example provides the title and product_variation headers...

title: Mapped to the Node Title field in Feed Import

product_variation: Mapped to the Commerce Product Referenced field. Field limit should be greater then 1, so multiple entities can be imported.

title,product_variation

Product Example,"product_sku-1|product_sku-2"

Step 2 -Import Node

The "|" is used to create a unique entry using the Feeds Import Explode plugin.

The Feed Tamper product_variation field should have a single Plugin called Explode with the String separator set to "|".

Essentially, the Feeds Tamper Module will prepare the column values into an array, so Drupal can handle the request all awesome like :)

2

Using Feed to import product into Drupal Commerce is not the best approach. Instead you should use Commerce Migrate which add Commerce Product support for Migrate. Many helpers are available to support for example taxonomy terms, files ...

Many tutorials explain how to use Migrate which is a wonderfull module, but a quite huge.

But here is a sample workflow :

  1. Import Category into Taxonomy
  2. Import Product Ref
  3. Import Product Display and link them to previous imported elements (category and product ref)

To do the last thing, you have to specify the previous source used. Like that, Migrate will be able to "convert" SKU and categories codes to the drupal corresponding elements.

Modules to use :

  • Migrate
  • Commerce Migrate
  • Migrate Extras
  • Everything works fine for me using feeds. What I am stuck with is just implementing the single table structure. Have you created this scenario using migrate module – Pravin Ajaaz Oct 16 '14 at 8:01
  • I made a such work with Migrate. You have create 9 product ref into with commerce product entity, but only 3 product displays using nodes. And with your field product_ref you have to reference the 3 skus corresponding to your mapping. – Sebastien M. Oct 16 '14 at 11:27
  • ... with Migrate I made 2 migrate scripts. The first one which create SKUs into Commerce Product content type, and a second one which create product display and link it with previously created SKUs. Based on your file, you will have to parse two times your csv. The first time you will create a static mapping which store an array : $display['A'] = array('101', '102', '103); and when you'll import your product display, create the Display A and link it to SKUs and skip new line for the same Display product – Sebastien M. Oct 16 '14 at 11:32
  • ... but if you can, keep in separated files the content of Product Display from Product Ref. Otherwise it's quite hard to maintain and import. Hope it helps – Sebastien M. Oct 16 '14 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.