- Posts: 118
- Thank you received: 3
Refresh Cart Module
Hello, we would like help to get something working.
On our website, we have an image inserted into an article. This image links to add a particular product to the cart using the following code in the article:
<a href="index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=191" onclick="try{ new Ajax('index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=191', { method: 'get' }).request(); }catch(err){ new Request({url:'index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=191', method: 'get'}).send(); } return false;"><img style="float: right;" alt="FilePrep" src="images/FilePrep.png" height="105" width="76" /></a>
This does what we want it to, although it doesn't update the cart module displayed in our sidebar.
I have referred to the "cart.php" file to find the code for refreshing this module but can't find it, could you let me know what code I need to add to the article to get the cart refreshed please?
Thanks
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
One solution would be to directly insert your product into your Joomla article by using the following plugins :
- Hikashop product TAG insertion
- Hikashop product TAG translation
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Please Log in or Create an account to join the conversation.
The Add to Cart HTML link does indeed add to cart, BUT it then takes you directly to the cart and doesn't allow you to stay on the current page. If you look at my code above, I have used the HTML link inside the code. The code was copied from another post as suggested by one of the HS support crew. The code works perfectly BUT the cart module doesn't refresh. I have tried modifying the code using various calls to update the cart, all they do is send the user straight to checkout.
The feature I am looking for is the same as a normal "add to cart" button action from the product listing, where the user clicks "add to cart" (in this instance it is an image rather than a button), and the product gets added to the cart with a quantity of 1, and the cart shows it has been added. It is only required for one product and there are no variables other than the set quantity of 1.
Is this possible?
Please Log in or Create an account to join the conversation.
To stay on the same page you need to have the option "After a product is added to the cart" to "Always stay on the same page".
For the cart refresh problem, that's probably a cache issue, thanks to try to clear and disable the Joomla cache via the Joomla configuration and disable the cache plugin, you can also maybe have cache with your template, thanks to disable it too.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
The product inserted in an article is not compatible with the Ajax system which stay on the same page and refresh the cart module.
Because it is something from HikaShop displaying in another component, we can't assure that all required feature will be there. That's why the link is a link to HikaShop and that's why it redirect you to the checkout.
In the HikaShop products page, it should work properly but your problem here, is the context.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
In the modifications you made, you can probably add some javascript to reload the current page.
With something like a location.reload
Please Log in or Create an account to join the conversation.
Thanks heaps for your help.
Please Log in or Create an account to join the conversation.
We are currently a little bit blind, we can't even see what you are doing and it is very difficult to provide you a good support without having access to the information.
Can you please provide a link or something useful for helping us help you ?
Thanks,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.