View Single Post
  #36  
Old 08-14-2014, 02:35 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: All Products on front page, similar to featured products

Ok I think I figure out where to put the code, because that fixed the duplication problem. But I'm having trouble with the Home page showing a product "ghosted" that has no inventory and is disabled. See Home Page 2014_0814.jpg I've also attached my Product Advisor Settings.jpg file

Just in case you want the current Package https://www.dropbox.com/s/z41ummw6ip033qb/FasterThanYours-ProductsOnHomePage-v5_1_3.tar

Here's the current ProductsOnHomePage.php file:
PHP Code:
<?php

namespace XLite\Module\FasterThanYours\ProductsOnHomePage\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';
    }

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();
        }

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

// disabling ability to sort products and switch between display modes
    
protected function defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams[self::PARAM_GRID_COLUMNS]->setValue(3);

        unset(
$this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]);
        unset(
$this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]);
    }
}
Attached Thumbnails
Click image for larger version

Name:	Home Page 2014_0814.jpg
Views:	133
Size:	64.9 KB
ID:	3875  Click image for larger version

Name:	Product Advisor Settings.jpg
Views:	132
Size:	59.1 KB
ID:	3876  
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote