add palier by categorie
This commit is contained in:
parent
7387b73078
commit
8b78c80ac1
@ -9,8 +9,11 @@ class Category extends CategoryCore
|
|||||||
public $long_description;
|
public $long_description;
|
||||||
public $liste_icons_univers;
|
public $liste_icons_univers;
|
||||||
public $linkExclusive;
|
public $linkExclusive;
|
||||||
|
public $level_price_listing;
|
||||||
|
|
||||||
|
|
||||||
|
public static $paliers = array();
|
||||||
|
|
||||||
public static $definition = array(
|
public static $definition = array(
|
||||||
'table' => 'category',
|
'table' => 'category',
|
||||||
'primary' => 'id_category',
|
'primary' => 'id_category',
|
||||||
@ -25,7 +28,8 @@ class Category extends CategoryCore
|
|||||||
'id_parent' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
'id_parent' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||||
'id_shop_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
'id_shop_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||||
'is_root_category' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
'is_root_category' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
'position' => array('type' => self::TYPE_INT),
|
'position' => array('type' => self::TYPE_INT),
|
||||||
|
'level_price_listing' => array('type' => self::TYPE_INT),
|
||||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
|
|
||||||
@ -43,6 +47,22 @@ class Category extends CategoryCore
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** Récupere le palier pour afficher le prix de la déclinaison dans la bonne quantité paramétre par catégorie */
|
||||||
|
public static function getPalier($id_category)
|
||||||
|
{
|
||||||
|
if(empty(self::$paliers)) {
|
||||||
|
foreach (Db::getInstance()->executeS('
|
||||||
|
SELECT `id_category`, `level_price_listing`
|
||||||
|
FROM `'._DB_PREFIX_.'category`
|
||||||
|
') as $key => $value) {
|
||||||
|
self::$paliers[$value['id_category']] = $value['level_price_listing'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isset(self::$paliers[$id_category])) {
|
||||||
|
return self::$paliers[$id_category];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function getChildrenIds($id_parent, $id_lang, $active = true, $id_shop = false)
|
public static function getChildrenIds($id_parent, $id_lang, $active = true, $id_shop = false)
|
||||||
{
|
{
|
||||||
if (!Validate::isBool($active))
|
if (!Validate::isBool($active))
|
||||||
|
@ -92,6 +92,17 @@ class AdminCategoriesController extends AdminCategoriesControllerCore
|
|||||||
'class' => 'copy2friendlyUrl',
|
'class' => 'copy2friendlyUrl',
|
||||||
'hint' => $this->l('Invalid characters:').' <>;=#{}',
|
'hint' => $this->l('Invalid characters:').' <>;=#{}',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'select',
|
||||||
|
'label' => $this->l('Palier de quantité pour le prix sur les listings'),
|
||||||
|
'name' => 'level_price_listing',
|
||||||
|
'hint' => $this->l('Choose a category'),
|
||||||
|
'options' => array(
|
||||||
|
'query' => AttributeGroup::getAttributes(1,5),
|
||||||
|
'id' => 'id_attribute',
|
||||||
|
'name' => 'name',
|
||||||
|
)
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'type' => 'switch',
|
'type' => 'switch',
|
||||||
'label' => $this->l('Displayed'),
|
'label' => $this->l('Displayed'),
|
||||||
@ -178,7 +189,6 @@ class AdminCategoriesController extends AdminCategoriesControllerCore
|
|||||||
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1&folder=home',
|
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1&folder=home',
|
||||||
'hint' => $this->l('Upload a category image from your computer.'),
|
'hint' => $this->l('Upload a category image from your computer.'),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => $this->l('Icone category'),
|
'label' => $this->l('Icone category'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user