Hello all. Im new to the CS Cart Community and i dont have a live store. Im experimenting in my localhost server using XAMPP. I made a quick hack to learn about cs card modification. Im new to the Smary Templates and The CS Cart development. If you have any sugestions please let me know. I will post later another way to do this by editing just a sigle line of code.
[SIZE=“5”]
[COLOR=“DarkOrange”]Description[/COLOR][/SIZE]
What the hack will do?
I will append a unique HTML class to each of your top menu item.
Example:
If your menu code is
[HTML]
Will make it
[HTML]
Why you will need this hack?
You will need it to do style customizations to your menu. Lets say you want to make the first menu item display a red link. You can select it in CSS by
[HTML].menuid0 span a{ color: red; } [/HTML]
Or you can use the “class” attribute to make some cool JavaScript menus.
[SIZE=“5”]
[COLOR=“DarkOrange”]How to make the Hack[/COLOR][/SIZE]
- Edit your top_menu.tpl in your current template. If you dont know where to find it use the CS Cart “Customization Feature” (AdminBackend → Design → Enable Customization mode)
- Line 2 Add a php variable that will keep the menu id starting from zero “0”
{php}$menuid = 0;{/php}
```<br />
3) Line 8 Make the menuid variable be displayed on your menu by changin it to <br />
```php
<li class="first-level menuid{php}echo $menuid;{/php}{if $m.selected == true} cm-active{/if}">
```<br />
4) Line 14 Just before you close the "{/foreach}" function increase the variable +1 by adding<br />
```php
{php}$menuid += 1;{/php}
```<br />
5) Save and test.<br />
<br />
Now you must have a menu looking something like this:<br />
[HTML]<li class="first-level menuid0 cm-active"><span><a href="home.html">Home</a></span></li><br />
<li class="first-level menuid1"><span><a href="item1.html">Item1</span></li><br />
<li class="first-level menuid2"><span><a href="item2.html">Item2</span></li>[/HTML]