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);
     $nb = count($this->_list);
     if ($this->_list) {
         $context = $this->context->cloneContext();
         $context->shop = clone $context->shop;
         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']);
             }
             $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']);
     }
 }
예제 #2
0
 public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = false)
 {
     global $cookie;
     if (!$this->is_seller) {
         parent::getList($id_lang, $orderBy, $orderWay, $start = 0, $limit, $id_lang_shop);
     } else {
         parent::getList(intval($cookie->id_lang), !Tools::getValue($this->table . 'Orderby') ? 'id_product' : NULL, !Tools::getValue($this->table . 'Orderway') ? 'DESC' : NULL, $start = 0, $limit, $id_lang_shop);
     }
     for ($idx = 0; $idx < count($this->_list); $idx++) {
         $approved = isset($this->_list[$idx]['approved']) ? intval($this->_list[$idx]['approved']) : 0;
         $this->_list[$idx]['approved'] = $this->_approved_statuses[$approved];
     }
 }