- Posts: 217
- Thank you received: 1
refresh cart
14 years 7 months ago - 14 years 7 months ago #38372
by Mat
refresh cart was created by Mat
Hi Nic,
I add items to the cart via url.
which works. However the cart doesn't get updated until I refresh the page.
Am I doing something wrong? How can I refresh the cart on the page?
Mat
I add items to the cart via url.
Code:
$.get("<?php echo JURI::root(); ?>index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=43");
which works. However the cart doesn't get updated until I refresh the page.
Am I doing something wrong? How can I refresh the cart on the page?
Mat
Last edit: 14 years 7 months ago by Mat.
Please Log in or Create an account to join the conversation.
14 years 7 months ago #38379
by Mat
Replied by Mat on topic Re: refresh cart
Also with the above code how do I add 1 to cart rather than replace the current quantity with 1?
Please Log in or Create an account to join the conversation.
14 years 7 months ago #38507
by nicolas
Replied by nicolas on topic Re: refresh cart
That's normal. You're just sending a request to the server telling it to add the product into the cart in the database.
You're not refreshing the cart module with the new cart module which requires more complex javascript. The simplest will be to not use ajax and just have the whole page refresh.
Otherwise, if you really want to do it in ajax and refresh the cart module, you should base your JS code on the JS code near the end of the file administrator/components/com_hikashop/helpers/cart.php
To add instead of replacing, just add the parameter &add=1 in the URL.
You're not refreshing the cart module with the new cart module which requires more complex javascript. The simplest will be to not use ajax and just have the whole page refresh.
Otherwise, if you really want to do it in ajax and refresh the cart module, you should base your JS code on the JS code near the end of the file administrator/components/com_hikashop/helpers/cart.php
To add instead of replacing, just add the parameter &add=1 in the URL.
Please Log in or Create an account to join the conversation.
Time to create page: 0.164 seconds