Step 1 :
Create config.xml file : app/code/local/Jaydip/Kansagra/etc/config.xml
<config>
<global>
<blocks>
<jaydip_kansagra>
<class>Jaydip_Kansagra_Block</class>
</jaydip_kansagra>
<!-- For Hide Shipping address-->
<checkout>
<rewrite>
<onepage>Jaydip_kansagra_Block_Kansagra_Checkout_Onepage</onepage>
</rewrite>
</checkout>
<!-- For Hide Shipping address-->
</blocks>
...........
...........
...........
<!-- For Hide Shipping address-->
<rewrite>
<hideshippingadd> <!--This can be any unique id -->
<from><![CDATA[#^/checkout/onepage/#]]></from> <!-- the URL which u want to override-->
<to>/kansagra/onepage/</to> <!-- destination url -->
</hideshippingadd>
</rewrite>
<!-- For Hide Shipping address-->
...........
...........
...........
</global>
</config>
Step 2 :
Create OnepageController.php file : app/code/local/Jaydip/Kansagra/controllers/OnepageController.php
<?php
require_once Mage::getModuleDir('controllers', "Mage_Checkout") . DS . "OnepageController.php";
class Jaydip_Kansagra_OnepageController extends Mage_Checkout_OnepageController {
public function saveBillingAction() {
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
if (!isset($result['error'])) {
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
'html' => $this->_getShippingMethodsHtml()
);
} else {
$result['goto_section'] = 'shipping';
}
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
}
Step 3 :
Create Onepage.php file : app/code/local/Jaydip/Kansagra/Block/Kansagra/Checkout/Onepage.php
<?php
class Jaydip_Kansagra_Block_Kansagra_Checkout_Onepage extends Mage_Checkout_Block_Onepage {
protected function _getStepCodes() {
return array('login', 'billing', 'shipping_method', 'payment', 'review');
}
}
Step 4 :
And now you need to copy billing.phtml from app/design/frontend/base/default/checkout/onepage
folder into app/design/frontend/rwd/default/template/newgenray/checkout folder.
Find following code
<li class="control">
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo Mage::helper('core')->quoteEscape($this->__('Ship to this address')) ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label>
</li>
<li class="control">
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo Mage::helper('core')->quoteEscape($this->__('Ship to different address')) ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
</li>
and replace this by
<li class="control">
<input type="hidden" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1" />
</li>
No comments:
Post a Comment