Customizing Onepage Checkout - Remove login

Last modified by pluc on Thu, June 24, 2010 17:03
Source|Old Revisions  

This is an old revision of the document!


How to remove login block from OnepageCheckout. Every customer checkout as guest.

This is working with Magento 1.1.6!

1.) /app/code/core/Mage/Checkout/Block/Onepage.php

  1. public function getSteps()
  2. {
  3.     $steps = array();
  4.  
  5.     if (!$this->isCustomerLoggedIn()) {
  6.         //$steps['login'] = $this->getCheckout()->getStepData('login');
  7.         $steps['billing'] = array("label"=>"Billing Information", "allow"=>true);
  8.     }
  9.        
  10.     $stepCodes = array('shipping', 'shipping_method', 'payment', 'review');
  11.  
  12.     foreach ($stepCodes as $step) {
  13.         $steps[$step] = $this->getCheckout()->getStepData($step);
  14.     }
  15.        
  16.     return $steps;
  17. }
  18.  
  19. public function getActiveStep()
  20. {
  21.     return 'billing';
  22. }

2.) opcheckout.js Class Checkout Function setMethod

  1. setMethod: function(){
  2.     //if ($('login:guest') && $('login:guest').checked) {
  3.         this.method = 'guest';
  4.         var request = new Ajax.Request(
  5.             this.saveMethodUrl,
  6.             {method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method:'guest'}}
  7.         );
  8.         Element.hide('register-customer-password');
  9.         this.gotoSection('billing');
  10.     /*}
  11.     else if($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
  12.         this.method = 'register';
  13.         var request = new Ajax.Request(
  14.             this.saveMethodUrl,
  15.             {method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method:'register'}}
  16.         );
  17.         Element.show('register-customer-password');
  18.         this.gotoSection('billing');
  19.     }
  20.     else{
  21.         alert(Translator.translate('Please choose to register or to checkout as a guest'));
  22.         return false;
  23.     }*/
  24. },

3.) onepage.phtml (Template)

Paste this code:

  1.     <li id="opc-login" class="section allow " style="display:none;">
  2.         <div id="checkout-step-login" class="box a-item" style="display:none;">
  3.             <input type="hidden" name="checkout_method" id="login:guest" value="guest" checked="checked" />
  4.         <script type="text/javascript">
  5.           Event.observe(window, 'load', function() {
  6.             checkout.setMethod();
  7.           });
  8.         </script>
  9.         </div>
  10.     </li>

after:

  1.     <ol id="checkoutSteps" class="one-page-checkout">



 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs