1

I am trying to override inchoo social connect plugin, but I am facing some kind of layout issue, unable to resolve

my

local.xml

<layout version="0.1.0">
    <default>
        <reference name="youamaajaxlogin">
            <block type="inchoo_socialconnect/login" name="inchoo_socialconnect_login" as='test'>
                <block type="inchoo_socialconnect/google_button" name="inchoo_socialconnect_google_login_button" />
                <block type="inchoo_socialconnect/facebook_button" name="inchoo_socialconnect_facebook_login_button" />
                <block type="inchoo_socialconnect/twitter_button" name="inchoo_socialconnect_twitter_login_button" />
            </block>
        </reference>
    </default>  

    <customer_account_login>
        <reference name="customer_form_login">
            <action method="setTemplate">
                <template>diboltplus/customer/form/login.phtml</template>
            </action>
            <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
            <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
            <block type="inchoo_socialconnect/login" name="inchoo_socialconnect_login">
                <block type="inchoo_socialconnect/google_button" name="inchoo_socialconnect_google_login_button" />
                <block type="inchoo_socialconnect/facebook_button" name="inchoo_socialconnect_facebook_login_button" />
                <block type="inchoo_socialconnect/twitter_button" name="inchoo_socialconnect_twitter_login_button" />
            </block>
        </reference>
    </customer_account_login>
</layout>

The <default> node having the layout block for popup login,I have included a block inchoo_socialconnect_login, and able to call it from my template file and its working fine as expected, but <customer_account_login> node when I am including the same block inchoo_socialconnect_login inside it and trying it to call from diboltplus/customer/form/login.phtml, the block is not visible in template, but if I comment my default node code, than I am able to call block inchoo_socialconnect_login from the template.

I am doing something wrong here?

I have tried giving alias name too , but its not working.

Any help !

Commenting Default

When both are present

1 Answer 1

2

There are lot of things that makes confusion here. Let me explore those below.

  1. You have included your block inchoo_socialconnect_login inside <default /> layout update handle. This means you have that block available in almost every page. I am sure this block is available in customer account page too. So why are you trying to re-declare same block again in your customer account page ?

  2. You are using same names for your button blocks in both default and customer_account_login layout update handles. This is what makes problem here. You should uniquely differentiate socialconnect_login block which you included via default layout update handle and via customer_account_login. So try this.

    <customer_account_login>
    <reference name="customer_form_login">
        <action method="setTemplate">
            <template>diboltplus/customer/form/login.phtml</template>
        </action>
        <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
        <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
        <block type="inchoo_socialconnect/login" name="customer.inchoo_socialconnect_login" as="sc_login">
            <block type="inchoo_socialconnect/google_button" name="customer.inchoo_socialconnect_google_login_button" as="inchoo_socialconnect_google_login_button" />
            <block type="inchoo_socialconnect/facebook_button" name="customer.inchoo_socialconnect_facebook_login_button" as="inchoo_socialconnect_facebook_login_button" />
            <block type="inchoo_socialconnect/twitter_button" name="customer.inchoo_socialconnect_twitter_login_button" as="inchoo_socialconnect_twitter_login_button" />
        </block>
    </reference>
    </customer_account_login>
    

Now inside the template diboltplus/customer/form/login.phtml, call your socialconnect_login block like this :

 <?php echo $this->getChildHtml('sc_login') ?>
9
  • Thanks for answering , I have got the issue its because of block file , when you made two time call it checks if a instance is present it doesnot render again ! Thanks anyways bro :) Sep 18, 2015 at 4:12
  • @n01ze if you declare those button block as I have shown in my point-2 sections, you will get two unique blocks. one from default handle and one from customer_account_login handle. so both of them will render. I dont know what you are trying to achieve. If you resolve this issue, then please put an answer and accept it or if my answer helped you, you can accept mine Sep 18, 2015 at 4:20
  • see I already have used alias as you mentioned <block type="inchoo_socialconnect/login" name="inchoo_socialconnect_login" as='test'> still not working Sep 18, 2015 at 4:21
  • 1
    @n01ze read my answer twice. I clearly mentioned that, problem resides in the name not in alias. my block is <block type="inchoo_socialconnect/login" name="customer.inchoo_socialconnect_login" as="sc_login">. see the name is customer.inchoo_socialconnect_login which is differnt than inchoo_socialconnect_login Sep 18, 2015 at 4:59
  • Yes bro , tried that option too Sep 18, 2015 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.