Post by OC2PS » Sat May 19, 2012 12:47 am

Further to http://forum.opencart.com/viewtopic.php?f=110&t=62531 I have another request:

In the lists (esp. Categories, Information pages, and other menus), it would be great of each List Item tag has its own class

Code: Select all

<li class="menu-item item-code-48">
This would open up many more styling possibilities, and give a great deal of granular control to the style artists.

Further the current/active item should have its own tag, e.g.

Code: Select all

<li class="menu-item item-code-48 current-item">
I would be very surprised if this is not a common need. When creating menus, often UI designers and usability guys want the active menu item to look different from others. To some extent, they can do it due to

Code: Select all

<a class="active" href="...">
tag. But that's rather limited. CSS does not allow upwards propagation i.e. doesn't allow reference to parents. Hence it would be really nice if OC core enables reference to the list items directly via these classes.

OC2PS
OC 3.0.3.7, vQmod 2.6.2, Journal3 theme
Arcfesték, Csillámtetoválás, Henna
Image
Check out: All my extensions | My FREE extensions


User avatar
Active Member

Posts

Joined
Wed Jul 22, 2009 4:15 am
Location - Hungary

Post by inactiveaccount9912 » Sat May 19, 2012 1:13 am

You could easyly do that yourself by editing the category.tpl (module) , and add the class to category items, using the category id.
For example, you have this code for the main categories (btw: which allready has the active class):

Code: Select all

<?php if ($category['category_id'] == $category_id) { ?>
          <a href="<?php echo $category['href']; ?>" class="active"><?php echo $category['name']; ?></a>
          <?php } else { ?>
          <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
          <?php } ?>
and turn it into:

Code: Select all

<?php if ($category['category_id'] == $category_id) { ?>
          <a href="<?php echo $category['href']; ?>" class="item-<?php echo $category['category_id']; ?> active"><?php echo $category['name']; ?></a>
          <?php } else { ?>
          <a href="<?php echo $category['href']; ?>" class="item-<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></a>
          <?php } ?>

Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am

Post by OC2PS » Sat May 19, 2012 6:34 am

The issue is that you are still changing the anchor tag instead of the list item tag.

I feel this (li with class) is a simple enough and powerful enough "feature" that it merits being in the core.

Eitherway, I took a leaf off your book...till such time as this is included in core, I have a vQmod that can be used: http://www.opencart.com/index.php?route ... on_id=6500

OC2PS
OC 3.0.3.7, vQmod 2.6.2, Journal3 theme
Arcfesték, Csillámtetoválás, Henna
Image
Check out: All my extensions | My FREE extensions


User avatar
Active Member

Posts

Joined
Wed Jul 22, 2009 4:15 am
Location - Hungary
Who is online

Users browsing this forum: No registered users and 3 guests