News:

Support the VirtueMart project and become a member

Main Menu

Cart update quantity validation: where is this code?

Started by cleoni, October 06, 2014, 14:59:15 PM

Previous topic - Next topic

cleoni

Question regading: VM 2.6.0 (possibly also other versions)

Hello,
After a few hours searching I finally decided to post here for a hint.

I am looking for the code which accepts thr input from the cart page, and that validates the user-entered quantity.

I am searching for this code because it won't take into any account the "price_quantity_end" value that you enter in the product general info tab, with the purpose to limit the number of items that may be sold.

I also have discovered that entering "strange" values (eg. a character string) the line is deleted.

How to reproduce problem:


1) http://dasinfomedia.com.au/mojoomla/joomla/mj_cart/
2) put any item in the cart
3) View cart page
4) enter in the quantity field: "aa" and  click UPDATE icon, the line will disappear. I would like a different action (eg. on invalid input, leave quantity untouched)

Anybody knows where to find the code?


--Cris

Milbo

I think a js is most suitable to catch that, else it is interpreted as zero, which is interpreted as the command "remove"
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

cleoni

Thanks Milbo, this is a good point.

But supposing I need to do more checks which involve server-side, can you (or anybody) point me to where this checks are performed in the code? I looked at the Cart model, Product model, but I cannot find where the checks are being made...
--Cris

Milbo

cart function add and cart controller add respectivly addjs
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/