Add To Cart with Custom Field problem

  • Posts: 2
  • Thank you received: 0
11 years 7 months ago #100991

Hi There,

I have added a Custom Field, of type "item" to my shop. I associated that to just one Product Category.

It is a simple text box, and is displayed correctly on the listing of products in a category, as well as on each single product page in that category. Adding a value to the text box correctly includes that value with the product when it is added to the Cart.

This is where I am finding an issue.

If I enter a value in my field when on a Category page, and click "Add To Cart" the process works as normal - the product is added to my cart, and I stay on the same page.

If I am on a single product page, enter a value in my custom field, and click "Add To Cart" it does actually add it to the cart, but instead of staying on the same page, it takes me to the Checkout process.

If I un-publish the Custom field, the process of adding to cart from the specific product page works as normal, so it is specifically to do with having a Custom Field on a product.

Can anybody think of what might be causing this issue, and ideas on how to fix it?

Many thanks,

Nathan

Last edit: 11 years 7 months ago by nathangoss. Reason: More accurate Subject

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

  • Posts: 2
  • Thank you received: 0
11 years 7 months ago #101002

I have done a little digging, and can see the following code is displayed for the Add To Cart button:

Code with Custom Field turned on - Add to Cart goes to Checkout (not normal):
<input type="submit" class="button hikashop_cart_input_button" name="add" value="Add to cart" onclick="var field=document.getElementById('hikashop_product_quantity_field_1');if(hikashopCheckChangeForm('item','hikashop_product_form')){ return hikashopModifyQuantity('38',field,1,'hikashop_product_form','cart'); } else { return false; }">

Code with Custom Field disabled - Add to Cart works as normal, and stays on page:
<input type="submit" class="button hikashop_cart_input_button" name="add" value="Add to cart" onclick="var field=document.getElementById('hikashop_product_quantity_field_1');if(hikashopCheckChangeForm('item','hikashop_product_form')){ return hikashopModifyQuantity('38',field,1,0,'cart'); } else { return false; }">

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 7 months ago #101303

Hi,

Can you make sure that the "when a product is added to the cart" option of the configuration is set to "always stay on the current page" ?

The fact that you have that change between having the custom field and not having it is normal actually. That's because the system has to use the form of the page when there is a custom field.
If you hadn't that, the custom field value would not be added to the cart.

The issue with the redirection is something else. Probably just an issue with the "when a product is added to the cart" option or something like that.
Also, please make sure that you have the latest version.

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

Time to create page: 0.037 seconds
Powered by Kunena Forum