<?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>The Wojo Group &#187; e-commerce</title>
	<atom:link href="http://www.thewojogroup.com/tag/e-commerce/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thewojogroup.com</link>
	<description>The musings of a small creative media company.</description>
	<lastBuildDate>Tue, 11 May 2010 00:10:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>simpleCart(js) + PayPal = E-commerce in minutes</title>
		<link>http://www.thewojogroup.com/2008/10/simplecartjs-paypal-e-commerce-in-minutes/</link>
		<comments>http://www.thewojogroup.com/2008/10/simplecartjs-paypal-e-commerce-in-minutes/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 18:23:57 +0000</pubDate>
		<dc:creator>Brett Wejrowski</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cart]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.thewojogroup.com/?p=178</guid>
		<description><![CDATA[Over the past few years, our company has had several clients who have needed a smaller shopping cart, usually to only sell a couple items.  Because we expected sporadic traffic, we were tentative to go with a packaged shopping cart and merchant service.  That just seemed like a lot of overhead.  Thus, I have developed a few different ajax carts using paypal.  I realized it would be nice to package this up, and create a lightweight, easy-to-use, flexible shopping cart.

So we made simpleCart(js).  The cart is a 10.5kb javascript file that uses cookies to keep track of the items in the cart.  Thus, simpleCart(js) doesn't require any databases or programming.  You simply need to know some basic HTML and have the ability to copy and paste.  However, it can easily be expanded to use databases or contain more advanced options. ]]></description>
			<content:encoded><![CDATA[<p>****UPDATE: Version 2 is now available, this post is outdated.  Please go to <a href="http://simplecartjs.com">simplecartjs.com</a> to find out more*****</p>
<p>**update: v1.2: fixed rounding error in price formatting<br />
**update: v1.1: back button works, no trailing comma for options</p>
<p>(if you want to skip right to the example and downloads, check it out <a href="http://thewojogroup.com/simpleCart/" target="_blank">here</a>)</p>
<p>Over the past few years, our company has had several clients who have needed a smaller shopping cart, usually to sell just a couple of items.  We generally built these small carts using paypal.  I realized it would be nice to package this up, and create a lightweight, easy-to-use, flexible shopping cart.</p>
<p>So we made simpleCart(js).  The cart is a 10.5kb javascript file that uses cookies to keep track of the items in the cart.  SimpleCart(js) doesn&#8217;t require any databases or programming knowledge.  You simply need to know some basic HTML and have the ability to copy and paste.  However, it can easily be expanded to use databases or contain more advanced options.</p>
<h3>Setup Paypal</h3>
<p>The first thing you will need to do, if you don&#8217;t already have one, is set up a free merchant account with <a href="http://paypal.com">Paypal.</a></p>
<h3>Add simpleCart(js) to your pages</h3>
<p>Once you have the files downloaded, simply add this snippet to the top of any page you wish to have the cart running on:</p>
<pre name="code" class="html">

&lt;script src=&quot;simpleCart.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
simpleCart = new cart(&quot;you@yours.com&quot;);
// --&gt;&lt;/script&gt;
</pre>
<p>You will need to replace you@yours.com with the email address you used to sign up to Paypal.</p>
<h3>Adding items to the cart</h3>
<p>Any page you have the simpleCart(js) running, you can add an item by simply using a link like this:</p>
<pre name="code" class="html">

&lt;a onclick=&quot;simpleCart.add(&#039;name=[name]&#039;,&#039;price=[price]&#039;);return false;&quot; href=&quot;#&quot;&gt; link to add item &lt;/a&gt;
</pre>
<p>You are required to at least have a name and price when adding an item to the cart.  However, you can add other fields also.  If you want an image to be linked to the item, you can add it like this:</p>
<pre name="code" class="javascript">

simpleCart.add(&#039;name=Shirt&#039;,&#039;price=6.00&#039;,&#039;image=images/myImage.png&#039;);
</pre>
<h3>Viewing the cart</h3>
<p>You may have the cart on any page, and it will update automatically using ajax. To show the cart items on a particular page, you simply need to have an element with the class of &#8220;simpleCart_items&#8221; on the page. This element will automatically be filled with all of the items in the cart, and will show each field.</p>
<pre name="code" class="javascript">

&lt;div class=&quot;simpleCart_items&quot;&gt;&lt;/div&gt;
</pre>
<p>You can use any element (div,a,span,p,etc.) and the values will be put in the innerHTML of that element.</p>
<h3>Showing the totals on a page</h3>
<p>You can show the total quantity or price on any page by simply having an element with a class &#8220;simpleCart_quantity&#8221; or &#8220;simpleCart_total&#8221;:</p>
<pre name="code" class="html">

&lt;div class=&quot;simpleCart_total&quot;&gt;&lt;/div&gt; &lt;span class=&quot;simpleCart_quantity&quot;&gt;&lt;/span&gt; items
</pre>
<h3>Checkout and Empty Cart links</h3>
<p>You can have a checkout or empty cart link anywhere on any page where the simpleCart(js) is active. You do this by simply setting the class of an element to &#8220;simpleCart_checkout&#8221; or &#8220;simpleCart_empty&#8221;:</p>
<pre name="code" class="html">

&lt;a class=&quot;simpleCart_checkout&quot; href=&quot;#&quot;&gt;checkout&lt;/a&gt;

&lt;a class=&quot;simpleCart_empty&quot; href=&quot;#&quot;&gt;empty cart&lt;/a&gt;
</pre>
<p>You can use any type of element for these, and you can put anything inside of the element. Anything wrapped in a tag with those classes will link appropriately.</p>
<h3>Other Options</h3>
<p><strong>Adding other product options to items.</strong></p>
<pre name="code" class="javascript">

simpleCart.add(&#039;name=Shirt&#039;,&#039;price=6.00&#039;,&#039;image=images/myImage.png&#039;,&#039;size=XL&#039;,&#039;color=Blue&#039;);
</pre>
<p><strong>You can also change the quantity that will be added to the cart:</strong></p>
<pre name="code" class="javascript">

simpleCart.add(&#039;name=Shirt&#039;,&#039;price=6.00&#039;,&#039;image=images/myImage.png&#039;,&#039;quantity=5&#039;,&#039;size=XL&#039;,&#039;color=Blue&#039;);
</pre>
<p><em>The order of the arguments doesn&#8217;t matter, and you can add as many options as you would like.</em></p>
<p><strong>Styling the cart.</strong></p>
<p>You can style this cart to fit the look of your page.  The contents of the cart will start with a header row:</p>
<pre name="code" class="html">

&lt;div class=&quot;cartHeaders&quot;&gt;
&lt;div class=&quot;itemImage&quot;&gt;Image&lt;/div&gt;
&lt;div class=&quot;itemName&quot;&gt;Name&lt;/div&gt;
&lt;div class=&quot;itemPrice&quot;&gt;Price&lt;/div&gt;
&lt;div class=&quot;itemOptions&quot;&gt;Options&lt;/div&gt;
&lt;div class=&quot;itemQuantity&quot;&gt;Quantity&lt;/div&gt;
&lt;div class=&quot;itemTotal&quot;&gt;Total&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Each item in the cart will have the following form:</p>
<pre name="code" class="html">

&lt;div class=&quot;itemContainer&quot;&gt;
&lt;div class=&quot;itemImage&quot;&gt;[myImage]&lt;/div&gt;
&lt;div class=&quot;itemName&quot;&gt;Shirt&lt;/div&gt;
&lt;div class=&quot;itemPrice&quot;&gt;$6.00&lt;/div&gt;
&lt;div class=&quot;itemOptions&quot;&gt;size: XL; color: Blue&lt;/div&gt;
&lt;div class=&quot;itemQuantity&quot;&gt;&lt;input type=&quot;text&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;itemTotal&quot;&gt;$30.00&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>And there will also be a totals row:</p>
<pre name="code" class="html">

&lt;div class=&quot;totalRow&quot;&gt;
&lt;div class=&quot;totalItems&quot;&gt;6&lt;/div&gt;
&lt;div class=&quot;totalPrice&quot;&gt;$30.00&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>You can choose to omit part of the cart in your stylesheet:</p>
<pre name="code" class="css">

.itemOptions,itemImage{
display:none;
}
</pre>
<p>Or you can hide the header or totals rows:</p>
<pre name="code" class="css">

.totalRow{
display:none;
}

.cartHeaders{
display:none;
}
</pre>
<p><strong>Change the order of the cart columns.</strong></p>
<p>If you would like to change the order of columns or remove the columns from ever being shown, simply add a line to the top of your page:</p>
<pre name="code" class="html">

&lt;script type=&quot;text/javascript&quot; src=&quot;simpleCart.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
simpleCart = new cart(&quot;you@yours.com&quot;);

//Add the following line to reorder and remove item columns
simpleCart.ItemColumns = [&#039;Image&#039;,&#039;Price&#039;,&#039;Name&#039;,&#039;Quantity&#039;,&#039;Total&#039;];

&lt;/script&gt;
</pre>
<p><strong>Download and Demo</strong></p>
<p>Below are links to download simpleCart(js) and to view a working Demo. One great thing about the cart being stored in cookies is that you can have your items be added on one page and the cart be on another if you wish. The demo reflects this. The main page of the sample store is <a href="http://thewojogroup.com/simpleCart">here</a> and the View Your Cart page is <a href="http://thewojogroup.com/simpleCart/myCart.html">here.</a></p>
<p>********* Please go to <a href="http://simplecartjs.com">simplecartjs.com</a> for the updated downloads and demo************</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thewojogroup.com/2008/10/simplecartjs-paypal-e-commerce-in-minutes/feed/</wfw:commentRss>
		<slash:comments>398</slash:comments>
		</item>
	</channel>
</rss>
