VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: mailblade on October 07, 2017, 15:27:09 PM

Title: Edit modal popup once item has been added to cart?
Post by: mailblade on October 07, 2017, 15:27:09 PM
Hey guys.

I just have one question:

You know once you add a product to the cart a modal box appears saying how much of the product you added? Then you can click "Continue Shopping"; "Show Cart" or press the "X" to close the modal window.

Now, once I click the continue shopping, the page refreshes and goes to the top of my product list. How can I make it refresh without going to the top of the page again? Let's say I scrolled down 50 products and add product no 51 to the cart and click "Continue Shopping" , I would lose my location and at which product I am. Then I'll have to scroll down all the way again and find the specific product.

Can the refresh automatically go back to the location I was on the weg page? This is for the category view.

Thanks for reading :)
Title: Re: Edit modal popup once item has been added to cart?
Post by: jenkinhill on October 07, 2017, 15:56:00 PM
You can use JavaScript to simulate the browser back arrow function - Google for some code examples.

The file to edit &override is components/com_virtuemart/views/cart/tmpl/padded.php  (unless you already use overrides).
Title: Re: Edit modal popup once item has been added to cart?
Post by: mailblade on October 07, 2017, 16:17:05 PM
Thanks a lot jenkinhill, you're a lifesaver.

I'll just put a Javascript refresh function which refreshes the page. This will then keep me at the location I already was in the webpage.

The main issue was, I didn't know which file to edit for the modal popup. Now I do know it is the "padded.php".

Cheers!  :)

For those wondering, I just added this:

href="javascript:window.location.reload();"
Title: Re: Edit modal popup once item has been added to cart?
Post by: jenkinhill on October 07, 2017, 16:32:32 PM
Or   window.history.back()  would probably work, too.
Title: Re: Edit modal popup once item has been added to cart?
Post by: mailblade on October 07, 2017, 16:39:56 PM
Yeah that one does work as well!

If you don't mind, I have another question:

Is there a way I can show the cart quantity for each product in the category view?

I'd like to add a small note in the category layout for each product which says: "Currently in cart - 5"

How would I go about that? I'd rather not make a full new topic as it feels I'm asking too many questions.
Title: Re: Edit modal popup once item has been added to cart?
Post by: jenkinhill on October 07, 2017, 17:26:50 PM
That would probably need a plugin to be developed. I suspect that is not likely to be a commercial venture due to low demand (I believe you are the first to ask for it) and it would have to contend with the many types of different templates used.
Title: Re: Edit modal popup once item has been added to cart?
Post by: mailblade on October 08, 2017, 08:22:46 AM
Thanks a lot for your reply jenkinhill.

I understand, will have to look at plugins.
Title: Re: Edit modal popup once item has been added to cart?
Post by: Studio 42 on October 12, 2017, 14:45:11 PM
I don't think a plugin exist.
You need to check with a developper as me or perhaps GJC Web Design(or any developer answering many time in the forum)