<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jeff Malterre &#187; mini-login</title>
	<atom:link href="http://www.jeffmalterre.com/tag/mini-login/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffmalterre.com</link>
	<description>accessible web programmer, SEO specialist, e-commerce professional</description>
	<lastBuildDate>Tue, 05 Oct 2010 18:23:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Adding a mini login box to Magento</title>
		<link>http://www.jeffmalterre.com/2009/01/16/adding-a-mini-login-box-to-magento/</link>
		<comments>http://www.jeffmalterre.com/2009/01/16/adding-a-mini-login-box-to-magento/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 18:29:54 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[login box]]></category>
		<category><![CDATA[mini-login]]></category>

		<guid isPermaLink="false">http://www.sibble.com/?p=924</guid>
		<description><![CDATA[I&#8217;m surprised there is not one in the default template for Magento.  Nevertheless, it&#8217;s pretty common to see a login box on a sidebar, and I need one.  This is actually pretty simple to do, we&#8217;re going to be modifying templates, layouts, and unfortunatly we&#8217;re going to have to alter the core (for something really [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m surprised there is not one in the default template for <a href="http://www.magentocommerce.com">Magento</a>.  Nevertheless, it&#8217;s pretty common to see a login box on a sidebar, and I need one.  This is actually pretty simple to do, we&#8217;re going to be modifying templates, layouts, and unfortunatly we&#8217;re going to have to alter the core (for something really silly.)</p>
<p><span id="more-924"></span></p>
<p>First, lets go ahead and make a template for the mini login box.  Take a look in <strong>&frasl;template&frasl;customer&frasl;form&frasl;</strong>&#8230;  What&#8217;s this!?  We already see that there is a <strong>mini.login.phtml</strong>.  For a closer look:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPostActionUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
    &lt;table width=&quot;100%&quot; class=&quot;mini-login&quot;&gt;
        &lt;tr&gt;&lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Email'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>:&lt;/td&gt;&lt;td&gt;&lt;input name=&quot;login[username]&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Password'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>:&lt;/td&gt;&lt;td&gt;&lt;input name=&quot;login[password]&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;submit&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Login'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
&lt;/form&gt;</pre></div></div>

<p>We&#8217;ll, even though functional, this isn&#8217;t styled nor does it fit in with the default Magento template.  So let&#8217;s change this.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;box base-mini mini-login-form&quot;&gt;
    &lt;div class=&quot;head&quot;&gt;
        &lt;h4&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Login'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h4&gt;
    &lt;/div&gt;
    &lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPostActionUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot; id=&quot;login-form&quot;&gt;
        &lt;div class=&quot;content&quot;&gt;
            &lt;ul class=&quot;form-list&quot;&gt;
                    &lt;li&gt;
                        &lt;label for=&quot;email&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Email Address'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;&lt;/label&gt;&lt;br /&gt;
                        &lt;input name=&quot;login[username]&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">htmlEscape</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUsername</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Email Address'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; id=&quot;email&quot; type=&quot;text&quot; class=&quot;input-text required-entry&quot; style=&quot;width:122px;&quot; /&gt;
                    &lt;/li&gt;
                    &lt;li&gt;
                        &lt;label for=&quot;pass&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Password'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;&lt;/label&gt;&lt;br /&gt;
                        &lt;input name=&quot;login[password]&quot; type=&quot;password&quot; class=&quot;input-text required-entry validate-password&quot; id=&quot;pass&quot; style=&quot;width:122px;&quot; /&gt;
                    &lt;/li&gt;
                &lt;/ul&gt;
                &lt;p class=&quot;required&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'* Required Fields'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
          &lt;/div&gt;
    &lt;div class=&quot;actions&quot;&gt;
        &lt;button class=&quot;form-button-alt&quot; type=&quot;submit&quot; name=&quot;send&quot; id=&quot;send2&quot;&gt;&lt;span&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Login'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;&lt;/button&gt;
    &lt;/div&gt;
&lt;/form&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    var dataForm = new VarienForm('login-form', true);
&lt;/script&gt;
&lt;/div&gt;</pre></div></div>

<p>Also add this to your CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.mini-login-form</span> h4 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">../images/icon_page_white_text.gif</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Now that we have a template (mini.login.phtml), we&#8217;re going to have to add it to our block structure.  Open <strong>layout/customer.xml</strong>, and make this change starting at <strong>line 65</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;customer_logged_out<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reference</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;top.links&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;addLink&quot;</span> <span style="color: #000066;">translate</span>=<span style="color: #ff0000;">&quot;label title&quot;</span> <span style="color: #000066;">module</span>=<span style="color: #ff0000;">&quot;customer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Log In<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;url</span> <span style="color: #000066;">helper</span>=<span style="color: #ff0000;">&quot;customer/getLoginUrl&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Log In<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;prepare</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;urlParams</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;position<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>100<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/position<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/action<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/reference<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;remove</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;wishlist_sidebar&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/remove<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;remove</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;reorder&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/remove<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reference</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;right&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;block</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;customer/form_login&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mini_login&quot;</span> <span style="color: #000066;">template</span>=<span style="color: #ff0000;">&quot;customer/form/mini.login.phtml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/reference<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/customer_logged_out<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Remember to copy this file/folder structure and put it in <strong>app/code/local</strong>.  We do this, because when you go to upgrade your Magento installation, your core files get patched, thus erasing all the hard work you did <img src='http://www.jeffmalterre.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeffmalterre.com/2009/01/16/adding-a-mini-login-box-to-magento/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

