public function __construct()
 {
     parent::__construct();
     $this->fields_list['stock']['callback'] = 'callbackStockQuantity';
 }
 public function renderDetails()
 {
     if (Tools::isSubmit('id_product')) {
         // override attributes
         $this->identifier = 'id_product_attribute';
         $this->list_id = 'product_attribute';
         $this->lang = false;
         $this->addRowAction('addstock');
         $this->addRowAction('removestock');
         if (count(Warehouse::getWarehouses()) > 1) {
             $this->addRowAction('transferstock');
         }
         // no link on list rows
         $this->list_no_link = true;
         // inits toolbar
         $this->toolbar_btn = array();
         // get current lang id
         $lang_id = (int) $this->context->language->id;
         // Get product id
         $product_id = (int) Tools::getValue('id_product');
         // Load product attributes with sql override
         $this->table = 'product_attribute';
         $this->list_id = 'product_attribute';
         $this->_select = 'a.id_product_attribute as id, a.id_product, a.reference, a.ean13, a.upc';
         $this->_where = 'AND a.id_product = ' . $product_id;
         $this->_group = 'GROUP BY a.id_product_attribute';
         $this->fields_list = array('reference' => array('title' => $this->l('Product reference'), 'filter_key' => 'a!reference'), 'ean13' => array('title' => $this->l('EAN-13 or JAN barcode'), 'filter_key' => 'a!ean13'), 'upc' => array('title' => $this->l('UPC barcode'), 'filter_key' => 'a!upc'), 'name' => array('title' => $this->l('Name'), 'orderby' => false, 'filter' => false, 'search' => false), 'stock' => array('title' => $this->l('Quantity'), 'orderby' => false, 'filter' => false, 'search' => false, 'class' => 'fixed-width-sm', 'align' => 'center', 'hint' => $this->l('Quantitity total for all warehouses.')));
         self::$currentIndex = self::$currentIndex . '&id_product=' . (int) $product_id . '&detailsproduct';
         $this->processFilter();
         return parent::renderList();
     }
 }
Example #3
0
 public function initProcess()
 {
     if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
         $this->warnings[md5('PS_ADVANCED_STOCK_MANAGEMENT')] = $this->l('You need to activate advanced stock management prior to using this feature.');
         return false;
     }
     if (Tools::getIsset('detailsproduct')) {
         $this->list_id = 'product_attribute';
         if (isset($_POST['submitReset' . $this->list_id])) {
             $this->processResetFilters();
         }
     } else {
         $this->list_id = 'product';
     }
     parent::initProcess();
 }