skip to Main Content

I can’t find a clear answer to this one, so worth writing if it helps someone else.

I’m running a site on Magento 1.9. I’d like the customer account login form to appear next to content on a CMS page.

This is usually found on the page,

www.mydomain.com/customer/account/login/referer/[insert referral key]/

As far as I’m aware, the code for the form lies in app/design/frontend/base/default/template/customer/form/login.phtml and the XML for the layout is,

    <customer_account_login translate="label">
    <label>Customer Account Login Form</label>
    <!-- Mage_Customer -->
    <remove name="right"/>
    <remove name="left"/>

    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="content">
        <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml" />
    </reference>
</customer_account_login>

I’m au fait with CSS, so could probably work out how to style the form to fit the page, but can’t figure out how to neatly get that block of content to sit in the page.

Any ideas?

Thanks for reading!

2

Answers


  1. Chosen as BEST ANSWER

    I figured out what I needed to do.

    I created a custom CMS Login form - cmslogin.phtml - cribbed from the existing login form.

    I uploaded this to,

    app/design/frontend/base/default/template/cms

    and then call the form as a block in the CMS page via,

    {{block type="core/template" template="cms/cmslogin.phtml"}}
    

    This seems to have done the job but I now have an issue getting the login form to work properly - I think that's to do with the URL of the CMS Page not including a unique key as the default login page does. I.e.

    www.mydomain.com/customer/account/login/referer/[insert referral key]/

    Any help on that would be appreciated. The code of cmslogin.phtml is:

    <div class="block block-login">
    <div class="block-title">
        <strong><span><?php echo $this->__('Login') ?></span></strong>
    </div>
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
        <div class="block-content">
            <label for="mini-login"><?php echo $this->__('Email:') ?></label><input type="text" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" />
            <label for="mini-password"><?php echo $this->__('Password:') ?></label><input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Password')) ?>" />
            <div class="actions">
                <button type="submit" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
            </div>
        </div>
    </form>
    

    I think it's to do with the getPostActionUrl() function in there.


  2. Try Below code:

    {{block type ="Mage_Customer_Block_Form_login" template="customer/form/login.phtml" }}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search