public function __construct()
    {
        global $currentIndex;
        $this->table = 'product';
        $this->className = 'Product';
        $this->lang = true;
        $this->edit = true;
        $this->delete = true;
        $this->view = false;
        $this->duplicate = true;
        $this->imageType = 'jpg';
        $this->maxImageSize = Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1000000;
        $this->maxFileSize = Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000;
        $this->fieldsDisplay = array('id_product' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 20), 'image' => array('title' => $this->l('Photo'), 'align' => 'center', 'image' => 'p', 'width' => 45, 'orderby' => false, 'filter' => false, 'search' => false), 'name' => array('title' => $this->l('Name'), 'width' => 220, 'filter_key' => 'b!name'), 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 20), 'price' => array('title' => $this->l('Base price'), 'width' => 70, 'price' => true, 'align' => 'right', 'filter_key' => 'a!price'), 'price_final' => array('title' => $this->l('Final price'), 'width' => 70, 'price' => true, 'align' => 'right', 'havingFilter' => true, 'orderby' => false), 'quantity' => array('title' => $this->l('Quantity'), 'width' => 30, 'align' => 'right', 'filter_key' => 'a!quantity', 'type' => 'decimal'), 'position' => array('title' => $this->l('Position'), 'width' => 40, 'filter_key' => 'cp!position', 'align' => 'center', 'position' => 'position'), 'a!active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'filter_key' => 'a!active', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
        /* Join categories table */
        $this->_category = AdminCatalog::getCurrentCategory();
        $this->_join = '
		LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
		LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_product` = a.`id_product`)
		LEFT JOIN `' . _DB_PREFIX_ . 'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = ' . (int) Country::getDefaultCountryId() . ' AND tr.`id_state` = 0)
		LEFT JOIN `' . _DB_PREFIX_ . 'tax` t ON (t.`id_tax` = tr.`id_tax`)';
        $this->_filter = 'AND cp.`id_category` = ' . (int) $this->_category->id;
        $this->_select = 'cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final';
        parent::__construct();
    }
Beispiel #2
0
 public function __construct()
 {
     global $cookie;
     $this->table = 'category';
     $this->className = 'Category';
     $this->lang = true;
     $this->edit = true;
     $this->view = true;
     $this->delete = true;
     $this->fieldImageSettings = array('name' => 'image', 'dir' => 'c');
     $this->fieldsDisplay = array('id_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30), 'name' => array('title' => $this->l('Name'), 'width' => 100, 'callback' => 'hideCategoryPosition'), 'description' => array('title' => $this->l('Description'), 'width' => 480, 'maxlength' => 90, 'orderby' => false), 'physical_products_quantity' => array('title' => $this->l('In stock Products'), 'align' => 'center', 'width' => 50), 'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
     $this->_category = AdminCatalog::getCurrentCategory();
     $this->_filter = 'AND `id_parent` = ' . intval($this->_category->id);
     $children = Category::getChildren($this->_category->id, $cookie->id_lang);
     foreach ($children as &$child) {
         $tmp_list = $this->_category->id . ',';
         $obj = new Category($child['id_category']);
         $parents = $obj->getParentsCategories();
         foreach ($parents as $parent) {
             $tmp_list .= $parent['id_category'] . ',';
         }
         $child['parent_id_list'] = rtrim($tmp_list, ',');
     }
     parent::__construct();
 }
 public function __construct()
 {
     global $cookie;
     $this->table = 'category';
     $this->className = 'Category';
     $this->lang = true;
     $this->edit = true;
     $this->view = true;
     $this->delete = true;
     $this->fieldImageSettings = array('name' => 'image', 'dir' => 'c');
     $this->fieldsDisplay = array('id_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30), 'name' => array('title' => $this->l('Name'), 'width' => 100, 'callback' => 'hideCategoryPosition'), 'description' => array('title' => $this->l('Description'), 'width' => 560, 'maxlength' => 90, 'orderby' => false), 'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
     $this->_category = AdminCatalog::getCurrentCategory();
     $this->_filter = 'AND `id_parent` = ' . intval($this->_category->id);
     parent::__construct();
 }
 public function __construct()
 {
     /* Get current category */
     $id_category = abs((int) Tools::getValue('id_category'));
     if (!$id_category) {
         $id_category = 1;
     }
     self::$_category = new Category($id_category);
     if (!Validate::isLoadedObject(self::$_category)) {
         die('Category cannot be loaded');
     }
     $this->table = array('category', 'product');
     $this->adminCategories = new AdminCategories();
     $this->adminProducts = new AdminProducts();
     parent::__construct();
 }
 protected function l($string, $class = 'AdminTab', $addslashes = FALSE, $htmlentities = TRUE)
 {
     if ($class != __CLASS__) {
         if (!in_array($class, array("AdminCategories", "AdminProducts"))) {
             $class = "AdminCatalog";
         }
         $parentTranslation = parent::l($string, $class, $addslashes, $htmlentities);
         if ($string != $parentTranslation) {
             return $parentTranslation;
         }
         global $_LANGADM;
         $key = md5(str_replace('\'', '\\\'', $string));
         $str = key_exists($class . $key, $_LANGADM) ? $_LANGADM[$class . $key] : $string;
         $str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str;
         return str_replace('"', '"', $addslashes ? addslashes($str) : stripslashes($str));
     }
     return exfeatures::getInstance()->l($string, strtolower($class));
 }
    public function __construct()
    {
        global $currentIndex;
        $this->table = 'product';
        $this->className = 'Product';
        $this->lang = true;
        $this->edit = true;
        $this->delete = true;
        $this->view = false;
        $this->duplicate = true;
        $this->imageType = 'jpg';
        $this->fieldsDisplay = array('id_product' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 20), 'image' => array('title' => $this->l('Photo'), 'align' => 'center', 'image' => 'p', 'width' => 45, 'orderby' => false, 'filter' => false, 'search' => false), 'name' => array('title' => $this->l('Name'), 'width' => 277, 'filter_key' => 'b!name'), 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 20), 'price' => array('title' => $this->l('Base price'), 'width' => 70, 'price' => true, 'align' => 'right', 'filter_key' => 'a!price'), 'price_final' => array('title' => $this->l('Final price'), 'width' => 70, 'price' => true, 'align' => 'right'), 'quantity' => array('title' => $this->l('Quantity'), 'width' => 30, 'align' => 'right', 'filter_key' => 'a!quantity', 'type' => 'decimal'), 'position' => array('title' => $this->l('Position'), 'width' => 40, 'align' => 'center', 'position' => 'position'), 'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
        /* Join categories table */
        $this->_category = AdminCatalog::getCurrentCategory();
        $this->_join = '
		LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
		LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_product` = a.`id_product`)';
        $this->_filter = 'AND cp.`id_category` = ' . intval($this->_category->id);
        $this->_select = 'cp.`position`, i.`id_image`';
        parent::__construct();
    }