/**
  * Modifying initial getList method to display position feature (drag and drop)
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if ($order_by && $this->context->cookie->__get($this->table . 'Orderby')) {
         $order_by = $this->context->cookie->__get($this->table . 'Orderby');
     } else {
         $order_by = 'position';
     }
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     if ($this->_list && is_array($this->_list)) {
         foreach ($this->_list as $key => $list) {
             if ($list['carrier_name'] == '0') {
                 $this->_list[$key]['carrier_name'] = Carrier::getCarrierNameFromShopName();
             }
         }
     }
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     if ($this->_list && is_array($this->_list)) {
         foreach ($this->_list as $key => $list) {
             if ($list['carrier_name'] == '0') {
                 $this->_list[$key]['carrier_name'] = Configuration::get('PS_SHOP_NAME');
             }
         }
     }
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     if (isset($this->_virtual_item_list) && !empty($this->_virtual_item_list)) {
         foreach ($this->_list as &$item) {
             foreach ($this->_virtual_item_list as $key) {
                 $item[$key] = '';
             }
         }
     }
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     foreach ($this->_list as $k => $list) {
         if ($list['reduction_type'] == 'amount') {
             $this->_list[$k]['reduction_type'] = $this->list_reduction_type['amount'];
         } elseif ($list['reduction_type'] == 'percentage') {
             $this->_list[$k]['reduction_type'] = $this->list_reduction_type['percentage'];
         }
     }
 }
 public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
 {
     parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, 0);
     if (!empty($this->_list)) {
         $nb = count($this->_list);
         for ($i = 0; $i < $nb; $i++) {
             if (Configuration::get('APH_PROFILE_STORE_EMPLOYEE') == $this->_list[$i]['id_profile']) {
                 $this->_list[$i]['email'] = '-';
             }
         }
     }
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     $shop_group_delete_list = array();
     // test store authorized to remove
     foreach ($this->_list as $shop_group) {
         $shops = Shop::getShops(true, $shop_group['id_shop_group']);
         if (!empty($shops)) {
             $shop_group_delete_list[] = $shop_group['id_shop_group'];
         }
     }
     $this->addRowActionSkipList('delete', $shop_group_delete_list);
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     foreach ($this->_list as $k => $list) {
         $currency = $this->cldr->getCurrency($this->_list[$k]['currency_iso_code']);
         $this->_list[$k]['currency_name'] = ucfirst($currency['name']);
         if ($list['reduction_type'] == 'amount') {
             $this->_list[$k]['reduction_type'] = $this->list_reduction_type['amount'];
         } elseif ($list['reduction_type'] == 'percentage') {
             $this->_list[$k]['reduction_type'] = $this->list_reduction_type['percentage'];
         }
     }
 }
Ejemplo n.º 9
0
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList((int) $id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     if (count($this->_list)) {
         $this->product_attachements = Attachment::getProductAttached((int) $id_lang, $this->_list);
         $list_product_list = array();
         foreach ($this->_list as $list) {
             $product_list = '';
             if (isset($this->product_attachements[$list['id_attachment']])) {
                 foreach ($this->product_attachements[$list['id_attachment']] as $product) {
                     $product_list .= $product . ', ';
                 }
             }
             $list_product_list[$list['id_attachment']] = $product_list;
         }
         // Assign array in list_action_delete.tpl
         $this->tpl_delete_link_vars = array('product_list' => $list_product_list, 'product_attachements' => $this->product_attachements);
     }
 }
 /**
  * Modifying initial getList method to display position feature (drag and drop)
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if (Tools::isSubmit($this->table . 'Orderby') || Tools::isSubmit($this->table . 'Orderway')) {
         $this->filter = true;
     }
     if ($order_by && $this->context->cookie->__get($this->table . 'Orderby')) {
         $order_by = $this->context->cookie->__get($this->table . 'Orderby');
     } else {
         $order_by = 'position';
     }
     if (is_null($order_way)) {
         $order_way = Tools::getValue($this->table . 'Orderway', 'ASC');
     }
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
 }
Ejemplo n.º 11
0
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if (Shop::getContext() == Shop::CONTEXT_GROUP) {
         $this->_where .= ' AND a.id_shop_group = ' . (int) Shop::getContextShopGroupID();
     }
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     $shop_delete_list = array();
     // don't allow to remove shop which have dependencies (customers / orders / ... )
     foreach ($this->_list as &$shop) {
         if (Shop::hasDependency($shop['id_shop'])) {
             $shop_delete_list[] = $shop['id_shop'];
         }
     }
     $this->context->smarty->assign('shops_having_dependencies', $shop_delete_list);
 }
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  *
  * @param int         $id_lang
  * @param string|null $order_by
  * @param string|null $order_way
  * @param int         $start
  * @param int|null    $limit
  * @param int|bool    $id_lang_shop
  *
  * @throws PrestaShopException
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     // foreach item in the list to render
     $nb_items = count($this->_list);
     for ($i = 0; $i < $nb_items; ++$i) {
         // depending on the management type, translates the management type
         $item =& $this->_list[$i];
         switch ($item['management_type']) {
             // management type can be either WA/FIFO/LIFO
             case 'WA':
                 $item['management_type'] = $this->l('WA: Weighted Average');
                 break;
             case 'FIFO':
                 $item['management_type'] = $this->l('FIFO: First In, First Out');
                 break;
             case 'LIFO':
                 $item['management_type'] = $this->l('LIFO: Last In, First Out');
                 break;
         }
     }
 }
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     if ($this->ajax) {
         foreach ($this->_list as &$list) {
             if (file_exists(_PS_IMG_DIR_ . $this->fieldImageSettings['dir'] . '/' . (int) $list['id_attribute'] . '.jpg')) {
                 if (!isset($list['color']) || !is_array($list['color'])) {
                     $list['color'] = array();
                 }
                 $list['color']['texture'] = '../img/' . $this->fieldImageSettings['dir'] . '/' . (int) $list['id_attribute'] . '.jpg';
             }
         }
     } else {
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; ++$i) {
             $item =& $this->_list[$i];
             $query = new DbQuery();
             $query->select('COUNT(a.id_attribute) as count_values');
             $query->from('attribute', 'a');
             $query->join(Shop::addSqlAssociation('attribute', 'a'));
             $query->where('a.id_attribute_group =' . (int) $item['id_attribute_group']);
             $query->groupBy('attribute_shop.id_shop');
             $query->orderBy('count_values DESC');
             $item['count_values'] = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
             unset($query);
         }
     }
 }
 public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
 {
     parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, 0);
     $currency = $this->context->currency;
     if (!empty($this->_list)) {
         $nb = count($this->_list);
         for ($i = 0; $i < $nb; $i++) {
             //$image = new AphOfferImage((int)$this->_list[$i]['id_image']);
             //$this->_list[$i]['image'] = AphOfferImage::getImgFolderStatic((int)$this->_list[$i]['id_image']).$this->_list[$i]['id_image'].'.jpg';
             $this->_list[$i]['available'] = 'Dal ' . Tools::displayDate($this->_list[$i]['available_from_date'], (int) Context::getContext()->language->id, false) . ' al ' . Tools::displayDate($this->_list[$i]['available_to_date'], (int) Context::getContext()->language->id, false);
             $this->_list[$i]['visible'] = 'Dal ' . Tools::displayDate($this->_list[$i]['visible_from_date'], (int) Context::getContext()->language->id, false) . ' al ' . Tools::displayDate($this->_list[$i]['visible_to_date'], (int) Context::getContext()->language->id, false);
             $this->_list[$i]['new_price'] = $this->_list[$i]['price_wt'] < 0 ? $this->_list[$i]['reduction_type'] == 'percentage' ? '-' . intval(round($this->_list[$i]['reduction'])) . '%' : '-' . Tools::displayPrice($this->_list[$i]['reduction'], (int) Context::getContext()->currency->id) : Tools::displayPrice($this->_list[$i]['price_wt'], (int) Context::getContext()->currency->id) . ' ';
         }
     }
 }
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     $nb_items = count($this->_list);
     for ($i = 0; $i < $nb_items; ++$i) {
         if (isset($this->_list[$i]['messages'])) {
             $this->_list[$i]['messages'] = Tools::htmlentitiesDecodeUTF8($this->_list[$i]['messages']);
         }
     }
 }
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  *
  * @param int         $id_lang
  * @param string|null $order_by
  * @param string|null $order_way
  * @param int         $start
  * @param int|null    $limit
  * @param int|bool    $id_lang_shop
  *
  * @throws PrestaShopException
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     // Check each row to see if there are combinations and get the correct action in consequence
     $nb_items = count($this->_list);
     for ($i = 0; $i < $nb_items; $i++) {
         $item =& $this->_list[$i];
         // if it's an ajax request we have to consider manipulating a product variation
         if (Tools::isSubmit('id_product')) {
             $item['name'] = Product::getProductName($item['id_product'], $item['id']);
             // no details for this row
             $this->addRowActionSkipList('details', array($item['id']));
             // specify actions in function of stock
             $this->skipActionByStock($item, true);
         } elseif (array_key_exists('variations', $item) && (int) $item['variations'] > 0) {
             // we have to desactivate stock actions on current row
             $this->addRowActionSkipList('addstock', array($item['id']));
             $this->addRowActionSkipList('removestock', array($item['id']));
             $this->addRowActionSkipList('transferstock', array($item['id']));
             // does not display these informaions because this product has combinations
             $item['reference'] = '--';
             $item['ean13'] = '--';
             $item['upc'] = '--';
         } else {
             //there are no variations of current product, so we don't want to show details action
             $this->addRowActionSkipList('details', array($item['id']));
             // specify actions in function of stock
             $this->skipActionByStock($item, false);
         }
         // Checks access
         if (!($this->tabAccess['add'] === '1')) {
             $this->addRowActionSkipList('addstock', array($item['id']));
         }
         if (!($this->tabAccess['delete'] === '1')) {
             $this->addRowActionSkipList('removestock', array($item['id']));
         }
         if (!($this->tabAccess['edit'] === '1')) {
             $this->addRowActionSkipList('transferstock', array($item['id']));
         }
     }
 }
 public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
 {
     parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);
     if ($this->_list) {
         foreach ($this->_list as &$row) {
             $row['badge_success'] = $row['total_spent'] > 0;
         }
     }
 }
Ejemplo n.º 18
0
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if (Tools::isSubmit('csv_orders') || Tools::isSubmit('csv_orders_details') || Tools::isSubmit('csv_order_details')) {
         $limit = false;
     }
     // defines button specific for non-template supply orders
     if (!$this->is_template_list && $this->display != 'details') {
         // adds export csv buttons
         $this->toolbar_btn['export-csv-orders'] = array('short' => 'Export Orders', 'href' => $this->context->link->getAdminLink('AdminSupplyOrders') . '&csv_orders&id_warehouse=' . $this->getCurrentWarehouse(), 'desc' => $this->l('Export Orders (CSV)'), 'class' => 'process-icon-export');
         $this->toolbar_btn['export-csv-details'] = array('short' => 'Export Orders Details', 'href' => $this->context->link->getAdminLink('AdminSupplyOrders') . '&csv_orders_details&id_warehouse=' . $this->getCurrentWarehouse(), 'desc' => $this->l('Export Orders Details (CSV)'), 'class' => 'process-icon-export');
         unset($this->toolbar_btn['new']);
         if ($this->tabAccess['add'] === '1') {
             $this->toolbar_btn['new'] = array('href' => self::$currentIndex . '&add' . $this->table . '&token=' . $this->token, 'desc' => $this->l('Add New'));
         }
     }
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     // adds colors depending on the receipt state
     if ($order_by == 'quantity_expected') {
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; ++$i) {
             $item =& $this->_list[$i];
             if ($item['quantity_received'] == $item['quantity_expected']) {
                 $item['color'] = '#00bb35';
             } elseif ($item['quantity_received'] > $item['quantity_expected']) {
                 $item['color'] = '#fb0008';
             }
         }
     }
     // actions filters on supply orders list
     if ($this->table == 'supply_order') {
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; $i++) {
             // if the current state doesn't allow order edit, skip the edit action
             if ($this->_list[$i]['editable'] == 0) {
                 $this->addRowActionSkipList('edit', $this->_list[$i]['id_supply_order']);
             }
             if ($this->_list[$i]['enclosed'] == 1 && $this->_list[$i]['receipt_state'] == 0) {
                 $this->addRowActionSkipList('changestate', $this->_list[$i]['id_supply_order']);
             }
             if (1 != $this->_list[$i]['pending_receipt']) {
                 $this->addRowActionSkipList('updatereceipt', $this->_list[$i]['id_supply_order']);
             }
         }
     }
 }
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  *
  * @param int         $id_lang
  * @param string|null $order_by
  * @param string|null $order_way
  * @param int         $start
  * @param int|null    $limit
  * @param int|bool    $id_lang_shop
  *
  * @throws PrestaShopException
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if (Tools::isSubmit('id_stock')) {
         parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; $i++) {
             $item =& $this->_list[$i];
             $manager = StockManagerFactory::getManager();
             // gets quantities and valuation
             $query = new DbQuery();
             $query->select('SUM(physical_quantity) as physical_quantity');
             $query->select('SUM(usable_quantity) as usable_quantity');
             $query->select('SUM(price_te * physical_quantity) as valuation');
             $query->from('stock');
             $query->where('id_product = ' . (int) $item['id_product'] . ' AND id_product_attribute = ' . (int) $item['id_product_attribute']);
             if ($this->getCurrentCoverageWarehouse() != -1) {
                 $query->where('id_warehouse = ' . (int) $this->getCurrentCoverageWarehouse());
             }
             $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
             $item['physical_quantity'] = $res['physical_quantity'];
             $item['usable_quantity'] = $res['usable_quantity'];
             $item['valuation'] = $res['valuation'];
             $item['real_quantity'] = $manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $this->getCurrentCoverageWarehouse() == -1 ? null : array($this->getCurrentCoverageWarehouse()), true);
         }
     } else {
         if ((Tools::isSubmit('csv_quantities') || Tools::isSubmit('csv_prices')) && (int) Tools::getValue('id_warehouse') != -1) {
             $limit = false;
         }
         $order_by_valuation = false;
         $order_by_real_quantity = false;
         if ($this->context->cookie->{$this->table . 'Orderby'} == 'valuation') {
             unset($this->context->cookie->{$this->table . 'Orderby'});
             $order_by_valuation = true;
         } elseif ($this->context->cookie->{$this->table . 'Orderby'} == 'real_quantity') {
             unset($this->context->cookie->{$this->table . 'Orderby'});
             $order_by_real_quantity = true;
         }
         parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; ++$i) {
             $item =& $this->_list[$i];
             $item['price_te'] = '--';
             $item[$this->identifier] = $item['id_product'] . '_' . $item['id_product_attribute'];
             // gets stock manager
             $manager = StockManagerFactory::getManager();
             // gets quantities and valuation
             $query = new DbQuery();
             $query->select('SUM(physical_quantity) as physical_quantity');
             $query->select('SUM(usable_quantity) as usable_quantity');
             $query->select('SUM(price_te * physical_quantity) as valuation');
             $query->from('stock');
             $query->where('id_product = ' . (int) $item['id_product'] . ' AND id_product_attribute = ' . (int) $item['id_product_attribute']);
             if ($this->getCurrentCoverageWarehouse() != -1) {
                 $query->where('id_warehouse = ' . (int) $this->getCurrentCoverageWarehouse());
             }
             $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
             $item['physical_quantity'] = $res['physical_quantity'];
             $item['usable_quantity'] = $res['usable_quantity'];
             // gets real_quantity depending on the warehouse
             $item['real_quantity'] = $manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $this->getCurrentCoverageWarehouse() == -1 ? null : array($this->getCurrentCoverageWarehouse()), true);
             // removes the valuation if the filter corresponds to 'all warehouses'
             if ($this->getCurrentCoverageWarehouse() == -1) {
                 $item['valuation'] = 'N/A';
             } else {
                 $item['valuation'] = $res['valuation'];
             }
         }
         if ($this->getCurrentCoverageWarehouse() != -1 && $order_by_valuation) {
             usort($this->_list, array($this, 'valuationCmp'));
         } elseif ($order_by_real_quantity) {
             usort($this->_list, array($this, 'realQuantityCmp'));
         }
     }
 }
Ejemplo n.º 20
0
 public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, Context::getContext()->shop->id);
 }
Ejemplo n.º 21
0
 public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
 {
     $orderByPriceFinal = empty($orderBy) ? $this->context->cookie->__get($this->table . 'Orderby') ? $this->context->cookie->__get($this->table . 'Orderby') : 'id_' . $this->table : $orderBy;
     $orderWayPriceFinal = empty($orderWay) ? $this->context->cookie->__get($this->table . 'Orderway') ? $this->context->cookie->__get($this->table . 'Orderby') : 'ASC' : $orderWay;
     if ($orderByPriceFinal == 'price_final') {
         $orderBy = 'id_' . $this->table;
         $orderWay = 'ASC';
     }
     parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $this->context->shop->id);
     /* update product quantity with attributes ...*/
     $nb = count($this->_list);
     if ($this->_list) {
         $context = $this->context->cloneContext();
         $context->shop = clone $context->shop;
         /* update product final price */
         for ($i = 0; $i < $nb; $i++) {
             if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP) {
                 $context->shop = new Shop((int) $this->_list[$i]['id_shop_default']);
             }
             // convert price with the currency from context
             $this->_list[$i]['price'] = Tools::convertPrice($this->_list[$i]['price'], $this->context->currency, true, $this->context);
             $this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, null, 2, null, false, true, 1, true, null, null, null, $nothing, true, true, $context);
         }
     }
     if ($orderByPriceFinal == 'price_final') {
         if (strtolower($orderWayPriceFinal) == 'desc') {
             uasort($this->_list, 'cmpPriceDesc');
         } else {
             uasort($this->_list, 'cmpPriceAsc');
         }
     }
     for ($i = 0; $this->_list && $i < $nb; $i++) {
         $this->_list[$i]['price_final'] = $this->_list[$i]['price_tmp'];
         unset($this->_list[$i]['price_tmp']);
     }
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     $alias = 'sa';
     parent::getList($id_lang, $alias . '.position', $order_way, $start, $limit, Context::getContext()->shop->id);
     // Check each row to see if there are combinations and get the correct action in consequence
     $nb_items = count($this->_list);
     for ($i = 0; $i < $nb_items; $i++) {
         $item =& $this->_list[$i];
         $category_tree = Category::getChildren((int) $item['id_category'], $this->context->language->id);
         if (!count($category_tree)) {
             $this->addRowActionSkipList('view', array($item['id_category']));
         }
     }
 }
