Post by Thallium » Sun Mar 08, 2015 2:38 am

Hello,

Id like to align the last 4 items on the category navigation bar to the right, meanwhile the others stay at the left. Editing the CSS affects all the <li> elements hence it won't move only the last item to the right but all of them. I think I have to add CSS classes to categories in the header.tpl. I used the below VQmod.xml file to add classes to category items but I fail to synchronize it with CSS(most likely due lack of knowledge).

There's a similar thread on the forum, but the difference is that the author on the other thread was looking for moving only the last item but I need to move 3-4 items. Also their code messes up the dropdown-menu which makes it pretty unusable.
http://forum.opencart.com/viewtopic.php?t=129177

A visual preview of what I'm trying to archive.

http://i.imgur.com/4TzRkt2.png

Code: Select all

<modification>

   <id><![CDATA[Adds CSS classes to categories in header.]]></id>
   <version><![CDATA[1.0.0]]></version>
   <vqmver><![CDATA[2.4.1]]></vqmver>
   <author><![CDATA[CreadevDotOrg]]></author>

   <file name="catalog/controller/common/header.php">

      <operation error="log">
         <search position="after"><![CDATA[
            'name'  => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
         ]]></search>
         <add><![CDATA[
                  'child_id' => $child['category_id'],
         ]]></add>
      </operation>
      <operation error="log">
         <search position="after"><![CDATA[
            'name'     => $category['name'],
         ]]></search>
         <add><![CDATA[
               'category_id' => $category['category_id'],
         ]]></add>
      </operation>

   </file>

   <file name="catalog/view/theme/*/template/common/header.tpl">

      <operation error="log">
         <search position="replace"><![CDATA[
            <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
         ]]></search>
         <add><![CDATA[
    <li class="cat-<?php echo $category['category_id']; ?>"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
         ]]></add>
      </operation>
      <operation error="log">
         <search position="replace"><![CDATA[
            <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
         ]]></search>
         <add><![CDATA[
          <li class="cat-<?php echo $category['children'][$i]['child_id']; ?>"><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
         ]]></add>
      </operation>

   </file>

</modification>
Any help would be warmly appreaciated! :)
Warm regards,
Thallium

Newbie

Posts

Joined
Sun Mar 08, 2015 2:16 am

Post by Thallium » Wed Mar 11, 2015 7:54 am

Guys, any recommendations?

Newbie

Posts

Joined
Sun Mar 08, 2015 2:16 am

Post by viethemes » Thu Mar 12, 2015 1:24 am

Could you provide your site url, so we can take a look at it closer?

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by Thallium » Fri Mar 13, 2015 4:10 am

It's currently on localhost although I'll try to upload it to a webhosting by tomorrow. Thanks for your input. :)

On a sidenote, is there a bug on the subforum or how does my thread have THAT many views? My thread was verified by Moderators on 10'th of March but it already has over 2000 views within two days meanwhile others mostly under 100. ;D

Newbie

Posts

Joined
Sun Mar 08, 2015 2:16 am

Post by Opencartmenot » Sat Mar 21, 2015 9:15 am

Hi I have made an extension that will just do that, you can pick the menu items tha you want to align to the right.

http://www.opencart.com/index.php?route ... n_id=21494

gr.
http://www.opencart.com/index.php?route ... n_id=21494

Newbie

Posts

Joined
Sat Mar 21, 2015 9:12 am
Who is online

Users browsing this forum: No registered users and 5 guests