<?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>Solution Log &#124; Antonio David - NVNCBL &#187; checkout</title>
	<atom:link href="http://www.nvncbl.com/tagged/checkout/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nvncbl.com</link>
	<description>A place to log my programming solutions for future reference</description>
	<lastBuildDate>Mon, 17 May 2010 21:39:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Magento Clear Shopping Cart and Session</title>
		<link>http://www.nvncbl.com/2009/09/magento-clear-shopping-cart-and-session/</link>
		<comments>http://www.nvncbl.com/2009/09/magento-clear-shopping-cart-and-session/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 04:29:21 +0000</pubDate>
		<dc:creator>Antonio</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[checkout]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[reset]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[shopping cart]]></category>

		<guid isPermaLink="false">http://www.nvncbl.com/?p=410</guid>
		<description><![CDATA[If you ever need to programmatically clear Magento&#8217;s shopping cart, use the snippet of code below.  If you need to clear the user&#8217;s entire session, including the shopping cart, shipping information, billing information and chosen payment methods, please refer to the snippet further below.
Clear shopping cart

foreach&#40; Mage::getSingleton&#40;'checkout/session'&#41;-&#62;getQuote&#40;&#41;-&#62;getItemsCollection&#40;&#41; as $item &#41;&#123;
    Mage::getSingleton&#40;'checkout/cart'&#41;-&#62;removeItem&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever need to programmatically clear Magento&#8217;s shopping cart, use the snippet of code below.  If you need to clear the user&#8217;s entire session, including the shopping cart, shipping information, billing information and chosen payment methods, please refer to the snippet further below.</p>
<p><span id="more-410"></span><strong>Clear shopping cart</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getSingleton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checkout/session'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuote</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getItemsCollection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    Mage<span style="color: #339933;">::</span><span style="color: #004000;">getSingleton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checkout/cart'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">removeItem</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Clear entire session</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Mage<span style="color: #339933;">::</span><span style="color: #004000;">getSingleton</span><span style="color: #009900;">&#40;</span>‘checkout<span style="color: #339933;">/</span>session’<span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">clear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nvncbl.com/2009/09/magento-clear-shopping-cart-and-session/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Magento Skip Login/Registration at Checkout</title>
		<link>http://www.nvncbl.com/2009/09/magento-skip-loginregistration-at-checkout/</link>
		<comments>http://www.nvncbl.com/2009/09/magento-skip-loginregistration-at-checkout/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:05:13 +0000</pubDate>
		<dc:creator>Antonio</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[checkout]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[onepage]]></category>
		<category><![CDATA[register]]></category>

		<guid isPermaLink="false">http://www.nvncbl.com/?p=397</guid>
		<description><![CDATA[A client wanted every checkout on his site to be a guest checkout.  He was selling a very niche product and wanted to avoid hassling potential customers with a user log-in or registration form.  The goal was to modify Magento&#8217;s One Page Checkout to completely skip Step 1: Login/Register and show Step 2: [...]]]></description>
			<content:encoded><![CDATA[<p>A client wanted every checkout on his site to be a guest checkout.  He was selling a very niche product and wanted to avoid hassling potential customers with a user log-in or registration form.  The goal was to modify Magento&#8217;s One Page Checkout to completely skip Step 1: Login/Register and show Step 2: Billing Information.</p>
<p><span id="more-397"></span>We are going to:</p>
<ol>
<li>Hide Step 1</li>
<li>Tell Magento that Step 1 was &#8220;completed&#8221; as Guest</li>
<li>Have Step 2 appear as Step 1</li>
</ol>
<p>Here goes:</p>
<p><strong>1. Hiding Step 1 &#8211; Login/Register</strong></p>
<p>Open /app/design/frontend/&lt;your_company&gt;/&lt;your_company&gt;/template/checkout/onepage.phtml</p>
<p>Find:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;opc-&lt;?php echo $_stepId ?&gt;</span></span>&quot; {...}</pre></div></div>

<p>And replace it with:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> &lt;?php echo $i<span style="color: #66cc66;">==</span><span style="color: #cc66cc;">1</span> ? <span style="color: #ff0000;">'style=&quot;display:none;&quot;'</span> : <span style="color: #ff0000;">''</span> ?&gt;</span> id=&quot;opc-<span style="color: #009900;">&lt;?php echo $_stepId ?&gt;</span>&quot;  {...}</pre></div></div>

<p><strong>2. Set Step 1 to equal Guest</strong></p>
<p>Open /app/design/frontend/&lt;your_company&gt;/&lt;your_company&gt;/template/checkout/onepage/login.phtml</p>
<p>Basically, comment everything out and insert:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkout_method&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login:guest&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;guest&quot;</span> <span style="color: #000066;">checked</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checked&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
Event.observe(window, 'load', function() {
checkout.setMethod();
});
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p><strong>3. Make Step 2 look like Step 1</strong></p>
<p>Open /app/design/frontend/&lt;your_company&gt;/&lt;your_company&gt;/template/checkout/onepage.phtml</p>
<p>Find:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getSteps</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$_stepId</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$_stepInfo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span></pre></div></div>

<p>And replace it with:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$i</span><span style="color: #339933;">=-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getSteps</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$_stepId</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$_stepInfo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span></pre></div></div>

<p>Finally, in the same file, change this snippet that we added in step 1:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$i</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span></pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$i</span><span style="color: #339933;">===</span><span style="color: #cc66cc;">0</span></pre></div></div>

<p>And there you have it.  Credit goes to poster <a class="external" href="http://www.imagebox.com">imagebox</a> on this particular Magento <a class="external" href="http://www.magentocommerce.com/boards/viewthread/17873/#t116490">how-to thread</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nvncbl.com/2009/09/magento-skip-loginregistration-at-checkout/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
