Question

How to create and allow cash on delivery checkbox on billing address step of checkout? If it's enabled then cash on delivery payment method should be visible on payment step.

Was it helpful?

Solution

in billing.phtml create Your New Checkbox.
app\design\frontend\themename\default\template\persistent\checkout\onepage\billing.phtml

paste this code..

<li class="control">

                    <input type="checkbox" name="cod" value="You-Select-Cash-On-Delivery" title="" id="cod1" onchange="" checked="" class="checkbox" /><label for="">
                    <?php echo $this->__('Cash on Delivery') ?></label>

                    <?php 
                        if(isset($_POST['cod'])){
                                echo "Checked !!!";                             
                                $var = Mage::app()->getRequest()->getPost('cod'); //session store variable
                                Mage::getSingleton('core/session')->setCod($var);
                        }
                    ?>  
                </li>   

Then Go to methods.phtml

app\design\frontend\base\default\template\checkout\onepage\payment\methods.phtml

Paste This Code

<?php $outputMessage =Mage::getSingleton('core/session')->getCod(); echo $this->__($outputMessage); ?>

At Last Go TO OnepageController.phtml

app\code\core\Mage\Checkout\controllers\OnepageController.php

Find saveBillingAction() Paste This Code...

$var = Mage::app()->getRequest()->getPost('cod');
Mage::getSingleton('core/session')->setCod($var);
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top