public function hookProductFooter($params)
{
$id_product = (int)$params['product']->id;
//webpc1
$ref = $params['product']->reference;
if ($ref=='') return false;
//echo $ref;
//die;
$product = $params['product'];
$cache_id = 'productscategory|'.$id_product.'|'.(isset($params['category']->id_category) ? (int)$params['category']->id_category : (int)$product->id_category_default);
/* if (!$this->isCached('productscategory.tpl', $this->getCacheId($cache_id)))
{
*/
//webpc2
//$category_products = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */
//$sql = 'SELECT p.`id_product`,pl.`link_rewrite`,p.`price`,pl.`name`
$sql = 'SELECT p.*, product_shop.*,pl.`link_rewrite`, pl.`meta_title`, pl.`name`, image_shop.`id_image` id_image,il.`legend` as legend
FROM `'._DB_PREFIX_.'product` p
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').')
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop=1)
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
ON (image_shop.`id_image` = il.`id_image`
AND il.`id_lang` = '.$this->context->language->id.')
WHERE pl.`id_lang` = '.$this->context->language->id.' and p.`reference`=\''.$ref.'\' AND p.`active` = 1 and p.`id_product`<>'.$id_product.' ORDER BY p.`id_product`';
//echo $sql;
//die;
$cpro = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql, true, false);
$category_products =Product::getProductsProperties($id_lang, $cpro);
// Display tpl
$this->smarty->assign(
array(
'categoryProducts' => $category_products,
'middlePosition' => (int)$middle_position,
'ProdDisplayPrice' => Configuration::get('PRODUCTSCATEGORY_DISPLAY_PRICE')
)
);
/* } */
//return $this->display(__FILE__, 'productscategory.tpl', $this->getCacheId($cache_id));
return $this->display(__FILE__, 'productscategory.tpl');
}