PDA

View Full Version : Highlighting Active Category Link "outside" of the cattree


aarcmedia
07-29-08, 05:07 PM
Many of our clients choose to use a hard-coded horizontal navigation either to replace or in conjunction with miva's built in category tree. The category tree has the ability to highlight the active category, and we're trying to do something similar with a hard-coded category link stored outside of the category tree.

I've re-worked the code, and have tried two variations without success. Here's the variations I've tried. I figure Bill or someone might be able to chime in and point out where I've made errors.

1st instance uses the cat-code instead of Category_Code as in the example below. I just took this code out of the catree and warped it trying to make this work.


<mvt:if expr="l.settings:cattree_category:code EQ g.bar-beverage">
<td class="nav"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
<mvt:else>
<td class="nav2"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
</mvt:if>
</mvt:if>


Here's the other instance I tried with no luck:


<mvt:if expr="l.settings:cattree_category:code EQ g.Category_Code">
<td class="nav"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
<mvt:else>
<td class="nav2"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
</mvt:if>
</mvt:if>

PCINET - Andreas
07-29-08, 06:05 PM
Uhm, instead of using g.Category_Code or g.bar-beverage use only bar-beverage in single quotes.

aarcmedia
07-29-08, 08:17 PM
So I tried this variation as you mentioned, but was still having problems.

<mvt:if expr="l.settings:cattree_category:code EQ 'bar-beverage'">
<td class="nav"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
<mvt:else>
<td class="nav2"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
</mvt:if>

So then I tried this variation, this time, removing cattree_ from the equation so it looked like this:

<mvt:if expr="l.settings:category:code EQ 'bar-beverage'">
<td class="nav2"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
<mvt:else>
<td class="nav"><a href="&mvt:global:sessionurl;Screen=CTGY&Store_Code=&mvta:store:code;&Category_Code=bar-beverage">Bar &amp;<br />Beverage</a></td>
</mvt:if>

And now it works. Thanks for the help.

PCINET - Andreas
07-29-08, 08:23 PM
A little push in the right direction <grin> and you find the answer yourself.