Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Adding calalog to top menu

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 11-02-2014, 06:19 AM
 
juancho juancho is offline
 

Advanced Member
  
Join Date: Mar 2014
Posts: 47
 

Default Adding calalog to top menu

Hi

How can I add a Catalog tab in the top menu? this tab should be able to display all categories and subcategories. The same concept as the calatog menu in the sidebar.first, but in the top menu

Thanks
__________________
X-Cart Business 5.0.12
Reply With Quote
  #2  
Old 11-02-2014, 06:21 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Adding calalog to top menu

Juancho, This is not that hard to code for yourself, but I recommend the module here: https://www.x-cart.com/extensions/addons/horizontal-flyout-categories-menu.html

Save yourself lots of time and trouble!
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following 2 users thank totaltec for this useful post:
juancho (11-02-2014), kevfromwiganinlancashire (11-03-2014)
  #3  
Old 11-02-2014, 01:58 PM
 
juancho juancho is offline
 

Advanced Member
  
Join Date: Mar 2014
Posts: 47
 

Default Re: Adding calalog to top menu

Thanks Mike, I wasn't aware of that module.
BTW thanks for all the videos you've uploaded. They are really useful.
__________________
X-Cart Business 5.0.12
Reply With Quote

The following user thanks juancho for this useful post:
totaltec (11-03-2014)
  #4  
Old 11-03-2014, 05:30 AM
 
juancho juancho is offline
 

Advanced Member
  
Join Date: Mar 2014
Posts: 47
 

Default Re: Adding calalog to top menu

Hi

I bought and installed the module. It does pretty much what I wanted except that now ALL categories have their own tab in the menu. Would it be possible just to have one "Catalog" tab and that all categories and subcategories would be hanging from this principal tab?

Thanks
__________________
X-Cart Business 5.0.12
Reply With Quote
  #5  
Old 11-23-2014, 05:35 PM
 
juancho juancho is offline
 

Advanced Member
  
Join Date: Mar 2014
Posts: 47
 

Default Re: Adding calalog to top menu

Hi I finally got the code to work. I can't guarantee that it will work in all cases but at least it did for me.
Overwrite QSL/HorizontalCategoriesMenu/body.tpl with this code

Code:
{if:isSubtree()} <ul class="flyout-menu{if:!isSubtree()} catalog-categories catalog-categories-tree{else:} sublevel{end:}"> {else:}<li><a href="">Shop</a> <ul class="flyout-menu sublevel"> {end:} {foreach:getCategories(rootId),idx,_category} <li {displayItemClass(idx,_categoryArraySize,_category):h}> <a href="{buildURL(#category#,##,_ARRAY_(#category_id#^_category.getCategoryId()))}" {displayLinkClass(idx,_categoryArraySize,_category):h} title="{_category.getName()}">{_category.getName()}{if:isShowProductNum()&isSubtree()} ({_category.countProducts()}){end:}</a><span class="icon-triangle" IF="isShowTriangle()&_category.hasSubcategories()"></span><widget template="{getBody()}" rootId="{_category.getCategoryId()}" IF="_category.getSubcategoriesCount()&!isRootOnly()}" is_subtree /> <span class="category-icon" IF="isShowCatIcon()&isSubtree()"><widget class="\XLite\View\Image" image="{_category.image}" maxWidth="16" maxHeight="16" /></span> </li> {end:}</li> {foreach:getViewList(#topCategories.children#,_ARRAY_(#rootId#^getParam(#rootId#),#is_subtree#^getParam(#is_subtree#))),idx,w} <li {displayListItemClass(idx,wArraySize,w):h}>{w.display()}</li> {end:} </ul>

good luck!
__________________
X-Cart Business 5.0.12
Reply With Quote

The following 3 users thank juancho for this useful post:
Ed B. (11-15-2019), qualiteam (11-25-2014), tony_sologubov (11-24-2014)
  #6  
Old 11-15-2019, 05:20 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Adding calalog to top menu

I'm trying to do this on 5.3 but the code above doesn't work.

I've added a main "Shop" menu item to the template, and now just need to pupolate the UL with the categories.

I've tried adding this code as copied from /skins/customer/categories/tree/body.twig but it's not working for some reason? I get an Internal Server Error

Code:
<li class="leaf has-sub"><span>Shop</span> <ul> {% for idx, _category in this.getCategories(this.rootId) %} <li {{ this.displayItemClass(idx, loop.length, _category)|raw }}> <a href="{{ _category.link }}" {{ this.displayLinkClass(idx, loop.length, _category)|raw }}>{{ _category.name }}</a> {% if _category.subcategoriesCount %} {{ widget(template=this.getBody(), rootId=_category.id, is_subtree='1') }} {% endif %} </li> {% endfor %} {% for idx, w in this.getViewList('topCategories.children', {'rootId': this.getParam('rootId'), 'is_subtree': this.getParam('is_subtree')}) %} <li {{ this.displayListItemClass(idx, loop.length, w)|raw }}>{{ w.display() }}</li> {% endfor %} </ul> </li>
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #7  
Old 11-19-2019, 11:08 AM
 
welly welly is offline
 

eXpert
  
Join Date: Mar 2011
Location: UK
Posts: 209
 

Default Re: Adding calalog to top menu

I don't think this is quite what you are looking for, but I used the Multilevel Primary Menu module for something like this. I added all of my menu items in a 'logical' order manually.

Up side, I didn't need to code anything, and I can configure any cat name or description I want, including subcategories.

Down side, the menu is not dynamic so each menu item must be configured manually. You may like that, or you may not.

Welly
__________________
X-Cart Business 5.3.6
Various add-ons

www.traininglines.co.uk
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:49 AM.

   

 
X-Cart forums © 2001-2020