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

Make Sidebar Item only show on the home page.

 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 10-14-2014, 11:54 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Make Sidebar Item only show on the home page.

I created a simple mod for xcart 5 that adds a menu item to the sidebar called Quick Links. Everything works fine with the mod. It shows up in the side bar just like it is supposed to, but I want it to only show on the home page. Where as now it shows on every page with the sidebar. What is the easiest way to accomplish this?


Below is my QuickLinks.php


<?php

namespace XLite\Module\Pmall\QuickLinks\View;

/**
* @ListChild (list="sidebar.first", zone="customer", weight="101")
*/

class QuickLinks extends \XLite\View\SideBarBox
{
protected function getHead()
{
return 'Quick Links';
}


protected function getDir()
{
return 'modules/Pmall/QuickLinks/menu';
}
}
__________________
Ver 5.2.6
Reply With Quote
  #2  
Old 10-14-2014, 12:29 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Make Sidebar Item only show on the home page.

In your QuickLinks class add method isVisible() like this:

PHP Code:
protected function isVisible()
    {
        return 
parent::isVisible()
            && \
XLite\Core\Request::getInstance()->target == 'main';
    } 

and it should do the trick.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
Phil Richman (10-14-2014)
  #3  
Old 10-14-2014, 12:43 PM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Make Sidebar Item only show on the home page.

Thank you very much. That worked.
__________________
Ver 5.2.6
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (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 07:29 PM.

   

 
X-Cart forums © 2001-2020