static function getInfoRecentProduct($args) { $model = new Models_Product(); $stringRelated = ' null'; $sortRelated = array(); foreach ($args as $item) { $stringRelated .= ',' . DB::quote($item); $sortRelated[$item] = $item; } $stringRelated = substr($stringRelated, 1); $data['products'] = $model->getProductByUserFilter(' p.code IN (' . $stringRelated . ') and p.activity = 1 '); if (!empty($data['products'])) { $data['currency'] = MG::getSetting('currency'); foreach ($data['products'] as $item) { $img = explode('|', $item['image_url']); $item['img'] = $img[0]; $item['url'] = SITE . '/' . (isset($item["category_url"]) ? $item["category_url"] : 'catalog') . '/' . $item["product_url"]; $item['price'] = MG::priceCourse($item['price_course']); $sortRelated[$item['code']] = $item; } $data['products'] = array(); //сортируем связанные товары в том порядке, в котором они идут в строке артикулов foreach ($sortRelated as $item) { if (!empty($item['id']) && is_array($item)) { $data['products'][$item['id']] = $item; } } } return self::htmlRecentlyProducts($data); }
} $sorterData = explode('|', $_POST['sorter']); if ($sorterData[1] > 0) { $sorterData[3] = 'desc'; } else { $sorterData[3] = 'asc'; } $countPrintRowsProduct = MG::getSetting('countPrintRowsProduct'); if (!empty($userFilter)) { $catalog = $model->getListByUserFilter($countPrintRowsProduct, $userFilter, true); } else { $catalog = $model->getList($countPrintRowsProduct, true); } //категории: $listCategories = MG::get('category')->getCategoryTitleList(); $arrayCategories = $model->categoryId = MG::get('category')->getHierarchyCategory(0); $categoriesOptions = MG::get('category')->getTitleCategory($arrayCategories, URL::get('category_id')); $product = new Models_Product(); $this->productsCount = $product->getProductsCount(); $this->catalog = $catalog['catalogItems']; $this->listCategories = $listCategories; $this->categoriesOptions = $categoriesOptions; $this->countPrintRowsProduct = $countPrintRowsProduct; $this->pagination = $catalog['pager']; $this->displayFilter = $_POST['cat_id'] != "null" && !empty($_POST['cat_id']) || isset($_POST['displayFilter']); // так проверяем произошол ли запрос по фильтрам или нет $this->settings = MG::get('settings'); $this->sorterData = $sorterData; $exampleName = $product->getProductByUserFilter(' 1=1 LIMIT 0,1'); $ids = array_keys($exampleName); $this->exampleName = $exampleName[$ids[0]]['title'];