News:

Support the VirtueMart project and become a member

Main Menu

Custom addtocart function query?

Started by Agaton, August 29, 2019, 17:20:21 PM

Previous topic - Next topic

Agaton

Hi,

I want to be able to create a notice on the product details page when the add to cart button has been clicked.


  • I would like it to start with "add to cart" when they first look at the product - which is obviously already a function
  • when they click the "add to cart" i would like it to read "adding" - I am sure this can be achieved with css or javascript action onclick or something similar
  • The tricky part is then adding a notice under the "add to cart" button saying "1 item in your cart" or "you have 1 of these in your cart

My question is, what php code/array/function would I need to use to be able to get the information to display in the product details page?
Is it a cart session/cookie or php array that I need to work with, this is really an area I don't touch much!

I really do not know where to begin and some pointers would be welcome, I don't need this written in full for me, just a starting point.

Cheers
Martyn

PRO

assets/vmprices.js

This
Virtuemart.addtocart = function (e)
then
Virtuemart.productUpdate = function()


are you NOT using the minicart module? or the pop up?



Agaton

Sorry I don't think I made myself clear.

I want the number of that product only to be displayed under the add to cart button like this website...

https://www.cartridgesave.co.uk/ink-cartridges/Brother/DCP-197C.html

click add to basket and see what happens that's exactly what I am after

I just need to know what variable/array/session or other code I need to work from to make this possible. Thanks in advance.

Studio 42

Session ?
You can override core javascript in your template to replace the popup and update only the button.
To do this check
Quote from: PRO on August 29, 2019, 20:36:31 PM
assets/vmprices.js

This
Virtuemart.addtocart = function (e)
then
Virtuemart.productUpdate = function()


are you NOT using the minicart module? or the pop up?




Agaton

Thanks, Javascript is my start them in that asset file

By session I was referring to cookie sessions, as I said I had no idea where to start.