View Single Post
  #2  
Old 01-25-2017, 12:39 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: this.isCheckoutLayout() to also hide on view cart

To check if it is the cart page you can use the following code in your View class:
PHP Code:
/**
     * Check if the widget is visible.
     *
     * @return boolean
     */
    
protected function isVisible()
    {
        return 
parent::isVisible() && $this->isAllowedPage();
    }

    protected function 
isAllowedPage()
    {
        
$controller = \XLite::getController();

        return !
$controller->isCheckoutLayout() && ($controller->getTarget() !== 'cart');
    } 

This way you don't need any checks in the template of your menu widget - isVisible() method will make it disappear on checkout and cart pages.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote