Hi,
I want to add a sort of check on the options before an item can be added to the cart. Some products have 2 custom_text_plugin fields where the user must fill in the dimensions of the product that he wants. What I want to check before an item is added:
- Are both fields filled with correct values (integer)?
- The dimensions may not exceed 1000x1600. I can't integrate this in the plugin, since I have to check both fields at once. That's because 1600x1000 is also valid.
After it has checked the fields:
- If everything is fine, just add it to the cart
- If it's not fine, show a modal form/popup that tells you what's wrong. After closing that popup, the user can change them to correct values.
I think I have to add something to default_addtocart.php...Does anybody know how to do this?
Hi,
been searching around myself a little more and found the components\com_virtuemart\helpers\cart.php. There is the check for the quantity and it can also show a popup.
So to see there is also access to alle the fields of product that's being added. Don't see how to get access to the custom fields, but I might find that out to.
I think I have to create a similar function like checkForQuantities with a possible false return value and add this new function as an extra check to the add function?
Am I right?
But that's something for tomorrow, it's 4 in the morning over here...