Characteristics conflict in different options

  • Posts: 228
  • Thank you received: 8
10 years 8 months ago #186133

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6

Hello,

I've got a complicated setup on a site I'm building. I've created a Father product with Son products. The father is just an empty shell which holds the Sons which are hidden products that I've assigned to the Father as options. Now, each son has one characteristic assigned to it to manage sizes and stock respectively.

For example: My Father product is Bikini swimsuit, Son 1 is the top part, Son 2 is the bottom part. Each one have it's own product details and an add to cart button. Son 1 (top) has characteristic "top-size" assigned to it with sizes: XS, S, M, L. Son 2 has characteristic "bottom-size" assigned to it with sizes: S, M, L, D. The entire stock of the site is manged via the sizes.

My problem is that the characteristic seems to collide and will not work. When I use the dedicated size characteristic for each son the drop down boxes collide. In the given example the bottom drop down box shows the right stock levels but on the top son while the top does nothing. When I use the same characteristic for both sons one seems to work and I can see the stock values but the other won't.

I know I've made some extensive modifications to the code but maybe you'll be able to think of a creative solution to help me here.

Link to a sample product I've created:
fitin.guywalderonline.com/index.php/he/%...duct/245-father-test

See attached screen shot of the characteristic and product built as well.

Thank you in advance,

Guy.

Attachments:
Last edit: 10 years 8 months ago by theguy.

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

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 8 months ago #186137

Hi,

By default the product page can only have one add to cart button and each option is a dropdown that gets added at the same time when the main add to cart button is pressed.
There is the possibility to have several add to cart, one per variant but it's really a specific case whereby you only have characteristics attached to the product and the characteristics are displayed as a list (it doesn't apply to your case).
So I'm not surprised that it doesn't work like you want.

We don't display characteristics or options on products listings to avoid loading too much data, and thus the characteristics/options system isn't made to work with several instances of itself on the same page. Here it seems that you're trying to squeeze the code of two product pages into one but then the second product redefines the data of the first one, the ids of the elements collide as they are not unique anymore, etc. If you really want to do it like that, it will require rewriting the characteristics/options system from scratch almost.

I don't see an easy solution to have two products' product page displayed on the same page with the characteristics system working (updating the stock, the price, etc when you change the selection). So I'm afraid I don't have an easy solution for what you're trying to do.

One thing I can propose as an alternative:
Customize the product page of the main product to display two iframes, one for each child product, and set the product page of each parent as the src of each iframe. If you add the &tmpl=component parameter to the URL in the src, it will display just the product page layout without the template and the modules in each iframe and you can do some simple customization of the product page to only display the characteristic dropdown, stock, title, add to cart in each iframe.
With some small cosmetic CSS, you can have the iframes look as if they were part of the product page of the main product.
I don't like using iframes, but here, it will allow you to isolate the javascript and ids of the elements of each child product avoiding the errors that you're currently facing while avoiding you to rewrite the whole code of the characteristic system.

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

  • Posts: 228
  • Thank you received: 8
10 years 8 months ago #186208

Hello Nicoals,

Thank you for the detailed answer. I can see now why it's not working for me...

If I remove the "Add to cart" button from each product option and leave just main "Add to cart" button, will I still be able to show the stock levels for each variant and add an amount box?
If so, how can I add an option to include one "son" - product option (let's say just the top) and not the second one. The way it's built in your demo a client doesn't really have a choice but to buy the product with all three options (Hard drive disk, RAM, Processor). What if a client wishes to buy the computer without the Hard drive disk?

In addition, you've mentioned you don't like using Iframes. Why is that?

Again, thank you very much for your help.

Guy.

Last edit: 10 years 8 months ago by theguy.

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 8 months ago #186322

Hi,

The option selection list the variants in a single dropdown ; in that dropdown you can decide to display the stock quantity if you want.
By default HikaShop won't let the customer select a variant of an option if the stock does not allow it ; so I don't think it will be an issue.

What if a client wishes to buy the computer without the Hard drive disk?

It is possible to configure the product in order to have a "no" value in the dropdown.
The previous demo website had this configuration, I don't know why the new one does not but we will see to update it.

In addition, you've mentioned you don't like using Iframes. Why is that?

It's a big question which is more about the "world wide web" and the html than HikaShop.
Personally, I don't like iframe and I use them only for very very specific cases ; but for most use case, using some classical HTML or some javascript (ajax..) is quite better. An iframe is just a block that you can't even control and which is totally separate from your web page.

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: 228
  • Thank you received: 8
10 years 7 months ago #186583

Hello Jerome,

Thank you for the great support.
At the end we've decided to make some changes to the core built of characteristic.php. There was no need to rebuild the entire characteristics model, just modify it. Now when a product has sons the characteristics are based on class names instead of IDs. When there are no sons it works as usual. This change is actually an upgrade the the core functions of your product options and characteristics.

I'm willing to contribute my code so you can take a look and even consider implementing it in Hikashop. I think it can much improve your solution and add some flexibility that is missing the way it is right now.

Thank you again,

Guy.

The following user(s) said Thank You: Jerome

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

Time to create page: 0.067 seconds
Powered by Kunena Forum