Postponed
Project:
Commerce Feeds
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2012 at 08:36 UTC
Updated:
14 Apr 2013 at 17:46 UTC
Jump to comment: Most recent file
Comments
Comment #1
sin commentedHere is the code.
Comment #2
sin commentedFor now it works only with one to one relationship and I need a little bit help.
In CommerceML products are identified by a single GUID or two GUIDs concatenated by #, where the first one is the GUID of as we say "product display node", and the second is products GUID itself. So to map multiple product entities to a single product display node I need to search for product display node GUID as a prefix of previously imported product's GUIDs and grab them all. So here supposed to be a loop:
Any help is appreciated :)
Comment #3
pcambraSorry but I don't see any reason to add a meta property as GUID having both product id (if you already know the id in database) and SKU (unique identifier), you shouldn't need anything else here.
Comment #4
sin commentedSorry but I can't understand how to do it, I'm relatively new to Feeds. Here is simplified example.
The first file import.xml contains products like this:
The second file offers.xml contains product variants with prices and attribute details like this:
It fits perfectly to Commerce product entity and display node separation, however one to many relationship is stored wierd. This type of export (CommerceML spec.) is offered by the most popular trade accounting software in Russia (1С Enterprise), supported by all major Drupal + Commerce competitors in Russia so it is very important issue for us. Could you please elaborate on that? Now I see three ways to do such import.
1. My first try to import this beast was to import the second file as commerce product entities first, storing id as both Feeds GUID and SKU. Those SKU looks ugly and would be hidden for customers, but nothing unique suits here. After that I imported the first file as product display nodes storing id as Feeds GUID. Next we need to map product reference field to multiple products, searching for whole GUID or a first part of it. It is partally implemented in the patch.
2. Slightly different approach would be to split product id by # using Feeds Tamper and storing not unique part into separate field. After that we may populate product reference field by mapping product display GUID to not unique new product field. I've seen some sort of temporary field also which may help here. I hope it is doable but do not tried yet as first option was the most obvious for me :)
3. We may map product reference field by part of product's SKU. I may add an option for SKU mapper using new configuration API for mappers like I did here: http://drupal.org/node/1019688#comment-6726772
It would search by comparing all SKU array keys in memory or do a lot of DB queries.
Sorry for long post, pcambra, please help, thanks for your time.
Comment #5
pcambraI would say that this is a use case very particular to you, as you would normally have a source for the displays and a source for the products, having it all together with some separation keys is up to you, I don't think this has to be in the module itself.
If this is some standard that commerce xml module exports as it is we might want to discuss it further, but I'm not sold on pushing it into commerce feeds.
I keep saying that you could use sku or product id for the importer...
Comment #6
sin commentedI created a sandbox project based on patch #1:
https://drupal.org/sandbox/sin/1970072
CommerceML is a cross corporate standard very popular in Russia:
http://ru.wikipedia.org/wiki/CommerceML
It is codeveloped by our major vendors, including Microsoft and Intel.
I do not like CommerceML much personally but have to deal with it :) One can't use sku or product id for the job, unless we store GUIDs from the import to sku field or additional product field which seems counterproductive to me as we already have GUID support from Feeds.
I agree this use case may seem situational. I hope it can be implemented and accepted to commerce feeds in future as a part of more general feature request with other cases, something like #1938812: How to Import from CSV several products referenced to one display-node?.