CS
This commit is contained in:
parent
9803b2424c
commit
93fe8b597a
@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
class Filtervp extends Module {
|
class Filtervp extends Module
|
||||||
|
{
|
||||||
const FILTER_ID = 75;
|
const FILTER_ID = 75;
|
||||||
const FILTER_SIZE = 272;
|
const FILTER_SIZE = 272;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->name = 'filtervp';
|
$this->name = 'filtervp';
|
||||||
$this->tab = 'front_office_features';
|
$this->tab = 'front_office_features';
|
||||||
$this->version = '1.0';
|
$this->version = '1.0';
|
||||||
@ -14,16 +16,18 @@ class Filtervp extends Module {
|
|||||||
$this->description = $this->l('Enable to filter by size in VP.');
|
$this->description = $this->l('Enable to filter by size in VP.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function install() {
|
public function install()
|
||||||
if(!parent::install()
|
{
|
||||||
OR !$this->registerHook('displayLeftVP')) {
|
if (!parent::install()
|
||||||
return FALSE;
|
|| !$this->registerHook('displayLeftVP')) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hookdisplayLeftVP($params) {
|
public function hookdisplayLeftVP($params)
|
||||||
|
{
|
||||||
global $smarty;
|
global $smarty;
|
||||||
$sizes = self::getAllValueAttr(Filtervp::FILTER_ID, Tools::getValue('id_category'));
|
$sizes = self::getAllValueAttr(Filtervp::FILTER_ID, Tools::getValue('id_category'));
|
||||||
|
|
||||||
@ -34,7 +38,7 @@ class Filtervp extends Module {
|
|||||||
$name = self::getAttrName(self::FILTER_ID);
|
$name = self::getAttrName(self::FILTER_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($name == 'Tailles') {
|
if ($name == 'Tailles') {
|
||||||
$name = 'Taille';
|
$name = 'Taille';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,13 +50,14 @@ class Filtervp extends Module {
|
|||||||
return $this->display(__FILE__, 'filter.tpl');
|
return $this->display(__FILE__, 'filter.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAllValueAttr($id_attr, $id_cat){
|
public static function getAllValueAttr($id_attr, $id_cat)
|
||||||
|
{
|
||||||
global $cookie;
|
global $cookie;
|
||||||
|
|
||||||
$id_lang = $cookie->id_lang;
|
$id_lang = $cookie->id_lang;
|
||||||
$results = Db::getInstance()->ExecuteS('
|
$results = Db::getInstance()->ExecuteS('
|
||||||
SELECT
|
SELECT
|
||||||
al.`name`,
|
al.`name`,
|
||||||
a.`id_attribute`
|
a.`id_attribute`
|
||||||
FROM
|
FROM
|
||||||
`'._DB_PREFIX_.'attribute` a
|
`'._DB_PREFIX_.'attribute` a
|
||||||
@ -61,23 +66,27 @@ class Filtervp extends Module {
|
|||||||
LEFT JOIN '._DB_PREFIX_.'product p ON cp.id_product = p.id_product
|
LEFT JOIN '._DB_PREFIX_.'product p ON cp.id_product = p.id_product
|
||||||
INNER JOIN '._DB_PREFIX_.'product_attribute pa ON pa.id_product = cp.id_product
|
INNER JOIN '._DB_PREFIX_.'product_attribute pa ON pa.id_product = cp.id_product
|
||||||
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_attribute = a.id_attribute AND pac.id_product_attribute = pa.id_product_attribute
|
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_attribute = a.id_attribute AND pac.id_product_attribute = pa.id_product_attribute
|
||||||
WHERE
|
WHERE
|
||||||
a.id_attribute_group = "'.$id_attr.'"
|
a.id_attribute_group = "'.$id_attr.'"
|
||||||
GROUP BY
|
GROUP BY
|
||||||
a.`id_attribute`
|
a.`id_attribute`
|
||||||
ORDER BY
|
ORDER BY
|
||||||
al.`name` ASC
|
al.`name` ASC
|
||||||
');
|
');
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAttrName($id_attr){
|
public static function getAttrName($id_attr)
|
||||||
|
{
|
||||||
global $cookie;
|
global $cookie;
|
||||||
|
|
||||||
$id_lang = $cookie->id_lang;
|
$id_lang = $cookie->id_lang;
|
||||||
return Db::getInstance()->getValue('
|
|
||||||
SELECT
|
return Db::getInstance()->getValue('
|
||||||
`public_name`
|
SELECT
|
||||||
FROM `'._DB_PREFIX_.'attribute_group_lang`
|
`public_name`
|
||||||
|
FROM `'._DB_PREFIX_.'attribute_group_lang`
|
||||||
WHERE `id_attribute_group` = "'.(int)$id_attr.'"
|
WHERE `id_attribute_group` = "'.(int)$id_attr.'"
|
||||||
AND `id_lang` = "'.(int)$id_lang.'"
|
AND `id_lang` = "'.(int)$id_lang.'"
|
||||||
');
|
');
|
||||||
|
Loading…
Reference in New Issue
Block a user