5

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?

  • Is new attribute displaying on frontside ? – Suresh Chikani Apr 12 '16 at 9:23
  • thats ok its reflect in frontend, but I need in CSV also, what I do for this – Bilal Usean Apr 12 '16 at 9:27
  • Cay you please tell me attribute type dropdown or any others ? – Suresh Chikani Apr 12 '16 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 – Bilal Usean Apr 12 '16 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). – Suresh Chikani Apr 12 '16 at 10:44
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.

  • 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 Jun 29 '16 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. Jul 4 '16 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. – Bilal Usean Aug 3 '16 at 9:05
  • 1
    Bilal, I am glad we finally got the answer :) Even i was trying this for last few days. I am updating the answer with a link to the reference, not for you but for anyone like us who came here with a tight schedule for this answer :) – Kumar A. Aug 8 '16 at 4:33
  • @KumarA. where is the answer and where you share link for reference ? – Hafiz Arslan May 16 at 5:43
3

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
  • I will be back to you after experiment @lucky – Bilal Usean Oct 17 '16 at 11:55
  • @BilalUsean - Sure – Lucky Oct 17 '16 at 11:57
  • Yeah but this is just the export when you import the CSV again it won't update those attributes – Stevie G Mar 8 '17 at 8:14
  • @StevieG Do you find any solution for import? – Gaurav Agrawal May 15 '17 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 – Stevie G May 15 '17 at 8:34
3

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 :)

0

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, privacy policy and cookie policy

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