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