How to import the categories ordering from a CSV file?

  • Posts: 13
  • Thank you received: 1
7 years 1 month ago #263573

-- HikaShop version -- : 3.0.0
-- Joomla version -- : 3.6.5

Hi,

I'm trying to have a list of categories imported in a specific order from a CSV like the following one:

product_code;parent_category;categories;category_ordering
;"Category";"Cyclo Cross ";1
;"Category";"E-Bikes City ";2
;"Category";"E-Bikes MTB ";3
;"Category";"Fitness ";4
;"Category";"Full Suspension All Mountain ";5
;"Category";"Full Suspension Cross Country ";6
;"Category";"Full Suspension Enduro ";7
;"Category";"Full Suspension Trail ";8
;"Category";"Hardtails 26 ";9
;"Category";"Hardtails 27.5 ";10
;"Category";"Hardtails 29 ";11
;"Category";"Road ";12
;"Category";"Single Speed ";13
;"Category";"Trekking / City ";14
;"Category";"Women ";15
;"Category";"Youth / Kids ";16
;"Size";"13.5 ";1
;"Size";"15 ";2
;"Size";"15.5 ";3
;"Size";"16 ";4
;"Size";"17 ";5
;"Size";"18 ";6
;"Size";"18.5 ";7
;"Size";"19 ";8
;"Size";"20 ";9
;"Size";"21 ";10
;"Size";"21.5 ";11
;"Size";"22 ";12
;"Size";"24 ";13
;"Size";"36 ";14
;"Size";"38 ";15
;"Size";"41 ";16
;"Size";"42 ";17
;"Size";"42L ";18
;"Size";"43 ";19
;"Size";"44 ";20
;"Size";"45 ";21
;"Size";"46 ";22
;"Size";"46L ";23

The categories are imported correctly, but the sort order - which I suppose is given by "categories_ordering" - is not imported at all.
Any idea why?

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
7 years 1 month ago #263576

Hi,

The column name should be categories_ordering
That's because instead of :

;"Size";"13.5 ";1
;"Size";"15 ";2
;"Size";"15.5 ";3
you could have:
;"Size";"13.5|15|15.5";"1|2|3"

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

  • Posts: 13
  • Thank you received: 1
7 years 1 month ago #263680

Hi,

nicolas wrote:
The column name should be categories_ordering
That's because instead of :

;"Size";"13.5 ";1
;"Size";"15 ";2
;"Size";"15.5 ";3
you could have:
;"Size";"13.5|15|15.5";"1|2|3"


Ok, thanks, I corrected my import file, but it still does not work as expected. The following import file:
product_code;parent_category;categories;categories_ordering
;"Category";"Cyclo Cross |E-Bikes City |E-Bikes MTB |Fitness |Full Suspension All Mountain |Full Suspension Cross Country |Full Suspension Enduro |Full Suspension Trail |Hardtails 26 |Hardtails 27.5 |Hardtails 29 |Road |Single Speed |Trekking / City |Women |Youth / Kids  ";"1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16"
;"Size";"13.5 |15 |15.5 |16 |17 |18 |18.5 |19 |20 |21 |21.5 |22 |24 |36 |38 |41 |42 |42L |43 |44 |45 |46 |46L |47 |48 |50 |51 |51L |52 |53 |54 |55 |56 |56L |58 |59 |60 |61 |65 |L |S  ";"1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41"

gets not imported in the given sort order. In the back-end all values of column "Order" are zero.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
7 years 1 month ago #263695

Hi,

You're right I was wrong. The categories_ordering is for you to define the ordering of a product in a category and not the ordering of the category when it is created automatically by the system.
There is actually no column to set the ordering of categories when they are being created by the import system.

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

  • Posts: 13
  • Thank you received: 1
7 years 1 month ago #264577

Hi Nicolas,

Thank you for your explanation! In the meantime I solved the problem with a special PHP script that updates the ordering field directly in the database. Not the best solution, but it works :-) I also noticed the same problem with the "Brand" field, which is internally mapped to a category as well, so I used the same procedure as for my categories. As a suggestion for an upcoming update it would be nice to directly set the category order on the base of the order the categories are listed in the CSV file.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
7 years 1 month ago #264581

Hi,

That's a good idea. We'll do that.

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

Time to create page: 0.066 seconds
Powered by Kunena Forum