public function __construct() { parent::__construct(); $this->fields_list['physical_quantity']['callback'] = 'callbackPhysicalQuantity'; $this->fields_list['usable_quantity']['callback'] = 'callbackUsableQuantity'; $this->fields_list['real_quantity']['callback'] = 'callbackRealQuantity'; }
public function renderDetails() { if (Tools::isSubmit('id_stock')) { // if a product id is submit $this->lang = false; $this->table = 'stock'; $this->list_id = 'details'; $this->tpl_list_vars['show_filter'] = false; $lang_id = (int) $this->context->language->id; $this->actions = array(); $this->list_simple_header = true; $ids = explode('_', Tools::getValue('id_stock')); if (count($ids) != 2) { die; } $id_product = $ids[0]; $id_product_attribute = $ids[1]; $id_warehouse = Tools::getValue('id_warehouse', -1); $this->_select = 'IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(DISTINCT agl.`name`, \' - \', al.name SEPARATOR \', \')),pl.name) as name, w.id_currency, a.price_te'; $this->_join = ' LEFT JOIN `' . _DB_PREFIX_ . 'warehouse` AS w ON w.id_warehouse = a.id_warehouse'; $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON ( a.id_product = pl.id_product AND pl.id_lang = ' . (int) $this->context->language->id . ' )'; $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` pac ON (pac.id_product_attribute = a.id_product_attribute)'; $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'attribute` atr ON (atr.id_attribute = pac.id_attribute)'; $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON ( al.id_attribute = pac.id_attribute AND al.id_lang = ' . (int) $this->context->language->id . ' )'; $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group_lang` agl ON ( agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = ' . (int) $this->context->language->id . ' )'; $this->_where = 'AND a.id_product = ' . (int) $id_product . ' AND a.id_product_attribute = ' . (int) $id_product_attribute; if ($id_warehouse != -1) { $this->_where .= ' AND a.id_warehouse = ' . (int) $id_warehouse; } $this->_group = 'GROUP BY a.price_te'; self::$currentIndex = self::$currentIndex . '&id_stock=' . Tools::getValue('id_stock') . '&detailsstock'; return parent::renderList(); } }