0

I am using magento 1.7 .Let me explain step by step:- 1. Clicked on any product from product 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 window appears which contains product details.and a Submit button called "ORDER". After click on "ORDER" button it redirect to above form action.here I get the product id and it shows a form and 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') ?>&nbsp;<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"/>

  1. Now get these values at add to cart page using this:-

app\design\frontend\base\default\template\checkout\cart.phtml

    $params = $this->getRequest()->getParams();
    $_REQUEST['request_flag'];

But I am not able to get value of that form on add to cart page.please help.

Neeraj
  • 101
  • 5
  • 16

1 Answers1

0

You are posting the form to checkout/cart/add then after adding the products to cart in add() method it will redirect to checkout/cart therefore $this->getRequest()->getParams() will not be available on the cart page.

Please provide more detail, so that we can better advise you on how accomplish this.

MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62
  • So what should i do for get values from that form to "add to cart" page as well as all orders,sales,emails.I added some files name in above questions please check. – Neeraj Dec 04 '12 at 11:42
  • Normally you would use event/observer, so when an item is added to the cart it trigger an event (eg sales_quote_add_item) and your observer listen for that event ...something like http://stackoverflow.com/questions/9721583/changing-the-price-in-quote-while-adding-product-to-cart-magento ...What do you need those value for? you could store it in a session, as query string etc – MagePal Extensions Dec 04 '12 at 11:51
  • Actually i need to get input from user before "add to cart". I tried custom options but they are showing on product detail page I need to show them on different page. – Neeraj Dec 04 '12 at 11:56
  • Try override addAction() see http://stackoverflow.com/questions/5404618/how-do-i-override-the-addaction-funciton-under-app-code-core-mage-checkout-c ... Then do a _forward() instead of _redirect() see http://www.magentocommerce.com/boards/viewthread/73454/ – MagePal Extensions Dec 04 '12 at 12:03
  • This will be great help if you guide me that how to show custom options of a product on a different page other than product detail page. – Neeraj Dec 04 '12 at 12:04
  • I am very thankful to you for your guide.But I have not got my answer.Can you suggest me step by step the best way to do this(get input from user before "add to cart" page and show them in all places like sales,orders,checkout).Thank you very much for give me time to solve my problem. – Neeraj Dec 04 '12 at 14:31
  • I used another method that I create a module using module creator now I want to call its XML before checkout cart XML but not succeed. – Neeraj Dec 04 '12 at 14:39
  • Let me ask this question that is ask 2+ hrs ago, What do you need those value for? Are you trying to save some custom values to the db or to displaying info to the user... You can get all product id from the cart object, Prescription Type should be a product option which would be available in the product object of the cart object – MagePal Extensions Dec 04 '12 at 14:46
  • I think,we have little confusion.let me explain from starting. 1. firstly i was using custom options which was working fine as default functionality of magento. Everything was OK but at that time custom options form was opening on product detail page.But now My client wants to show that custom options form on another page.means when click on "ORDER" button on product detail page it redirects to new page after that it redirect to add to cart page as http://www.zennioptical.com/ . – Neeraj Dec 05 '12 at 05:17
  • according to zennioptical.com :- product listing page = http://d.pr/i/2pvW product detail page = http://d.pr/i/a3BY prescription form = http://d.pr/i/YnPi – Neeraj Dec 05 '12 at 05:22
  • according to my site :- product listing page = http://d.pr/i/uuVw product detail page = http://d.pr/i/oekG including custom options in product detail page. – Neeraj Dec 05 '12 at 05:30
  • The popup box is often refer to as 'Quick View' or 'Quick Look' see http://stackoverflow.com/questions/13713231/magento-ajax-call-product-page-elements-to-category-page-select-box-not-popul/13713636#13713636 – MagePal Extensions Dec 05 '12 at 12:59