View Single Post
  #7  
Old 12-17-2014, 06:46 PM
 
juancho juancho is offline
 

Advanced Member
  
Join Date: Mar 2014
Posts: 47
 

Default Re: How eliminate the display options and sorting tabs in product pages

Hi Tony,
thanks, here I am again, trying to make this run.
ok this is my whole code. It crashes with this message: "Error (code: 1): Call to a member function setValue() on a non-object"

PHP Code:
<?php 

namespace  XLite\Module\MyID\MyModule\View\Custom

/** 
 * 
 * @ListChild (list="center.bottom", zone="customer", weight="300") 
 */ 

class ProductsOnHomePage extends \XLite\View\ItemsList\Product\Customer\Category\ACategory 

    protected 
$allProducts null

    protected function 
getHead() 
    { 
        
'My products'
    } 

// this method defines that products will be displayed only in the main page 
    
public static function getAllowedTargets()  
    {  
        
$return = array('main'); 

        return 
$return;  
    }  

// this method defines that you do not need pagination 
    
protected function getPagerClass() 
    { 
        return 
'\XLite\View\Pager\Infinity'
    } 

// this method defines that all products must be displayed in this section 
    
protected function getData(\XLite\Core\CommonCell $cnd$countOnly false
    { 
        if (!isset(
$this->allProducts)) { 
            
$this->allProducts = \XLite\Core\Database::getRepo('XLite\Model\Product')->findAll(); 
  
//          $this->allProducts = \XLite\Core\Database::getRepo('XLite\Model\Product')->findAllActive(); 
        


        return 
true == $countOnly 
            
count($this->allProducts
            : 
$this->allProducts
    } 


    public function 
setWidgetParams(array $params)
    {
        
parent::setWidgetParams($params);
        
$this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]->setValue(false);
    } 
}

What I am trying to do is get rid of the display menu but maintaining the sort menu.
what it's wrong?
Thanks
__________________
X-Cart Business 5.0.12
Reply With Quote