I had the same problem like Boguslaw, blank page after using idea of gonebdg.
There was error about rewriting initContent function, so I make some changes and in CategoryController.php I changed original initContent function like this (about line 98):
public function initContent()
{
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_.'category.tpl');
if (!$this->customer_access)
return;
if (isset($this->context->cookie->id_compare))
$this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare));
$this->productSort(); // Product sort must be called before assignProductList()
$this->assignScenes();
$this->assignSubcategories();
if ($this->category->id != 1)
$this->assignProductList();
$products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
$combinations = $this->getProductAttributeCombinations($products);
$this->context->smarty->assign(array(
'category' => $this->category,
'combinations' => $combinations,
'description_short' => Tools::truncateString($this->category->description),
'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : null,
'id_category' => (int)$this->category->id,
'id_category_parent' => (int)$this->category->id_parent,
'return_category_name' => Tools::safeOutput($this->category->name),
'path' => Tools::getPath($this->category->id),
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'categorySize' => Image::getSize(ImageType::getFormatedName('category')),
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
'thumbSceneSize' => Image::getSize(ImageType::getFormatedName('m_scene')),
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
'allow_oosp' => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK'),
'comparator_max_item' => (int)Configuration::get('PS_COMPARATOR_MAX_ITEM'),
'suppliers' => Supplier::getSuppliers()
));
}
before this code I put code of public function getProductAttributeCombinations($products) what gonebdg mentioned. And in Productlist.tpl this code from gonebdg aswell:
{foreach from=$combinations key=k item=comb}
{if $k = $product.id_product}
<p class="comb_title">{$comb.group_name}</p>
<select>
{foreach from=$comb item=attr}
<option value="{$attr.id_attribute}">{$attr.attribute_name}</option>
{/foreach}
</select>
{/if}
{/foreach}
Problems:
If I look to some category now I see in every article attributes of all articles. It dificult to explain so I'm attaching screenshot.
Prestashop saying error about Undefinied index $comb.group_name How can I show only sizes what are available (by quantity in stock)
Somebody have some idea how to solve it? The second point is not so important for me but the first one.