public static function productRank2014($array) { global $DB_Product_Read, $db_read2; $showCnt = 10; //显示的条数 $showLen = 25; //显示的标题长度 //配合产品库推广新品,此模板进行独立发布 2011-3-15 wangml $productStr = ''; $subcat_id = $array['subcatid']; $relcat_id = $array['relcatid']; //暂时关闭--测试完开启 //$productStr = '<!--#if expr="$sub_id > 0" --><!--#include virtual="/dynamic/article_domain_product_${sub_id}_2014.html"--><!--#else --><!--#include virtual="/dynamic/article_domain_product_' . $subcat_id . '_2014.html"--><!--#endif -->'; //return $productStr; $sub_id_str = ''; if ($subcat_id) { $sub_id_str .= $subcat_id; if ($relcat_id) { $sub_id_str .= ',' . $relcat_id; } } if ($sub_id_str) { $sub_arr = array_unique(explode(',', $sub_id_str)); $sub_i = 1; $sub_icnt = count($sub_arr); foreach ($sub_arr as $subcatId) { //保存评测文章,避免重复取得 $testArticleArr = array(); if ($subcatId) { //获得产品线英文名 $sql = 'select brief from subcategory_extra_info where subcategory_id=' . $subcatId; $subEName = trim($DB_Product_Read->get_var($sql)); //获得产品线名称 $sql = 'select name from subcategory where id=' . $subcatId; $subName = $DB_Product_Read->get_var($sql); //产品 最热 $productList1 = ''; $paramArr1 = array('sub_id' => $subcatId, 'showimgFlag' => 1, 'titlelen' => $showLen, 'showimg' => 1, 'pwidth' => 80, 'pheight' => 60, 'priceFlag' => 1, 'priceUrlFlag' => 1, 'hudongflag' => 1, 'merchantFlag' => 1, 'orderby' => 2, 'limit' => 'limit 0,' . $showCnt); $rows = PageHelper::getProductList($paramArr1); if ($rows) { $i = 0; $hotest = 0; foreach ($rows as $row) { $i++; $pcArti = ''; $pid = $row['pid']; $priceStr = $row['price']; if ($i < 4) { $productList1 .= '<li class="special"> <em class="n1">' . $i . '</em> <a href="' . $row['url'] . '" class="pic"> <img width="60" height="48" .src="' . $row['pic'] . '" alt="' . $row['ftitle'] . '"> </a> <a href="' . $row['url'] . '" class="title" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a> <span class="price">' . $priceStr . '</span> </li>'; } else { $productList1 .= '<li><em class="n2">' . $i . '</em><a href="' . $row['url'] . '" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a><span class="price">' . $priceStr . '</span></li>'; } } } //产品 最新 $productList2 = ''; $paramArr2 = array('sub_id' => $subcatId, 'showimgFlag' => 1, 'titlelen' => $showLen, 'showimg' => 1, 'pwidth' => 80, 'pheight' => 60, 'priceFlag' => 1, 'priceUrlFlag' => 1, 'hudongflag' => 1, 'merchantFlag' => 1, 'orderby' => 1, 'level' => '+0', 'limit' => 'limit 0,' . $showCnt); $rows = PageHelper::getProductList($paramArr2); if ($rows) { $i = 0; $hotest = 0; foreach ($rows as $row) { $i++; $pcArti = ''; $pid = $row['pid']; $priceStr = ''; $priceStr = $row['price']; if ($i < 4) { $productList2 .= '<li class="special"> <em class="n1">' . $i . '</em> <a href="' . $row['url'] . '" class="pic"> <img width="60" height="48" .src="' . $row['pic'] . '" alt="' . $row['ftitle'] . '"> </a> <a href="' . $row['url'] . '" class="title" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a> <span class="price">' . $priceStr . '</span> </li>'; } else { $productList2 .= '<li><em class="n2">' . $i . '</em><a href="' . $row['url'] . '" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a><span class="price">' . $priceStr . '</span></li>'; } } } //第三个切换层 各产品线不同 $lastLi = ''; $productList4 = ''; if (16 == $subcatId || 31 == $subcatId) { //笔记本、服务器 加系列 $lastLi = '<li rel="tab_nb_3">系列</li>'; $paramArrTmp = array('limit' => "limit 0,10", 'orderby' => "2", 'sub_id' => $subcatId, 'len ' => $showLen, 'getproflag' => '1', 'imgwidth' => '80', 'imgheight' => '60', 'premanu' => 1); $rows = PageHelper::getProductSeries($paramArrTmp); if ($rows) { $i = 0; foreach ($rows as $row) { $i++; //得到该系列的报价区间 $sql = 'select min(price),max(price) from product_search_index where productid in (' . $row['pro_ids'] . ') and price > 0'; $priceArr = $DB_Product_Read->get_results($sql); $priceMin = (int) $priceArr[0]['min(price)']; $priceMax = (int) $priceArr[0]['max(price)']; $priceStr = $priceMin; if ($i < 4) { $productList4 .= '<li class="special"> <em class="n1">' . $i . '</em> <a href="' . $row['url'] . '" class="pic"> <img width="60" height="48" .src="' . $row['pic_src'] . '" alt="' . $row['ftitle'] . '"> </a> <a href="' . $row['url'] . '" class="title" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a> <span class="price">' . $priceStr . '</span> </li>'; } else { $productList4 .= '<li><em class="n2">' . $i . '</em><a href="' . $row['url'] . '" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a><span class="price">' . $priceStr . '</span></li>'; } } } } else { if (15 == $subcatId) { //数码相机 $lastLi = '<li rel="tab_nb_3">套机</li>'; $paramArrTmp = array('limit' => "limit 0,10", 'len' => $showLen, 'showimgflag' => '1', 'pwidth' => '80', 'pheight' => '60'); $rows = PageHelper::getCameraExtra($paramArrTmp); if ($rows) { $i = 0; $hotest = 0; foreach ($rows as $row) { $i++; $pcArti = ''; $pid = $row['pid']; $priceStr = $row['price'] ? $row['price'] : '暂无报价'; if ($i < 4) { $productList4 .= '<li class="special"> <em class="n1">' . $i . '</em> <a href="' . $row['url'] . '" class="pic"> <img width="60" height="48" .src="' . $row['pic'] . '" alt="' . $row['ftitle'] . '"> </a> <a href="' . $row['url'] . '" class="title" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a> <span class="price">' . $priceStr . '</span> </li>'; } else { $productList4 .= '<li><em class="n2">' . $i . '</em><a href="' . $row['url'] . '" title="' . $row['ftitle'] . '">' . $row['ftitle'] . '</a><span class="price">' . $priceStr . '</span></li>'; } } } } } if ($productList4 && $lastLi) { $lastLiRel = ' <ul class="intel-ranking" id="tab_nb_3" style="display:none">' . $productList4 . '</ul>'; } if ($sub_icnt > 1) { if (1 == $sub_i) { $productStr .= '<!--#if expr="$sub_id=' . $subcatId . '" -->'; } else { if ($sub_icnt == $sub_i) { $productStr .= '<!--#else -->'; } else { $productStr .= '<!--#elif expr="$sub_id=' . $subcatId . '" -->'; } } } $productStr .= '<div class="module"> <div class="module-header"><h3>周热门' . $subName . '排行榜</h3></div> <ul class="rank-tab switch clearfix"> <li class="first current" rel="tab_nb_1">热门</li> <li rel="tab_nb_2">新品</li> ' . $lastLi . ' </ul> <ul class="intel-ranking" id="tab_nb_1"> ' . $productList1 . ' </ul> <ul class="intel-ranking" id="tab_nb_2" style="display:none"> ' . $productList2 . ' </ul> ' . $lastLiRel . ' </div>'; if ($sub_icnt > 1 && $sub_icnt == $sub_i) { $productStr .= '<!--#endif -->'; } $sub_i++; } } } return $productStr; }