VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: gripped on May 14, 2014, 10:43:08 AM

Title: Add to cart - continue shopping stay on page with no reload. And a gap :)
Post by: gripped on May 14, 2014, 10:43:08 AM
I found the ajax add to cart frustrating. You add to cart without a reload. But continue shopping takes you away from the product page and reloads ?
If like me you've added 'add to cart' to the category list it reloads.
Plus there is no gap between Continue ShoppingShow Cart (like that) if its's the first of a product added.

With the help of this thread http://forum.virtuemart.net/index.php?topic=105390.0 (http://forum.virtuemart.net/index.php?topic=105390.0) I have solved both with the change of one line.

copy
components/com_virtuemart/views/cart/tmpl/padded.php
to
templates/YOURTEMPLATE/html/com_virtuemart/cart/padded.php

Change this line (line 23 as of 2.6.0a)
echo '<a class="continue" href="' . $this->continue_link . '" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
to
echo '<a class="continue" href="javascript:void(0);" onclick="jQuery.fancybox.close();" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>&nbsp;&nbsp;';

This is for fancybox but I'm sure it could be modified for facebox.

In my humble opinion this is how it should work as standard.

Seems to work fine but there may well be a better way.
Title: Re: Add to cart - continue shopping stay on page with no reload. And a gap :)
Post by: Milbo on May 14, 2014, 12:15:42 PM
It makes not really sense to let the customer on the same product page, which he just put in the cart.
Title: Re: Add to cart - continue shopping stay on page with no reload. And a gap :)
Post by: gripped on May 14, 2014, 13:51:52 PM
 :)
I did say it's only my opinion. But it makes perfect sense for me and my shop. It doesn't make any-more sense to be returned to the first page of the category you were browsing
And there are a number of threads on the forum where people have sought help on the same thing.

As I said in the first post I have overidden components/com_virtuemart/views/category/tmpl/default.php to show add to cart (another thing that would be great as an option)
From here I think http://forum.virtuemart.net/index.php?topic=90961.150 (http://forum.virtuemart.net/index.php?topic=90961.150).
And when used in this way it makes even less sense to take the customer to the first page of the category.

Done like this is smoother. IMHO (especially when combined with VM AddToCart Effect CK (http://www.joomlack.fr/en/joomla-extensions/vm-addtocart-ck))

The reason I made a new topic is the one I linked to in the FP was buried deep on my searches. But it was the simplest solution and the least hacky. I just changed it to prevent the page reload.

Let me take this opportunity to thank you, and all the other devs, for Virtuemart.  :)
Title: Re: Add to cart - continue shopping stay on page with no reload. And a gap :)
Post by: craftyweb on May 14, 2014, 16:06:26 PM
I'd agree gripped. Having the continue shopping button simply closing the ajax add to cart popup. Is what I'd want also.

It may be that there are other variants, or related items, which the customer would like to add to the cart also. Personally I feel redirecting to another page is a waste of time and resources.
Title: Re: Add to cart - continue shopping stay on page with no reload. And a gap :)
Post by: Milbo on May 14, 2014, 16:15:48 PM
So you can still be happy, becaus you can change it with a simple layout override. You have additionally the related products and categories.
Title: Re: Add to cart - continue shopping stay on page with no reload. And a gap :)
Post by: Ruup on July 29, 2015, 13:28:37 PM
I've made this change also and it works fine.
But there's a problem: ''continue shopping'' and ''to shopping cart'' were buttons in my template style and they are gone now.  So the layout of that window is gone.
How can i fix this.