<?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; shopping cart</title>
	<atom:link href="http://www.nvncbl.com/tagged/shopping-cart/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>Shopping Cart Design</title>
		<link>http://www.nvncbl.com/2008/12/shopping-cart-design/</link>
		<comments>http://www.nvncbl.com/2008/12/shopping-cart-design/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 08:43:49 +0000</pubDate>
		<dc:creator>Antonio</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[shopping cart]]></category>

		<guid isPermaLink="false">http://www.nvncbl.com/?p=35</guid>
		<description><![CDATA[I was assigned to work on a shopping cart for an online clothing retailer.  By the time this client approached us, it was just a few days before Christmas, and their shopping cart had a big problem.
Say for example that you added a blue polka dot shirt of size &#8220;large&#8221; to your shopping cart.  Then, [...]]]></description>
			<content:encoded><![CDATA[<p>I was assigned to work on a shopping cart for an online clothing retailer.  By the time this client approached <a href="http://www.redstage.com" class="external">us</a>, it was just a few days before Christmas, and their shopping cart had a big problem.</p>
<p>Say for example that you added a blue polka dot shirt of size &#8220;large&#8221; to your shopping cart.  Then, after continued browsing through the online catalog, you decide that you want a &#8220;small&#8221; blue polka dot shirt.  The problem was that after adding this shirt of size &#8220;small&#8221;, your shopping cart would contain <strong>two</strong> (correct) shirts of size <strong>small</strong> (wrong).  Obviously, you should have a small shirt and a large shirt.</p>
<p><span id="more-35"></span>This cart was indexing items by product ID, and not accommodating for multiple sizes.</p>
<p>Our solution for them was a cart structured to be unique on product ID and size.  Short, Sweet, and Simple.  S, S, &amp; S the solution may have been, it still took a long time to develop because of the fact that there was no sandbox (development) environment and the system was in the process of taking orders as we were developing.  Some would say that&#8217;s a huge no-no, but the issue had to be addressed.  With the utmost planning and preparation, the coding was done and <em>no order processes were interfered with</em>.</p>
<p>On a humorous note, I charged my credit card a $xxx.xx item (yes, in the hundreds of dollars) to test the new shopping cart&#8217;s functionality.  When doing e-commerce development, make sure to obtain <strong>test credit card numbers</strong>.  Most online payment processors should have these readily available for developers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nvncbl.com/2008/12/shopping-cart-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
