Changing the checkout process can be a complicated and risky task to undertake. If you plan on taking this on yourself, as a beginner, you should carefully consider risk + time involved vs reward/benefit. There could be a number of edge cases you may need to account for that you would be unfamiliar with (e.g. are you selling any digital or virtual items that don't require shipping?). Understanding Magento's layout/design structure, their use of Prototype JS framework and creating custom extensions is definitely a requirement to create something that meets your requirements and doesn't put future upgrades at risk. Not for the faint of heart or inexperienced.
Here are a few pointers that will hopefully help you understand some of the checkout process, should you chose to take on the task:
The one page checkout steps have a series of steps and templates to go with each. The layout for this area of Magento is defined in layout/checkout.xml
. It is found within the <checkout_onepage_index>
handle.
<reference name="content">
<block type="checkout/onepage" name="checkout.onepage" template="checkout/onepage.phtml">
<block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="checkout/onepage/login.phtml">
<block type="page/html_wrapper" name="checkout.onepage.login.before" as="login_before" translate="label">
<label>Login/Registration Before</label>
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
<block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="checkout/onepage/billing.phtml"/>
<block type="checkout/onepage_shipping" name="checkout.onepage.shipping" as="shipping" template="checkout/onepage/shipping.phtml"/>
<block type="checkout/onepage_shipping_method" name="checkout.onepage.shipping_method" as="shipping_method" template="checkout/onepage/shipping_method.phtml">
<block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="checkout/onepage/shipping_method/available.phtml"/>
<block type="checkout/onepage_shipping_method_additional" name="checkout.onepage.shipping_method.additional" as="additional" template="checkout/onepage/shipping_method/additional.phtml"/>
</block>
<block type="checkout/onepage_payment" name="checkout.onepage.payment" as="payment" template="checkout/onepage/payment.phtml">
<block type="checkout/onepage_payment_methods" name="checkout.payment.methods" as="methods" template="checkout/onepage/payment/info.phtml">
<action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
</block>
</block>
<block type="checkout/onepage_review" name="checkout.onepage.review" as="review" template="checkout/onepage/review.phtml"/>
</block>
</reference>
In your custom theme you would then modify, add new blocks/templates or remove blocks via XML as necessary.
Frontend wise the one page checkout behavior is handled primarily in skin/frontend/base/default/js/opcheckout.js
. Since we're dealing with javascript its usually possible to change the functionality without modifying the the opcheckout.js .
For instance, there is a property in the Checkout
object called step
:
this.steps = ['login', 'billing', 'shipping', 'shipping_method', 'payment', 'review'];
The checkout object in the template files is instantiated in base/default/template/checkout/onepage.phtml
var checkout = new Checkout(accordion,{
progress: '<?php echo $this->getUrl('checkout/onepage/progress') ?>',
review: '<?php echo $this->getUrl('checkout/onepage/review') ?>',
saveMethod: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>',
failure: '<?php echo $this->getUrl('checkout/cart') ?>'}
);
It would be possible to add a new template via through a local.xml
file in your custom theme to change the behavior of that instance of the Checkout
javascript object.
<checkout_onepage_index>
<reference name="before_body_end">
<block type="core/template" template="checkout/onepage/custom_footer_js.phtml"/>
</reference>
</checkout_onepage_index>
Within this template it would be possible to change the instance properties/functionality.
If there is need to modify some functionality the recommended approach is to leverage Prototype JS's OOP functionality:
MyCheckout = Class.create(Checkout, {
...
//Custom functionality here
});
Then updating onepage.phtml
in a custom theme to instantiate your version of the Checkout object:
var checkout = new Checkout(accordion,{
...
});
You may need a custom controller to handle the input from the shipping information, you should look at the app/code/core/Mage/Checkout/controllers/OnepageContoller.php
file, mainly the saveShippingAction
and saveShippingMethodAction
methods. Those two methods should provide examples on how to save the shipping address and method selections to the session.
As you can see there are a number of moving parts that need to be orchestrated. The areas I listed above are just the tip of the iceberg and what I could come up in a short amount of time.