Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

does customer_logged_out always trump customer_create_account? 
 
andrewherman
Jr. Member
 
Total Posts:  19
Joined:  2009-06-14
 

Im trying to load the javascript files for Mootools, which conflicts with Prototype, so i try and alternate them on specific pages. I have my site set so that when customers are not logged in, they are redirected to the login.phtml, where they can login or create an account. What I was hoping to do was leave Prototype enabled on the default page.xml layout, remove it for the login page where i have a JS slideshow, and re-enable it when customers are logged in or when they are creating an account (Prototype is used in forms, which is essential for some of the account creation fields, like State/Province)

<customer_logged_out>
    <
reference name="head">
        <
action method="removeItem"><type>js</type><name>prototype/prototype.js</name></action>
        <
action method="removeItem"><type>js</type><name>prototype/deprecation.js</name></action>
        <
action method="removeItem"><type>js</type><name>prototype/validation.js</name></action
    </
reference>
    
    <
reference name="root">
        <
action method="setTemplate"><template>page/1column.phtml</template></action>
    </
reference>
    
    <
reference name="abovecontent">
        <
block type="customer/form_login" name="customer_form_login" template="customer/form/b2b-login.phtml" as="login_challenge"/>
        <
action method="setTitle"><title>Company Name</title></action>
    </
reference>
    ...
    </
customer_logged_out>

What this accomplishes is the javascript is removed when the customer is not logged out, and is initialized when the customer logs in. However, for initializing the prototype JS files in the account creation layout updates

<customer_account_create>
        <!-- 
Mage_Customer -->
<
remove name="right"/>
<
remove name="left"/>
    <
reference name="head">
            <
action method="addJs"><script>prototype/prototype.js</script></action>
            <
action method="addJs"><script>prototype/validation.js</script></action>
    </
reference>
        <
reference name="root">
            <
action method="setTemplate"><template>page/1column.phtml</template></action>
        </
reference>
                        
    <
reference name="content">
            <
block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/>
        </
reference>
        <
remove name="abovecontent" />
    </
customer_account_create>

the files are not initialized. After trial and error, ive determined that the ‘customer_logged_out’ seems to trump ‘customer_account_create’ (so when the customer is trying to create an account while not logged in, the Prototype js files are first loaded, and then removed).
What options do i have for initializing the JS files so that they are in the head block? (initializing from within the register.phtml is not sufficient, as the forms do not work)

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top