私はmagento 1.7を使用しています。順を追って説明しましょう:- 1.製品リストから任意の製品をクリックしました。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. 製品の詳細と [注文] という [送信] ボタンを含むポップアップ ウィンドウが表示されます。「注文」ボタンをクリックすると、上記のフォーム action.here にリダイレクトされ、製品 ID が取得され、フォームと送信ボタンが表示されます。
\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"/>
- これを使用して、カートに追加ページでこれらの値を取得します。
app\design\frontend\base\default\template\checkout\cart.phtml
$params = $this->getRequest()->getParams();
$_REQUEST['request_flag'];
しかし、カートに追加するページでそのフォームの値を取得できません。助けてください。