I have created an importexport module for csv import for a custom model. This module is to support CSVs supplied from multiple sources, so are not all marked up the same. Generally, this is not a problem as long as the correct table column names are used in the right place.

The problem arises from a number of the CSVs containing two, or more, lots of data for the item, depending on the state of the existing items.

Is it possible to specify "valid" column names in the importexport models that don't exist in the custom table? I want a way to add custom column names to the CSV, at which point I will filter the data and break the single rows into multiple, valid rows with the right column names.

For example, here is the first-row of a CSV I have been given:

Afghanistan, 12.5, 160, 13.98, 143, 16.88, 59, 30, 18.88, 53, 26

If the item in the database has a price of £20, then I want the data from columns 1 and 3. For all other values, I want the data from columns 5 and 7. (And in all cases I want the country name - column 0).

As I have said, I want to add custom column names to the above, for example "20rateOne":


My importexport entity models extend Mage_ImportExport_Model_Import_Entity_Abstract.

  • I'm not sure what you want to import, are this products you are trying to import? I've build a custom importer for categories which extends Mage_ImportExport, you could take that as an example. github.com/avstudnitz/AvS_FastSimpleImport/blob/master/src/app/… Jun 10 '14 at 20:23
  • @PaulHachmang I have drawn a lot from this code in the development of my importexport module. What I am uploading is reference data for each product. Due to the sheer amount of data being imported it was decided to be impractical to have them as attributes on the product, and to set it up with it's own table. The basic CSV import works (right number of columns, right column names), but it's the above scenario that is causing me issues. In the supplied link there are constants for permanent column names. Is there a way to declare column names that are not in the table so the csv validates? Jun 11 '14 at 9:04

CSV column names must NOT start with numbers. The reason the above column names were failing validation is because they started with a number (e.g. 20rateOne).

Other than that, the Magento import will accept every, non-empty, arbitrary column name.

I have changed my column names to have the number at the end (e.g. rateOne20) and have given a single character name to the columns I am not interested in (e.g. a,b,c,etc).

I am now able to process the CSVs as I need.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.