How to create a category under Root from a CSV import?

  • Posts: 13
  • Thank you received: 1
7 years 9 months ago #263166

Hello,

I need to reload the products list every night from a CSV file. I managed to build a CSV file that can generate categories under "Product category", but I don't know how to achieve that for a category under Root, using only data provided in the CSV file directly.
In other words, the following import works, if category "Size" has been previously defined in the back-end (In this case it has the ID #167):

product_code;parent_category;categories;images;product_manufacturer_id;product_name;product_msrp;price_value;product_description
;"Product category";"Cyclo Cross";"";"";"";"";"";""
;"Product category";"E-Bikes City";"";"";"";"";"";""
;"Product category";"E-Bikes MTB";"";"";"";"";"";""
;"Product category";"Fitness";"";"";"";"";"";""
;"Product category";"Full Suspension All Mountain";"";"";"";"";"";""
;"Product category";"Full Suspension Cross Country";"";"";"";"";"";""
;"Product category";"Full Suspension Enduro";"";"";"";"";"";""
;"Product category";"Full Suspension Trail";"";"";"";"";"";""
;"Product category";"Hardtails 26";"";"";"";"";"";""
;"Product category";"Hardtails 27.5";"";"";"";"";"";""
;"Product category";"Hardtails 29";"";"";"";"";"";""
;"Product category";"Road";"";"";"";"";"";""
;"Product category";"Single Speed";"";"";"";"";"";""
;"Product category";"Trekking / City";"";"";"";"";"";""
;"Product category";"Women";"";"";"";"";"";""
;"Product category";"Youth / Kids";"";"";"";"";"";""
;"167";"53 p";"";"";"";"";"";""
"13326053";"";"Trekking / City;53 p";"133260.jpg";"Kettler";"TRAVELLER 9.3 LITE ";"1399.00";"1199.00";"<ul><li>size: 53</li><li>year: 2013</li><li>speeds: 30</li><li>frame: Aluminium light 7005-K1</li><li>color: brown       </li><li>fork: Suntour Nex 4610</li><li>derailleur_front: Shimano Deore</li><li>derailleur_rear: Shimano SLX</li><li>shifter: Shimano SLX</li><li>brake: Tektro Scheibenbremse DRACO, hydraulisch</li><li>chainwheel: Shimano FCT 551</li></ul>"
"13411145";"";"E-Bikes City";"134111.jpg";"Kettler";"Obra Ergo";"3599.00";"3199.00";"<ul><li>size: 45</li><li>year: 2014</li><li>speeds: 8</li><li>color: BASALT      </li><li>derailleur_rear: Shimano Nexus</li><li>motor: Panasonic Center Motor CM 214</li><li>battery: 540 Wh</li></ul>"

Is it possible to generate the category "Size" directly in the CSV, with something like
;"0";"Size";"";"";"";"";"";""
?

Thanks

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 9 months ago #263172

Hi,

You're not supposed to create categories outside of the "product category" category.
You can try by using the text "Root" or "root" or "1" as "parent_category", but I've never tried. If these don't work, then I would say it's not possible.

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

  • Posts: 13
  • Thank you received: 1
7 years 8 months ago #263414

Thank you for this info. I can confirm that the "Size" category is created under Root when "1" is used as parent category ID, as in the following sample:

product_code;images;parent_category;categories;product_manufacturer_id;product_name;product_msrp;price_value;product_description
;;"Product category";"Cyclo Cross";"";"";"";"";""
;;"Product category";"E-Bikes City";"";"";"";"";""
;;"Product category";"E-Bikes MTB";"";"";"";"";""
;;"Product category";"Fitness";"";"";"";"";""
;;"Product category";"Full Suspension All Mountain";"";"";"";"";""
;;"Product category";"Full Suspension Cross Country";"";"";"";"";""
;;"Product category";"Full Suspension Enduro";"";"";"";"";""
;;"Product category";"Full Suspension Trail";"";"";"";"";""
;;"Product category";"Hardtails 26";"";"";"";"";""
;;"Product category";"Hardtails 27.5";"";"";"";"";""
;;"Product category";"Hardtails 29";"";"";"";"";""
;;"Product category";"Road";"";"";"";"";""
;;"Product category";"Single Speed";"";"";"";"";""
;;"Product category";"Trekking / City";"";"";"";"";""
;;"Product category";"Women";"";"";"";"";""
;;"Product category";"Youth / Kids";"";"";"";"";""
;;"1";"Size";"";"";"";"";""
;;"Size";"13.5 ";"";"";"";"";""
;;"Size";"15 ";"";"";"";"";""
;;"Size";"15.5 ";"";"";"";"";""
;;"Size";"16 ";"";"";"";"";""
;;"Size";"17 ";"";"";"";"";""
;;"Size";"18 ";"";"";"";"";""
;;"Size";"18.5 ";"";"";"";"";""
;;"Size";"19 ";"";"";"";"";""
;;"Size";"20 ";"";"";"";"";""
;;"Size";"21 ";"";"";"";"";""
;;"Size";"21.5 ";"";"";"";"";""
;;"Size";"22 ";"";"";"";"";""
;;"Size";"24 ";"";"";"";"";""
;;"Size";"36 ";"";"";"";"";""
;;"Size";"38 ";"";"";"";"";""
;;"Size";"41 ";"";"";"";"";""
;;"Size";"42 ";"";"";"";"";""
;;"Size";"42L ";"";"";"";"";""
;;"Size";"43 ";"";"";"";"";""
;;"Size";"44 ";"";"";"";"";""
;;"Size";"45 ";"";"";"";"";""
;;"Size";"46 ";"";"";"";"";""
;;"Size";"46L ";"";"";"";"";""
;;"Size";"47 ";"";"";"";"";""
;;"Size";"48 ";"";"";"";"";""
;;"Size";"50 ";"";"";"";"";""
;;"Size";"51 ";"";"";"";"";""
;;"Size";"51L ";"";"";"";"";""
;;"Size";"52 ";"";"";"";"";""
;;"Size";"53 ";"";"";"";"";""
;;"Size";"54 ";"";"";"";"";""
;;"Size";"55 ";"";"";"";"";""
;;"Size";"56 ";"";"";"";"";""
;;"Size";"56L ";"";"";"";"";""
;;"Size";"58 ";"";"";"";"";""
;;"Size";"59 ";"";"";"";"";""
;;"Size";"60 ";"";"";"";"";""
;;"Size";"61 ";"";"";"";"";""
;;"Size";"65 ";"";"";"";"";""
;;"Size";"L ";"";"";"";"";""
;;"Size";"S ";"";"";"";"";""

Unfortunately, it seems I can't use such a category in a filter. I can define it, but apparently it does not show up in the product listing...

Last edit: 7 years 8 months ago by cpix. Reason: Corrected typo

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 8 months ago #263419

Hi,

That's an entirely different issue.
And as I said

You're not supposed to create categories outside of the "product category" category.

So it's no wonder that something might not work with such category.
But to say if that's something you could work out, we would need more information on how you configure your filter on the categories...

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

  • Posts: 13
  • Thank you received: 1
7 years 8 months ago #263460

Hi,

I need to solve this problem:
I have a set of products, each with a property called "size", and I have to let the user choose from one of the possible values of "size" from either a list or a simple dropdown box. The possible values of "size" can change overnight, but they are always a finite set of values.
In the meantime I have tried using a custom field. But in this case I have yet to find a way to assemble a list of all distinct values to present the user. Should I try to implement that "size" property as a sub-category of "product_category"?
Thanks in advance for any hint! I'm otherwise quite impressed by the HikaShop Business solution and very happy with it!

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 8 months ago #263466

Hi,

You should indeed use a custom field of the table "product" in that case.
Enter all the possible values of the field in the custom field (as a single or multiple dropdown, etc).
Then, in your products select the value(s) you want in the custom field.
And then create a filter applying on that custom field via the menu Display>Filters.
That filter will appear on your products listings allowing you to filter the products based on the values selected in the custom field for each one of them.
www.hikashop.com/support/documentation/1...-filter-listing.html

Thanks for the comment. If you want to, you can post a review on the Joomla Extensions Directory:
extensions.joomla.org/extensions/extensi...pping-cart/hikashop/

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

  • Posts: 13
  • Thank you received: 1
7 years 8 months ago #263563

Hi,

nicolas wrote: You should indeed use a custom field of the table "product" in that case.
Enter all the possible values of the field in the custom field (as a single or multiple dropdown, etc).
Then, in your products select the value(s) you want in the custom field.


The problem is that I do not know all the possible values of the field. And I need to have them all listed in a single dropdown.
If there is a way to programmatically update the list of all possible values of a custom field, then I would be very glad if someone could explain me how to do it.
In the meantime I found an alternative solution by creating a sub-category of "Product category" called "Size" and mapping all distinct values of that field to sub-categories of that category. All products are then assigned to one of those sub-categories and I can apply a category filter to achieve the wanted result of having a single dropdown of all possible (distinct) "Size" values.

nicolas wrote: Thanks for the comment. If you want to, you can post a review on the Joomla Extensions Directory:
extensions.joomla.org/extensions/extensi...pping-cart/hikashop/


Yes, I'll surely do it!

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 8 months ago #263566

Hi,

Programmatically, you can do anything so that sure is possible. But it's not the easiest. You would have to run a PHP script to update the data of the custom field in the table hikashop_field. If you found a good enough solution with categories then it will be easier that way.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum