cancel
Showing results for 
Search instead for 
Did you mean: 

Export Products and Their Multiple Categories

Export Products and Their Multiple Categories

I need to export all of my products along with each category they belong to.  The two tricks here are:

 

  1. Each produt may belong to up to 4 categories
  2. I want the whole tree of the category, not just the node.

So one category for a product might be food/fruit/rasberry and I want all three of these as one of its categories, not just 'rasberry'.

 

Ideally I want a sixcolumn csv that gives me the sku, the product name, and 4 columns for categories.

 

Any extentions that do this?  Or suggestions for a simple way to do it?

 

Thanks!

3 REPLIES 3

Re: Export Products and Their Multiple Categories

Are you going to change the format in the future¿ This is just a few lines of custom code, an extension would be overkill.

Re: Export Products and Their Multiple Categories

Thanks Melvyn,

We have no plans to change the format.  I am not sure what this code would look like.  Any pointers?

Re: Export Products and Their Multiple Categories

The easiest way to get the category data is from the category flat table.  However, it's still not trivial.  If you want a solution, you can build on the Free CSV Product Export Script for Magento 2.x.  In addition to SKU and Name, it exports a field called json_categories, which contains all the category data for each item in this format (formatted for readability):

 

[
["2","1\/2","Default Category"],
["21","1\/2\/20\/21","Tops"],
["23","1\/2\/20\/21\/23","Jackets"],
["30","1\/2\/29\/30","Women Sale"]
]

You would still have to parse the JSON and reformat.

 

If you want that data formatted like this:

Default Category > Tops > Jackets,Default Category > Women Sale

then you can set up a Google feed at Aten Software using the free trial and add the aten_all_product_categories field to the feed.  That column will contain all four categories separated by commas.