Saturday, 20 October 2012

Skip Login/Registration at Checkout


We are going to:
  1. Hide Step 1
  2. Tell Magento that Step 1 was “completed” as Guest
  3. Have Step 2 appear as Step 1

1. Hiding Step 1 – Login/Register
Open /app/design/frontend/<your_company>/<your_company>/template/checkout/onepage.phtml
Find:

<li id="opc-<?php echo $_stepId ?>" {...}


And replace it with:

<li <?php echo $i==1 ? 'style="display:none;"' : '' ?> id="opc-<?php echo $_stepId ?>"  {...}


2. Set Step 1 to equal Guest
Open /app/design/frontend/<your_company>/<your_company>/template/checkout/onepage/login.phtml
Basically, comment everything out and insert:

<input type="hidden" name="checkout_method" id="login:guest" value="guest" checked="checked" />
<script type="text/javascript">
Event.observe(window, 'load', function() {
checkout.setMethod();
});
</script>


3. Make Step 2 look like Step 1
Open /app/design/frontend/<your_company>/<your_company>/template/checkout/onepage.phtml
Find:
$i=0; foreach($this->getSteps() as $_stepId => $_stepInfo):
And replace it with:
$i=-1; foreach($this->getSteps() as $_stepId => $_stepInfo):
Finally, in the same file, change this snippet that we added in step 1:
echo $i==1
to:
echo $i===0

No comments:

Post a Comment