View Single Post
  #9  
Old 12-18-2014, 03:58 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

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

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

Not sure why it does not work for you, because it work perfectly for me:
http://awesomescreenshot.com/0854235ua8

What I have done is I enabled Custom Skin module and then put View/ProductsOnHomePage.php file inside it with this code:

PHP Code:
<?php  

namespace XLite\Module\XC\CustomSkin\View;  

/**  
 *  
 * @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); 
    }  
}

In order to debug the problem, you need to check that you have not decorated the \XLite\View\ItemsList\Product\Customer\Category\AC ategory class anywhere else. If you did, you might have unsetted $this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR] param there and it causes the fatal error.
__________________
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