How to import with CSV file if 1 product display node has multiple product reference (ie: shirt-s, shirt-m, shirt-l) ?
I tried using included example_products_displays.csv by adding "PROD-IMPORT-01, PROD-IMPORT-02" with no success.

Comments

BellaTunno’s picture

Priority: Normal » Minor

Which cart are you importing? I'm trying to do an import from my store and am having a similar problem.

rfay’s picture

Multivalued fields are a basic area of immaturity in feeds.

There's a discussion of this at #759966: CSV: Support one to many relationships, along with some code samples (for D6).

pcambra’s picture

Yup, for multivalue in the same file you need to do things like separate the values with pipes, i.e

"5|4|6"

I've had to use a custom target to import multiple prices into the same product

bc24102’s picture

The Feeds Tamper module is probably the way to go for this. I have used it to assign multiple taxonomy terms to product display nodes so I'm sure the same can be done for the product reference field.

  • http://drupal.org/project/feeds_tamper
  • rfay’s picture

    Thanks. I've been thinking that would be the ticket and hope to try it out soon.

    bc24102’s picture

    I tested out importing multiple product references, but it didn't work. The product display was created with the first SKU associated with it. However, the other two values I had in the field were not imported. A message came up saying the products with those SKUs didn't exist when they actually did.

    rfay’s picture

    Wow, I just used Feeds Tamper and it just worked for me right out of the box. I'm so impressed.

    Note that this issue actually has nothing to do with Commerce Feeds. However, this is where people are interested :-)

    Background: I'm using the stock Commerce Kickstart install profile, and feeds defined in the feature provided with commerce_feeds_example (bundled with this module). I've imported 100 products (attached) and then will use a short node import CSV (attached) to import nodes with multivalued product reference fields.

    What I did:

    1. Make sure your product reference field is set to "unlimited" values.

    2. Import the product feed (attached) at /import/product_importer

    3. Enable Feeds Tamper and create a plugin on the SKU

    • Plugin type: Explode
    • Machine name: explode_cpu
    • String separator: ,
    • Limit: empty. Note that there seems to be a bug in feeds tamper or something I just don't understand, and the display shows it as having a limit of 1, but it seems to take all I give it.

    4. Import the product reference nodes at /import/product_reference_importer

    It *just worked*.

    Yay Feeds Tamper!

    bc24102’s picture

    Thanks, rfay. I realized my issue after looking at your example. I was using || to explode. However after looking in my test file I noticed there were spaces before my || and after. Once I removed the spaces it worked.

    PROD-1 || PROD-2 || PROD-3 <---- did not work

    PROD-1||PROD-2||PROD-3 <---- worked

    I am not really sure why the spaces make a difference but I am glad it works nonetheless.

    rfay’s picture

    Priority: Minor » Normal
    Status: Active » Fixed

    I'll call this fixed, but will probably need to do an article or screencast on it... unless somebody else does it first.

    @bc24102, the spaces become part of the data value, so it was looking for items with a sku of " PROD-3 ", not one with a sku of "PROD-3". Big difference.

    bc24102’s picture

    Gotcha, thanks for the explanation!

    Status: Fixed » Closed (fixed)

    Automatically closed -- issue fixed for 2 weeks with no activity.

    emawk7’s picture

    Has anyone managed to import multiple images for products?

    summit’s picture

    Also interested in multiple images..greetings, Martijn

    webroru’s picture

    But if products are located at each of the new line? For example:
    SKU; displayID; name
    1, 99, Red Shirt
    2, 99, Blue T-shirt
    3, 99, Yellow jersey

    As a result, I want to get in the Product Display ID 99 with three T-shirts in different colors.

    bfodeke’s picture

    I was having the same issue even while using feed_tamper. My solution was to run a Trim on the data after the Explode. I trimmed whitespace on either side and it worked like a charm!

    zkrebs’s picture

    Issue summary: View changes

    #14, did anyone find an answer?