_select2 = true; $id_category = Tools::getValue('id_category', 1); $id_product = Tools::getValue('id_product', false); $db = Db::getInstance(); $sql_category = ' SELECT c.`id_category`, cl.`name` FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category` WHERE c.`id_parent` = 1 AND cl.`id_lang` = '.(int) $cookie->id_lang.' ORDER BY c.`id_category` DESC'; $categories = $db->ExecuteS($sql_category); $ids_categories = array(); foreach ($categories as $key => $category) { $ids_categories[] = (int) $category["id_category"]; } $small_titles = array(); foreach (Db::getInstance()->executeS(' SELECT ex.`value`, ps.`id_category` FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` ex LEFT JOIN `'._DB_PREFIX_.'privatesale` ps on ex.`id_sale` = ps.`id_sale` LEFT JOIN `'._DB_PREFIX_.'category` c on c.`id_category` = ps.`id_category` WHERE ex.`id_field` = 1 AND ex.`id_lang` = '. (int) $cookie->id_lang.' AND c.`id_category` IN ('.implode(',', $ids_categories).') ') as $key => $data) { $small_titles[(int) $data['id_category']] = $data['value']; } $this->_html .= $helperForm->renderStyle(); $this->_html .= $this->_buildHtmlCategoryBlock($categories, $small_titles); $helperForm->_js .= ' '; $this->_html .= $helperForm->renderScript(); $iso = Language::getIsoById((int)($cookie->id_lang)); $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en'); $ad = dirname($_SERVER["PHP_SELF"]); $this->_html.= ' '; echo $this->_html; } private function _buildHtmlCategoryBlock($categories, $small_titles) { global $cookie; $token = Tools::getAdminToken('AdminBraderie'.(int)(Tab::getIdFromClassName('AdminBraderie')).(int)($cookie->id_employee)); $html = '

'.$this->l('Braderie').'

Produit

'; // $html = ' // //
// '.$this->l('Braderie').' //
'; // if ($this->error) { // $html .= '

'.$this->error.'

'; // } else { // $html .= '

'.$this->error.'

'; // } // $html .=' // '; // $html .= '
// // //
// // // // // // // //
//
'; return $html; } }