Thursday 5 July 2012

skip shipping method from onepage checkout :=>In Magento

skip shipping method from onepage checkout :=>In Magento

step 1: app/code/core/Mage/Checkout/Block/Onepage/Onepage.php

change the line
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
with
$stepCodes = array('billing', 'payment', 'review');

step2 : app/code/core/mage/checkout/controller/Onepagecontrollers.php

protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'shpping-method' => '_getShippingMeghtoHtml',
'review' => '_getReviewHtml',
);

to

protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'review' => '_getReviewHtml',
);


Step 3. In same page

------------------------Change this code--------------------------
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$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'])) {
/* check quote for virtual */
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()
);

$result['allow_sections'] = array('shipping');
$result['duplicateBillingInfo'] = 'true';
} else {
$result['goto_section'] = 'shipping';
}
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
-----------------------With-----------------------
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$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'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} else {
$result['goto_section'] = 'payment';
}
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}



Step 4. app/code/core/Mage/Sales/Model/Service/Quote.php

-------------------------Change this code ----------------
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
if ($addressValidation !== true) {
Mage::throwException(
$helper->__('Please check shipping address information. %s', implode(' ', $addressValidation))
);
}
$method= $address->getShippingMethod();
$rate = $address->getShippingRateByCode($method);*/
if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
Mage::throwException($helper->__('Please specify a shipping method.'));
}
}


---------------------------With------------------------
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
}



Step: 5. app/design/frontend/base/default/template/checkout/onepage/billing.phtml

remove the code of radio button : line no 173

Step: 6. app/design/frontend/base/default/template/checkout/onepage/progress.phtml
remove the code for hide shipping method block: Your Checkout Progress

Step: 7.


Change Order tamplate which you have created
OR
Change from here:
app/locale/en_US/template/email/sales/order_new.html


Shipping Information:
Shipping Method:

{{var order.getShippingAddress().format('html')}}


{{var order.getShippingDescription()}}


Refer Following url:

http://www.magentocommerce.com/boards/viewthread/76049/

http://www.magentocommerce.com/boards/viewthread/19125/

No comments:

Post a Comment

Note: only a member of this blog may post a comment.