fix when sale is in multi families

This commit is contained in:
Marion Muszynski 2016-10-14 16:31:09 +02:00
parent 42d4e5ed89
commit a80ce2855a
3 changed files with 31 additions and 29 deletions

View File

@ -130,7 +130,7 @@ class Privatesales_similarproducts extends Module
else {
$this->has_accessories_state = self::HAS_ACCESSORIES_NO;
$this->family = ProductSale::getSaleFamily(
$params['sale']->id,
$params['current_cat'],
$params['cookie']->id_lang
);
if (!empty($this->family)) {

View File

@ -111,7 +111,7 @@ class ProductSale extends ProductSaleCore
public static function getSaleFamily(
$id_sale,
$id_category,
$id_lang
)
{
@ -119,8 +119,7 @@ class ProductSale extends ProductSaleCore
SELECT DISTINCT a.`id_category_family`, c.`name`
FROM `'._DB_PREFIX_.'category_family_association` a
JOIN `'._DB_PREFIX_.'category_family_lang` c ON c.`id_category_family` = a.`id_category_family`
JOIN `'._DB_PREFIX_.'privatesale_category` b ON b.`id_category` = a.`id_category`
WHERE b.`id_sale` = '.pSql($id_sale).'
WHERE a.`id_category` = '.pSql($id_category).'
AND c.`id_lang` = '.pSql($id_lang);
return Db::getInstance()->getRow($query);
}

View File

@ -14,6 +14,7 @@ class ProductController extends ProductControllerCore {
foreach ($first_step_cats as $key => $first_step_cat) {
if(in_array($first_step_cat['id_category'], $available_cat)){
$first_step_cat = $first_step_cat['id_category'];
$current_cat = $$first_step_cat['id_category'];
break;
}
}
@ -21,6 +22,7 @@ class ProductController extends ProductControllerCore {
foreach ($second_step_cats as $key => $second_step_cat) {
if(in_array($second_step_cat['id_category'], $available_cat)){
$second_step_cat = $second_step_cat['id_category'];
$current_cat = $second_step_cat['id_category'];
break;
}
}
@ -28,6 +30,7 @@ class ProductController extends ProductControllerCore {
foreach ($third_step_cats as $key => $third_step_cat) {
if(in_array($third_step_cat['id_category'], $available_cat)){
$third_step_cat = $third_step_cat['id_category'];
$current_cat = $third_step_cat['id_category'];
break;
}
}
@ -44,8 +47,8 @@ class ProductController extends ProductControllerCore {
self::$smarty->assign(array(
'sale' => $sale,
'HOOK_SIMILAR_PRODUCT' => Module::hookExec('similarProduct', array('product' => $this->product, 'sale' => $sale)),
'HOOK_SIMILAR_PRODUCT_TABLABEL' => Module::hookExec('simlarProductTabLabel', array('product' => $this->product, 'sale' => $sale)),
'HOOK_SIMILAR_PRODUCT' => Module::hookExec('similarProduct', array('product' => $this->product, 'current_cat' => $current_cat)),
'HOOK_SIMILAR_PRODUCT_TABLABEL' => Module::hookExec('simlarProductTabLabel', array('product' => $this->product, 'current_cat' => $current_cat)),
'HOOK_PRIVATESALES_PRODUCT' => Module::hookExec('privatesales_product', array('sale' => $sale)),
'is_sale_home' => ($sale? $sale->id_category == $id_category: FALSE),
'is_thumb_vp' => (file_exists(_PS_ROOT_DIR_.'/img/c/'.$id_category_thumb.'_thumb_vp.jpg')),