Let see how to remove shipping address and method from onepage checkout in magento

Let see how to remove shipping address and method from onepage checkout in magento 

 

Go to:
appcodecoreMageCheckoutBlock Onepage.php
Change the code :

public function getSteps()
 {
 $steps = array();
 if (!$this->isCustomerLoggedIn()) {
 $steps['login'] = $this->getCheckout()->getStepData('login');
 }
 //$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
 $stepCodes = array('billing', 'payment', 'review');
 foreach ($stepCodes as $step) {
 $steps[$step] = $this->getCheckout()->getStepData($step);
 }
 return $steps;
 }

Go to:
appcodecoreMageCheckoutcontrollers OnepageController.php

Edit:

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

 
 Also edit  saveBillingAction() function

public function saveBillingAction()
 {
 if ($this->_expireAjax()) {
 return;
 }
 if ($this->getRequest()->isPost()) {
 //$postData = $this->getRequest()->getPost('billing', array());
 //$data = $this->_filterPostData($postData);
 $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'])) {
 /* 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';
 }*/
 //End of Comment by Amit Bera
 else {
 //$result['goto_section'] = 'shipping';
 $result['goto_section'] = 'payment';
 }
 }
 $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 }
 }

 Go to:
appcodecoreMageSalesModelService Quote.php

Edit:
 

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.'));
 //}
 }

In billing information tab  you see radio button for  shipping address
as billing address ,just hidden it or remove it .the file located at –
appdesignfrontenddefaultyour
templateyourtemplatepersistentcheckoutonepagebilling,phtml

Or
appdesignfrontenddefaultyour templatetemplate checkoutonepagebilling,phtml

In  applocaleen_UStemplateemailsales order_new.html
From
{{var order.getShippingAddress().format(‘html’)}}
To
{{var order.getBillingAddress().format(‘html’)}}
And
{{var order.getShippingDescription()}}
Remove it. 

 

Puneet Kumar Magento Developer
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply