<?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>Musings From the Throne &#187; Miva Merchant</title>
	<atom:link href="http://www.tinyqueen.com/tag/miva-merchant/feed" rel="self" type="application/rss+xml" />
	<link>http://www.tinyqueen.com</link>
	<description>Random Ramblings from the Tiny Queen</description>
	<lastBuildDate>Fri, 04 Mar 2011 15:16:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=8155</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Miva Merchant Quick Tip: Styling Your Category Tree</title>
		<link>http://www.tinyqueen.com/miva-merchant/miva-merchant-quick-tip-styling-your-category-tree</link>
		<comments>http://www.tinyqueen.com/miva-merchant/miva-merchant-quick-tip-styling-your-category-tree#comments</comments>
		<pubDate>Sun, 21 Feb 2010 16:58:15 +0000</pubDate>
		<dc:creator>Tiny Queen</dc:creator>
				<category><![CDATA[Miva Merchant]]></category>
		<category><![CDATA[Store Morph Technology]]></category>
		<category><![CDATA[category tree]]></category>
		<category><![CDATA[css-based category tree]]></category>
		<category><![CDATA[list-based category tree]]></category>

		<guid isPermaLink="false">http://www.tinyqueen.com/?p=540</guid>
		<description><![CDATA[
There have been several posts on the forums lately from people looking to style their category trees.  Many of them need the tree to be in an unordered list format in order to implement a flyout or dropdown menu of some sort.
There are numerous methods available for creating accessible, cross-browser compatible flyout or dropdown [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tinyqueen.com/wp-content/uploads/2010/02/cattree.jpg"><img src="http://www.tinyqueen.com/wp-content/uploads/2010/02/cattree.jpg" alt="Styling the Miva Merchant Category Tree" title="cattree" width="215" height="333" class="alignright size-full wp-image-546"></a>
<p>There have been several posts on the forums lately from people looking to style their category trees.  Many of them need the tree to be in an unordered list format in order to implement a flyout or dropdown menu of some sort.</p>
<p>There are numerous methods available for creating accessible, cross-browser compatible flyout or dropdown menus, so I&#8217;ll leave it to you to search out the one that works best for your needs.  What I will do here, however, is to provide you with the code you need for your category tree to create those unordered lists from your categories and subcategories.</p>
<p>The tree code below does not contain the conditional that removes the link from the current category &#8212; I&#8217;ve always thought that was a bit nonsensical.  It does, however, include a css class that will allow you to highlight the current category in the list, making your Miva Merchant site more user friendly.</p>
<p>Some of the lines in the code below are pretty long &#8212; that&#8217;s just because I hate seeing &#8220;orphaned&#8221; &lt;li&gt; tags on their own line in the source code.  If you need to break it out to make it more readable for yourself, by all means do so.</p>
<pre title="code" class="html">
&lt;mvt:if expr=&quot;l.settings:cattree:stack EQ 0&quot;&gt;
  &lt;mvt:item name=&quot;category_tree&quot; param=&quot;cattree_header&quot; /&gt;
&lt;/mvt:if&gt;

&lt;mvt:if expr=&quot;l.settings:nextcount GT 0&quot;&gt;
  &lt;ul id=&quot;catlevel&amp;mvt:cattree:stack;&quot;&gt;
    &lt;mvt:item name=&quot;category_tree&quot; param=&quot;nextlevel&quot;&gt;
      &lt;mvt:foreach iterator=&quot;cattree_category&quot; array=&quot;categories&quot;&gt;
          &lt;mvt:if expr=&quot;l.settings:cattree_category:image&quot;&gt;
            &lt;li&gt;&lt;a href=&quot;&amp;mvt:global:sessionurl;Screen=CTGY&amp;Store_Code=&amp;mvta:store:code;&amp;Category_Code=&amp;mvta:cattree_category:code;&quot;&gt;&lt;img src=&quot;&amp;mvte:cattree_category:image;&quot; alt=&quot;&amp;mvte:cattree_category:name;&quot;&gt;&lt;/a&gt;&lt;mvt:if expr=&quot;l.settings:cattree_category:id NE l.settings:cattreenext&quot;&gt;&lt;/li&gt;&lt;/mvt:if&gt;
          &lt;mvt:else&gt;
            &lt;mvt:if expr=&quot;l.settings:cattree_category:code EQ g.Category_code&quot;&gt;
		&lt;li class=&quot;thiscat&quot;&gt;&lt;a href=&quot;&amp;mvt:global:sessionurl;Screen=CTGY&amp;Store_Code=&amp;mvta:store:code;&amp;Category_Code=&amp;mvta:cattree_category:code;&quot;&gt;&amp;mvt:cattree_category:name;&lt;/a&gt;&lt;mvt:if expr=&quot;l.settings:cattree_category:id NE l.settings:cattreenext&quot;&gt;&lt;/li&gt;&lt;/mvt:if&gt;
	    &lt;mvt:else&gt;
		&lt;li&gt;&lt;a href=&quot;&amp;mvt:global:sessionurl;Screen=CTGY&amp;Store_Code=&amp;mvta:store:code;&amp;Category_Code=&amp;mvta:cattree_category:code;&quot;&gt;&amp;mvt:cattree_category:name;&lt;/a&gt;&lt;mvt:if expr=&quot;l.settings:cattree_category:id NE l.settings:cattreenext&quot;&gt;&lt;/li&gt;&lt;/mvt:if&gt;
	    &lt;/mvt:if&gt;
          &lt;/mvt:if&gt;
          &lt;mvt:if expr=&quot;l.settings:cattree_category:id EQ l.settings:cattreenext&quot;&gt;
		&lt;mvt:item name=&quot;category_tree&quot;/&gt;
		&lt;/li&gt;
          &lt;/mvt:if&gt;
      &lt;/mvt:foreach&gt;
    &lt;/mvt:item&gt;
  &lt;/ul&gt;
&lt;/mvt:if&gt;

&lt;mvt:if expr=&quot;l.settings:cattree:stack EQ 0&quot;&gt;
  &lt;mvt:item name=&quot;category_tree&quot; param=&quot;cattree_footer&quot; /&gt;
&lt;/mvt:if&gt;
</pre>
<p>This code will give you a tidy set of nested unordered lists that you can style in your css file using the id of the list item.  When the tree is generated, each list will have an id of catlevel, with a number appended to it indicating which level of the category tree is being displayed (i.e. catlevel, catlevel1, catlevel2, etc).</p>
<p>As an example, the code below will get you a category tree that resembles the picture at the top of this post.</p>
<pre title="code" class="css">
ul#catlevel {
list-style-type:none;
margin-left:0;
padding-left:0;
font-weight:bold;
}

ul#catlevel li a {
display:block;
border-bottom:1px dotted #ccc;
padding:5px 3px;
margin-right:5px;
font-size:1.1em;
color:#18316b;
}

ul#catlevel1, ul#catlevel2, ul#catlevel3, ul#catlevel4 {
list-style:none;
margin:5px 0;
padding:5px 0;
}

ul#catlevel li ul li, ul#catlevel li ul ul li, ul#catlevel li ul ul ul li{
padding:2px 0 2px 5px;
}

ul#catlevel li ul a, ul#catlevel li ul ul a, ul#catlevel li ul ul ul a {
border:none;
padding:3px 5px;
}

ul#catlevel1 {
border-bottom:1px dotted #ccc
}

li.thiscat a {
color: #cc0000;
}
</pre>
<p>For those users using the new CSSUI version of Miva Merchant 5.5, you&#8217;ll need to use a different set of code for your creating your list.  I&#8217;ll be honest, this code below hasn&#8217;t been tested (the part I&#8217;m not positive on is the creation of the nested list if you&#8217;re in a subcategory) so don&#8217;t be afraid to let me know if it doesn&#8217;t work, and we can tweak it. </p>
<pre title="code" class="html">
&lt;ul id=&quot;category-tree&quot;&gt;
&lt;mvt:foreach array=&quot;cattree_categories&quot; iterator=&quot;cattree_category&quot;&gt;

	&lt;mvt:if expr=&quot;((l.settings:cattree_category:level NE 1) AND (pos1 EQ 1))&quot;&gt;
		&lt;ul class=&quot;ul-level-&amp;mvte:cattree_category:level;&quot;&gt;
		&lt;mvt:if expr=&quot;l.settings:cattree_category:code EQ g.Category_Code&quot;&gt;
		&lt;li class=&quot;level-&amp;mvte:cattree_category:level; active&quot;&gt;
		&lt;mvt:else&gt;
		&lt;li class=&quot;level-&amp;mvte:cattree_category:level;&quot;&gt;
		&lt;/mvt:if&gt;
	&lt;mvt:else&gt;
		&lt;mvt:if expr=&quot;l.settings:cattree_category:code EQ g.Category_Code&quot;&gt;
		&lt;li class=&quot;level-&amp;mvte:cattree_category:level; active&quot;&gt;
		&lt;mvt:else&gt;
		&lt;li class=&quot;level-&amp;mvte:cattree_category:level;&quot;&gt;
		&lt;/mvt:if&gt;
	&lt;/mvt:if&gt;
			&lt;a href=&quot;&amp;mvte:cattree_category:link;&quot;&gt;
			&lt;mvt:if expr=&quot;l.settings:cattree_category:image&quot;&gt;
			&lt;img src=&quot;&amp;mvte:cattree_category:image;&quot; alt=&quot;&amp;mvte:cattree_category:name;&quot; /&gt;
			&lt;mvt:else&gt;
			&amp;mvte:cattree_category:name;
			&lt;/mvt:if&gt;
			&lt;/a&gt;
		&lt;/li&gt;
	&lt;mvt:if expr=&quot;((l.settings:cattree_category:level NE 1) AND (pos1 EQ 1))&quot;&gt;
		&lt;/ul&gt;
	&lt;/mvt:if&gt;
&lt;/mvt:foreach&gt;
&lt;/ul&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyqueen.com/miva-merchant/miva-merchant-quick-tip-styling-your-category-tree/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

