Add to cart item bound to layout?

  • Posts: 175
  • Thank you received: 0
10 years 2 months ago #207025

-- HikaShop version -- : 2.2.3

Hi

so i tried to change the show_default.php through template override. The problem is if i use characteristics, it doesnt add the item to the cart, instead it shows to product listing page with "the cart is empty"

my question is, does add to cart button in the product detail page bounded to certain parameter or class when adding the item to the cart?

i used jQuery to append and move item around [such as custom field], is it because i moved the items from original structure and the "add to cart" button refused to work?


Thank You

original layout



i.imgur.com/mu3fxJk.jpg


i.imgur.com/tHhBbUW.jpg

Modified layout

i.imgur.com/mn3c2NK.jpg


i.imgur.com/UiEf4wt.jpg

Last edit: 10 years 2 months ago by veeco.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #207043

Hi,

Giving the code of the show_default view will give us more details.
If you have moved elements out of the "form" HTML tags so yes that can't be working properly.

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

  • Posts: 175
  • Thank you received: 0
10 years 2 months ago #207162

Hi

i have attached the HTML of the new layout


File Attachment:

File Name: new_layout.zip
File Size:1,824 KB

Attachments:
Last edit: 10 years 2 months ago by veeco.

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

  • Posts: 84305
  • Thank you received: 13700
  • MODERATOR
10 years 2 months ago #207210

Hi,

I can see that you completely altered the HTML of the page. That won't work.
If you look at the HTML of the original layout, you can see first the form of the product page, with all the divs with _main in their id. And you can see the second part with all the divs with a display:none style on them.
The characteristic system will replace the data in the _main divs with the data in the hidden divs based on what you select in the characteristic dropdowns so that you automatically see the data of the selected variant.
This also modifies the add to cart, product_id areas.
The way you modified the layout, that cannot work anymore and that's why you get that problem.

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

  • Posts: 175
  • Thank you received: 0
10 years 2 months ago #207446

Hi

after further inspection, turns out my form missing product id input field in it

after i put the input, it worked normally


<span id="hikashop_product_id_main" class="hikashop_product_id_main">
<input type="hidden" name="product_id" value="<?php echo $this->element->product_id; ?>" />
</span>

Last edit: 10 years 2 months ago by veeco.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum