I try to add an additional login option during the checkout process. At the moment, you have the username/password way. I want to add a button image to login via an OAuth process (in my case Github).
I found a way but it's not the best way. There is in the checkout/onepage/login.phtml template file, a call to get a block child named form.additional.info
.
I tried to insert my own block in it in this way but it didn't work.
<checkout_onepage_index>
<reference name="form.additional.info">
<block type="core/template" name="login_github_button" as="login.github.button">
<action method="setTemplate" ifconfig="github/config/enabled">
<template>github/customer/login.phtml</template>
</action>
</block>
</reference>
</checkout_onepage_index>
I found a different way like it is done by the captcha module:
<checkout_onepage_index>
<reference name="checkout.onepage.login">
<block type="core/text_list" name="form.additional.info">
<block type="core/template" name="login_github_button" as="login.github.button">
<action method="setTemplate" ifconfig="github/config/enabled">
<template>github/customer/login.phtml</template>
</action>
</block>
</block>
</reference>
</checkout_onepage_index>
In this case, it works BUT the captcha won't be displayed.
How can I insert several blocks into form.additional.info
block?
Thanks for your help
EDIT:
I found some reasons why the button is not displayed under the login fields when using the reference form.additional.info
method. It is displayed in the checkout billing view instead.
- The block
form.additional.info
is created by the captcha module for the blockcheckout.onepage.login
then it is also created for the blockcheckout.onepage.billing
- While generating the block in
Mage_Core_Model_Layout::_generateBlock() it searches the parent
block object of the block
login_github_button
. Instead of finding the one ofcheckout.onepage.login
, it finds one of the latest created:checkout.onepage.billing
. The block is attached to this last one, instead of the log in one. Then I find my login button in the billing address view instead of the login view!!! - If I comment into the layout captcha.xml file the part about
checkout.onepage.billing
my first solution works.
It's still not ok but I begin to find the reasons.