Jump to content

CSV Product Import with multiple category/subcategory positions


Recommended Posts

I am trying to import products in a V1.3.1 Prestashop using the native tools/import function with a CSV file formatted with the ; as the field separator. I have everything worked out except getting the products into the correct categories. The shop has 1,800 categories in 5 category levels. Each product can be in several categories (e.g. MASKS and MASKS|HORROR where HORROR is a subcategory of parent category MASKS). I've tried importing into the categories field with the following:

;MASKS, MASKS|HORROR; (with | value separator, this only added to MASKS parent

and messed up the subcateory tree)

(with the , value separator, this added to MASKS and

added MASKS|HORROR as another parent category)

;MASKS, HORROR; (this added to MASKS parent and added HORROR as another parent catgory)

 

Would someone please help me and advise what the CSV file should look like and what the value separator value should be from the presta import tool?

 

Thanks!

Link to comment
Share on other sites

semi-colon as field separator and comma as value separator are fine. First make sure you import categories then once the categories are in place product should appear in the comma separated categories correctly. If still having problem post a sample from your csv file

Link to comment
Share on other sites

Phrasespot,

 

Thanks for the reply. I did find some clues in other posts and figured out that I needed to use the native category numbers instead of the category names to get full control of the category assignments. I pulled the category data from the database using MyPHPAdmin and an now crunching it to get a xref mapping to our suppliers category mapping for my bulk import. Since I have over 5,500 new products, I plan to import in chunks for 500 so I don't overload the server with the new images.

 

Thanks again!

Link to comment
Share on other sites

yes,

is far better to force the import saying to PS the ID of the category, so no problems and also better to delete previous categories before to import the new one, if you change the id and tree.

If you change only name and description, no need to delete.

 

Each subcategory has to have a new ID, a new name and you decide to attach it to another category using the Parent Cayegory Option.

So

Remember that Category n.1 is everytime the Home, so is better to start your tree from ID2, otherwise you will have all your category under the ID1 you insert.

 

So:

ID2 Monster

ID3 Dragon Parent2

ID4 Butterfly Parent2

ID5 Fire Parent3

ID6 Flying Parent3

 

to have

Monster

.......Dragon

.................Fire

.................Flying

...... Butterfly

 

For products, if you want that product XXX is on category Monster/Dragon/Flying you have to indicate category 6

 

If it is in more categories input with comma separated the relative categories, like

5,6 if it is a Dragon that while Flying, he burns around :):)

 

But i and others we encountered a big problem when changing the language when you import the CSV : if i have imported the English CSV language first and now i import the French CSV language, it will override totally the English so i will have two languages with same languages :(.

Have you also this problem?

 

You can follow us on this post, related to CSV import

My link

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Could someone please help me understand how to display this in a CSV under Parent Category - I tried putting everything in the correct 'number' but this destroyed my site!

 

Example:

 

horse riding clothing - Main Cat equestrian clothing - Sub Cat riding clothing - sub sub cat polo tops & t-shirts- sub sub cat rugby shirts & jumpers- sub sub cat coats & jackets - sub sub cat jodhpurs & breeches- sub sub cat underwear & thermals- sub sub cat waterproofs- sub sub cat headwear & scarves- sub sub cat show riding wear - Sub Cat shirts & bibs- sub sub cat ties & stocks- sub sub cat show jackets & waistcoats- sub sub cat overcoats- sub sub cat breeches- sub sub cat rider safety - Sub Cat hats, skulls & silks- sub sub cat body protectors- sub sub cat reflective wear- sub sub cat gloves- sub sub cat horse riding footwear - Sub Cat short riding boots- sub sub cat long riding boots- sub sub cat country boots- sub sub cat muckers, thermal boots & wellies- sub sub cat chaps & gaiters- sub sub cat spurs & straps- sub sub cat socks- sub sub cat

 

Thank you so much!

Link to comment
Share on other sites

  • 2 years later...

to renew this page....i have similar problem...want to import category + subcategory.....doesnt work....

 

I have the 2 main categories, and each subcategorie has 3 subcategories wich has the same name. 

 

Example:

1. categorie name BAMBUS

-subcategorie MOSKI

-subcategorie ZENSKE

-subcategorie OTROCI

 

1. categorie name SPORT

-subcategorie MOSKI

-subcategorie ZENSKE

-subcategorie OTROCI

 

the problem is, that no matter in wchich main categorie is the product, it gives me subcategorie ZENSKE from main categorie SPORT into subcategorie OTROCI in main categorie BAMBUS!!!

 

I have tried to put space after "," but the same problem.

 

 

 

 

 

 

 

 

untitled.jpg

Edited by matjazr (see edit history)
Link to comment
Share on other sites

  • 9 months later...

Hi,

 

Just for info, i have been struggling one day with this category/subcategory import and found easy way to go through

 

1. i have no idea why but keep first line in your csv with some title (not sure if mandatory but easier to follow)

2. the parent , don't use name but id_parent, then forget names and simply put the id you want as parent.

3. when you import, force ID, delete old

4. Skip first line with title in import...

 

Just import and should be ok..(at least for me in 1.6.0.1)

 

Now still trying to find how to get that position imported (as long as this is not a field to assign in the import csv section for categories)

 

Good coding..

Link to comment
Share on other sites

Hi,

 

For info again, i found solution to import position in categories csv import:

 

1. one line added in AdminImportController around line 167

line added is  'position' => array('label' => $this->l('Position')),

 

case $this->entities[$this->l('Categories')]:
                $this->available_fields = array(
                    'no' => array('label' => $this->l('Ignore this column')),
                    'id' => array('label' => $this->l('ID')),
                    'active' => array('label' => $this->l('Active (0/1)')),
                    'name' => array('label' => $this->l('Name')),
                    'parent' => array('label' => $this->l('Parent category')),
                    'is_root_category' => array(
                        'label' => $this->l('Root category (0/1)'),
                        'help' => $this->l('A category root is where a category tree can begin. This is used with multistore.')
                        ),
                    'description' => array('label' => $this->l('Description')),
                    'meta_title' => array('label' => $this->l('Meta title')),
                    'meta_keywords' => array('label' => $this->l('Meta keywords')),
                    'meta_description' => array('label' => $this->l('Meta description')),
                    'position' => array('label' => $this->l('Position')),
                    'link_rewrite' => array('label' => $this->l('URL rewritten')),
                    'image' => array('label' => $this->l('Image URL')),
                    'shop' => array(
                        'label' => $this->l('ID / Name of shop'),
                        'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.'),
                    ),
                );

 

2. Now when you go to import csv categories, you will have opportunity to assign position in the select list..

3 You import...surprisingly, the position will all show '1' in the back office but the values have been updated in the table ps_category AND are used in front office to sort categories, solution to see the real position (select all in back office, disable all and re-enable all), and the positions imported will be shown..

 

 

That's it , i think that those 2 posts solve (at least for me) those 2issues.

 

1 prestashop 1.6.01 categories csv import: subcategories import

2 prestashop 1.6.01 categories csv import: position import

 

Hope this will help..

Regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...