I'm creating a Marketplace logic for my webSite but I'm facing a problem with product_addtocart_form
form.
I've customized the product page and I'm trying to set a customAttribute and retrieve it on the cart.
Example: The user has 3 options to select on the product page. I want to store the information of which option the user picked and retrieve it on the cart.
Mage::getSingleton('checkout/session')->setData('marketplace_info', $customInfo);
The logic above works and I'm able to get it on the cart. The problem now is that I don't know how to set this information only after the user choose/submit the form.
The form that I'm trying to customize is placed on the view.phtml
and the HTML is:
<form action="*magento-url*" method="post" id="product_addtocart_form">
Logic that I want to create:
User select one option (button) > My custom logic set a customAttribute (logic mentioned above) > Magento default logic add product to the cart.
Any idea? Thx
You are doing it wrong way.Add a input tag inside your form. Add your value under the value part of input tag. Like below
<input type="hidden" name="newVal" value="<?php echo 'yourValue'?>">
Now in your cart controller you will easily get this value. And there you can set the value in your session or where ever you want. Dont forget to add a check "if(isset('yourvalue')){}
" like this in your controller.