Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am attempting to use the commerce feeds module to import both products and product display nodes as well as relating the product display to multiple child products. Is there any way to do this cleanly?
I have seen:
http://drupal.org/node/1122422#comment-4639566
But unfortunately my data (which I have very little control over) looks like
ProdDisplay1, product1, field1
ProdDisplay1, product2, field2
ProdDisplay1, product3, field3
ProdDisplay2, product4, field4
Is there a way to set up this one to many relationship?
Comment | File | Size | Author |
---|---|---|---|
#17 | FM-DC-csv-Produktimport Kopie.pdf | 46.84 KB | BrianLP |
#14 | commerce_feeds_multi.png | 47.49 KB | redhatusr |
#6 | Product import table system.png | 69.28 KB | BrianLP |
#7 | Product import table system_.png | 70.92 KB | BrianLP |
Comments
Comment #1
pcambraYou should take a look to this patch #1188994: Accumulative product reference mapper that provides a way to accumulate products in displays
Comment #2
BrianLP CreditAttribution: BrianLP commentedI'm not sure whether I understand this right, but doesn't that work just like importing other multiple values? Use the Feeds Tamper module and the "explode" plugin. Then you can import multiple SKUs as product references for your Product display. (comma separated in one cell of your csv table)
That's how I import multiple taxonomy terms per display.
Comment #3
pcambraThat slolution works if you can have this data structure:
Display1, SKU1|SKU2|SKU3
Display2, SKU1|SKU2|SKU3
But if you have
Display1, SKU1
Display1, SKU2
Display2, SKU1
Display2, SKU2
You need the accumulative importer as feeds doesn't support this, you'll find a lot more of details in the issue I pasted above.
Comment #4
BrianLP CreditAttribution: BrianLP commentedI think I don't get the purpose of that. Is it to display product variants in one display each instead of one display with a selector for variants?
Chair > red/green/blue -vs.- red chair / green chair / blue chair
If so, I solved it by preparing all mapping tasks in my spread sheet app. There I have one product table and one display table.
product 1 - display 1
product 2 - display 1
product 3 - display 1
product 4 - display 2
product 5 - display 2
product 6 - display 2
This is not the solution to the original question but it's the easiest way I have found for me.
Comment #5
liupascal CreditAttribution: liupascal commented@papalapapp
With this solution do you end up with having
display 1 : refers to product 1, 2, 4
display 2 : refers to product 4, 5, 6 ?
If yes can you please export a little csv example (a few lines) and the export of your importer configuration ?
Many thanks
Comment #6
BrianLP CreditAttribution: BrianLP commentedWell, it isn't technically the way that the display is refering to multiple products. The referral is done before the import and written in that table which is importet then.
So inside drupal, instead of referring, the display is imported as often as needed. I find it hard to explain but actually it's quite easy. The hardest part is doing the formulas in the spreadsheet. You can use excel or any other spreadsheet app.
In the image below, I actuall only edit the first two tables "Displays" and "Products". The import csv table is a bunch of formulas referencing the data to the products and displays. Once set up, no more editing needed. Same for the importers.
So if there are changes or new products, I just do a csv-export of the table in the middle and run the importers.
If Commerce could map it internally, there wouldn't be a need for a joint csv table with formulas. They could be handled separately.
Comment #7
BrianLP CreditAttribution: BrianLP commentedComment #8
rfayI demonstrate how to do this with feeds tamper in the last screencast on http://www.drupalcommerce.org/node/467
Comment #9
pcambraLet's mark this as fixed as many solutions and information has been provided, feel free to reopen if necessary.
Thanks to everyone!
Comment #11
Robert21 CreditAttribution: Robert21 commentedWe have a similar situation as shown above #7 (Posted by papalapapp on December 14, 2011 at 12:45am). Is the only option to importira through feeds tamper? I have for example a product with 30 different variations and all together 6500 products.
example(structures):
PRODUCTCODE;MODELCODE;MODELNAME;DESCRIPTION;COMPOSITION;CATEGORY;GENDER;SIZE;COLOR;COLLECTION;SUBCOLLECTION;PRODUCTIMAGE;MODELIMAGE
PRODUCTCODE = unique
MODELCODE = different product variations (Alphanumeric)
How should I do it?
Comment #12
vbard CreditAttribution: vbard commentedHi!
I have same question as #11, does anyone has a solution?
Comment #13
Summit CreditAttribution: Summit commentedHi,
I try to get it clear here: https://drupal.org/comment/8138947#comment-8138947
Greetings, Martijn
Comment #14
redhatusr CreditAttribution: redhatusr commentedI am trying to import multiple products into one product display node following papalapapp suggestions at #6 and #7 but something that I don't understand creates many Product Displays with one Product instead of one Product Display with many Products
does anyone know what I am doing it wrong?
Also i try in Node processor to map SKU -> GUID (insted of ID -> GUID) with the same results
Comment #15
Summit CreditAttribution: Summit commentedHi,
I am still struggling with this also as remark here (https://drupal.org/node/2113575#comment-8162539), may be this helps you:
First time you use "Commerce Product processor", second - "Node processor".
Would love to see you succeed and please explain than how and what you used.
greetings,
Martijn
Comment #16
Pravin Ajaaz CreditAttribution: Pravin Ajaaz commentedI am also Struggling with the same as #14... since Title is not unique it creates multiple displays... Have anyone found the way to do it... Please let me know...
Comment #17
BrianLP CreditAttribution: BrianLP commentedMaybe the trick is that I set the SKU also as the GUID additionally as to the SKU mapping. These screenshots and the xls import table (as pdf) might be of some help.
Comment #18
GuyPaddock CreditAttribution: GuyPaddock commented@papalapapp: With that set-up, don't you end up with 1-1 product display to product SKU matchings? In the sample you provided of the 3 MacBooks, how many products and how many product displays do you end up with?
Comment #19
GuyPaddock CreditAttribution: GuyPaddock commentedOkay, just checked and it looks like this is working as expected as long as the following is true:
Now, according to How to configure unique fields in Drupal feeds importer?, that last requirement can be satisfied by creating a unique value validation for any field you want to use as a unique key for the same display. I'm currently trying to figure out how to do that on my end, but I can say that using Title as unique did work for me so far as long as everything above was satisfied.
Comment #20
GuyPaddock CreditAttribution: GuyPaddock commentedOkay, two additional pieces that will help with satisfying requirement 6 in comment #19 with the Field Validation module:
Comment #21
BrianLP CreditAttribution: BrianLP commentedI haven't been working on that project for a while so I currently don't have an answer form the top of my head. However, rfay has a link to three screencasts on this in comment #8. I recall that they were very useful for me.
Comment #22
respown CreditAttribution: respown as a volunteer commentedOk. So there's how I sorted that.
CSV structure like:
ProdDisplay1, product1, field1
ProdDisplay1, product2, field2
ProdDisplay1, product3, field3
ProdDisplay2, product4, field4
Is completely fine and easy to use to import in feeds.
You don't even need field with specified Display Name as long as you can extract that by REGEX replace (in Field Tamper module).
My CSV looked like:
Title; SKU; Pack size
But the title did not match with display name and was a name of variation:
"New book about living cars - 1"; SKUAA1; "Pack size 1"
"New book about living cars - 3"; SKUAA2; "Pack size 3"
"New book about living cars - 5"; SKUAA3; "Pack size 5"
Instead of playing with spreadsheets and soft like EXCEL/Gdocs in product importer I have imported typically:
Title -> "Product Title"
SKU -> SKU (unique)
But in Product Reference Importer I used Tamper to replace my "- [number]" by REGEX:
/((\s+-\s(\d*))|(-(\d*)))+/
That way we have Display Name to import:
Title -> Title (unique);
SKU -> Product variations (SKU)
And the most important in Product Reference importer settings: Node processor, there has to be "Update existing nodes" option ticked.
That way we (using the same CSV):
And all that in Fields and Tamper settings.
Comment #23
millionleaves CreditAttribution: millionleaves as a volunteer and commented#22 is the approach I've been using for a while:
The only difference in my approach is that I would edit my spreadsheet in Excel prior to import and create additional columns with formulas to generate the product display node title, rather than using Feeds Tamper. This allows me to visualise my data prior to import and pick up any potential issues that would cause problems.
For example, the Excel formula to achieve what #22 did with a REGEX is:
=LEFT(A2,FIND(" - ",A2)-1)
This assumes the Title value above is in A2. There are more examples of such formulas here (and in the comments);
http://fiveminutelessons.com/learn-microsoft-excel/extract-text-cell-excel
I figure this might help people who would otherwise struggle with writing REGEX.
Comment #25
aumcara CreditAttribution: aumcara commentedHi there,
I am actualy testing importation of some products into a C.Kickstatt 2 with Feeds and feeds tamper etc etc.
all these products are translated with entity translation etc...
I am asking myself if I can import all languages in a single import csv file and process everything in a single operation (gosh that would be great) or if I need to have several import .csv files per languages ... witch will be quiet a boring thing to prepare ... I guess some of you will agree witbh me :-)
I did actualy manage to import French products as product variations and did manage to import node related to those multiple variations with feeds tamper ... and this with the help of the video of Randy Fay avaialble at : https://vimeo.com/25668519
But it would help me quiet a lot for the import of all the others products I need to import after my tests ...
Oh, I almost forgot :
- is it possible while importing to only have "ONE IMAGE" for some of my same products variations
and
- would it be possible to have differents "image file name per language" for those different language variations :
exemple : for the english product : MUG we would have :
mug.jpg for EN
gobelet.jpg for FR
pot.jpg for NL
would it be possible to explain how to achierve this also ...
Many tbanks for your replies and or recommendations.