characteristics saved data in products table

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
9 years 7 months ago #229584

Hi!
We re developing a script to update hikashop products, categories... , from an external prorgam. we are at the point to update values for a product variant.
I remarked in hikashop product table, that the product which is created as variant of another product doesnt have any connection with the characteristic. I mean there is no refference with the characteristic table. How are these connected? How does hikashop know that the specifiq variant is attached with the characteristic with id XXX
Thanks! I m lost

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

  • Posts: 84307
  • Thank you received: 13701
  • MODERATOR
9 years 7 months ago #229586

Hi,

It uses the hikashop_variant table. That's the table which links characteristics and characteristics values on one hand, to the product and variants on the other hand.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
9 years 7 months ago #229830

Ok. I found it but, how (where is hikashop writing) the default variant? I cannot find it.

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 7 months ago #229832

Hi,

In the variant table too.
The variant_characteristic_id can link to characteristics and also the characteristic values (aka: the default value).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
9 years 7 months ago #230030

what do you mean (aka: the default value).?
you have

`variant_characteristic_id` int(10) unsigned NOT NULL,
`variant_product_id` int(10) unsigned NOT NULL,
`ordering` int(10) unsigned NOT NULL DEFAULT '0',

so how hika knows which is the default?

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
9 years 7 months ago #230085

Please can I have a proper answer so I can proceed withe script?

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

  • Posts: 84307
  • Thank you received: 13701
  • MODERATOR
9 years 7 months ago #230090

Hi,

In that table, for each product and for each characteristic you have:
- one entry linking a value of the characteristic with a variant of the product
- one entry linking the characteristic itself and the main product
- one entry linking the default value of the characteristic with the main product

So by loading all the entries in that table you know which value is the default one for each characteristic of the product and that way, you know which variant is the default one when the values of the variant match with the values of the links of the main product.

The following user(s) said Thank You: verzevoul

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

Time to create page: 0.040 seconds
Powered by Kunena Forum