Virtuemart handle custom form and validate before add to cart is allowed

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
Phil147
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Tue Aug 23, 2016 9:41 pm

Virtuemart handle custom form and validate before add to cart is allowed

Post by Phil147 » Tue Aug 23, 2016 10:50 pm

hi,

I'm running Joomla 3.51 and Virtuemart 3.09

I've created a form in html and placed it with product using a custom product field. The custom field type is editor to allow me to place the html code.

I need the form data posted with php code and once the form is submitted execute add to cart code for the product.

Any ideas how to do this? Has anyone done something similar?

Phil

cjoomdev
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 178
Joined: Fri Mar 11, 2016 1:44 am
Contact:

Re: Virtuemart handle custom form and validate before add to cart is allowed

Post by cjoomdev » Fri Aug 26, 2016 4:01 am

You can do something like this using JS... You can call you function on AddToCart button click and once done... Let it do the VM AddToCart Post... Or do both simultaneously.

Phil147
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Tue Aug 23, 2016 9:41 pm

Re: Virtuemart handle custom form and validate before add to cart is allowed

Post by Phil147 » Mon Aug 29, 2016 1:36 pm

I found the function addtocart with JS in the file cart.php
/**
* Add the product to the cart, with JS
* @access public
*/
public function addJS() {

Can I add code addJS() to the end of my form so when the form is posted it executes add to cart using addJS()

Also what code is needed after add to cart function to return to product detail page?

ciphercraft
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Nov 26, 2013 6:02 am

Re: Virtuemart handle custom form and validate before add to cart is allowed

Post by ciphercraft » Wed Oct 25, 2017 9:48 am

hi,

I'm running Joomla 3.8 and Virtuemart 3.09

Image

can i customize virtuemart cart like above form image?
can i do fields dependency using custom fileds?
and dynamically adding services to product with services quantity using custom fileds ?

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 20652
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ Germany/ S'pore/Bogor/ North America
Contact:

Re: Virtuemart handle custom form and validate before add to cart is allowed

Post by leolam » Wed Oct 25, 2017 3:32 pm

ciphercraft wrote:hi,

I'm running Joomla 3.8 and Virtuemart 3.09

Image

can i customize virtuemart cart like above form image?
can i do fields dependency using custom fileds?
and dynamically adding services to product with services quantity using custom fileds ?
No you cannot do this simply. This requires coding by a professional with experience in VM and PHP and Javascript

Leo 8)
Joomla's #1 Professional Services Provider:
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -


Locked

Return to “General Questions/New to Joomla! 3.x”