Product characteristics not adding to cart

  • Posts: 41
  • Thank you received: 4
3 years 8 months ago #333936

-- HikaShop version -- : 4.4.2
-- Joomla version -- : 3.9.27
-- PHP version -- : 7.2.34

Hi,

I'm having an issue in which the Products Characteristics that I have set up are not being added to the cart when selected from the dropdown. Instead the default is being used. (you are able to change it IN the cart, but that's not really what I would consider functional.0

I have had a look at the Views>Product to see if there was any customizations that are causing an issue and have reverted some of them to see if it would resolve the issue and it has not.

Wondering if you had any ideas? (The linked page is an example of this on the website)

Thank you

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 8 months ago #333938

Hi,

This is indeed normally a product details page customization issue. So you were on the right track.
The issue is that the hidden data of each variant, which replaced the displayed information when you change the dropdown of a characteristic, is inside the form of the product page instead of being after it:
i.imgur.com/v6i9Ztp.png
All the divs with style="display:none;" should be after the </form> as it is the case by default.
And because the browser thinks that the hidden data is inside the form, this leads to the browser transmitting the hidden input fields of the variants after the input fields displayed on the page:
i.imgur.com/Z2gbBHp.png
And when the data arrives on the server it sees only the last element with the same name. So even the quantity field value should be ignored as it takes the quantity input field of the last variant which is hidden.

This indicates that there are probably one or several </div> missing at the end of show_tabular.php or show_default.php (I'm not sure which layout you're using on your product page as it has been customized and the tabs system there is different from what is by default in show_tabular.php).

The following user(s) said Thank You: mabdelaziz

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

  • Posts: 41
  • Thank you received: 4
3 years 8 months ago #334009

You were totally right, It was the show_default as when I removed the customization it worked fine!

However, as you said the store is not default in layout and removing this makes it look terrible. I'm not very versed in php, or any coding language for that matter.

Is there any way to fix this whist still using the same customizations, I wouldn't know where to begin.

This is the show_default.php

gist.github.com/fpmatty/e52c74c768ef14ccac07b3ce52ea4195

If you could help with this that would be amazing!
Thanks for all your help so far in the matter

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 8 months ago #334014

Hi,

As I said, you're missing some </div> at the end of the view file.
So try adding one </div> at the end. Then, see how it goes. And if you still have the hidden inputs inside the form, add a second </div> at the end, etc until you get the correct amount.

Also, if the customization came with the template, I would recommend that you contact your template provider so that they can fix it. It will not only help you but others using that template in the future.

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

  • Posts: 41
  • Thank you received: 4
3 years 8 months ago #334050

Just adding one </div> has worked perfectly! That's amazing, thank you very much! Really do appreciate the help!

I'll inform the person that I have gotten the template from, like you suggest as your right a lot of people like myself wouldnt have known that!

Thanks again, amazing support as usual!

The following user(s) said Thank You: nicolas

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

  • Posts: 58
  • Thank you received: 2
3 years 6 months ago #335593

I am experiencing the same problem however I checked the

show_default.php (views, product)

with no modifications at all and it does not pass on any values. Using Joomla 3.10.1 and Hikashop Business 4.4.3

Would you mind to have a quick look?
Product with characteristics

Thank you.

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 6 months ago #335609

Hi,

I don't see the same problem on your link.
As far as I can see there, the correct variant is being added to the cart.
You can confirm this with the "edit" icon on the cart page. It will open a popup with the correct variant selected and the image of the variant also correspond to the variant selected.
However, I see a problem with the variant name of the variants. It seems that you've entered the same "name" for all the variants of your product, and worst, you made it similar to the main product name.
So you end up with the main product name being repeated twice in the cart and thus if the user only look at the name, he doesn't know what variant of the product he is buying.
So I would recommend to edit your product variants and either remove the name so that HikaShop can generate it dynamically for you, as it is by default, or to set a name that describe the variant itself, and not the main product.

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

  • Posts: 58
  • Thank you received: 2
3 years 6 months ago #335644

Hello Nicolas

Yes, I can see what you mean!!! I changed it for one product (we have over 3000) to check it out and it solved the problem. This is how it looks like in the cart.



Is there a possibility to (I am lighting it for reference as bold Characteristics) to show the label of the value as well which could be f.e. Color, Cover, Size etc. so it would look like:

Colour: Orange
Size: 12" 300mm

Also when the products in the cart are listed on the checkout the SKU (order code) is displayed nicely with the rest, see example

Attachments:

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 6 months ago #335655

Hi,

There is no easy option to add the label. We figured that it would make it too much there, especially since that text is also used for the email notifications where the width is less important, and also when passing the name of the products to payment gateways, they often restrict the number of characters so you want the name to be as small as possible. And since it's the same code generating the name with the selected characteristics appended to it, we figured it would be better to not include the label.

Changing the order of the code to have the SKU before the edit button should be possible without too much difficulty.
You need to edit the view file checkout / show_block_cart.php via the menu Display>Views and move a bit the code displaying the "product_code".
Normally, by default the product_code is directly after the product name:
i.imgur.com/OM7aits.png
And thus it's already by default before the edit icon.
So I suppose that your template already has a customization of checkout / show_block_cart.php and thus I'm not sure what exact modification should be done.

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

  • Posts: 58
  • Thank you received: 2
3 years 5 months ago #336036

Just a quick question:

Is there a fast and easy way to reset all the names of the variants of the products or does one have to go through them one by one?

Thank you for your help.

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 5 months ago #336038

Hi,

You can create, via the menu System>Mass action, a mass action with a filter on the "product type" being "variant" and an action "update the values" on the "product_name" column with the type "string" and the input field being empty. When you run the mass action, it will clear the product name of all the variants at once. And when the product name is empty, for a variant, the system will dynamically generate it based on the values of the characteristics of the variant.

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

  • Posts: 58
  • Thank you received: 2
3 years 5 months ago #336080

Thank you very much. I set it up and run it but it does not seem to clear the names in the variants:

Attachments:

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 5 months ago #336082

Hi,

This looks ok. Note that this mass action will only clear the name of the first 50 000 variants it finds. So if you have several hundred of thousands or millions of them, you would have to run the mass action several times, each time changing the "start" value and increasing by 50 000.
Also, what happen when you run the mass action ? Do you get an error ? Or a successful message ?

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

Time to create page: 0.110 seconds
Powered by Kunena Forum