I’m using Magento 1.7 . And I am explaining step-by-step:- 1. Clicked on any item among my items list. app\design\frontend\base\default\template\catalog\product\view.phtml
<form action=”http://abc.local/prescriptionform” id=”requestForm2″ method=”post”>
<input type=”hidden” name=”id1″ id=”id1″ value=”<?php echo $_product->getId() ?>” />
<input type=”submit” name=”Order” id=”order”/>
</form>
2. A popup box seems that consists of item particulars along with a Submit button known as “ORDER”. When clicking “ORDER” button it takes to above form action and then I obtain the item id, also it displays a form along with a submit button.
\app\design\frontend\base\default\template\prescriptionform\index.phtml
$baseurl = Mage::getBaseUrl();
$product_id = $_REQUEST['id1'];
<form action=”<?php echo $baseurl.”checkout/cart/add?product=”.$product_id; ?>” id=”requestForm” method=”post”>
<h3 class=”txt-blue”><?php echo Mage::helper(‘contacts’)->__(‘Your Prescription ‘) ?></h3>
<ul class=”form-list”>
<li>
<label class=”required type”><?php echo $this->__(‘Prescription Type’) ?> <font color=”red”>*</font></label>
<div class=”input-box p_form”>
<select name=”type” id=”name-prefix” class=”required-entry”>
<option value=”" selected>Please select…</option>
<option value=”single” title=”Single Vision”>Single Vision</option>
<option value=”bifocal” title=”Bifocal”>Bifocal</option>
<option value=”progressive” title=”Progressive”>Progressive</option>
</select>
</div>
</li>
</ul>
<p><?php echo $this->__(“<font color=’red’>*</font> Required Fields”) ?></p>
<input type=”hidden” name=”request_flag” id=”request_flag” value=”1″/>
<input type=”hidden” name=”productID” value=”<?php echo $product_id; ?>”/>
<input type=”submit” name=”add” id=”add”/>
3. Then I got these values by addition to cart page after using as follows:-
app\design\frontend\base\default\template\checkout\cart.phtml
$params = $this->getRequest()->getParams();
$_REQUEST['request_flag'];
But I’m not capable of getting worth of that form by adding to cart page. Please help me anyone if possible, I shall be thankful to you.
The post Looking for different ways to acquire form values when submitting an addition to Magento cart? appeared first on Magento Expert.