Saturday, 1 February 2014

Magento import products with custom product type via csv

I was assigned a job to import products with custom product types through CSV

Magento's default product types are
  1. simple
  2. configurable
  3. virtual
  4. grouped
But when you import products with new product type other than the above mentioned. you will get this error

Product Type is invalid or not supported in rows... 

To overcome this error and import products with your custom product type you must follow these two steps.

1. Now am going to assume you have created an extension. On the config.xml file of your extension place this code under <global> tag.



Replace YOUR_MODULE with you module name.

2. Create a new model class to do the import. For this create this folder structure inside your model structure

In my case i have a new product type "subscription_simple". so my folder structure will be

Inside the folder i have a model class Simple.php file extending the magneto import class.\

place this code inside Simple.php file.

class NAMESPACE_MODULE_Model_Import_Entity_Product_Type_Subscription_Simple
    extends Mage_ImportExport_Model_Import_Entity_Product_Type_Abstract


Now you can do the import with your custom product type.

you can check out one of the inbuilt classes for an example Mage_ImportExport_Model_Import_Entity_Product_Type_Simple


No comments:

Post a Comment