* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminTags extends AdminTab { public function __construct() { global $cookie; $this->table = 'tag'; $this->className = 'Tag'; $this->edit = true; $this->delete = true; $this->fieldsDisplay = array( 'id_tag' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25, 'filter_key' => 'a!id_seller_message'), 'lang' => array('title' => $this->l('Language'), 'filter_key' => 'l!name'), 'name' => array('title' => $this->l('Name'), 'width' => 200, 'filter_key' => 'a!name'), 'products' => array('title' => $this->l('Products'), 'align' => 'right', 'havingFilter' => true)); $this->_select = 'l.name as lang, COUNT(pt.id_product) as products'; $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'product_tag` pt ON (a.`id_tag` = pt.`id_tag`) LEFT JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = a.`id_lang`)'; $this->_group = 'GROUP BY a.name, a.id_lang'; parent::__construct(); } public function postProcess() { if ($this->tabAccess['edit'] === '1' AND Tools::getValue('submitAdd'.$this->table)) if ($id = (int)(Tools::getValue($this->identifier)) AND $obj = new $this->className($id) AND Validate::isLoadedObject($obj)) $obj->setProducts($_POST['products']); return parent::postProcess(); } public function displayForm($isMainTab = true) { global $currentIndex, $cookie; parent::displayForm(); if (!($obj = $this->loadObject(true))) return; $products1 = $obj->getProducts(true); $products2 = $obj->getProducts(false); echo '
'.($obj->id ? '' : '').'
'.$this->l('Tag').'
*
*

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



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


<< '.$this->l('Add').'
 
* '.$this->l('Required field').'
'; } }