Discussions

Importing Products Types from CSV file

Let's say I have two Commerce Products Types (admin/commerce/products/types), T-Shirts and Hats.

Now, I've a CSV file to import my products into the web store.

SKU;Title;Description;Price;Category;Image
sku_1;This is a T-Shirt;descr_1;1000;category_1;/url/to/image/1.jpg
sku_2;This is a Hat;descr_2;1000;category_2;/url/to/image/2.jpg

In the Settings for Commerce Product processor (admin/structure/feeds/importer_name/settings/FeedsCommerceProductProcessor), Drupal asks me to choose a Product Type.

Does this mean that I need to create two separate CSV files, one for the T-Shirts and the other one for the Hats?

Posted: Nov 28, 2012

Comments

drupalability on November 29, 2012

you need to two separate files because for each feed importer you must choose a content type. one will be hats and the other will be shirts. with a single feed you will not be able to push data to two separate content types... at least to the best of my knowledge. I could be wrong of course :o)

Copyfight on November 30, 2012

Thank you for your answer.

Is this the intended behaviour?
Let's say I'm a big eCommerce store: I'll never migrate to Drupal Commerce if I need to import products one category at a time.

I hope we are wrong ;-)

Copyfight on December 1, 2012

Ok, but If I have a CSV containing all my products, I can't import multiple product types in just one import process.

I need to import TShirts, then I need to import Hats, and so on.

That's senseless.

I think and hope there is another way to import everything with just one import process.

drupalability on December 1, 2012

It is not senseless. If your two product types are so radically different as far as attributes are concerned that you need to create completely different product types, then you will need a unique feed for each. That is because each feed has to be mapped to a content entity and its fields. You have two choices in my opinion, create one product type that has all attributes you need... and create one global feed. On import some fields will get filled by the feed and some won't... in this case I would add a term reference field to the product type that would select the product type term in a vocabulary... therefore you could easily sort and categorize products by "type" as you wish. The other choice is two have separate feeds. I think either solution is very easy to implement. A CVS file can be sorted and in such a way that you should easily be able to create product groups where you can simply cut and past one group into another CVS file which will become the source for another feed.

You suggest you may not choose Drupal Commerce because of this... I am curious how other e-commerce solutions work. This is very easy and straight forward. I think you will see that once you experiment with it more. Cheers, Kevin

peterjtracey on April 5, 2013

Have a look at migrate/commerce migrate - you can decide on a product's content type during import from one source.