X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   How to stop Product Filter module hiding Category menu (https://forum.x-cart.com/showthread.php?t=70150)

JannieB 10-04-2014 03:24 AM

How to stop Product Filter module hiding Category menu
 
The default behaviour of the product Filter module is to hide the category menu when a filter is being applied. I need to undo this functionality as I am using the topCategories module for subnavigation options in a horizontal menu, so no-one can navigate anywhere if these are hidden.

I tried setting the isVisible element to always be true, but then the filters wouldn't work properly.

I started this in another thread http://forum.x-cart.com/showthread.php?p=378089, but now it is a specific question ... maybe someone from x-cart can help???

(see previous thread for background ..)

qualiteam 10-10-2014 04:51 AM

Re: How to stop Product Filter module hiding Category menu
 
Hello Jan,

It looks like doing this right now is not as simple as it could be.

I've reported this to the XC5 team: https://bt.x-cart.com/view.php?id=43921
Perhaps, they could improve this in the next XC5 version.

The problem is that ProductVariants override the isVisible() method for TopCategories as follows:
Code:

    protected function isVisible()
    {
        return parent::isVisible()
            && 'category_filter' != $this->getTarget();
    }



So, you can't hack on top and get rid of this check from your module. And you can't just return "true", as this will make the menu visible on every website page (that may be a problem).

Try the following: override the method and copy&paste the code from the original TopCategories class. Add ProductFilter to the @LC_Dependencies tag so that your method will stack on top of the ProductFilter's one:

Code:

namespace XLite\Module\CustomSkin\View;

/**
 * @inherit
 *
 * @LC_Dependencies ("XC\ProductFilter")
 */
class TopCategories extends \XLite\View\TopCategories implements \XLite\Base\IDecorator
{
    /**
    * @inherit
    */
    protected function isVisible()
    {
        return $this->checkTarget() && $this->checkMode() && $this->checkACL();
    }
}


This may work for you.

JannieB 10-10-2014 07:21 AM

Re: How to stop Product Filter module hiding Category menu
 
You're a star ...! This worked....

I didn't know you could specify dependencies ... this might help me with some other issues too.

Thanks for your help.

Jan


All times are GMT -8. The time now is 09:40 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.