Alors voici mon override de CategoryController.php
public function getProductAttributeCombinations($products) {
$combinations = array();
foreach($products as $product)
{
// load product object
$product = new Product ($product['id_product'], $this->context->language->id);
// get the product combinations data
// create array combinations with key = id_product
$combinations[$product->id] = $product->getAttributeCombinations($this->context->language->id);
}
return $combinations;
}
public function initContent()
{
parent::initContent();
$this->assignSubcategoriesAlt();
$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,
'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),
'combinations' => $combinations,
'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(),
'others_categories' => $others
));
}