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

Removing/Editing the Primary Menu (Solved)

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 04-12-2014, 12:46 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Removing/Editing the Primary Menu (Solved)

Previously I was discussing this problem in this thread:http://forum.x-cart.com/showthread.php?t=69010

What we are trying to accomplish is remove and edit the top menu also known in the CDev\SimpleCMS modules as the Primary Menu. I struggled with this for a while, and realized there were several teaching points here that I could use to help others.
Removing the Primary Menu: So without further ado I reveal the second of my tutorials on X-cart 5: http://youtu.be/byLG9q13pxk

You can find all of my X-cart 5 tutorials here: http://forum.x-cart.com/showthread.php?t=64668
__________________
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
  #2  
Old 04-13-2014, 09:06 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Removing/Editing the Primary Menu (Solved)

So what was needed is to remove the top menu so I could add my own, I believe it would be normally accomplished by extending the class
XLite\View\Menu\Customer\Top

In this case though, the module CDev\SimpleCMS already extended this class. As of now, I don't know a way to extend another modules extension. Since CDev came after Baby (my company id) alphabetically, then its changes were overwriting my own when I tried to extend the class.

First I tried removing the template top_menu.tpl by using the function removeTemplateFromLists contained in XLite\Core\Layout.php, but found it was not included in the "template lists". Instead I ultimately used this code in my Baby\DropDown\Main.php file:
Code:
public static function runBuildCacheHandler() { parent::runBuildCacheHandler(); \XLite\Core\Layout::getInstance()->removeClassFromLists( 'XLite\View\Menu\Customer\Top' ); }
This unset the viewer class that was calling the template completely. My next move is to include my new template with my code to display the menu.

Any suggestions or comments welcome! Please let me now if I am doing this wrong or right.

-Mike
__________________
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
  #3  
Old 04-16-2014, 11:02 PM
  xplorer's Avatar 
xplorer xplorer is offline
 

X-Cart team
  
Join Date: Jul 2004
Posts: 925
 

Default Re: Removing/Editing the Primary Menu (Solved)

If you want to wipe the menu completely and replace it with your custom one, you can make the \XLite\View\Menu\Customer\Top::isVisible() return FALSE (so that the widget won't show up on the page at all), and add a new custom widget having @ListChild (list="layout.main", weight="250") in its declarations.
Reply With Quote

The following user thanks xplorer for this useful post:
totaltec (04-16-2014)
  #4  
Old 04-16-2014, 11:38 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Removing/Editing the Primary Menu (Solved)

Slava,
Thanks!
Anything wrong with the way I did it?
__________________
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
  #5  
Old 04-17-2014, 12:06 AM
  xplorer's Avatar 
xplorer xplorer is offline
 

X-Cart team
  
Join Date: Jul 2004
Posts: 925
 

Default Re: Removing/Editing the Primary Menu (Solved)

The way you did it will work (and, I guess, it will be a bit better in terms of the performance). However, runBuildCacheHandler() is not the place that you look into when investigating why the menu is not displayed on the page Your way may be confusing for other developers customizing your code later.
Reply With Quote

The following user thanks xplorer for this useful post:
totaltec (04-17-2014)
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 06:42 AM.

   

 
X-Cart forums © 2001-2020