NeedZoom Posted October 10, 2016 Share Posted October 10, 2016 Bonjour, je cherche à lister les catégories actives dans mon shop. array('type' => 'select', 'label' => $this->l('Product'), 'name' => 'id_product', 'required' => true, 'default_value' => 1, 'options' => array('query' => Product::getProducts($this->context->cookie->id_lang, 1, 1000, 'name', 'ASC'), 'id' => 'id_product', 'name' => 'name')), je veux utiliser comment la liste de produits comme ce ci merci de m'aider. Link to comment Share on other sites More sharing options...
NeedZoom Posted October 13, 2016 Author Share Posted October 13, 2016 array('type' => 'select', 'label' => $this->l('Category'), 'name' => 'id_category', 'required' => false, 'default_value' => 1, 'options' => array('query' => Category::getMyCategory($this->context->language->id, true, false), 'id' => 'id_category', 'name' => 'name')), My class override: class Category extends CategoryCore { static public function getMyCategory($id_lang, $active = true, $order = true) { if (!Validate::isBool($active)) die(Tools::displayError()); $result = Db::getInstance()->ExecuteS(' SELECT * FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category` WHERE `id_lang` = '.intval($id_lang).' AND not INSTR("Racine Accueil" ,`name`)<>0 '.($active ? 'AND `active` = 1' : '').' ORDER BY `name` ASC'); if (!$order) return $result; $categories = array(); foreach ($result AS $row) $categories[$row['id_parent']][$row['id_category']]['infos'] = $row; return $categories; } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now