Refresh Cart Module

  • Posts: 118
  • Thank you received: 3
11 years 8 months ago #126107

-- HikaShop version -- : Business 2.2.2

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
11 years 8 months ago #126135

Hi,

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.

  • Posts: 118
  • Thank you received: 3
11 years 8 months ago #126147

Thanks, although that won't suit our layout/design. We have main product pages already, this is a "extra" that people can purchase but its more of a "side note". All I need is a way to refresh the page (or preferrably just the cart module), everything else works as we want, it is adding to the cart perfectly, just not updating the cart module view.... Any other ideas?

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

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #126157

Ok, so the best solution will just be to use the link of the "Add to cart HTML link" option that you'll find through your product page for your image.

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

  • Posts: 118
  • Thank you received: 3
11 years 8 months ago #126261

Hello, thanks but not what I needed.

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.

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #126302

Hi,

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.

  • Posts: 118
  • Thank you received: 3
11 years 8 months ago #126603

Hello, we have that option selected. It seems whenever the html link is used for adding a product to the cart, it always goes to the checkout. Looking at other threads, it is a common issue people have been trying to work around. The cache is turned off also. Any other ideas?

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

  • Posts: 26251
  • Thank you received: 4040
  • MODERATOR
11 years 8 months ago #126627

Hi,

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 118
  • Thank you received: 3
11 years 8 months ago #126675

Thankyou for a more detailed response Jerome, that makes sense. Would it be possible for me to add some js into the code I posted above to reload the entire page? (ie. document.load() or similar? As it stands at the moment, I have got it to the point where we click on the image, it adds to the cart and doesn't redirect to the checkout. yay! :) BUT, the cart module doesn't refresh until another menu option is selected or the page is refreshed, therefore we would be happy with just a way to refresh the page after it adds to the cart if thats a possibility?

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

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #126741

Hi,

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.

  • Posts: 118
  • Thank you received: 3
11 years 8 months ago #126855

Yeah, I tried location.reload(true) positioned in various locations within the "onclick" action, unfortunately it makes it go to the cart again, I am guessing it is the "return false" that prevents it from going to the cart, if I put the reload command after that, it does a continuous page reload loop :( Looks like I'll have to flag this modification and think of another way to make it look good, unless someone can tell me where/how to put the location.reload code into the code to just run at the end of the onclick statement?

Thanks heaps for your help.

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

  • Posts: 26251
  • Thank you received: 4040
  • MODERATOR
11 years 8 months ago #127050

Hi,

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 118
  • Thank you received: 3
11 years 8 months ago #127229

Hello, we have altered our website now and just made a dedicated product page instead of a direct add to cart from an image click. our website is www.quickcheapprint.co.nz , but you won't see what we were trying to do now as we changed the design due to not being able to force a refresh of the cart. no worries :)

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

Time to create page: 0.098 seconds
Powered by Kunena Forum