9

short description what I done:

  1. create product attribute set (Chennai)
  2. create 21 new product attributes
  3. assign to Chennai attribute set
  4. set value to attribute while create product
  5. export (System->Export->Continue) csv

problem is my new attributes comes under additional_attributes column but I am expecting each attribute occupy one column.

Anything need to mention while creating attribute for export related things?

can anyone pointing to me right direction?

11
  • Is new attribute displaying on frontside ? Commented Apr 12, 2016 at 9:23
  • thats ok its reflect in frontend, but I need in CSV also, what I do for this Commented Apr 12, 2016 at 9:27
  • Cay you please tell me attribute type dropdown or any others ? Commented Apr 12, 2016 at 10:19
  • I have try with three different Catalog Input Type for Store Owner 1)Dropdown 2)Text Swatch 3)Text Field but all times I get failed to get result in expoerted CSV Commented Apr 12, 2016 at 10:33
  • I have try with one text and drop-down attributes but i am getiing attributes value in csv file. I have working in magento (2.0.4). Commented Apr 12, 2016 at 10:44

4 Answers 4

8

I found a free Magento 2 extension from BSS Commerce which helped me work around this:

It provides some override code for the Model\Export\Product core class which breaks out the additional_attributes field into separate columns. In my testing it works on Import and Export.

You do have to configure an Admin setting for the module to tell it which fields to break out into their own columns, but it was easy to set up.

This module saved me some time duplicating their efforts, which was nice, and now the client can provide a normal CSV with attributes in columns, without me having to transform it with a script :)

6

Solution :

For this Need to do some changes in vendor\magento\module-catalog-import-export\Model\Export\Product.php file or override same model file in your custom module .

In vendor\magento\module-catalog-import-export\Model\Export\Product.php file add custom_attributes code those you want in separate cell ( not in additional_attributes cell) in $_exportMainAttrCodes global array variable line no. 263.

For example :

if suppose your export csv file contained

"collection_year=2014,lining_color=Light,material=Cotton|Wool|Polyester,season=Winter" value under additional_attributes header field for particular product. so add collection_year, hanger, lining_color & material keys in this $_exportMainAttrCodes array variable like:

protected $_exportMainAttrCodes = [
    self::COL_SKU, 
    'name',
    'description',
    'short_description',
    'weight',
    'collection_year',
    'lining_color',
   'material'
   .......SO on
7
  • I will be back to you after experiment @lucky Commented Oct 17, 2016 at 11:55
  • @BilalUsean - Sure
    – Lucky
    Commented Oct 17, 2016 at 11:57
  • Yeah but this is just the export when you import the CSV again it won't update those attributes
    – tread
    Commented Mar 8, 2017 at 8:14
  • @StevieG Do you find any solution for import? Commented May 15, 2017 at 5:25
  • @GauravAgrawal I was forced to write a script to combine those custom attributes back into the additional_attributes column in the correct format and stripping out special characters
    – tread
    Commented May 15, 2017 at 8:34
6

All custom attributes get appeared under "additional_attributes" header in the export separated by a comma (,). I am using Magento 2.0.7. enter image description here

To make these attributes occupy a separate cell, we can add more columns to the CSV.

4
  • I also tried the same and my custom attributes are getting exported under additional_attributes column. Try to find out in csv using search if your attribute is there in any column
    – Rushvi
    Commented Jun 29, 2016 at 6:40
  • Yes ! As you can see in the attached screenshot, number_of_colours , wash_instructions , are our custom attributes. I guess this time Magento2 chose to list all attributes under one roof inside the csv.
    – Kumar A.
    Commented Jul 4, 2016 at 4:45
  • please review my comments already I point out it is come under additional attribute. RJ07, Kumar sorry guys it is my fault. I updated my question please review. Commented Aug 3, 2016 at 9:05
  • @KumarA. where is the answer and where you share link for reference ? Commented May 16, 2019 at 5:43
5

This formula works in Excel, assuming no values have commas.

=IFERROR(LEFT(RIGHT(H5, SUM(LEN(H5)-FIND("material=", H5)- LEN("material="), 1)), IFERROR(FIND(",", RIGHT(H5, SUM(LEN(H5)-FIND("material=", H5)- LEN("material="), 1)))-1, LEN(RIGHT(H5, SUM(LEN(H5)-FIND("material=", H5)- LEN("material="), 1))))), "")

Just replace H5 and "material" with the appropriate cell and key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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