Ejemplo n.º 23
0
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  *
  * @param int         $id_lang
  * @param string|null $order_by
  * @param string|null $order_way
  * @param int         $start
  * @param int|null    $limit
  * @param int|bool    $id_lang_shop
  *
  * @throws PrestaShopException
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     if ($this->display == 'details') {
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; ++$i) {
             $item =& $this->_list[$i];
             $item['name'] = Product::getProductName($item['id_product'], $item['id']);
             // computes coverage
             $coverage = StockManagerFactory::getManager()->getProductCoverage($item['id_product'], $item['id'], Tools::getValue('period') ? (int) Tools::getValue('period') : 7, $this->getCurrentCoverageWarehouse() == -1 ? null : Tools::getValue('id_warehouse', -1));
             if ($coverage != -1) {
                 // if coverage is available
                 if ($coverage < $this->getCurrentWarning()) {
                     // if highlight needed
                     $item['color'] = '#BDE5F8';
                 }
                 $item['coverage'] = $coverage;
             } else {
                 // infinity
                 $item['coverage'] = '--';
             }
             // computes quantity sold
             $qty_sold = $this->getQuantitySold($item['id_product'], $item['id'], $this->getCurrentCoveragePeriod());
             if (!$qty_sold) {
                 $item['qty_sold'] = '--';
             } else {
                 $item['qty_sold'] = $qty_sold;
             }
         }
     } else {
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; ++$i) {
             $item =& $this->_list[$i];
             if (array_key_exists('variations', $item) && (int) $item['variations'] <= 0) {
                 // computes coverage and displays (highlights if needed)
                 $coverage = StockManagerFactory::getManager()->getProductCoverage($item['id'], 0, $this->getCurrentCoveragePeriod(), $this->getCurrentCoverageWarehouse() == -1 ? null : $this->getCurrentCoverageWarehouse());
                 if ($coverage != -1) {
                     // coverage is available
                     if ($coverage < $this->getCurrentWarning()) {
                         $item['color'] = '#BDE5F8';
                     }
                     $item['coverage'] = $coverage;
                 } else {
                     // infinity
                     $item['coverage'] = '--';
                 }
                 // computes quantity sold
                 $qty_sold = $this->getQuantitySold($item['id'], 0, $this->getCurrentCoveragePeriod());
                 if (!$qty_sold) {
                     $item['qty_sold'] = '--';
                 } else {
                     $item['qty_sold'] = $qty_sold;
                 }
                 // removes 'details' action on products without attributes
                 $this->addRowActionSkipList('details', array($item['id']));
             } else {
                 $item['stock'] = $this->l('See details');
                 $item['reference'] = '--';
                 $item['ean13'] = '--';
                 $item['upc'] = '--';
             }
         }
     }
 }
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     //If there is a field product_name in the list, check if this field is null and display standard message
     foreach ($this->fields_list as $key => $value) {
         if ($key == 'product_name') {
             $nb_items = count($this->_list);
             for ($i = 0; $i < $nb_items; ++$i) {
                 $item =& $this->_list[$i];
                 if (empty($item['product_name'])) {
                     $item['product_name'] = $this->l('The name of this product is not available. It may have been deleted from the system.');
                 }
             }
         }
     }
 }
 /**
  * AdminController::getList() override
  * @see AdminController::getList()
  */
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if ($this->table == 'feature_value') {
         $this->_where .= ' AND (a.custom = 0 OR a.custom IS NULL)';
     }
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
     if ($this->table == 'feature') {
         $nb_items = count($this->_list);
         for ($i = 0; $i < $nb_items; ++$i) {
             $item =& $this->_list[$i];
             $query = new DbQuery();
             $query->select('COUNT(fv.id_feature_value) as count_values');
             $query->from('feature_value', 'fv');
             $query->where('fv.id_feature =' . (int) $item['id_feature']);
             $query->where('(fv.custom=0 OR fv.custom IS NULL)');
             $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
             $item['value'] = (int) $res;
             unset($query);
         }
     }
 }