<?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>Eclipse Creations &#187; Other</title>
	<atom:link href="http://www.eclipse-creations.com/category/blog/other/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eclipse-creations.com</link>
	<description>Fine Handcrafted Gifts</description>
	<lastBuildDate>Fri, 03 Sep 2010 18:13:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Collapsing Categories in WP e-Commerce</title>
		<link>http://www.eclipse-creations.com/blog/other/collapsing-categories-in-wp-e-commerce/</link>
		<comments>http://www.eclipse-creations.com/blog/other/collapsing-categories-in-wp-e-commerce/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 20:20:24 +0000</pubDate>
		<dc:creator>eclipse</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.eclipse-creations.com/blog/other/collapsing-categories-in-wp-e-commerce/</guid>
		<description><![CDATA[I built this site using WordPress and a shopping cart plugin called WP e-Commerce. WP e-Commerce is a great add on to an already terrific base, but sometimes there isn&#8217;t a pre-built solution to get it to do what you want it to do and you need to change some of the code yourself. Enough [...]]]></description>
			<content:encoded><![CDATA[<p>I built this site using <a href="http://wordpress.org">WordPress</a> and a shopping cart plugin called <a href="http://www.instinct.co.nz/e-commerce/">WP e-Commerce</a>.<br />
WP e-Commerce is a great add on to an already terrific base, but sometimes there isn&#8217;t a pre-built solution to get it to do what you want it to do and you  need to change some of the code yourself.</p>
<p>Enough people have asked me about how I managed to get the collapsing categories you see on the left sidebar to work, that I thought it would be easier to post my code here for any one that was interested.</p>
<p>If you&#8217;re interested, please read on&#8230;<br />
If you&#8217;re not interested in looking at some badly written code, visit our main site and check out the terrific hand crafted gifts we have for sale. <img src='http://www.eclipse-creations.com/shop/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<span id="more-180"></span><br />
Ok .. if you&#8217;re reading this, I&#8217;ll assume you&#8217;re interested in the code, so here it is <img src='http://www.eclipse-creations.com/shop/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>But first, a quick disclaimer .. I&#8217;m not a professional programmer and manage to do things by what I call &#8220;trial and error coding&#8221;. As such, there&#8217;s probably a better way to do this, but it works.</p>
<hr />
<p>in file category_widget.php (in your cart theme) &#8230; around line 4, find</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h4 class='wpsc_category_title'&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$categorisation_group</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h4&gt;</pre></div></div>

<p>and replace it with</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h4 class='wpsc_category_title menu_head'&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$categorisation_group</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h4&gt;&lt;div class=&quot;menu_body&quot;&gt;</pre></div></div>

<p>same file &#8230; around line 26, find</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">		<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</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: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>in file /widgets/category_widget.28.php &#8230; around line 25, find</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$selected_categorisations</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$instance</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'categorisation'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>and place this before it</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">		<span style="color: #000088;">$thisisa</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;div id='firstpane' class='menu_list'&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$thisisa</span><span style="color: #339933;">;</span></pre></div></div>

<p>same file .. around line 50, find</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;">$after_widget</span><span style="color: #339933;">;</span></pre></div></div>

<p>and place this before it</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In your wordpress theme header.php &#8230; find</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span></pre></div></div>

<p>and add this before it</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
		jQuery<span style="color: #339933;">.</span>noConflict<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>ready<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">//slides the element with class &quot;menu_body&quot; when paragraph with class &quot;menu_head&quot; is clicked </span>
			jQuery<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#firstpane h4.menu_head&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>click<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		    <span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> jQuery<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">next</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.menu_body&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>is<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:hidden&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					jQuery<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#firstpane .menu_body&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>slideUp<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				    jQuery<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#firstpane h4.menu_head&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>css<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>backgroundImage<span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;url(/images/site/16-square-blue-add.png)&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					jQuery<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>css<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>backgroundImage<span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;url(/images/site/16-square-blue-remove.png)&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">next</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;div.menu_body&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>slideDown<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">300</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
					jQuery<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>css<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>backgroundImage<span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;url(/images/site/16-square-blue-add.png)&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">next</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;div.menu_body&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>slideUp<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></pre></div></div>

<p>In your theme&#8217;s css file .. add this.<br />
You’ll need to modify it to fit your theme and preferences.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">.</span>menu_list <span style="color: #009900;">&#123;</span>
	width<span style="color: #339933;">:</span> 185px<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>menu_head <span style="color: #009900;">&#123;</span>
  background<span style="color: #339933;">:</span> url<span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span>images<span style="color: #339933;">/</span>site<span style="color: #339933;">/</span><span style="color: #cc66cc;">16</span><span style="color: #339933;">-</span>square<span style="color: #339933;">-</span>blue<span style="color: #339933;">-</span>add<span style="color: #339933;">.</span>png<span style="color: #009900;">&#41;</span> center right no<span style="color: #339933;">-</span>repeat<span style="color: #339933;">;</span>
  padding<span style="color: #339933;">:</span> 5px 10px<span style="color: #339933;">;</span>
  cursor<span style="color: #339933;">:</span> crosshair<span style="color: #339933;">;</span>
  position<span style="color: #339933;">:</span> relative<span style="color: #339933;">;</span>
  border<span style="color: #339933;">-</span>bottom<span style="color: #339933;">:</span> dashed 1px <span style="color: #666666; font-style: italic;">#7cdfe7;
</span><span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>menu_body <span style="color: #009900;">&#123;</span>
	display<span style="color: #339933;">:</span>none<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>menu_body a <span style="color: #009900;">&#123;</span>
  display<span style="color: #339933;">:</span>block<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>you&#8217;ll also need to change the jscript and css to point to the images you want to use for the + and  -</p>
<hr />
<p>Well .. that&#8217;s it.<br />
I hope you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eclipse-creations.com/blog/other/collapsing-categories-in-wp-e-commerce/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
