public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL) { $orderByPriceFinal = empty($orderBy) ? Tools::getValue($this->table . 'Orderby', 'id_' . $this->table) : $orderBy; $orderWayPriceFinal = empty($orderWay) ? Tools::getValue($this->table . 'Orderway', 'ASC') : $orderWay; if ($orderByPriceFinal == 'price_final') { $orderBy = 'id_' . $this->table; $orderWay = 'ASC'; } parent::getList($id_lang, $orderBy, $orderWay, $start, $limit); /* update product quantity with attributes ...*/ if ($this->_list) { $nb = count($this->_list); for ($i = 0; $i < $nb; $i++) { Attribute::updateQtyProduct($this->_list[$i]); } /* update product final price */ for ($i = 0; $i < $nb; $i++) { $this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], $usetax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true); } } if ($orderByPriceFinal == 'price_final') { if (strtolower($orderWayPriceFinal) == 'desc') { uasort($this->_list, 'cmpPriceDesc'); } else { uasort($this->_list, 'cmpPriceAsc'); } } for ($i = 0; $this->_list and $i < $nb; $i++) { $this->_list[$i]['price_final'] = $this->_list[$i]['price_tmp']; unset($this->_list[$i]['price_tmp']); } }
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL) { global $cookie; $orderByPriceFinal = empty($orderBy) ? $cookie->__get($this->table . 'Orderby') ? $cookie->__get($this->table . 'Orderby') : 'id_' . $this->table : $orderBy; $orderWayPriceFinal = empty($orderWay) ? $cookie->__get($this->table . 'Orderway') ? $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); /* update product quantity with attributes ...*/ if ($this->_list) { $nb = count($this->_list); for ($i = 0; $i < $nb; $i++) { Attribute::updateQtyProduct($this->_list[$i]); } /* update product final price */ for ($i = 0; $i < $nb; $i++) { $this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, NULL, 6, NULL, false, true, 1, true); } } if ($orderByPriceFinal == 'price_final') { if (strtolower($orderWayPriceFinal) == 'desc') { uasort($this->_list, 'cmpPriceDesc'); } else { uasort($this->_list, 'cmpPriceAsc'); } } for ($i = 0; $this->_list and $i < $nb; $i++) { $this->_list[$i]['price_final'] = $this->_list[$i]['price_tmp']; unset($this->_list[$i]['price_tmp']); } }