Post by aaron1988 » Fri Jul 29, 2011 6:17 pm

Hi everyone i have the categories in my header and of course on the left, how can i limit the categories in my header so it only display say the first 8 or 9 and then it adds the rest to the categories on the left? the code in my header is this: Also Opencart Version using 1.5.1.1

Code: Select all

<?php if ($categories) { ?>
<div id="menu">
  <ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
  </ul>
</div>
<?php } ?>
Kind Regards,
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by teratyke » Fri Jul 29, 2011 7:26 pm

I know its not exactly answering your question, but did you know that you can choose which top level categories appear in the header in the admin by clicking "Top"?

This doesn't stop them appearing in your left category navigation though.

Perhaps you could check for the top attribute in the category module and exclude any categories which have it selected - that would make the header categories and the "left" categories mutually exclusive. Sorry I don't have the code to do that.

Rob
Last edited by teratyke on Fri Jul 29, 2011 7:34 pm, edited 1 time in total.

Active Member

Posts

Joined
Sun Jun 12, 2011 3:05 pm

Post by uksitebuilder » Fri Jul 29, 2011 7:26 pm

easy way is to only select/tick the 'Top' radio button when adding/editing categories for those categories you want to display in the top menu bar

ImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by aaron1988 » Fri Jul 29, 2011 11:49 pm

Awwww ok i will try this :)

Thanks for reply

Kind Regards,
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by aaron1988 » Sat Jul 30, 2011 2:07 am

Thanks, thats exactly what i needed :),

Kind Regards,
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by tilesupply » Wed Aug 17, 2011 2:28 am

How can I set the categories that are in the top menu not to show in the left categories box and only show the ones in the left that are not in the top menu.

Kind Regards

Active Member

Posts

Joined
Wed Aug 26, 2009 7:48 am


Post by aaron1988 » Wed Aug 17, 2011 4:58 am

All i believe you can do at the moment is Display all the categories on the left and choose which categories appear on the top. i not seen a way to do what you need but maybe soneone else could help on this with more knowledge.

Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by uksitebuilder » Wed Aug 17, 2011 5:37 am

It would require editing core code or using vQmod to create an override

Basically you would need to edit the category module controller to not add to the data array if top = 1

And also omit it's children.

ImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by tilesupply » Wed Aug 17, 2011 6:19 am

What would the code need to be changed to.
I did have a go but lets just say i donk know the code that well.

If I know what the code is I will make a VQmod and give it as a Free Contributions.
As this is sending me a bit nuts trying to get it to work.
uksitebuilder wrote:It would require editing core code or using vQmod to create an override

Basically you would need to edit the category module controller to not add to the data array if top = 1

And also omit it's children.

Active Member

Posts

Joined
Wed Aug 26, 2009 7:48 am


Post by aaron1988 » Thu Aug 18, 2011 3:15 pm

Hey i will look this morning and see if i can find it for you :).

Kind Regards,
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by tilesupply » Thu Aug 18, 2011 8:58 pm

Many Thanks
aaron1988 wrote:Hey i will look this morning and see if i can find it for you :).

Kind Regards,
Aaron

Active Member

Posts

Joined
Wed Aug 26, 2009 7:48 am


Post by uksitebuilder » Thu Aug 18, 2011 9:06 pm

open: catalog/controller/module/category.php

find:

Code: Select all

		foreach ($categories as $category) {
add after:

Code: Select all

			if(!$category['top']){
find:

Code: Select all

		}
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/category.tpl')) {
before add:

Code: Select all

}

ImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by aaron1988 » Thu Aug 18, 2011 9:54 pm

And it 100% Works :)

Kind Regards,
Aaron
Last edited by uksitebuilder on Thu Aug 18, 2011 10:42 pm, edited 1 time in total.
Reason: cleaned my error up - nice spot :-)

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by aaron1988 » Fri Aug 19, 2011 12:39 am

No Problem mate :)

thats what we are here for to help the community :), if i can help i will but my knowledge isn't that great on php but i am better at debugging lol

Kind Regards,
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by tilesupply » Fri Aug 19, 2011 3:28 am

Thanks to uksitebuilder for the code and here is the vqmod to change the core file without messing with the core files.

http://forum.opencart.com/download/file ... ew&id=6716
Many Thanks
Paul
uksitebuilder wrote:open: catalog/controller/module/category.php

find:

Code: Select all

		foreach ($categories as $category) {
add after:

Code: Select all

			if(!$category['top']){
find:

Code: Select all

		}
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/category.tpl')) {
before add:

Code: Select all

}

Active Member

Posts

Joined
Wed Aug 26, 2009 7:48 am


Post by kaylamatthews » Wed Aug 24, 2011 1:27 pm

uksitebuilder wrote:open: catalog/controller/module/category.php

find:

Code: Select all

		foreach ($categories as $category) {
add after:

Code: Select all

			if(!$category['top']){
find:

Code: Select all

		}
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/category.tpl')) {
before add:

Code: Select all

}
As usual, after searching for a while here, you save the day! Thanks so much!

New member

Posts

Joined
Wed Jun 01, 2011 12:30 pm

Post by jg_hill » Thu Feb 09, 2012 11:35 pm

I am looking for something similar:

I have a set of top-level categories that I show in the header (using the Top checkbox)
I need to be able to exclude/hide a subset of those categories in the side module.

For example, my header row includes a Contact Us link that I don't want shown in the list of categories down the side.

Using 1.5.1.3 with VQMod

Any help would be appreciated.

James Hill
http://www.cypressparacord.com


Newbie

Posts

Joined
Tue Aug 09, 2011 1:28 am

Post by Viacheslav » Mon Sep 03, 2012 3:28 am

Hello, I'm using OpenCart 1.5.4.1 and this xml file doesn't work in this version.The solution for hiding from the sidebar (Display in the top menu bar) doesn't do anything.
Is there is a way to make it work in 1.5.4.1 ?

Newbie

Posts

Joined
Mon Sep 03, 2012 3:02 am

Post by ThuNderGr » Thu Dec 20, 2012 2:49 am

jg_hill wrote:I am looking for something similar:

I have a set of top-level categories that I show in the header (using the Top checkbox)
I need to be able to exclude/hide a subset of those categories in the side module.

For example, my header row includes a Contact Us link that I don't want shown in the list of categories down the side.

Using 1.5.1.3 with VQMod

Any help would be appreciated.
same problem here....
i used a vqmod to add a link to a category and dislay it on the top menu. However it also displays in category module.
any ideas on how to exclude that specific pseudo-category from showing up in category module?

Εστιατορια Αθηνα http://www.athensmenu.gr


Newbie

Posts

Joined
Fri Feb 03, 2012 5:08 pm

Post by alvin101 » Fri Oct 04, 2013 10:26 pm

This looks like a great mod... Trying to use os in part as a cms to host some general information pages... I would need a menu which links to these pages.

So I think I can use Categories for this, but I would want to separate the product categories form the info categories, this module will do that... unless someone has a better idea?

So I have the top as product category, and the side as info category,..

Now I would like to change the name on this menu from Categories to something like Product Info,

Is there an easy way to do this?

Please inform, Thanks

Alvin


User avatar
New member

Posts

Joined
Thu Sep 12, 2013 9:08 pm
Who is online

Users browsing this forum: No registered users and 15 guests