Create Categories with CSV

  • Posts: 242
  • Thank you received: 0
13 years 8 months ago #10752

Hello All,

Is it possible to CREATE categories with an import file (CSV), or must categories be created from within Hikashop? The import documentation page near the top says that since v1.4.1 categories can be imported, but further down it states that they must already exist in Hikashop.

If they can be created that way, what would the column headers look like to make sure parent/child relationships were established?

Thanks,
Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
13 years 8 months ago #10753

Hi,

Yes you can create categories with the import. The documentation even has an example:

parent_category,categories
product category,main category 1;main category 2;main category 3
main category 1,sub category 1;sub category 2

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 8 months ago #10807

Thanks Nicolas,

So if I understand correctly, the parent_category can be anywhere in the category tree structure and the category column reflects sub-categories of that particular parent_category only. Is that correct?

Rather than put all sub-categories in a single column on one row in the spreadsheet, for the sake of readability could each sub-category be on its own row and reference the same parent_category? In this case I guess "Create Automatically Missing Categories" would need to be enabled.

And finally, after an import is done to create the parent and sub-categories, any product imports would include the single column "categories" which would contain all pertinent category id numbers without reference to parent/sub-category level. Correct, or am I still confused?

Regards,
Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
13 years 8 months ago #10808

Yes.

Yes.

Yes.

You're correct on all your points.

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 8 months ago #11132

Nicolas,

A quick question: If a category is deleted in Hikashop, do all sub-categories associated with that category also get deleted or do they get left as orphan records in the database?

Thanks,
Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
13 years 8 months ago #11136

The third option. The get transfered to the parent category of the deleted category.

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 8 months ago #11147

I created a BUNCH of categories via import, but realize I need to structure them differently. What I would like to do is delete ALL product categories that currently exist and start over. I was going to just delete all records in jos_hikashop_category, but see there are some records in there that are not related to products. Can you give me an SQL query that would safely delete all the product categories without screwing anything else up in that table?

Thanks,
Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
13 years 8 months ago #11148

That's unfortunately not so easy. In order to improve performances, the category table has pre calculated binary tree leaves information. If you delete the categories in there directly via phpmyadmin, the pre calculated values won't be updated for all the other categories and that might break the category tree...You would have to rebuild the tree by changing the parent category of a category (there is a function which is triggered in that case to recalculate all these values automatically in that case).

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 8 months ago #11150

OK - So if I delete them through Hikashop then there won't be a problem?

Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
13 years 8 months ago #11151

Sure

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
12 years 2 months ago #65646

I began creating a shop within Virtuemart 2.0. I have thousands of new and previously-used products and approximately a thousand categories I will eventually integrate from another shop. Though, I am restructuring the category structure as well as adding new products and updating old.

Having created the ideal category structure for the shop within Virtuemart with no products yet imported, I am having difficulty getting the CSV file correct to import category, category description, category meta title and other parameters.

Do you have a sample CSV file for category and category data import as well as available fields? Any other advice would be helpful.

Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13362
  • MODERATOR
12 years 2 months ago #65804

You can't insert all the categories information via the CSV import.
It only allows you to import the name of the categories in order to link products to existing categories on your website and rapidly create the categories structure when the categories are not pre created.

Please Log in or Create an account to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum