Beispiel #1
0
 public function index($fid = 'id', $id = 0, $page = 1)
 {
     $id = intval($id);
     //ID
     $page = intval($page);
     //ID
     if (preg_match("/^\\d*\$/", $fid)) {
         $id = intval($fid);
         $page = intval($id);
         $fid = 'id';
     }
     $cid = intval($this->input->get_post('cid'));
     if ($page == 0) {
         $page = 1;
     }
     //判断ID
     if ($id == 0) {
         msg_url('出错了,ID不能为空!', Web_Path);
     }
     //获取数据
     $row = $this->CsdjDB->get_row_arr('singer', '*', $id);
     if (!$row || $row['yid'] > 0 || $row['hid'] > 0) {
         msg_url('出错了,该歌手不存在!', Web_Path);
     }
     //判断运行模式,生成则跳转至静态页面
     $html = config('Html_Uri');
     if (config('Web_Mode') == 3 && $html['show']['check'] == 1) {
         //获取静态路径
         $Htmllink = LinkUrl('pic', $cid, $id, 0, 'singer');
         header("Location: " . $Htmllink);
         exit;
     }
     if ($cid > 0) {
         $arr['cid'] = getChild($cid);
     }
     $arr['tags'] = $row['tags'];
     $arr['singerid'] = $id;
     //摧毁部分需要超级链接字段数组
     $rows = $row;
     //先保存数组保留下面使用
     unset($row['tags']);
     //装载模板并输出
     $Mark_Text = $this->CsdjTpl->plub_list($row, $id, $fid, $page, $arr, TRUE, 'pic.html', 'pic', 'singer', $row['name'], $row['name']);
     //评论
     $Mark_Text = str_replace("[singer:pl]", get_pl('singer', $id), $Mark_Text);
     //分类地址、名称
     $Mark_Text = str_replace("[singer:link]", LinkUrl('show', 'id', $row['id'], 1, 'singer'), $Mark_Text);
     $Mark_Text = str_replace("[singer:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'singer'), $Mark_Text);
     $Mark_Text = str_replace("[singer:classname]", $this->CsdjDB->getzd('singer_list', 'name', $row['cid']), $Mark_Text);
     //标签加超级连接
     $Mark_Text = str_replace("[singer:tags]", SearchLink($rows['tags']), $Mark_Text);
     echo $Mark_Text;
     $this->cache->end();
     //由于前面不是直接输出,所以这里需要加入写缓存
 }
 function SetPanelSettings()
 {
     $output = '';
     if ($GLOBALS['ISC_CLASS_NEWSEARCH']->GetNumResults() > 0) {
         // Do we need to show paging, etc?
         if ($GLOBALS['ISC_CLASS_NEWSEARCH']->GetNumResults() > GetConfig('CategoryProductsPerPage')) {
             // Workout the paging data
             $GLOBALS['SNIPPETS']['PagingData'] = "";
             $num_pages_either_side_of_current = 5;
             $start = max($GLOBALS['ISC_CLASS_NEWSEARCH']->GetPage() - $num_pages_either_side_of_current, 1);
             $end = min($GLOBALS['ISC_CLASS_NEWSEARCH']->GetPage() + $num_pages_either_side_of_current, $GLOBALS['ISC_CLASS_NEWSEARCH']->GetNumPages());
             for ($page = $start; $page <= $end; $page++) {
                 if ($page == $GLOBALS['ISC_CLASS_NEWSEARCH']->GetPage()) {
                     $snippet = "CategoryPagingItemCurrent";
                 } else {
                     $snippet = "CategoryPagingItem";
                 }
                 $GLOBALS['PageLink'] = SearchLink($GLOBALS['ISC_CLASS_NEWSEARCH']->GetQuery(), $page);
                 $GLOBALS['PageNumber'] = $page;
                 $GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
             }
             // Parse the paging snippet
             if ($GLOBALS['ISC_CLASS_NEWSEARCH']->GetPage() > 1) {
                 // Do we need to output a "Previous" link?
                 $GLOBALS['PrevLink'] = SearchLink($GLOBALS['ISC_CLASS_NEWSEARCH']->GetQuery(), $GLOBALS['ISC_CLASS_NEWSEARCH']->GetPage() - 1);
                 $GLOBALS['SNIPPETS']['CategoryPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious");
             }
             if ($GLOBALS['ISC_CLASS_NEWSEARCH']->GetPage() < $GLOBALS['ISC_CLASS_NEWSEARCH']->GetNumPages()) {
                 // Do we need to output a "Next" link?
                 $GLOBALS['NextLink'] = SearchLink($GLOBALS['ISC_CLASS_NEWSEARCH']->GetQuery(), $GLOBALS['ISC_CLASS_NEWSEARCH']->GetPage() + 1);
                 $GLOBALS['SNIPPETS']['CategoryPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingNext");
             }
             $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPaging");
             $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
             $GLOBALS['SNIPPETS']['SearchPaging'] = $output;
         }
     } else {
         // No search results were found
         $GLOBALS['HideSearchResults'] = "none";
     }
 }
 public function SetPanelSettings()
 {
     $count = 0;
     $output = "";
     $params = $GLOBALS['ISC_CLASS_SEARCH']->_searchterms;
     $this->searchterms = $params;
     $path = GetConfig('ShopPath');
     /* the below mmy links are passed to the breadcrumbs */
     $mmy_links = "";
     /*---------- This below section is for generating search phrase----------*/
     $GLOBALS['Category'] = "";
     $GLOBALS['MMY'] = "";
     $GLOBALS['PQ'] = "";
     $GLOBALS['VQ'] = "";
     $GLOBALS['SearchPhrase'] = "";
     $ext_links = "";
     // this variable is passed to the product detail page
     $seo_delim = "&";
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $seo_delim = "/";
     }
     if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
         $GLOBALS['Category'] .= $GLOBALS['ISC_SRCH_CATG_NAME'];
     }
     if (isset($params['year'])) {
         $GLOBALS['MMY'] .= $params['year'] . "<br>";
         $ext_links .= $seo_delim . "year=" . $params['year'];
     }
     if (isset($params['make'])) {
         $GLOBALS['MMY'] .= strtoupper($params['make']) . "<br>";
         $ext_links .= $seo_delim . "make=" . $params['make'];
     }
     if (isset($_REQUEST['model']) && !empty($_REQUEST['model']) && (!isset($params['model_flag']) || $params['model_flag'] != 0)) {
         $GLOBALS['MMY'] .= strtoupper($_REQUEST['model']) . "<br>";
         $ext_links .= $seo_delim . "model=" . strtoupper($params['model']);
     } else {
         if (isset($params['model'])) {
             $ext_links .= $seo_delim . "model=" . $params['model'];
         }
     }
     /* this condition has been added seperately here to show submodel at last */
     if (isset($params['submodel'])) {
         $GLOBALS['MMY'] .= strtoupper($params['submodel']) . "<br>";
     }
     /*if(isset($params['year'])) {
       $ext_links .= $seo_delim."year=".$params['year'];                
       }*/
     if (isset($params['dynfilters']) && !empty($params['dynfilters'])) {
         foreach ($params['dynfilters'] as $key => $value) {
             if (eregi('vq', $key)) {
                 $key = str_ireplace('vq', '', $key);
                 $GLOBALS['VQ'] .= ucfirst($key) . ": {$value}<br>";
             } else {
                 if (eregi('pq', $key)) {
                     $key = str_ireplace('pq', '', $key);
                     $GLOBALS['PQ'] .= ucfirst($key) . ": {$value}<br>";
                 }
             }
         }
     }
     $filter_var = array('vq', 'pq');
     /* this below patch is used for getting description of the category. Here currently the selected category id will be last one in the $params['srch_category'] array. if input['category'] is used then it will be the first one */
     if (!empty($params['srch_category'])) {
         if (isset($params['category'])) {
             $selected_catg = $params['srch_category'][0];
         } else {
             $selected_catg = end($params['srch_category']);
         }
         $catg_desc_qry = "select catdesc from [|PREFIX|]categories where categoryid = " . $selected_catg;
         $catg_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_desc_qry);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($catg_desc_res) > 0) {
             $catg_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res);
         }
         /* this below patch is used to show the display name for the qualifiers from the qualifier association table */
         $map_names = array();
         $display_names = array();
         $filter_names = "select qid , column_name , display_names from [|PREFIX|]qualifier_names where column_name regexp '^(pq|vq)'";
         $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
         while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
             $map_names[$filter_row['qid']] = $filter_row['column_name'];
             $display_names[$filter_row['qid']] = $filter_row['display_names'];
         }
         $this->GetAssocDetails($selected_catg, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
     }
     // for breadcrumbs
     $this->_BuildBreadCrumbs();
     /* the below line has been commented as client told to remove it */
     //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 30) {
         $msg_qry = "select value from [|PREFIX|]display where messageid = 1";
         $msg_res = $GLOBALS['ISC_CLASS_DB']->Query($msg_qry);
         $msg_row = $GLOBALS['ISC_CLASS_DB']->FetchOne($msg_res);
         $GLOBALS['SearchPhrase'] = $msg_row;
         //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     }
     /*if(!empty($params['dynfilters']))
       $GLOBALS['SearchPhrase'] .= " ".implode(" ",$params['dynfilters']);
       /*---------- Ending section for generating search phrase----------*/
     $vq_column_title = "";
     $GLOBALS['SearchResultList'] = "";
     if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 0) {
         // We have at least one result, let's show it to the world!
         $GLOBALS['HideNoResults'] = "none";
         // Only show the "compare" option if there are 2 or more products on this page
         if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) < 2) {
             $GLOBALS['HideCompareItems'] = "none";
         }
         if (GetConfig('EnableProductReviews') == 0) {
             $GLOBALS['HideProductRating'] = "display: none";
         }
         $GLOBALS['AlternateClass'] = '';
         $counter = 1;
         $CurCatId = 0;
         $mmy_links = $this->GetYMMLinks($params);
         $mmy_links .= $this->GetOtherLinks($params);
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['SearchResults'])) {
             /* Added by Simha to check inf prodcucts comes from different categories*/
             if (empty($params['srch_category']) || !isset($params['srch_category'])) {
                 if ($CurCatId != $row['categoryid']) {
                     $CurCatId = $row['categoryid'];
                     $map_names = array();
                     $display_names = array();
                     $filter_names = "SELECT DISTINCT qn.qid, qn.column_name, qn.display_names from \n                                                [|PREFIX|]qualifier_names qn\n                                                LEFT JOIN [|PREFIX|]qualifier_associations qa ON qa.qualifierid = qn.qid\n                                                WHERE (qa.categoryid = '{$CurCatId}') \n                                                AND qn.column_name regexp '^(pq|vq)'";
                     // || qa.categoryid IN (SELECT catparentid FROM isc_categories WHERE categoryid = '$CurCatId')
                     $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
                     while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
                         $map_names[$filter_row['qid']] = $filter_row['column_name'];
                         $display_names[$filter_row['qid']] = $filter_row['display_names'];
                     }
                     $this->GetAssocDetails($CurCatId, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
                 }
             }
             /* Added by Simha Ends */
             $GLOBALS['SearchTrackClass'] = "TrackLink";
             $imagefile = "";
             if ($GLOBALS['AlternateClass'] == 'Odd') {
                 $GLOBALS['AlternateClass'] = 'Even';
             } else {
                 $GLOBALS['AlternateClass'] = 'Odd';
             }
             $qry_string = $_SERVER['QUERY_STRING'];
             if (isset($_GET['page'])) {
                 $page = "&page=" . $_GET['page'];
                 $qry_string = str_ireplace($page, '', $qry_string);
             }
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 if (isset($_GET['search_key'])) {
                     $qry_string = str_ireplace('&search_key=' . $_GET['search_key'], '', $qry_string);
                 }
                 if (isset($params['search_query']) && !strstr($qry_string, 'search_query=')) {
                     $qry_string .= "search_query=" . MakeURLSafe($params['search_query']);
                 }
                 if (isset($params['make']) && !strstr($qry_string, 'make=')) {
                     $qry_string .= "&make=" . MakeURLSafe($params['make']);
                 }
                 if (isset($params['model']) && !strstr($qry_string, 'model=')) {
                     $qry_string .= "&model=" . MakeURLSafe($params['model']);
                 }
                 if (isset($params['year']) && !strstr($qry_string, 'year=')) {
                     $qry_string .= "&year=" . MakeURLSafe($params['year']);
                 }
                 if (isset($params['make']) && !strstr($qry_string, 'make=')) {
                     $qry_string .= "&make=" . MakeURLSafe($params['make']);
                 }
                 if (isset($params['model_flag']) && !strstr($qry_string, 'model_flag=')) {
                     $qry_string .= "&model_flag=" . MakeURLSafe($params['model_flag']);
                 }
                 if (isset($params['submodel']) && !strstr($qry_string, 'submodel=')) {
                     $qry_string .= "&submodel=" . MakeURLSafe($params['submodel']);
                 }
             }
             if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
                 if (isset($params['srch_category'])) {
                     $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                     // description will be added here to show it at the top of product listing page.
                 }
                 $GLOBALS['ProductCartQuantity'] = '';
                 if (isset($GLOBALS['CartQuantity' . $row['productid']])) {
                     $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']];
                 }
                 if ($counter % 2 == 0) {
                     $GLOBALS['RowColor'] = 'grayrow';
                 } else {
                     $GLOBALS['RowColor'] = 'whiterow';
                 }
                 $counter++;
                 $GLOBALS['ProductId'] = (int) $row['productid'];
                 $GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
                 $GLOBALS['ProductLink'] = ProdLink($row['prodname']);
                 $GLOBALS['ProductRating'] = (int) $row['prodavgrating'];
                 $GLOBALS['BrandName'] = $row['brandname'];
                 $GLOBALS['ProdCode'] = $row['prodcode'];
                 //$GLOBALS['ProdDesc'] = $this->strip_html_tags($row['proddesc']);
                 //$GLOBALS['ProdOptions'] = $row['productoption'];
                 $GLOBALS['VehicleOptions'] = "";
                 $GLOBALS['ProdOptions'] = "";
                 foreach ($row as $key => $val) {
                     if ($val != "" && $val != "~") {
                         if (($qualifier_id = array_search($key, $map_names)) !== false) {
                             if (eregi('^vq', $key)) {
                                 $val = trim($val, "~");
                                 $val = preg_split('/[~;]+/', $val);
                                 $val = array_unique($val);
                                 $val = array_values($val);
                                 $val = implode(",", $val);
                                 /* -- Setting display name for qualifier name -- */
                                 if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') {
                                     $key = $OwnAssoc[$qualifier_id][0]['qname'];
                                 } else {
                                     if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') {
                                         $key = $ParentAssoc[$qualifier_id][0]['qname'];
                                     } else {
                                         if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) {
                                             $key = $display_names[$qualifier_id];
                                         } else {
                                             $key = ucfirst(str_ireplace($filter_var, "", $key));
                                         }
                                     }
                                 }
                                 /* -- Setting display name for qualifier name ends -- */
                                 /* -- Setting display name for qualifier value -- */
                                 if (($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != "") {
                                     $val = $OwnAssoc[$qualifier_id][$m]['vname'];
                                 } else {
                                     if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentAssoc[$qualifier_id][$m]['vname'] != "") {
                                         $val = $ParentAssoc[$qualifier_id][$m]['vname'];
                                     }
                                 }
                                 /* -- Setting display name for qualifier value ends-- */
                                 $GLOBALS['VehicleOptions'] .= $key . " : " . $val . "<br>";
                             }
                             if (eregi('^pq', $key)) {
                                 $val = trim($val, "~");
                                 $val = preg_split('/[~;]+/', $val);
                                 $val = array_unique($val);
                                 $val = array_values($val);
                                 $val = implode(",", $val);
                                 /* -- Setting display name for qualifier name -- */
                                 if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') {
                                     $key = $OwnAssoc[$qualifier_id][0]['qname'];
                                 } else {
                                     if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') {
                                         $key = $ParentAssoc[$qualifier_id][0]['qname'];
                                     } else {
                                         if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) {
                                             $key = $display_names[$qualifier_id];
                                         } else {
                                             $key = ucfirst(str_ireplace($filter_var, "", $key));
                                         }
                                     }
                                 }
                                 /* -- Setting display name for qualifier name ends -- */
                                 /* -- Setting display name for qualifier value -- */
                                 if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != '') {
                                     $val = $OwnAssoc[$qualifier_id][$m]['vname'];
                                 } else {
                                     if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentValue[$qualifier_id][$m]['vname'] != '') {
                                         $val = $ParentAssoc[$qualifier_id][$m]['vname'];
                                     }
                                 }
                                 /* -- Setting display name for qualifier value ends-- */
                                 $GLOBALS['ProdOptions'] .= $key . " : " . $val . "<br>";
                             }
                         }
                     }
                 }
                 if (isset($row['vehicleoption'])) {
                     $GLOBALS['VehicleOptions'] = $row['vehicleoption'];
                 }
                 if (isset($row['productoption'])) {
                     $GLOBALS['ProdOptions'] = $row['productoption'];
                 }
                 if (isset($row['catuniversal']) && $row['catuniversal'] == 1) {
                     $GLOBALS['VehicleOptions'] = $GLOBALS['ProductName'];
                     if ($vq_column_title == "") {
                         $vq_column_title = "Product Name";
                     } else {
                         if ($vq_column_title != "Product Name") {
                             $vq_column_title = "Product Name / Vehicle Options";
                         }
                     }
                 } else {
                     if ($vq_column_title == "") {
                         $vq_column_title = "Vehicle Options";
                     } else {
                         if ($vq_column_title != "Vehicle Options") {
                             $vq_column_title = "Product Name / Vehicle Options";
                         }
                     }
                 }
                 if (empty($GLOBALS['VehicleOptions'])) {
                     $GLOBALS['VehicleOptions'] = "&nbsp;";
                 }
                 if (empty($GLOBALS['ProdOptions'])) {
                     $GLOBALS['ProdOptions'] = "&nbsp;";
                 }
                 /*--- the below lines are added for back 2 search link in the product detail page. Also modified line no 56 & 60 --- */
                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                     $GLOBALS['ProductLink'] .= "/refer=true" . $ext_links;
                 } else {
                     $GLOBALS['ProductLink'] .= "&refer=true" . $ext_links;
                 }
                 ### Added by Simha for onsale addition
                 // Determine the price of this product
                 //$GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row);
                 $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($row);
                 $FinalPrice = $GLOBALS['ProductPrice'];
                 $SalePrice = $row['prodsaleprice'];
                 //$DiscountAmount = $FinalPrice;
                 if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) {
                     $DiscountPrice = $SalePrice;
                 } else {
                     $DiscountPrice = $FinalPrice;
                     $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $row['categoryid'], $row['brandseriesid']);
                 }
                 /*
                 							foreach($DiscountInfo as $DiscountInfoSub)   {  
                     if(isset($DiscountInfoSub['catids']))    {
                 								    $catids = explode(",", $DiscountInfoSub['catids']); 
                 								    foreach($catids as $catid) {
                 									    if($catid == $row['categoryid']) {
                 										    $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); 
                 										    if ($DiscountAmount < 0) {
                 											    $DiscountAmount = 0;
                 										    }                                                                         
                 										    $DiscountPrice  = $FinalPrice - $DiscountAmount;  
                 									    } 
                 								    }  
                     }
                 							}       
                 */
                 if (isset($DiscountPrice) && $DiscountPrice < $FinalPrice) {
                     //&& GetConfig('ShowOnSale')
                     $GLOBALS['ProductPrice'] = '<strike>' . CurrencyConvertFormatPrice($FinalPrice) . '</strike>';
                     $GLOBALS['ProductPrice'] .= '<br>' . CurrencyConvertFormatPrice($DiscountPrice) . '';
                     $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                     if (GetConfig('ShowOnSale')) {
                         $GLOBALS['ProductPrice'] .= '<br>' . $GLOBALS['ShowOnSaleImage'] . '';
                     }
                 } else {
                     $GLOBALS['ProductPrice'] = '' . CurrencyConvertFormatPrice($FinalPrice) . '';
                 }
                 ### Added by Simha Ends
                 // commented the below line by vikas
                 //$GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname']));
                 $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], $GLOBALS['ProductLink']);
                 if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) {
                     //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas
                     $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
                     $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
                 } else {
                     //$GLOBALS['ProductURL'] = CartLink($row['productid']);
                     //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas
                     $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
                     //blessen
                     if (intval($row['prodretailprice']) <= 0) {
                         //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); // commented by vikas on 15-7-09
                         $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
                     } else {
                         //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); // commented by vikas on 15-7-09
                         $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
                     }
                     //blessen
                     // original $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink');
                 }
                 if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {
                     $GLOBALS['HideActionAdd'] = '';
                 } else {
                     $GLOBALS['HideActionAdd'] = 'none';
                 }
                 $GLOBALS['HideProductVendorName'] = 'display: none';
                 $GLOBALS['ProductVendor'] = '';
                 if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) {
                     $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors');
                     if (isset($vendorCache[$row['prodvendorid']])) {
                         $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>';
                         $GLOBALS['HideProductVendorName'] = '';
                     }
                 }
                 $GLOBALS['CartURL'] = CartLink($row['productid']);
                 $offer = $this->IsProductMakeanOffer($row['brandseriesid'], $row['brandname'], $row['categoryid']);
                 if ($offer == 'yes') {
                     $GLOBALS['HideOfferButton'] = 'block';
                 } else {
                     $GLOBALS['HideOfferButton'] = 'none';
                 }
                 $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItem");
             } else {
                 if ($GLOBALS['results_page_flag'] == 0) {
                     $subcatg_link = $this->LeftCatLink($mmy_links, 'subcategory', $row['catname']);
                     $link = "<a href='" . $subcatg_link . "'>";
                     if (isset($row['imagefile']) && !empty($row['imagefile'])) {
                         $images = explode("~", $row['imagefile']);
                         for ($j = 0; $j < count($images); $j++) {
                             if (!empty($images[$j])) {
                                 $imagefile = "{$link}<img src='{$path}/category_images/" . $images[$j] . "'></a>";
                                 break;
                             }
                         }
                     } else {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $imagefile = "{$link}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>";
                         }
                     }
                     $GLOBALS['LeftImage'] = $imagefile;
                     $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available";
                     $row['brandname'] = str_replace('~', ' , ', $row['brandname']);
                     //$GLOBALS['RelatedBrands'] = $row['brandname'];
                     if (!empty($row['seriesname'])) {
                         $row['brandname'] .= "<br>" . $row['seriesname'];
                     }
                     if ($row['seriesids'] != "") {
                         $seriesids = str_ireplace("~", ",", $row['seriesids']);
                         $seriesids_qry = "select brandname , seriesname from isc_brand_series bs left join isc_brands b on bs.brandid = b.brandid where seriesid in (" . $seriesids . ")";
                         $seriesids_res = $GLOBALS['ISC_CLASS_DB']->Query($seriesids_qry);
                         if ($GLOBALS['ISC_CLASS_DB']->CountResult($seriesids_res) > 0) {
                             while ($seriesids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($seriesids_res)) {
                                 if (!isset($params['brand'])) {
                                     if ($GLOBALS['EnableSEOUrls'] == 1) {
                                         $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     } else {
                                         $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     }
                                 } else {
                                     if ($GLOBALS['EnableSEOUrls'] == 1) {
                                         $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     } else {
                                         $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     }
                                 }
                             }
                         }
                     }
                     $content = $row['brandname'] . "<br>";
                     if (!isset($params['category']) && (isset($params['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))) {
                         $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                         // description will be added here to show it at the top of subcatg page.
                         $content .= "<h3><a href='" . $path . "/search.php?{$qry_string}&subcategory=" . MakeURLSafe($row['catname']) . "'>" . $row['catname'] . "</a></h3>>";
                         $GLOBALS['TitleLink'] = "<h2><a href='" . $subcatg_link . "'>" . $row['catname'] . "</a></h2>";
                     }
                     $content .= "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', '') . "<br>" . $imagefile;
                     $GLOBALS['leftsidecontent'] = $content;
                     $GLOBALS['PriceRange'] = "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', '');
                     $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty'];
                     $GLOBALS['rightsidecontent'] = $content;
                     $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>";
                     $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>";
                     $content = "{$link}<img src='{$path}/templates/default/images/view.gif'></a>";
                     $GLOBALS['ViewDetailsImage'] = $content;
                     if (IsDiscountAvailable('category', $row['categoryid'])) {
                         $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                     }
                     if ($this->IsMakeAnOffer('category', $row['categoryid']) == 'yes') {
                         $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>";
                     }
                     $GLOBALS['lowersidecontent'] = $content;
                     $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing");
                 } else {
                     $series_link = $this->LeftCatLink($mmy_links, 'series', $row['seriesname']);
                     $link = "<a href='" . $series_link . "'>";
                     if (isset($row['imagefile']) && !empty($row['imagefile'])) {
                         $images = explode("~", $row['imagefile']);
                         for ($j = 0; $j < count($images); $j++) {
                             if (!empty($images[$j])) {
                                 $imagefile = "{$link}<img src='{$path}/category_images/" . $images[$j] . "'></a>";
                                 break;
                             }
                         }
                     } else {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $imagefile = "{$link}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>";
                         }
                     }
                     $GLOBALS['LeftImage'] = $imagefile;
                     $row['brandname'] = str_replace('~', ' , ', $row['brandname']);
                     $GLOBALS['RelatedBrands'] = $row['brandname'];
                     if (isset($row['seriesname']) && !empty($row['seriesname']) && (!isset($params['srch_category']) || isset($params['category'])) && isset($GLOBALS['BRAND_SERIES_FLAG'])) {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $GLOBALS['LeftImage'] = "{$link}<img src='{$path}/templates/default/images/ProductDefault.gif'></a>";
                         } else {
                             $GLOBALS['LeftImage'] = "{$link}<img src='{$path}/series_images/" . $row['imagefile'] . "' width='140px'></a>";
                         }
                         $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>";
                         //"<h3>".$row['catname']."</h3>
                         $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available";
                         $GLOBALS['RelatedBrands'] = "<ul class='featurepoints'>";
                         if (!empty($row['feature_points1'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points1'] . "</li>";
                         }
                         if (!empty($row['feature_points2'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points2'] . "</li>";
                         }
                         if (!empty($row['feature_points3'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points3'] . "</li>";
                         }
                         if (!empty($row['feature_points4'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points4'] . "</li>";
                         }
                         $GLOBALS['RelatedBrands'] .= "</ul>";
                         /*if(isset($row['brandlargefile']) && !empty($row['brandlargefile'])) {
                         			$brand_image_path = "product_images/".$row['brandlargefile'];
                         			if(file_exists($brand_image_path)) {
                         				$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandlargefile']."'>";
                         			} else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) {
                         				$brand_image_path = "product_images/".$row['brandimagefile'];
                         				if(file_exists($brand_image_path))
                         					$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>";
                         			}
                         		} else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) {
                         				$brand_image_path = "product_images/".$row['brandimagefile'];
                         				if(file_exists($brand_image_path))
                         					$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>";
                         		}*/
                     }
                     $GLOBALS['CatgDescandBrandImage'] = $row['branddescription'];
                     if ($row['subcatgids'] != "") {
                         $subcatgids = str_ireplace("~", ",", $row['subcatgids']);
                         $subcatgids_qry = "select catname from [|PREFIX|]categories where categoryid in (" . $subcatgids . ")";
                         $subcatgids_res = $GLOBALS['ISC_CLASS_DB']->Query($subcatgids_qry);
                         if ($GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res) > 0) {
                             while ($subcatgids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($subcatgids_res)) {
                                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                                     $GLOBALS['ProductsCount'] .= "<br><a href='" . $series_link . "/subcategory/" . MakeURLSafe(Strtolower($subcatgids_arr['catname'])) . "'>" . $subcatgids_arr['catname'] . "</a>";
                                 } else {
                                     $GLOBALS['ProductsCount'] .= "<br><a href='" . $series_link . "&subcategory=" . MakeURLSafe(Strtolower($subcatgids_arr['catname'])) . "'>" . $subcatgids_arr['catname'] . "</a>";
                                 }
                             }
                         }
                     }
                     $content = $row['brandname'] . "<br>";
                     $content .= $row['catname'] . "<br>";
                     $content .= "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', '');
                     $GLOBALS['leftsidecontent'] = $content;
                     $GLOBALS['PriceRange'] = "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', '');
                     $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty'];
                     $GLOBALS['rightsidecontent'] = $content;
                     $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>";
                     $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>";
                     $content = "{$link}<img src='{$path}/templates/default/images/view.gif'></a>";
                     $GLOBALS['ViewDetailsImage'] = $content;
                     if (IsDiscountAvailable('series', $row['brandseriesid'])) {
                         $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                     }
                     if ($this->IsMakeAnOffer('series', $row['brandseriesid']) == 'yes') {
                         $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>";
                     }
                     $GLOBALS['lowersidecontent'] = $content;
                     $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing");
                     $GLOBALS['HideCompareItems'] = "none";
                 }
             }
         }
         $get_variables = $_GET;
         $sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']);
         unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']);
         $i = 0;
         foreach ($get_variables as $key => $value) {
             $sort_qry .= "&{$key}={$value}";
         }
         if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') {
             $sort = "asc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowDown.gif' border=0>";
         } else {
             $sort = "desc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowUp.gif' border=0>";
         }
         //$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas
         if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Part Number</a>";
                 $GLOBALS['ProductPrice'] = "<a href='{$path}{$mmy_links}/orderby/prodcalculatedprice/sortby/{$sort}'>Price</a>";
             } else {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Part Number</a>";
                 $GLOBALS['ProductPrice'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcalculatedprice&sortby={$sort}'>Price</a>";
             }
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') {
                 $GLOBALS['ProductBrand'] .= $img;
             }
             $GLOBALS['ProductVQ'] = $vq_column_title;
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname')
             		$GLOBALS['Product_VQ'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') {
                 $GLOBALS['ProductPartNumber'] .= $img;
             }
             $GLOBALS['ProductPQ'] = "Product Options";
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption')
             		$GLOBALS['SearchResults'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') {
                 $GLOBALS['ProductPrice'] .= $img;
             }
             $GLOBALS['ProductDetails'] = "Details";
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItemHeader");
         } else {
             //		                $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>";
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain");
         }
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']);
         } else {
             $back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING'];
         }
         ISC_SetCookie("back2search", $back2url, 0, "/");
         // Showing the syndication option?
         if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) {
             $GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);
             $GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed");
         }
     } else {
         // No search results were found
         $GLOBALS['HideSearchResults'] = "none";
         $GLOBALS['HidePanels'][] = 'SearchPageProducts';
     }
 }
Beispiel #4
0
 public function SetPanelSettings()
 {
     //$GLOBALS['ISC_CLASS_SEARCH'] = GetClass('ISC_SEARCH');
     //$GLOBALS['ISC_CLASS_NEWSEARCH'] = GetClass('ISC_NEWSEARCH');
     $count = 0;
     $output = "";
     $params = $GLOBALS['ISC_CLASS_NEWSEARCH']->_searchterms;
     $GLOBALS['DynamicDisplay'] = 'block';
     $GLOBALS['YMMTableDisplay'] = 'block';
     if (!empty($_COOKIE['last_search_selection']['year'])) {
         $params['year'] = $_COOKIE['last_search_selection']['year'];
     }
     if (!empty($_COOKIE['last_search_selection']['make'])) {
         $params['make'] = $_COOKIE['last_search_selection']['make'];
     }
     if (!empty($_COOKIE['last_search_selection']['model'])) {
         $params['model'] = $_COOKIE['last_search_selection']['model'];
     }
     $this->searchterms = $params;
     /* Checking the search string. If it is used in any search, will be retained. else it will not be retained - starts */
     if (isset($this->searchterms['search'])) {
         $search_str = trim(str_ireplace($this->searchterms['search_string'], "", $this->searchterms['search']));
         if ($search_str == '') {
             unset($this->searchterms['search'], $params['search']);
         } else {
             $this->searchterms['search'] = $params['search'] = $search_str;
         }
     }
     $path = GetConfig('ShopPath');
     /* the below mmy links are passed to the breadcrumbs */
     $mmy_links = "";
     /*---------- This below section is for generating search phrase----------*/
     $GLOBALS['Category'] = "";
     $GLOBALS['MMY'] = "";
     $GLOBALS['PQ'] = "";
     $GLOBALS['VQ'] = "";
     $GLOBALS['SearchPhrase'] = "";
     $ext_links = "";
     // this variable is passed to the product detail page
     $seo_delim = "&";
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $seo_delim = "/";
     }
     if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
         $GLOBALS['Category'] .= $GLOBALS['ISC_SRCH_CATG_NAME'];
     }
     if (isset($params['year'])) {
         $GLOBALS['MMY'] .= $params['year'] . "<br>";
         $ext_links .= $seo_delim . "year=" . $params['year'];
     }
     if (isset($params['make'])) {
         $GLOBALS['MMY'] .= strtoupper($params['make']) . "<br>";
         $ext_links .= $seo_delim . "make=" . MakeURLSafe($params['make']);
     }
     if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) {
         $GLOBALS['MMY'] .= strtoupper($params['model']) . "<br>";
         $ext_links .= $seo_delim . "model=" . MakeURLSafe($params['model']);
     }
     /*else if(isset($params['model']))
     	 $ext_links .= $seo_delim."model=".$params['model'];*/
     /* this condition has been added seperately here to show submodel at last */
     if (isset($params['submodel'])) {
         $GLOBALS['MMY'] .= MakeURLSafe($params['submodel']) . "<br>";
     }
     /*if(isset($params['year'])) {
     	 $ext_links .= $seo_delim."year=".$params['year'];
     	 }*/
     if (isset($params['dynfilters']) && !empty($params['dynfilters'])) {
         foreach ($params['dynfilters'] as $key => $value) {
             if (eregi('vq', $key)) {
                 $key = str_ireplace('vq', '', $key);
                 $GLOBALS['VQ'] .= ucfirst($key) . ": {$value}<br>";
             } else {
                 if (eregi('pq', $key)) {
                     $key = str_ireplace('pq', '', $key);
                     $GLOBALS['PQ'] .= ucfirst($key) . ": {$value}<br>";
                 }
             }
         }
     }
     $filter_var = array('vq', 'pq');
     $catg_desc_arr = array();
     $isDynamicPage = true;
     /* this below patch is used for getting description of the category. Here currently the selected category id will be last one in the $params['srch_category'] array. if input['category'] is used then it will be the first one */
     if (!empty($params['srch_category'])) {
         if (isset($params['category'])) {
             $selected_catg = $params['srch_category'][0];
         }
         //else
         //$selected_catg = end($params['srch_category']);
         $selected_catg = $params['srch_category'];
         //wirror_20100806: add selected files like pagecontenttype and customcontentid;
         //$catg_desc_qry = "select pagecontenttype, customcontentid, catdesc , categoryfooter  from [|PREFIX|]categories where categoryid = ".$selected_catg;
         $catg_desc_qry = "select categoryid, pagecontenttype, customcontentid, catdesc , categoryfooter  from [|PREFIX|]categories where categoryid in(" . implode(',', $selected_catg) . ")";
         $catg_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_desc_qry);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($catg_desc_res) > 0) {
             while ($rs = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res)) {
                 $catg_desc_arr[$rs['categoryid']] = $rs;
                 //zcs=add "$rs['categoryid']" as indexs
             }
             //$catg_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res);
         }
         //zcs=>Compat for "Custom Landing page"
         //filter out the category parents that have products
         $hasProductParents = $this->_filterParents($selected_catg);
         if (count($hasProductParents) == 1) {
             $catg_desc_arr = $catg_desc_arr[$hasProductParents[0]];
         }
         //<=zcs
         $isDynamicPage = $catg_desc_arr['pagecontenttype'] == 0 ? true : false;
         //wirror_20100806: get the custom prudocts list;
         $catg_custom_arr = array();
         /*$catg_custom_qry = "SELECT cp.productids, cp.categoryid, cp.subcategoryid, cp.brandid, cp.seriesid, cp.description
           		  FROM [|PREFIX|]custom_products cp 
           		  INNER JOIN [|PREFIX|]custom_contents cc on cc.contentid=cp.contentid
           		  WHERE cc.contentid
                     IN (
                          SELECT customcontentid
                          FROM [|PREFIX|]categories
                          WHERE categoryid = '$selected_catg'
                     )
                     AND cp.enabled=1 ";
           */
         $catg_custom_qry = "SELECT cp.productids, cp.categoryid, cp.subcategoryid, cp.brandid, cp.seriesid, cp.description\n            \t\t  FROM [|PREFIX|]custom_products cp \n            \t\t  INNER JOIN [|PREFIX|]custom_contents cc on cc.contentid=cp.contentid\n            \t\t  WHERE cc.contentid\n                      IN (\n                           SELECT customcontentid\n                           FROM [|PREFIX|]categories\n                           WHERE categoryid in(" . implode(',', $selected_catg) . ")\n                      )\n                      AND cp.enabled=1 ";
         if (isset($params['brand']) && $params['brand'] != "") {
             $brand_query = "select brandid from [|PREFIX|]brands WHERE brandname='" . $params['brand'] . "'";
             $brand_result = $GLOBALS['ISC_CLASS_DB']->Query($brand_query);
             $brandId = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_result);
             if ((int) $brandId > 0) {
                 $catg_custom_qry .= " AND cp.brandid={$brandId} ";
             }
         }
         $catg_custom_qry .= " ORDER BY cp.displayorder ASC ";
         $catg_custom_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_custom_qry);
         while ($rows = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_custom_res)) {
             $catg_custom_arr[] = $rows;
         }
         $catCustomFlag = false;
         /* this below patch is used to show the display name for the qualifiers from the qualifier association table */
         $map_names = array();
         $display_names = array();
         $filter_names = "select qid , column_name , display_names from [|PREFIX|]qualifier_names where column_name regexp '^(pq|vq)'";
         $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
         while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
             $map_names[$filter_row['qid']] = $filter_row['column_name'];
             $display_names[$filter_row['qid']] = $filter_row['display_names'];
         }
         $this->GetAssocDetails($selected_catg, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
     }
     if (isset($params['brand'])) {
         $brand_desc_arr = array();
         $brand_desc_qry = "select branddescription , brandfooter from [|PREFIX|]brands where brandname = '" . $params['brand'] . "'";
         $brand_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_desc_qry);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($brand_desc_res) > 0) {
             $brand_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_desc_res);
         }
     }
     // for breadcrumbs
     $this->_BuildBreadCrumbs();
     /* the below line has been commented as client told to remove it */
     //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     if ($GLOBALS['ISC_CLASS_NEWSEARCH']->GetNumResults() > 30) {
         $msg_qry = "select value from [|PREFIX|]display where messageid = 1";
         $msg_res = $GLOBALS['ISC_CLASS_DB']->Query($msg_qry);
         $msg_row = $GLOBALS['ISC_CLASS_DB']->FetchOne($msg_res);
         $GLOBALS['SearchPhrase'] = $msg_row;
         //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     }
     /*if(!empty($params['dynfilters']))
     	 $GLOBALS['SearchPhrase'] .= " ".implode(" ",$params['dynfilters']);
     	 /*---------- Ending section for generating search phrase----------*/
     $vq_column_title = "";
     $GLOBALS['SearchResultList'] = "";
     $brand_rating = 0;
     if ($GLOBALS['ISC_CLASS_NEWSEARCH']->GetNumResults() > 0) {
         $category_rating = 0;
         if ($GLOBALS['results_page_flag'] == 1) {
             $brand_rating_qry = "select avg(revrating) as rating from [|PREFIX|]reviews r left join [|PREFIX|]products p on r.revproductid = p.productid left join [|PREFIX|]brands b on p.prodbrandid = b.brandid  where r.revstatus = 1 and b.brandname = '" . $params['brand'] . "'";
             $brand_rating_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_rating_qry);
             $brand_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_rating_res);
             if (isset($brand_rating_arr['rating'])) {
                 $brand_rating = (int) $brand_rating_arr['rating'];
             }
         } else {
             if ($GLOBALS['results_page_flag'] == 0 && isset($selected_catg)) {
                 // 3rdAug2010: added the condition "isset($selected_catg)" as no need to show rating when only YMM is selected
                 // lguan_20100612: Category page mode, calculate the rating
                 //$catquery = $GLOBALS['ISC_CLASS_DB']->Query("SELECT categoryid FROM [|PREFIX|]categories where catparentid = $selected_catg");
                 $catquery = $GLOBALS['ISC_CLASS_DB']->Query("SELECT categoryid FROM [|PREFIX|]categories where catparentid in(" . implode(',', $selected_catg) . ")");
                 $catlistid = array();
                 while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catquery)) {
                     $catlistid[] = $catrow['categoryid'];
                 }
                 $catcountlist = implode(",", $catlistid);
                 //lguan_20100612: Changed following codes to get product rating for categories
                 if (count($catlistid) > 0) {
                     $catcountlist = $selected_catg . "," . $catcountlist;
                 }
                 $cat_rating_res = $GLOBALS['ISC_CLASS_DB']->Query("SELECT floor(SUM(p.prodratingtotal)/SUM(p.prodnumratings))AS prodavgrating FROM [|PREFIX|]categoryassociations c INNER JOIN [|PREFIX|]products p on c.productid=p.productid where c.categoryid IN ({$catcountlist})");
                 $cat_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($cat_rating_res);
                 if (isset($cat_rating_arr['prodavgrating'])) {
                     $category_rating = (int) $cat_rating_arr['prodavgrating'];
                 }
             }
         }
         /* displaying the dropdowns for YMM */
         if (!isset($params['make']) || !isset($params['year']) || !isset($params['model']) || isset($params['model_flag']) && $params['model_flag'] == 0) {
             $this->YMMSelectors($params);
         }
         // We have at least one result, let's show it to the world!
         $GLOBALS['HideNoResults'] = "none";
         // Only show the "compare" option if there are 2 or more products on this page
         if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) < 2) {
             $GLOBALS['HideCompareItems'] = "none";
         }
         if (GetConfig('EnableProductReviews') == 0) {
             $GLOBALS['HideProductRating'] = "display: none";
         }
         $mmy_links = $this->GetYMMLinks($params);
         $mmy_links .= $this->GetOtherLinks($params);
         $subcatId = array();
         if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
             $this->ShowProductList($mmy_links, $params, $catg_desc_arr, $ext_links, $vq_column_title);
         } else {
             if ($GLOBALS['results_page_flag'] == 0) {
                 //alandy mark.
                 //class.newsearch.php  $this->DoSearch($start, $GLOBALS['SearchResults'], $this->_numresults);
                 $this->ShowSubCategoies($mmy_links, $params, $catg_desc_arr, $subcatId, $catCustomFlag);
             } else {
                 $this->ShowSeriesPage($mmy_links, $params, $brand_rating);
             }
         }
         if (!$isDynamicPage) {
             $catCustomFlag = true;
         }
         ///wirror_code_mark_end
         $get_variables = $_GET;
         $sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']);
         unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']);
         $i = 0;
         foreach ($get_variables as $key => $value) {
             $sort_qry .= "&{$key}={$value}";
         }
         if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') {
             $sort = "asc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowDown.gif' border=0>";
         } else {
             $sort = "desc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowUp.gif' border=0>";
         }
         //wirror_code_mark_begin
         //$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas
         if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand / Series</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Image / Part#</a>";
                 $GLOBALS['ProductDetails'] = "<a href='{$path}{$mmy_links}/orderby/prodfinalprice/sortby/{$sort}'>Price</a>";
             } else {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand / Series</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Image / Part#</a>";
                 $GLOBALS['ProductDetails'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodfinalprice&sortby={$sort}'>Price</a>";
             }
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') {
                 $GLOBALS['ProductBrand'] .= $img;
             }
             $GLOBALS['ProductVQ'] = $vq_column_title;
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname')
             	 $GLOBALS['Product_VQ'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') {
                 $GLOBALS['ProductPartNumber'] .= $img;
             }
             $GLOBALS['ProductPQ'] = "Product Options";
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption')
             	 $GLOBALS['SearchResults'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') {
                 $GLOBALS['ProductPrice'] .= $img;
             }
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodfinalprice') {
                 $GLOBALS['ProductDetails'] .= $img;
             }
             //wirror_20110324: replace the empyt ymm selector with the given picture
             if (!isset($GLOBALS['YMMTable']) || !$GLOBALS['YMMTable']) {
                 $GLOBALS['YMMTable'] = "<img src='/images/mmy-middle-6.jpg'/>";
             }
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItemHeader");
         } else {
             if ($catCustomFlag) {
                 //wirror_20100809: show the custom filter items
                 if ($isDynamicPage) {
                     $GLOBALS['DynamicDisplay'] = 'block';
                     $GLOBALS['YMMTableDisplay'] = 'block';
                 } else {
                     $GLOBALS['DynamicDisplay'] = 'none';
                     $GLOBALS['YMMTableDisplay'] = 'none';
                 }
                 //wirror_20100809: record the searched productids
                 $searchedProductIds = array();
                 $subcatIds = implode("','", $subcatId);
                 $querySubcatProdsStr = "\n\t\t\t\t\t\t    \tSELECT DISTINCT(p.productid)\n                \t\t\t\tFROM [|PREFIX|]products p\n                \t\t\t    LEFT JOIN [|PREFIX|]categoryassociations ca on ca.productid = p.productid\n                \t\t\t    %s\n                \t\t\t\tWHERE 1=1 \n                \t\t\t\tAND p.prodvisible='1'\n                \t\t\t\tAND ca.categoryid in ('{$subcatIds}')\n\t\t\t\t\t\t    ";
                 $hasYMM = false;
                 if (isset($params['year']) && !empty($params['year'])) {
                     $hasYMM = true;
                     $year = $params['year'];
                     $querySubcatProdsStr .= " AND ({$year} between v.prodstartyear and v.prodendyear OR v.prodstartyear = 'ALL')";
                 }
                 if (isset($params['make']) && !empty($params['make'])) {
                     $hasYMM = true;
                     $make = $params['make'];
                     $querySubcatProdsStr .= " AND (v.prodmake='{$make}' or v.prodmake='NON-SPEC VEHICLE')";
                 }
                 if (isset($params['model']) && !empty($params['model'])) {
                     $hasYMM = true;
                     $model = $params['model'];
                     $querySubcatProdsStr .= " AND (v.prodmodel='{$model}' or v.prodmodel='ALL')";
                 }
                 if ($hasYMM) {
                     $querySubcatProds = sprintf($querySubcatProdsStr, ' LEFT JOIN [|PREFIX|]import_variations v on v.productid = p.productid ');
                 } else {
                     $querySubcatProds = sprintf($querySubcatProdsStr, '');
                 }
                 $resultSubcatProds = $GLOBALS['ISC_CLASS_DB']->Query($querySubcatProds);
                 while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($resultSubcatProds)) {
                     $searchedProductIds[] = $row['productid'];
                 }
                 if (isset($_GET['debug']) && $_GET['debug'] == 1) {
                     //                			    echo $GLOBALS['DoSearchQuery'].'<br/>';
                     //                			    echo $querySubcatProds;echo '<br/>';
                     //                			    var_dump($searchedProductIds);
                     //                			    echo '<br/>';
                 }
                 $hasProds = false;
                 $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                 // description will be added here to show it at the top of subcatg page.
                 $GLOBALS['CustomPage'] = '';
                 foreach ($catg_custom_arr as $subArr) {
                     $pIds = explode(',', $subArr['productids']);
                     if (count($pIds) == 1 && in_array('0', $pIds)) {
                         $condArr = array('category' => $subArr['categoryid'], 'subscategory' => $subArr['subcategoryid'], 'brand' => $subArr['brandid'], 'series' => $subArr['seriesid']);
                         $pIdArr = GetClass('ISC_ADMIN_CUSTOMCONTENTS')->GetProductIds($condArr);
                     } else {
                         $pIdArr = $pIds;
                     }
                     //print_r($pIdArr);
                     if (!empty($searchedProductIds) && $this->is_subarray($pIdArr, $searchedProductIds)) {
                         $hasProds = true;
                         $GLOBALS['CustomPage'] .= $subArr['description'];
                     }
                 }
                 if ($hasProds) {
                     $GLOBALS['YMMTableDisplay'] = 'block';
                 } else {
                     //if there is no static items, show the dynamic page
                     if (!empty($searchedProductIds)) {
                         $GLOBALS['DynamicDisplay'] = 'block';
                     }
                     $GLOBALS['YMMTableDisplay'] = 'block';
                 }
             }
             //lguan_20100612: Show overal product rating at category landing page
             if ($category_rating != 0) {
                 //$GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$category_rating.gif' alt='' /></h2>";
             }
             //		                $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>";
             //wirror_20110324: replace the empyt ymm selector with the given picture
             if (!isset($GLOBALS['YMMTable']) || !$GLOBALS['YMMTable']) {
                 $GLOBALS['YMMTable'] = "<img src='/images/mmy-middle-6.jpg'/>";
             }
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain");
             /*
             //alandy_2012-1-19 modify.
             if(isset($GLOBALS['showDialog']) && !empty($GLOBALS['showDialog'])){
             	$showDialog = true;
             
             }
             */
             if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) {
                 $GLOBALS['SearchLink'] = "";
                 if (isset($params['searchtext'])) {
                     $GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['searchtext']));
                 }
                 if (isset($params['search'])) {
                     $GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['search']));
                 }
                 if (isset($params['model']) && !isset($params['make'])) {
                     $GLOBALS['SearchLink'] .= "/model/" . MakeURLSafe(strtolower($params['model']));
                 }
                 if (isset($params['model_flag']) && $params['model_flag'] == 0 && !isset($params['make'])) {
                     $GLOBALS['SearchLink'] .= "/model_flag/" . MakeURLSafe(strtolower($params['model_flag']));
                 }
                 $GLOBALS['SearchResults'] = "";
                 if (isset($GLOBALS['YMMTable']) && $GLOBALS['YMMTable'] !== "<img src='/images/mmy-middle-6.jpg'/>") {
                     $GLOBALS['SearchResults'] .= "<div>" . $GLOBALS['YMMTable'] . "</div>";
                 }
                 if ($_REQUEST['is_smart_search']) {
                     $GLOBALS['SearchResults'] .= '<p class="ErrorMessage">' . GetLang('SearchYourSearch') . ' <strong>"' . htmlspecialchars($GLOBALS['OriginalSearchQuery']) . '"</strong> ' . GetLang('SearchDidNotMatch') . '</p>';
                     if ($GLOBALS['OriginalSearchQuery'] == '') {
                         $GLOBALS['SearchTitle'] = '';
                     } else {
                         $GLOBALS['SearchTitle'] = " " . sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']);
                         //$GLOBALS['SearchTitle'] = GetLang('SearchResultsFor');
                     }
                 }
                 //$GLOBALS['SearchResults'] .= "<div style='width:100%'><p class='InfoMessage'>Please choose a category or brand</p></div>";
                 $GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t\t\t\t%%Panel.StaticFeaturedBrands%%";
                 $GLOBALS['HidePanels'][] = 'SearchPagingTop';
             }
         }
         $GLOBALS['SearchResults'] .= "<script type=\"text/javascript\"> \$('.focushiddendiv').css({'position':'absolute', 'margin-top':'-200px', 'display':'block'}); </script>";
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']);
         } else {
             $back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING'];
         }
         ISC_SetCookie("back2search", $back2url, 0, "/");
         // Showing the syndication option?
         if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) {
             $GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_NEWSEARCH']->GetQuery(), 0, false);
             $GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed");
         }
         /*
         //alandy_2012-1-16 add logic.
         if(isset($showDialog) && $showDialog){
         	
         	$GLOBALS['Displaydialog'] = 5;
         }
         */
     } else {
         if (isset($GLOBALS['showDialog']) && !empty($GLOBALS['showDialog'])) {
             $GLOBALS['Displaydialog'] = 5;
             unset($GLOBALS['showDialog']);
         }
         $this->YMMSelectors($params);
         //alandy_2012-2-6 hidde middle ymm selector.
         //$GLOBALS['SearchResults'] = "<div>".$GLOBALS['YMMTable']."</div>";
         $GLOBALS['SearchResults'] = '';
         $GLOBALS['CategoryBrandList'] = "\n\t\t\t\n\t\t\t                                %%Panel.StaticFeaturedCategories%%\n\t\t\t\t                            %%Panel.StaticFeaturedBrands%%\n\t\t\t\t                           ";
         // No search results were found
         // commented below code as need to show the favorite categories and brands as in homepage
         // $GLOBALS['HideSearchResults'] = "none";
         //$GLOBALS['HidePanels'][] = 'SearchPageProducts';
     }
     //var_dump($GLOBALS['SearchResults']);exit;
 }
Beispiel #5
0
 public function index($fid = 'id', $id = 0)
 {
     $id = intval($fid) > 0 ? intval($fid) : intval($id);
     //ID
     //判断ID
     if ($id == 0) {
         msg_url(L('dance_09'), Web_Path);
     }
     //获取数据
     $row = $this->CsdjDB->get_row_arr('dance', '*', $id);
     if (!$row || $row['yid'] > 0 || $row['hid'] > 0) {
         msg_url(L('dance_10'), Web_Path);
     }
     //判断运行模式,生成则跳转至静态页面
     $html = config('Html_Uri');
     if (config('Web_Mode') == 3 && $html['play']['check'] == 1) {
         //获取静态路径
         $Htmllink = LinkUrl('play', 'id', $id, 0, 'dance');
         header("Location: " . $Htmllink);
         exit;
     }
     //摧毁部分需要超级链接字段数组
     $rows = $row;
     //先保存数组保留下面使用
     unset($row['tags']);
     //获取当前分类下二级分类ID
     $arr['cid'] = getChild($row['cid']);
     $arr['uid'] = $row['uid'];
     $arr['did'] = $row['id'];
     $arr['singerid'] = $row['singerid'];
     $arr['tags'] = $rows['tags'];
     //装载模板并输出
     $skins = empty($row['skins']) ? 'play.html' : $row['skins'];
     $Mark_Text = $this->CsdjTpl->plub_show('dance', $row, $arr, TRUE, $skins, $row['name'], $row['name']);
     //评论
     $Mark_Text = str_replace("[dance:pl]", get_pl('dance', $id), $Mark_Text);
     //分类地址、名称
     $Mark_Text = str_replace("[dance:link]", LinkUrl('play', 'id', $row['id'], 1, 'news'), $Mark_Text);
     $Mark_Text = str_replace("[dance:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'dance'), $Mark_Text);
     $Mark_Text = str_replace("[dance:classname]", $this->CsdjDB->getzd('dance_list', 'name', $row['cid']), $Mark_Text);
     //专辑
     if ($row['tid'] == 0) {
         $Mark_Text = str_replace("[dance:topiclink]", "###", $Mark_Text);
         $Mark_Text = str_replace("[dance:topicname]", L('dance_11'), $Mark_Text);
     } else {
         $Mark_Text = str_replace("[dance:topiclink]", LinkUrl('topic', 'show', $row['tid'], 1, 'dance'), $Mark_Text);
         $Mark_Text = str_replace("[dance:topicname]", $this->CsdjDB->getzd('dance_topic', 'name', $row['tid']), $Mark_Text);
     }
     //获取上下曲
     preg_match_all('/[dance:slink]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $rowd = $this->db->query("Select id,cid,name from " . CS_SqlPrefix . "dance where yid=0 and hid=0 and id<" . $id . " order by id desc limit 1")->row();
         if ($rowd) {
             $Mark_Text = str_replace("[dance:slink]", LinkUrl('play', 'id', $rowd->id, 1, 'dance'), $Mark_Text);
             $Mark_Text = str_replace("[dance:sname]", $rowd->name, $Mark_Text);
             $Mark_Text = str_replace("[dance:sid]", $rowd->id, $Mark_Text);
         } else {
             $Mark_Text = str_replace("[dance:slink]", "#", $Mark_Text);
             $Mark_Text = str_replace("[dance:sname]", L('dance_20'), $Mark_Text);
             $Mark_Text = str_replace("[dance:sid]", 0, $Mark_Text);
         }
     }
     unset($arr);
     preg_match_all('/[dance:xlink]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $rowd = $this->db->query("Select id,cid,name from " . CS_SqlPrefix . "dance where yid=0 and hid=0 and id>" . $id . " order by id asc limit 1")->row();
         if ($rowd) {
             $Mark_Text = str_replace("[dance:xlink]", LinkUrl('play', 'id', $rowd->id, 1, 'dance'), $Mark_Text);
             $Mark_Text = str_replace("[dance:xname]", $rowd->name, $Mark_Text);
             $Mark_Text = str_replace("[dance:xid]", $rowd->id, $Mark_Text);
         } else {
             $Mark_Text = str_replace("[dance:xlink]", "#", $Mark_Text);
             $Mark_Text = str_replace("[dance:xname]", L('dance_20'), $Mark_Text);
             $Mark_Text = str_replace("[dance:xid]", 0, $Mark_Text);
         }
     }
     unset($arr);
     //标签加超级连接
     $Mark_Text = str_replace("[dance:tags]", SearchLink($rows['tags']), $Mark_Text);
     //歌曲完整试听地址
     preg_match_all('/[dance:qurl]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $purl = $row['purl'];
         if ($row['fid'] > 0) {
             $rowf = $this->db->query("Select purl from " . CS_SqlPrefix . "dance_server where id=" . $row['fid'] . "")->row_array();
             if ($rowf) {
                 $purl = $rowf['purl'] . $row['purl'];
             }
         }
         $purl = annexlink($purl);
         $Mark_Text = str_replace("[dance:qurl]", $purl, $Mark_Text);
     }
     unset($arr);
     //cmp音频播放器
     $player = "<script type='text/javascript'>\r\n\t\t\tvar mp3_w='" . CS_Play_w . "';\r\n\t\t\tvar mp3_h='" . CS_Play_h . "';\r\n\t\t\tvar mp3_i='" . $id . "';\r\n\t\t\tvar mp3_p='" . hitslink('play', 'dance') . "';\r\n\t\t\tvar mp3_t='" . Web_Path . "';\r\n\t\t\tmp3_play();\r\n\t\t\t</script>";
     $Mark_Text = str_replace("[dance:player]", $player, $Mark_Text);
     //jp音频播放器
     $jplayer = "<script type='text/javascript'>\r\n\t\t\tvar mp3_i='" . $id . "';\r\n\t\t\tvar mp3_p='" . hitslink('play', 'dance') . "';\r\n\t\t\tvar mp3_n='" . str_replace("'", "", $row['name']) . "';\r\n\t\t\tvar mp3_x='" . LinkUrl('down', 'id', $row['id'], 1, 'dance') . "';\r\n\t\t\tvar mp3_l='" . LinkUrl('down', 'lrc', $row['id'], 1, 'dance') . "';\r\n\t\t\tmp3_jplayer();\r\n\t\t\t</script>";
     $Mark_Text = str_replace("[dance:jplayer]", $jplayer, $Mark_Text);
     //增加人气
     $Mark_Text = hits_js($Mark_Text, hitslink('hits/ids/' . $id, 'dance'));
     echo $Mark_Text;
     $this->cache->end();
     //由于前面不是直接输出,所以这里需要加入写缓存
 }
Beispiel #6
0
 public function index($fid = 'id', $id = 0)
 {
     $id = intval($fid) > 0 ? intval($fid) : intval($id);
     //ID
     //判断ID
     if ($id == 0) {
         msg_url('出错了,ID不能为空!', Web_Path);
     }
     //获取数据
     $row = $this->CsdjDB->get_row_arr('news', '*', $id);
     if (!$row || $row['yid'] > 0 || $row['hid'] > 0) {
         msg_url('出错了,该数据不存在或者没有审核!', Web_Path);
     }
     //判断运行模式,生成则跳转至静态页面
     $html = config('Html_Uri');
     if (config('Web_Mode') == 3 && $html['show']['check'] == 1) {
         //获取静态路径
         $Htmllink = LinkUrl('show', $fid, $id, 0, 'news');
         header("Location: " . $Htmllink);
         exit;
     }
     //摧毁部分需要超级链接字段数组
     $rows = $row;
     //先保存数组保留下面使用
     unset($row['tags']);
     unset($row['content']);
     //获取当前分类下二级分类ID
     $arr['cid'] = getChild($row['cid']);
     $arr['uid'] = $row['uid'];
     $arr['tags'] = $rows['tags'];
     //默认模板
     $skins = empty($row['skins']) ? 'show.html' : $row['skins'];
     //装载模板并输出
     $Mark_Text = $this->CsdjTpl->plub_show('news', $row, $arr, TRUE, $skins, $row['name'], $row['name']);
     //评论
     $Mark_Text = str_replace("[news:pl]", get_pl('news', $id), $Mark_Text);
     //分类地址、名称
     $Mark_Text = str_replace("[news:link]", LinkUrl('show', 'id', $row['id'], 1, 'news'), $Mark_Text);
     $Mark_Text = str_replace("[news:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'news'), $Mark_Text);
     $Mark_Text = str_replace("[news:classname]", $this->CsdjDB->getzd('news_list', 'name', $row['cid']), $Mark_Text);
     //获取上下篇
     preg_match_all('/[news:slink]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $rowd = $this->db->query("Select id,cid,name from " . CS_SqlPrefix . "news where yid=0 and hid=0 and id<" . $id . " order by id desc limit 1")->row();
         if ($rowd) {
             $Mark_Text = str_replace("[news:slink]", LinkUrl('show', 'id', $rowd->id, 1, 'news'), $Mark_Text);
             $Mark_Text = str_replace("[news:sname]", $rowd->name, $Mark_Text);
             $Mark_Text = str_replace("[news:sid]", $rowd->id, $Mark_Text);
         } else {
             $Mark_Text = str_replace("[news:slink]", "#", $Mark_Text);
             $Mark_Text = str_replace("[news:sname]", "没有了", $Mark_Text);
             $Mark_Text = str_replace("[news:sid]", 0, $Mark_Text);
         }
     }
     unset($arr);
     preg_match_all('/[news:xlink]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $rowd = $this->db->query("Select id,cid,name from " . CS_SqlPrefix . "news where yid=0 and hid=0 and id>" . $id . " order by id asc limit 1")->row();
         if ($rowd) {
             $Mark_Text = str_replace("[news:xlink]", LinkUrl('show', 'id', $rowd->id, 1, 'news'), $Mark_Text);
             $Mark_Text = str_replace("[news:xname]", $rowd->name, $Mark_Text);
             $Mark_Text = str_replace("[news:xid]", $rowd->id, $Mark_Text);
         } else {
             $Mark_Text = str_replace("[news:xlink]", "#", $Mark_Text);
             $Mark_Text = str_replace("[news:xname]", "没有了", $Mark_Text);
             $Mark_Text = str_replace("[news:xid]", 0, $Mark_Text);
         }
     }
     unset($arr);
     //标签加超级连接
     $Mark_Text = str_replace("[news:tags]", SearchLink($rows['tags']), $Mark_Text);
     //文章内容,判断是否是收费文章
     if ($row['vip'] > 0 || $row['level'] > 0 || $row['cion'] > 0) {
         $content = "<div id='cscms_content'></div>";
         if (config('Ym_Mode', 'news') == 1) {
             $content .= "<script type='text/javascript' src='http://" . config('Ym_Url', 'news') . Web_Path . "index.php/show/pay/" . $id . "'></script>";
         } else {
             $content .= "<script type='text/javascript' src='http://" . Web_Url . Web_Path . "index.php/news/show/pay/" . $id . "'></script>";
         }
     } else {
         $content = $rows['content'];
     }
     $Mark_Text = str_replace("[news:content]", $content, $Mark_Text);
     //增加人气
     $Mark_Text = hits_js($Mark_Text, hitslink('hits/ids/' . $id, 'news'));
     echo $Mark_Text;
     $this->cache->end();
     //由于前面不是直接输出,所以这里需要加入写缓存
 }
Beispiel #7
0
 public function index($fid = 'id', $id = 0)
 {
     $id = intval($fid) > 0 ? intval($fid) : intval($id);
     //ID
     //判断ID
     if ($id == 0) {
         msg_url('出错了,ID不能为空!', Web_Path);
     }
     //获取数据
     $row = $this->CsdjDB->get_row_arr('pic_type', '*', $id);
     if (!$row || $row['yid'] > 0 || $row['hid'] > 0) {
         msg_url('出错了,该数据不存在或者没有审核!', Web_Path);
     }
     //判断运行模式,生成则跳转至静态页面
     $html = config('Html_Uri');
     if (config('Web_Mode') == 3 && $html['show']['check'] == 1) {
         //获取静态路径
         $Htmllink = LinkUrl('show', $fid, $id, 0, 'pic');
         header("Location: " . $Htmllink);
         exit;
     }
     //摧毁部分需要超级链接字段数组
     $rows = $row;
     //先保存数组保留下面使用
     unset($row['tags']);
     //获取当前分类下二级分类ID
     $arr['cid'] = getChild($row['cid']);
     $arr['uid'] = $row['uid'];
     $arr['tags'] = $rows['tags'];
     $arr['sid'] = $row['id'];
     //默认模板
     $skins = empty($row['skins']) ? 'show.html' : $row['skins'];
     //装载模板并输出
     $Mark_Text = $this->CsdjTpl->plub_show('pic', $row, $arr, TRUE, $skins, $row['name'], $row['name']);
     //评论
     $Mark_Text = str_replace("[pic:pl]", get_pl('pic', $id), $Mark_Text);
     //分类地址、名称
     $Mark_Text = str_replace("[pic:link]", LinkUrl('show', 'id', $row['id'], 1, 'pic'), $Mark_Text);
     $Mark_Text = str_replace("[pic:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'pic'), $Mark_Text);
     $Mark_Text = str_replace("[pic:classname]", $this->CsdjDB->getzd('pic_list', 'name', $row['cid']), $Mark_Text);
     //获取上下张
     preg_match_all('/[pic:slink]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $rowd = $this->db->query("Select id,cid,pic,name from " . CS_SqlPrefix . "pic_type where yid=0 and hid=0 and id<" . $id . " order by id desc limit 1")->row();
         if ($rowd) {
             $Mark_Text = str_replace("[pic:slink]", LinkUrl('show', 'id', $rowd->id, 1, 'pic'), $Mark_Text);
             $Mark_Text = str_replace("[pic:sname]", $rowd->name, $Mark_Text);
             $Mark_Text = str_replace("[pic:sid]", $rowd->id, $Mark_Text);
             $Mark_Text = str_replace("[pic:spic]", piclink('pic', $rowd->pic), $Mark_Text);
         } else {
             $Mark_Text = str_replace("[pic:slink]", "#", $Mark_Text);
             $Mark_Text = str_replace("[pic:sname]", "没有了", $Mark_Text);
             $Mark_Text = str_replace("[pic:sid]", 0, $Mark_Text);
             $Mark_Text = str_replace("[pic:spic]", piclink('pic', ''), $Mark_Text);
         }
     }
     unset($arr);
     preg_match_all('/[pic:xlink]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $rowd = $this->db->query("Select id,cid,pic,name from " . CS_SqlPrefix . "pic_type where yid=0 and hid=0 and id>" . $id . " order by id asc limit 1")->row();
         if ($rowd) {
             $Mark_Text = str_replace("[pic:xlink]", LinkUrl('show', 'id', $rowd->id, 1, 'pic'), $Mark_Text);
             $Mark_Text = str_replace("[pic:xname]", $rowd->name, $Mark_Text);
             $Mark_Text = str_replace("[pic:xid]", $rowd->id, $Mark_Text);
             $Mark_Text = str_replace("[pic:xpic]", piclink('pic', $rowd->pic), $Mark_Text);
         } else {
             $Mark_Text = str_replace("[pic:xlink]", "#", $Mark_Text);
             $Mark_Text = str_replace("[pic:xname]", "没有了", $Mark_Text);
             $Mark_Text = str_replace("[pic:xid]", 0, $Mark_Text);
             $Mark_Text = str_replace("[pic:xpic]", piclink('pic', ''), $Mark_Text);
         }
     }
     unset($arr);
     //标签加超级连接
     $Mark_Text = str_replace("[pic:tags]", SearchLink($rows['tags']), $Mark_Text);
     //获取当前相册总数
     $pcount = $this->db->query("Select id from " . CS_SqlPrefix . "pic where sid=" . $id . " and hid=0 and yid=0")->num_rows();
     $Mark_Text = str_replace("[pic:count]", $pcount, $Mark_Text);
     //第一张图片
     $rowp = $this->db->query("Select pic,content from " . CS_SqlPrefix . "pic where sid=" . $id . " and hid=0 and yid=0 order by id desc limit 1")->row();
     $pics = $rowp ? $rowp->pic : '';
     $content = $rowp ? $rowp->content : '';
     $Mark_Text = str_replace("[pic:url]", piclink('pic', $pics), $Mark_Text);
     $Mark_Text = str_replace("[pic:content]", $content, $Mark_Text);
     //增加人气
     $Mark_Text = hits_js($Mark_Text, hitslink('hits/ids/' . $id, 'pic'));
     echo $Mark_Text;
     $this->cache->end();
     //由于前面不是直接输出,所以这里需要加入写缓存
 }
Beispiel #8
0
 public function SetPanelSettings()
 {
     $count = 0;
     $output = "";
     $params = $GLOBALS['ISC_CLASS_SEARCH']->_searchterms;
     $this->searchterms = $params;
     /* Checking the search string. If it is used in any search, will be retained. else it will not be retained - starts */
     if (isset($this->searchterms['search'])) {
         $search_str = trim(str_ireplace($this->searchterms['search_string'], "", $this->searchterms['search']));
         if ($search_str == '') {
             unset($this->searchterms['search'], $params['search']);
         } else {
             $this->searchterms['search'] = $params['search'] = $search_str;
         }
     }
     $path = GetConfig('ShopPath');
     /* the below mmy links are passed to the breadcrumbs */
     $mmy_links = "";
     /*---------- This below section is for generating search phrase----------*/
     $GLOBALS['Category'] = "";
     $GLOBALS['MMY'] = "";
     $GLOBALS['PQ'] = "";
     $GLOBALS['VQ'] = "";
     $GLOBALS['SearchPhrase'] = "";
     $ext_links = "";
     // this variable is passed to the product detail page
     $seo_delim = "&";
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $seo_delim = "/";
     }
     if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
         $GLOBALS['Category'] .= $GLOBALS['ISC_SRCH_CATG_NAME'];
     }
     if (isset($params['year'])) {
         $GLOBALS['MMY'] .= $params['year'] . "<br>";
         $ext_links .= $seo_delim . "year=" . $params['year'];
     }
     if (isset($params['make'])) {
         $GLOBALS['MMY'] .= strtoupper($params['make']) . "<br>";
         $ext_links .= $seo_delim . "make=" . MakeURLSafe($params['make']);
     }
     if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) {
         $GLOBALS['MMY'] .= strtoupper($params['model']) . "<br>";
         $ext_links .= $seo_delim . "model=" . MakeURLSafe($params['model']);
     }
     /*else if(isset($params['model']))
       $ext_links .= $seo_delim."model=".$params['model'];*/
     /* this condition has been added seperately here to show submodel at last */
     if (isset($params['submodel'])) {
         $GLOBALS['MMY'] .= MakeURLSafe($params['submodel']) . "<br>";
     }
     /*if(isset($params['year'])) {
       $ext_links .= $seo_delim."year=".$params['year'];                
       }*/
     if (isset($params['dynfilters']) && !empty($params['dynfilters'])) {
         foreach ($params['dynfilters'] as $key => $value) {
             if (eregi('vq', $key)) {
                 $key = str_ireplace('vq', '', $key);
                 $GLOBALS['VQ'] .= ucfirst($key) . ": {$value}<br>";
             } else {
                 if (eregi('pq', $key)) {
                     $key = str_ireplace('pq', '', $key);
                     $GLOBALS['PQ'] .= ucfirst($key) . ": {$value}<br>";
                 }
             }
         }
     }
     $filter_var = array('vq', 'pq');
     /* this below patch is used for getting description of the category. Here currently the selected category id will be last one in the $params['srch_category'] array. if input['category'] is used then it will be the first one */
     if (!empty($params['srch_category'])) {
         if (isset($params['category'])) {
             $selected_catg = $params['srch_category'][0];
         } else {
             $selected_catg = end($params['srch_category']);
         }
         //wirror_20100806: add selected files like pagecontenttype and customcontentid;
         $catg_desc_qry = "select pagecontenttype, customcontentid, catdesc , categoryfooter  from [|PREFIX|]categories where categoryid = " . $selected_catg;
         $catg_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_desc_qry);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($catg_desc_res) > 0) {
             $catg_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res);
         }
         //wirror_20100806: get the custom prudocts list;
         $catg_custom_arr = array();
         $catg_custom_qry = "SELECT cp.productids, cp.categoryid, cp.subcategoryid, cp.brandid, cp.seriesid, cp.description\n            \t\t  FROM [|PREFIX|]custom_products cp \n            \t\t  INNER JOIN [|PREFIX|]custom_contents cc on cc.contentid=cp.contentid\n            \t\t  WHERE cc.contentid\n                      IN (\n                           SELECT customcontentid\n                           FROM [|PREFIX|]categories\n                           WHERE categoryid = '{$selected_catg}'\n                      )\n                      AND cp.enabled=1 ";
         if (isset($params['brand']) && $params['brand'] != "") {
             $brand_query = "select brandid from [|PREFIX|]brands WHERE brandname='" . $params['brand'] . "'";
             $brand_result = $GLOBALS['ISC_CLASS_DB']->Query($brand_query);
             $brandId = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_result);
             if ((int) $brandId > 0) {
                 $catg_custom_qry .= " AND cp.brandid={$brandId} ";
             }
         }
         $catg_custom_qry .= " ORDER BY cp.displayorder ASC ";
         $catg_custom_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_custom_qry);
         while ($rows = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_custom_res)) {
             $catg_custom_arr[] = $rows;
         }
         $catCustomFlag = false;
         /* this below patch is used to show the display name for the qualifiers from the qualifier association table */
         $map_names = array();
         $display_names = array();
         $filter_names = "select qid , column_name , display_names from [|PREFIX|]qualifier_names where column_name regexp '^(pq|vq)'";
         $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
         while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
             $map_names[$filter_row['qid']] = $filter_row['column_name'];
             $display_names[$filter_row['qid']] = $filter_row['display_names'];
         }
         $this->GetAssocDetails($selected_catg, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
     }
     if (isset($params['brand'])) {
         $brand_desc_arr = array();
         $brand_desc_qry = "select branddescription , brandfooter from [|PREFIX|]brands where brandname = '" . $params['brand'] . "'";
         $brand_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_desc_qry);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($brand_desc_res) > 0) {
             $brand_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_desc_res);
         }
     }
     // for breadcrumbs
     $this->_BuildBreadCrumbs();
     /* the below line has been commented as client told to remove it */
     //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 30) {
         $msg_qry = "select value from [|PREFIX|]display where messageid = 1";
         $msg_res = $GLOBALS['ISC_CLASS_DB']->Query($msg_qry);
         $msg_row = $GLOBALS['ISC_CLASS_DB']->FetchOne($msg_res);
         $GLOBALS['SearchPhrase'] = $msg_row;
         //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     }
     /*if(!empty($params['dynfilters']))
       $GLOBALS['SearchPhrase'] .= " ".implode(" ",$params['dynfilters']);
       /*---------- Ending section for generating search phrase----------*/
     $vq_column_title = "";
     $GLOBALS['SearchResultList'] = "";
     if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 0) {
         $brand_rating = 0;
         $category_rating = 0;
         if ($GLOBALS['results_page_flag'] == 1) {
             $brand_rating_qry = "select avg(revrating) as rating from [|PREFIX|]reviews r left join [|PREFIX|]products p on r.revproductid = p.productid left join [|PREFIX|]brands b on p.prodbrandid = b.brandid  where r.revstatus = 1 and b.brandname = '" . $params['brand'] . "'";
             $brand_rating_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_rating_qry);
             $brand_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_rating_res);
             if (isset($brand_rating_arr['rating'])) {
                 $brand_rating = (int) $brand_rating_arr['rating'];
             }
         } else {
             if ($GLOBALS['results_page_flag'] == 0 && isset($selected_catg)) {
                 // 3rdAug2010: added the condition "isset($selected_catg)" as no need to show rating when only YMM is selected
                 // lguan_20100612: Category page mode, calculate the rating
                 $catquery = $GLOBALS['ISC_CLASS_DB']->Query("SELECT categoryid FROM [|PREFIX|]categories where catparentid = {$selected_catg}");
                 $catlistid = array();
                 while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catquery)) {
                     $catlistid[] = $catrow['categoryid'];
                 }
                 $catcountlist = implode(",", $catlistid);
                 //lguan_20100612: Changed following codes to get product rating for categories
                 if (count($catlistid) > 0) {
                     $catcountlist = $selected_catg . "," . $catcountlist;
                 }
                 $cat_rating_res = $GLOBALS['ISC_CLASS_DB']->Query("SELECT floor(SUM(p.prodratingtotal)/SUM(p.prodnumratings))AS prodavgrating FROM [|PREFIX|]categoryassociations c INNER JOIN [|PREFIX|]products p on c.productid=p.productid where c.categoryid IN ({$catcountlist})");
                 $cat_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($cat_rating_res);
                 if (isset($cat_rating_arr['prodavgrating'])) {
                     $category_rating = (int) $cat_rating_arr['prodavgrating'];
                 }
             }
         }
         /* displaying the dropdowns for YMM */
         if (!isset($params['make']) || !isset($params['year']) || !isset($params['model']) || isset($params['model_flag']) && $params['model_flag'] == 0) {
             $this->YMMSelectors($params);
         }
         // We have at least one result, let's show it to the world!
         $GLOBALS['HideNoResults'] = "none";
         // Only show the "compare" option if there are 2 or more products on this page
         if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) < 2) {
             $GLOBALS['HideCompareItems'] = "none";
         }
         if (GetConfig('EnableProductReviews') == 0) {
             $GLOBALS['HideProductRating'] = "display: none";
         }
         $GLOBALS['AlternateClass'] = '';
         $counter = 1;
         $CurCatId = 0;
         $mmy_links = $this->GetYMMLinks($params);
         $mmy_links .= $this->GetOtherLinks($params);
         //wirror_code_mark_begin
         //wirror_20100809: show the custom filter items
         $subcatId = array();
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['SearchResults'])) {
             /* Added by Simha to check inf prodcucts comes from different categories*/
             if (empty($params['srch_category']) || !isset($params['srch_category'])) {
                 if ($CurCatId != $row['categoryid']) {
                     $CurCatId = $row['categoryid'];
                     $map_names = array();
                     $display_names = array();
                     $filter_names = "SELECT DISTINCT qn.qid, qn.column_name, qn.display_names from \n                                                [|PREFIX|]qualifier_names qn\n                                                LEFT JOIN [|PREFIX|]qualifier_associations qa ON qa.qualifierid = qn.qid\n                                                WHERE (qa.categoryid = '{$CurCatId}') \n                                                AND qn.column_name regexp '^(pq|vq)'";
                     // || qa.categoryid IN (SELECT catparentid FROM isc_categories WHERE categoryid = '$CurCatId')
                     $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
                     while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
                         $map_names[$filter_row['qid']] = $filter_row['column_name'];
                         $display_names[$filter_row['qid']] = $filter_row['display_names'];
                     }
                     $this->GetAssocDetails($CurCatId, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
                 }
             }
             /* Added by Simha Ends */
             $GLOBALS['SearchTrackClass'] = "TrackLink";
             $imagefile = "";
             if ($GLOBALS['AlternateClass'] == 'Odd') {
                 $GLOBALS['AlternateClass'] = 'Even';
             } else {
                 $GLOBALS['AlternateClass'] = 'Odd';
             }
             $qry_string = $_SERVER['QUERY_STRING'];
             if (isset($_GET['page'])) {
                 $page = "&page=" . $_GET['page'];
                 $qry_string = str_ireplace($page, '', $qry_string);
             }
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 if (isset($_GET['search_key'])) {
                     $qry_string = str_ireplace('&search_key=' . $_GET['search_key'], '', $qry_string);
                 }
                 if (isset($params['search_query']) && !strstr($qry_string, 'search_query=')) {
                     $qry_string .= "search_query=" . MakeURLSafe($params['search_query']);
                 }
                 if (isset($params['make']) && !strstr($qry_string, 'make=')) {
                     $qry_string .= "&make=" . MakeURLSafe($params['make']);
                 }
                 if (isset($params['model']) && !strstr($qry_string, 'model=')) {
                     $qry_string .= "&model=" . MakeURLSafe($params['model']);
                 }
                 if (isset($params['year']) && !strstr($qry_string, 'year=')) {
                     $qry_string .= "&year=" . MakeURLSafe($params['year']);
                 }
                 if (isset($params['make']) && !strstr($qry_string, 'make=')) {
                     $qry_string .= "&make=" . MakeURLSafe($params['make']);
                 }
                 if (isset($params['model_flag']) && !strstr($qry_string, 'model_flag=')) {
                     $qry_string .= "&model_flag=" . MakeURLSafe($params['model_flag']);
                 }
                 if (isset($params['submodel']) && !strstr($qry_string, 'submodel=')) {
                     $qry_string .= "&submodel=" . MakeURLSafe($params['submodel']);
                 }
             }
             if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) {
                 break;
             }
             if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
                 //wirror_mark_condition1
                 /*if( isset($params['srch_category']) )  {
                 			$GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of product listing page.
                 		}*/
                 if (isset($params['category']) || !isset($params['subcategory']) && isset($params['series'])) {
                     $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription'];
                     //$GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter'];
                     $GLOBALS['CatgBrandSeriesFooter'] = "";
                     if ((isset($params['category']) || isset($params['subcategory'])) && $GLOBALS['CatgDescandBrandImage'] == "") {
                         $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                         //$GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : '';
                         $GLOBALS['CatgBrandSeriesFooter'] = "";
                     }
                 } else {
                     if (isset($params['srch_category'])) {
                         $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                         $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : '';
                         if (isset($params['series']) && $row['seriesdescription'] != "") {
                             $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription'];
                             //$GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter'];
                             $GLOBALS['CatgBrandSeriesFooter'] = "";
                         }
                         if ($GLOBALS['CatgDescandBrandImage'] == '' && $GLOBALS['CatgBrandSeriesFooter'] == '' && isset($params['brand'])) {
                             $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : '';
                             //$GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : '';
                             $GLOBALS['CatgBrandSeriesFooter'] = "";
                         }
                     } else {
                         if (isset($params['brand'])) {
                             $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : '';
                             $GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : '';
                         }
                     }
                 }
                 /* No need to show footer description when YMM are selected */
                 if (isset($params['make']) || isset($params['model']) || isset($params['year'])) {
                     $GLOBALS['CatgBrandSeriesFooter'] = "";
                 }
                 $GLOBALS['ProductCartQuantity'] = '';
                 if (isset($GLOBALS['CartQuantity' . $row['productid']])) {
                     $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']];
                 }
                 if ($counter % 2 == 0) {
                     $GLOBALS['RowColor'] = 'grayrow';
                 } else {
                     $GLOBALS['RowColor'] = 'whiterow';
                 }
                 $counter++;
                 $GLOBALS['ProductId'] = (int) $row['productid'];
                 $GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
                 $GLOBALS['ProductLink'] = ProdLink($row['prodname']);
                 $GLOBALS['ProductRating'] = (int) $row['prodavgrating'];
                 //$GLOBALS['BrandName'] = $row['brandname'];
                 /* -- The below code is added to display the brand and series logo -- */
                 $GLOBALS['BrandName'] = "";
                 $brandlogo = realpath(ISC_BASE_PATH . '/product_images/' . $row['brandimagefile']);
                 if ($row['brandimagefile'] != '' && file_exists($brandlogo)) {
                     $GLOBALS['BrandName'] .= "<img src=\"" . $GLOBALS['ShopPath'] . "/product_images/" . $row['brandimagefile'] . "\" class=\"BrandSeriesLogo\" />";
                 } else {
                     $GLOBALS['BrandName'] .= $row['brandname'];
                 }
                 $serieslogo = realpath(ISC_BASE_PATH . '/series_images/' . $row['serieslogoimage']);
                 if ($row['serieslogoimage'] != '' && file_exists($serieslogo)) {
                     $GLOBALS['BrandName'] .= "<br><img src=\"" . $GLOBALS['ShopPath'] . "/series_images/" . $row['serieslogoimage'] . "\" />";
                 } else {
                     $GLOBALS['BrandName'] .= "<br>" . $row['seriesname'];
                 }
                 /* --- ends --- */
                 $GLOBALS['ProdCode'] = $row['prodcode'];
                 //$GLOBALS['ProdDesc'] = $this->strip_html_tags($row['proddesc']);
                 $GLOBALS['icon_file'] = '';
                 if (isset($row['icon_file'])) {
                     if (stripos($row['icon_file'], 'http://') >= 0) {
                         $GLOBALS['icon_file'] = "<img src='" . $row['icon_file'] . "' border=0 class='icon_image_class' width='125' />";
                     } else {
                         $GLOBALS['icon_file'] = "<img src='" . $GLOBALS["SHOP_PATH"] . "/" . $row['icon_file'] . "' border=0 class='icon_image_class' width='125'/>";
                     }
                 }
                 //$GLOBALS['ProdOptions'] = $row['productoption'];
                 $GLOBALS['VehicleOptions'] = "";
                 $GLOBALS['ProdOptions'] = "";
                 foreach ($row as $key => $val) {
                     if ($val != "" && $val != "~") {
                         if (($qualifier_id = array_search($key, $map_names)) !== false) {
                             if (eregi('^vq', $key)) {
                                 $val = trim($val, "~");
                                 $val = preg_split('/[~;]+/', $val);
                                 $val = array_unique($val);
                                 $val = array_values($val);
                                 $val = implode(",", $val);
                                 /* -- Setting display name for qualifier name -- */
                                 if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') {
                                     $key = $OwnAssoc[$qualifier_id][0]['qname'];
                                 } else {
                                     if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') {
                                         $key = $ParentAssoc[$qualifier_id][0]['qname'];
                                     } else {
                                         if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) {
                                             $key = $display_names[$qualifier_id];
                                         } else {
                                             $key = ucfirst(str_ireplace($filter_var, "", $key));
                                         }
                                     }
                                 }
                                 /* -- Setting display name for qualifier name ends -- */
                                 /* -- Setting display name for qualifier value -- */
                                 if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != "") {
                                     $val = $OwnAssoc[$qualifier_id][$m]['vname'];
                                 } else {
                                     if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentAssoc[$qualifier_id][$m]['vname'] != "") {
                                         $val = $ParentAssoc[$qualifier_id][$m]['vname'];
                                     }
                                 }
                                 /* -- Setting display name for qualifier value ends-- */
                                 //$GLOBALS['VehicleOptions'] .= "<b>".$key."</b> : ".$val."<br>";
                                 $GLOBALS['VehicleOptions'] .= "<div class='qualifierwrap'><div class='qualifiertitle'>" . $key . " :</div> " . $val . "</div>";
                             }
                             if (eregi('^pq', $key)) {
                                 $val = trim($val, "~");
                                 $val = preg_split('/[~;]+/', $val);
                                 $val = array_unique($val);
                                 $val = array_values($val);
                                 $val = implode(",", $val);
                                 /* -- Setting display name for qualifier name -- */
                                 if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') {
                                     $key = $OwnAssoc[$qualifier_id][0]['qname'];
                                 } else {
                                     if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') {
                                         $key = $ParentAssoc[$qualifier_id][0]['qname'];
                                     } else {
                                         if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) {
                                             $key = $display_names[$qualifier_id];
                                         } else {
                                             $key = ucfirst(str_ireplace($filter_var, "", $key));
                                         }
                                     }
                                 }
                                 /* -- Setting display name for qualifier name ends -- */
                                 /* -- Setting display name for qualifier value -- */
                                 if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != '') {
                                     $val = $OwnAssoc[$qualifier_id][$m]['vname'];
                                 } else {
                                     if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentValue[$qualifier_id][$m]['vname'] != '') {
                                         $val = $ParentAssoc[$qualifier_id][$m]['vname'];
                                     }
                                 }
                                 /* -- Setting display name for qualifier value ends-- */
                                 //$GLOBALS['ProdOptions'] .= "<b>".$key."</b> : ".$val."<br>";
                                 $GLOBALS['ProdOptions'] .= "<div class='qualifierwrap'><div class='qualifiertitle'>" . $key . " :</div> " . $val . "</div>";
                             }
                         }
                     }
                 }
                 if (isset($row['vehicleoption'])) {
                     $GLOBALS['VehicleOptions'] = $row['vehicleoption'];
                 }
                 if (isset($row['productoption'])) {
                     $GLOBALS['ProdOptions'] = $row['productoption'];
                 }
                 if (isset($row['catuniversal']) && $row['catuniversal'] == 1) {
                     $GLOBALS['VehicleOptions'] = $GLOBALS['ProductName'];
                     if ($vq_column_title == "") {
                         $vq_column_title = "Product Name";
                     } else {
                         if ($vq_column_title != "Product Name") {
                             $vq_column_title = "Product Name / Vehicle";
                         }
                     }
                 } else {
                     if ($vq_column_title == "") {
                         $vq_column_title = "Vehicle Options";
                     } else {
                         if ($vq_column_title != "Vehicle Options") {
                             $vq_column_title = "Product Name / Vehicle";
                         }
                     }
                 }
                 if (empty($GLOBALS['ProdOptions']) && empty($GLOBALS['VehicleOptions'])) {
                     $GLOBALS['ProdOptions'] = "&nbsp;";
                 }
                 if (empty($GLOBALS['VehicleOptions'])) {
                     $GLOBALS['VehicleOptions'] = "&nbsp;";
                 }
                 /*--- the below lines are added for back 2 search link in the product detail page. Also modified line no 56 & 60 --- */
                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                     $GLOBALS['ProductLink'] .= "/refer=true" . $ext_links;
                     if (isset($GLOBALS['SearchId'])) {
                         $GLOBALS['ProductLink'] .= '/SearchLogId/' . $GLOBALS['SearchId'];
                     }
                 } else {
                     $GLOBALS['ProductLink'] .= "&refer=true" . $ext_links;
                     if (isset($GLOBALS['SearchId'])) {
                         $GLOBALS['ProductLink'] .= '&SearchLogId=' . $GLOBALS['SearchId'];
                     }
                 }
                 ### Added by Simha for onsale addition
                 // Determine the price of this product
                 //$GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row);
                 $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($row);
                 $FinalPrice = $GLOBALS['ProductPrice'];
                 $SalePrice = $row['prodsaleprice'];
                 //$DiscountAmount = $FinalPrice;
                 $discounttype = 0;
                 $discountname = '';
                 if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) {
                     $DiscountPrice = $SalePrice;
                 } else {
                     $DiscountPrice = $FinalPrice;
                     $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $row['categoryid'], $row['brandseriesid'], $discounttype, $discountname);
                     /*if($discounttype == 0)    {
                           $DiscountPrice = $FinalPrice;
                       }*/
                 }
                 /*
                 							foreach($DiscountInfo as $DiscountInfoSub)   {  
                     if(isset($DiscountInfoSub['catids']))    {
                 								    $catids = explode(",", $DiscountInfoSub['catids']); 
                 								    foreach($catids as $catid) {
                 									    if($catid == $row['categoryid']) {
                 										    $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); 
                 										    if ($DiscountAmount < 0) {
                 											    $DiscountAmount = 0;
                 										    }                                                                         
                 										    $DiscountPrice  = $FinalPrice - $DiscountAmount;  
                 									    } 
                 								    }  
                     }
                 							}       
                 */
                 if (isset($DiscountPrice) && $DiscountPrice < $FinalPrice && $discounttype == 0) {
                     //&& GetConfig('ShowOnSale')
                     $GLOBALS['ProductPrice'] = '<strike>' . CurrencyConvertFormatPrice($FinalPrice) . '</strike>';
                     $GLOBALS['ProductPrice'] .= '<br><div class="finalprice">' . CurrencyConvertFormatPrice($DiscountPrice) . '</div> ';
                     if (strtolower($discountname) == "clearance") {
                         $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/clearance.gif" alt="">';
                     } else {
                         $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                     }
                     if (GetConfig('ShowOnSale')) {
                         $GLOBALS['ProductPrice'] .= '' . $GLOBALS['ShowOnSaleImage'] . '';
                     }
                 } else {
                     $GLOBALS['ProductPrice'] = '<div class="finalprice">' . CurrencyConvertFormatPrice($FinalPrice) . '</div>';
                 }
                 ### Added by Simha Ends
                 // commented the below line by vikas
                 //$GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname']));
                 $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], $GLOBALS['ProductLink']);
                 if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) {
                     //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas
                     $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
                     $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
                 } else {
                     //$GLOBALS['ProductURL'] = CartLink($row['productid']);
                     //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas
                     $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
                     //blessen
                     if (intval($row['prodretailprice']) <= 0) {
                         //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); // commented by vikas on 15-7-09
                         $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
                     } else {
                         //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); // commented by vikas on 15-7-09
                         $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
                     }
                     //blessen
                     // original $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink');
                 }
                 if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {
                     $GLOBALS['HideActionAdd'] = '';
                 } else {
                     $GLOBALS['HideActionAdd'] = 'none';
                 }
                 $GLOBALS['HideProductVendorName'] = 'display: none';
                 $GLOBALS['ProductVendor'] = '';
                 if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) {
                     $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors');
                     if (isset($vendorCache[$row['prodvendorid']])) {
                         $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>';
                         $GLOBALS['HideProductVendorName'] = '';
                     }
                 }
                 $GLOBALS['CartURL'] = CartLink($row['productid']);
                 if (isset($GLOBALS['SearchId'])) {
                     $GLOBALS['CartURL'] .= '&SearchLogId=' . $GLOBALS['SearchId'];
                 }
                 $offer = $this->IsProductMakeanOffer($row['brandseriesid'], $row['brandname'], $row['categoryid']);
                 if ($offer == 'yes') {
                     $GLOBALS['HideOfferButton'] = 'block';
                 } else {
                     $GLOBALS['HideOfferButton'] = 'none';
                 }
                 $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItem");
             } else {
                 if ($GLOBALS['results_page_flag'] == 0) {
                     //wirror_mark_condition2
                     $isDynamicPage = $catg_desc_arr['pagecontenttype'] == 0 ? true : false;
                     $mmy_links_modified = $mmy_links;
                     if (!isset($GLOBALS['ISC_SRCH_CATG_ID'])) {
                         $parentid = $GLOBALS['categories_all'][$row['categoryid']]['catparentid'];
                         if ($parentid != 0) {
                             if (isset($GLOBALS['categories_all'][$parentid])) {
                                 // if parent catg is not visible
                                 $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$parentid]['catname'])) . $mmy_links;
                             } else {
                                 $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links;
                             }
                         } else {
                             $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links;
                         }
                     }
                     $subcatg_link = $this->LeftCatLink($mmy_links_modified, 'subcategory', $row['catname']);
                     $link = "<a href='" . $subcatg_link . "'>";
                     $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "'  title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>";
                     $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title='' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>";
                     //$imagelink = "<a href='".$GLOBALS['ShopPath']."/catgbrand.php?categoryid=".$row['categoryid']."&url=$subcatg_link' class='thickbox' title=''>";
                     if (isset($row['imagefile']) && !empty($row['imagefile'])) {
                         $images = explode("~", $row['imagefile']);
                         for ($j = 0; $j < count($images); $j++) {
                             if (!empty($images[$j])) {
                                 $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $images[$j] . "' alt='" . $row['catimagealt'] . "' title='" . $row['catimagealt'] . "'></a>";
                                 $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>";
                                 break;
                             }
                         }
                     } else {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>";
                             $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>";
                         }
                     }
                     $GLOBALS['LeftImage'] = $imagefile;
                     $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available";
                     $row['brandname'] = str_replace('~', ' , ', $row['brandname']);
                     //$GLOBALS['RelatedBrands'] = $row['brandname'];
                     if (!empty($row['seriesname'])) {
                         $row['brandname'] .= "<br>" . $row['seriesname'];
                     }
                     $GLOBALS['CatgSeriesList'] = "";
                     if ($row['seriesids'] != "") {
                         $seriesids = str_ireplace("~", ",", $row['seriesids']);
                         $seriesids_qry = "select seriesid , brandname , seriesname from isc_brand_series bs left join isc_brands b on bs.brandid = b.brandid where seriesid in (" . $seriesids . ")";
                         $seriesids_res = $GLOBALS['ISC_CLASS_DB']->Query($seriesids_qry);
                         if ($GLOBALS['ISC_CLASS_DB']->CountResult($seriesids_res) > 0) {
                             while ($seriesids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($seriesids_res)) {
                                 if ($GLOBALS['CatgSeriesList'] == "") {
                                     $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['categoryid'] . "')\">View Brands ></a><div id='" . $row['categoryid'] . "' style='display:block'>";
                                 } else {
                                     $GLOBALS['CatgSeriesList'] .= "<br>";
                                 }
                                 $tooltipscript = "onmouseover='createtip(" . $row['categoryid'] . $seriesids_arr['seriesid'] . ")' onmouseout='UnTip()'";
                                 if (!isset($params['brand'])) {
                                     if ($GLOBALS['EnableSEOUrls'] == 1) {
                                         $series_link = $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     } else {
                                         $series_link = $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     }
                                 } else {
                                     if ($GLOBALS['EnableSEOUrls'] == 1) {
                                         $series_link = $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     } else {
                                         $series_link = $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     }
                                 }
                                 //wirror20100728: keep the catname consistent with the displayname
                                 $GLOBALS['CatgSeriesList'] .= "<span id='span" . $row['categoryid'] . $seriesids_arr['seriesid'] . "' style='display:none'><a class='thickbox1'  href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $seriesids_arr['seriesid'] . "&catname=" . rawurlencode($row['catname']) . "&url=" . urlencode($series_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>";
                             }
                             $GLOBALS['CatgSeriesList'] .= "</br></div>";
                         }
                     }
                     $content = $row['brandname'] . "<br>";
                     if (!isset($params['category']) && (isset($params['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))) {
                         //wirror_20100806: add condition to control the display of static page
                         if ($isDynamicPage) {
                             //$GLOBALS['CatgDescandBrandImage'] = '';
                             //lguan_20100826: Quick fix for missing category head in dynamic category content page
                             $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                             // description will be added here to show it at the top of subcatg page.
                             $GLOBALS['CustomDisplay'] = 'none';
                         } else {
                             $subcatId[] = $row['categoryid'];
                             $GLOBALS['CustomDisplay'] = 'block';
                             $catCustomFlag = true;
                         }
                         $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : '';
                         if (isset($params['make']) || isset($params['model']) || isset($params['year']) || isset($params['brand'])) {
                             $GLOBALS['CatgBrandSeriesFooter'] = "";
                         }
                         $content .= "<h3><a href='" . $path . "/search.php?{$qry_string}&subcategory=" . MakeURLSafe($row['catname']) . "'>" . $row['catname'] . "</a></h3>>";
                         $GLOBALS['TitleLink'] = "<h2><a href='" . $subcatg_link . "' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>" . $row['catname'] . "</a></h2>";
                     }
                     /*	copy the code to outer		
                     			//lguan_20100612: Show overal product rating at category landing page
                     			if($category_rating != 0)
                     			{
                     				$GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$category_rating.gif' alt='' /></h2>";
                     			}
                     			*/
                     /*$ProdStartPrice = GetStartingPrice($row['categoryid'], $row['prodcalculatedprice']);
                                            
                     		$content .= "Price starting from $".number_format($ProdStartPrice, 2, '.', '')."<br>".$imagefile;*/
                     $GLOBALS['leftsidecontent'] = $content;
                     if (number_format($row['prodminprice'], 2, '.', '') < number_format($row['prodmaxprice'], 2, '.', '')) {
                         $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', '');
                     } else {
                         $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', '');
                     }
                     //lguan_20100612: Show product ratings in categories/sub-categories page
                     $GLOBALS['Rating'] = isset($row['prodavgrating']) ? $row['prodavgrating'] : 0;
                     $GLOBALS['RatingVisible'] = $GLOBALS['Rating'] == 0 ? 'display:none' : '';
                     $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty'];
                     $GLOBALS['rightsidecontent'] = $content;
                     $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>";
                     $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>";
                     $GLOBALS['ViewDetailsImage'] = "<a href='{$path}/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' class='thickbox'><img src='{$path}/templates/default/images/fastlook_red.gif'></a> ";
                     $content = "{$link}<img src='{$path}/templates/default/images/viewproducts.gif'></a>";
                     $GLOBALS['ViewDetailsImage'] .= $content;
                     $discountname = '';
                     if (IsDiscountAvailable('category', $row['categoryid'], $discountname)) {
                         if (strtolower($discountname) == "clearance") {
                             $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/clearance.gif" alt="">';
                         } else {
                             $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                         }
                     }
                     if ($this->IsMakeAnOffer('category', $row['categoryid']) == 'yes') {
                         $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>";
                     }
                     $GLOBALS['RelatedBrands'] = $row['featurepoints'];
                     $GLOBALS['lowersidecontent'] = $content;
                     $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing");
                 } else {
                     //wirror_mark_condition3
                     $series_link = $this->LeftCatLink($mmy_links, 'series', $row['seriesname']);
                     $link = "<a href='" . $series_link . "'>";
                     //$imagelink = "<a href='".$path."/catgbrand.php?seriesid=".$row['brandseriesid']."&catname=".MakeURLSafe($row['parentcatname'])."&url=$series_link' class='thickbox' title=''>";
                     $main_catg_link = "";
                     $catg_count = array();
                     $GLOBALS['CatgSeriesList'] = "";
                     if ($row['subcatgids'] != "") {
                         $subcatgids = str_ireplace("~", ",", $row['subcatgids']);
                         $subcatgids_qry = "select c.categoryid , c.catname as childcatname , p.categoryid as parentid , p.catname as parentcatname from [|PREFIX|]categories c left join [|PREFIX|]categories p on c.catparentid = p.categoryid where c.categoryid in (" . $subcatgids . ")";
                         $subcatgids_res = $GLOBALS['ISC_CLASS_DB']->Query($subcatgids_qry);
                         //$catg_count = $GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res);
                         if ($GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res) > 0) {
                             while ($subcatgids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($subcatgids_res)) {
                                 if ($subcatgids_arr['parentid'] != 0) {
                                     $main_catg_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname']));
                                     $catg_count[$subcatgids_arr['parentid']] = $subcatgids_arr['parentcatname'];
                                 } else {
                                     $catg_count[$subcatgids_arr['categoryid']] = $subcatgids_arr['childcatname'];
                                 }
                                 if ($GLOBALS['CatgSeriesList'] == "") {
                                     $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['brandseriesid'] . "')\">View Category ></a><div id='" . $row['brandseriesid'] . "' style='display:none'>";
                                 } else {
                                     $GLOBALS['CatgSeriesList'] .= "<br>";
                                 }
                                 $tooltipscript = "onmouseover='createtip(" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . ")' onmouseout='UnTip()'";
                                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                                     if ($subcatgids_arr['parentcatname'] == "") {
                                         $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     } else {
                                         $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "/subcategory/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     }
                                     if (isset($GLOBALS['SearchId'])) {
                                         $catgs_link .= '/SearchLogId/' . $GLOBALS['SearchId'];
                                     }
                                     $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>";
                                 } else {
                                     if ($subcatgids_arr['parentcatname'] == "") {
                                         $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     } else {
                                         $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "&subcategory=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     }
                                     if (isset($GLOBALS['SearchId'])) {
                                         $catgs_link .= '&SearchLogId=' . $GLOBALS['SearchId'];
                                     }
                                     $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>";
                                 }
                                 $GLOBALS['CatgSeriesList'] .= "<span id='span" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . "' style='display:none'><a class='thickbox1'  href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $subcatgids_arr['categoryid'] . "&url=" . urlencode($catgs_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>";
                             }
                             $GLOBALS['CatgSeriesList'] .= "</br></div>";
                         }
                     }
                     if (isset($GLOBALS['SearchId'])) {
                         if (isset($GLOBALS['EnableSEOUrls']) && $GLOBALS['EnableSEOUrls'] == 1) {
                             $main_catg_link .= '/SearchLogId/' . $GLOBALS['SearchId'];
                             $catgs_link .= '/SearchLogId/' . $GLOBALS['SearchId'];
                             $series_link .= '/SearchLogId/' . $GLOBALS['SearchId'];
                         } else {
                             $main_catg_link .= '&SearchLogId=' . $GLOBALS['SearchId'];
                             $catgs_link .= '&SearchLogId=' . $GLOBALS['SearchId'];
                             $series_link .= '&SearchLogId=' . $GLOBALS['SearchId'];
                         }
                     }
                     //wirror_20100727:show the displayname from db
                     $titleName = isset($row['displayname']) && $row['displayname'] != '' ? $row['displayname'] : $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'];
                     $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $titleName . "</a></h2>";
                     if (count($catg_count) == 1) {
                         $GLOBALS['TitleLink'] = "<h2><a href='" . $main_catg_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $titleName . "</a></h2>";
                     } else {
                         if (count($catg_count) > 1) {
                             $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()' onclick='return checkcategoryselection()'>" . $titleName . "</a></h2>";
                         }
                     }
                     //wirror20100728: keep the catname consistent with the displayname
                     $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . rawurlencode($row['parentcatname']) . "&url=";
                     if (count($catg_count) == 1) {
                         $tiplink .= urlencode($main_catg_link) . "'";
                     } else {
                         if (count($catg_count) > 1) {
                             $tiplink .= "#' ";
                         } else {
                             $tiplink .= urlencode($series_link) . "'";
                         }
                     }
                     $tiplink .= " title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>";
                     //wirror20100728: keep the catname consistent with the displayname
                     $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . rawurlencode($row['parentcatname']) . "&url=";
                     if (count($catg_count) == 1) {
                         $imagelink .= urlencode($main_catg_link) . "'";
                     } else {
                         if (count($catg_count) > 1) {
                             $imagelink .= "#' ";
                         } else {
                             $imagelink .= urlencode($series_link) . "'";
                         }
                     }
                     $imagelink .= " title='' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>";
                     if (isset($row['imagefile']) && !empty($row['imagefile'])) {
                         $images = explode("~", $row['imagefile']);
                         for ($j = 0; $j < count($images); $j++) {
                             if (!empty($images[$j])) {
                                 $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $images[$j] . "'></a>";
                                 break;
                             }
                         }
                     } else {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>";
                         }
                     }
                     $GLOBALS['LeftImage'] = $imagefile;
                     $row['brandname'] = str_replace('~', ' , ', $row['brandname']);
                     $GLOBALS['RelatedBrands'] = $row['brandname'];
                     if (isset($row['seriesname']) && !empty($row['seriesname']) && (!isset($params['srch_category']) || isset($params['category'])) && isset($GLOBALS['BRAND_SERIES_FLAG'])) {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif'  alt='" . $row['seriesimagealt'] . "' title='" . $row['seriesimagealt'] . "'></a>";
                             $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>";
                         } else {
                             $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/series_images/" . $row['imagefile'] . "' width='140px'  alt='" . $row['seriesimagealt'] . "' title='" . $row['seriesimagealt'] . "'></a>";
                             $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>";
                         }
                         //"<h3>".$row['catname']."</h3>
                         $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available";
                         $GLOBALS['RelatedBrands'] = "<ul class='featurepoints'>";
                         if (!empty($row['feature_points1'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points1'] . "</li>";
                         }
                         if (!empty($row['feature_points2'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points2'] . "</li>";
                         }
                         if (!empty($row['feature_points3'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points3'] . "</li>";
                         }
                         if (!empty($row['feature_points4'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points4'] . "</li>";
                         }
                         $GLOBALS['RelatedBrands'] .= "</ul>";
                         /*if(isset($row['brandlargefile']) && !empty($row['brandlargefile'])) {
                         			$brand_image_path = "product_images/".$row['brandlargefile'];
                         			if(file_exists($brand_image_path)) {
                         				$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandlargefile']."'>";
                         			} else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) {
                         				$brand_image_path = "product_images/".$row['brandimagefile'];
                         				if(file_exists($brand_image_path))
                         					$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>";
                         			}
                         		} else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) {
                         				$brand_image_path = "product_images/".$row['brandimagefile'];
                         				if(file_exists($brand_image_path))
                         					$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>";
                         		}*/
                     }
                     $GLOBALS['RelatedBrands'] = $row['feature_points'];
                     $GLOBALS['CatgDescandBrandImage'] = $row['branddescription'];
                     $GLOBALS['CatgBrandSeriesFooter'] = $row['brandfooter'];
                     if (isset($params['make']) || isset($params['model']) || isset($params['year']) || isset($params['srch_category'])) {
                         $GLOBALS['CatgBrandSeriesFooter'] = "";
                     }
                     if ($brand_rating != 0) {
                         //$GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$brand_rating.gif' alt='' /></h2>";
                     }
                     $content = $row['brandname'] . "<br>";
                     $content .= $row['catname'] . "<br>";
                     /*$ProdStartPriceSeries = GetStartingPriceForSeries($row['brandseriesid'], $row['prodcalculatedprice']);
                       
                       $content .= "Price starting from $".number_format($ProdStartPriceSeries, 2, '.', '');*/
                     $GLOBALS['leftsidecontent'] = $content;
                     //$GLOBALS['PriceRange'] = "Price range from $".number_format($row['prodminprice'], 2, '.', '')." to $".number_format($row['prodmaxprice'], 2, '.', '');
                     if (number_format($row['prodminprice'], 2, '.', '') < number_format($row['prodmaxprice'], 2, '.', '')) {
                         $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', '');
                     } else {
                         $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', '');
                     }
                     //lguan_20100612: Show product ratings in brand/series page
                     $GLOBALS['Rating'] = isset($row['prodavgrating']) ? $row['prodavgrating'] : 0;
                     $GLOBALS['RatingVisible'] = $GLOBALS['Rating'] == 0 ? 'display:none' : '';
                     $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty'];
                     $GLOBALS['rightsidecontent'] = $content;
                     $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>";
                     $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>";
                     //wirror20100727: show displayname for fastlook
                     $GLOBALS['ViewDetailsImage'] = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . rawurlencode($row['parentcatname']) . "&url=";
                     if (count($catg_count) > 1) {
                         $GLOBALS['ViewDetailsImage'] .= "#'";
                     } else {
                         if (count($catg_count) == 1) {
                             $GLOBALS['ViewDetailsImage'] .= urlencode($main_catg_link) . "'";
                         } else {
                             $GLOBALS['ViewDetailsImage'] .= urlencode($series_link);
                         }
                     }
                     if (isset($GLOBALS['SearchId'])) {
                         $GLOBALS['ViewDetailsImage'] .= '&SearchLogId=' . $GLOBALS['SearchId'];
                     }
                     $GLOBALS['ViewDetailsImage'] .= "' ><img src='{$path}/templates/default/images/fastlook_red.gif'></a> ";
                     $content = "{$link}";
                     if (count($catg_count) == 1) {
                         $content = "<a href='" . $main_catg_link . "'>";
                     } else {
                         if (count($catg_count) > 1) {
                             $content = "<a href='" . $series_link . "' onclick='return checkcategoryselection()'>";
                         }
                     }
                     $content .= "<img src='{$path}/templates/default/images/viewproducts.gif'></a>";
                     $GLOBALS['ViewDetailsImage'] .= $content;
                     $discountname = '';
                     if (IsDiscountAvailable('series', $row['brandseriesid'], $discountname)) {
                         if (strtolower($discountname) == "clearance") {
                             $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/clearance.gif" alt="">';
                         } else {
                             $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                         }
                     }
                     if ($this->IsMakeAnOffer('series', $row['brandseriesid']) == 'yes') {
                         $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>";
                     }
                     $GLOBALS['lowersidecontent'] = $content;
                     $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing");
                     $GLOBALS['HideCompareItems'] = "none";
                 }
             }
         }
         ///wirror_code_mark_end
         $get_variables = $_GET;
         $sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']);
         unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']);
         $i = 0;
         foreach ($get_variables as $key => $value) {
             $sort_qry .= "&{$key}={$value}";
         }
         if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') {
             $sort = "asc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowDown.gif' border=0>";
         } else {
             $sort = "desc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowUp.gif' border=0>";
         }
         //wirror_code_mark_begin
         //$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas
         if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand / Series</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Image / Part#</a>";
                 $GLOBALS['ProductDetails'] = "<a href='{$path}{$mmy_links}/orderby/prodfinalprice/sortby/{$sort}'>Price</a>";
             } else {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand / Series</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Image / Part#</a>";
                 $GLOBALS['ProductDetails'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodfinalprice&sortby={$sort}'>Price</a>";
             }
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') {
                 $GLOBALS['ProductBrand'] .= $img;
             }
             $GLOBALS['ProductVQ'] = $vq_column_title;
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname')
             		$GLOBALS['Product_VQ'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') {
                 $GLOBALS['ProductPartNumber'] .= $img;
             }
             $GLOBALS['ProductPQ'] = "Product Options";
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption')
             		$GLOBALS['SearchResults'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') {
                 $GLOBALS['ProductPrice'] .= $img;
             }
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodfinalprice') {
                 $GLOBALS['ProductDetails'] .= $img;
             }
             //wirror_20110324: replace the empyt ymm selector with the given picture
             if (!isset($GLOBALS['YMMTable']) || !$GLOBALS['YMMTable']) {
                 $GLOBALS['YMMTable'] = "<img src='/images/mmy-middle-6.jpg'/>";
             }
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItemHeader");
         } else {
             if ($catCustomFlag) {
                 //wirror_20100809: show the custom filter items
                 if ($isDynamicPage) {
                     $GLOBALS['DynamicDisplay'] = 'block';
                     $GLOBALS['YMMTableDisplay'] = 'block';
                 } else {
                     $GLOBALS['DynamicDisplay'] = 'none';
                     $GLOBALS['YMMTableDisplay'] = 'none';
                 }
                 //wirror_20100809: record the searched productids
                 $searchedProductIds = array();
                 $subcatIds = implode("','", $subcatId);
                 $querySubcatProdsStr = "\n\t\t\t\t\t\t    \tSELECT DISTINCT(p.productid)\n                \t\t\t\tFROM [|PREFIX|]products p\n                \t\t\t    LEFT JOIN [|PREFIX|]categoryassociations ca on ca.productid = p.productid\n                \t\t\t    %s\n                \t\t\t\tWHERE 1=1 \n                \t\t\t\tAND p.prodvisible='1'\n                \t\t\t\tAND ca.categoryid in ('{$subcatIds}')\n\t\t\t\t\t\t    ";
                 $hasYMM = false;
                 if (isset($params['year']) && !empty($params['year'])) {
                     $hasYMM = true;
                     $year = $params['year'];
                     $querySubcatProdsStr .= " AND ({$year} between v.prodstartyear and v.prodendyear OR v.prodstartyear = 'ALL')";
                 }
                 if (isset($params['make']) && !empty($params['make'])) {
                     $hasYMM = true;
                     $make = $params['make'];
                     $querySubcatProdsStr .= " AND (v.prodmake='{$make}' or v.prodmake='NON-SPEC VEHICLE')";
                 }
                 if (isset($params['model']) && !empty($params['model'])) {
                     $hasYMM = true;
                     $model = $params['model'];
                     $querySubcatProdsStr .= " AND (v.prodmodel='{$model}' or v.prodmodel='ALL')";
                 }
                 if ($hasYMM) {
                     $querySubcatProds = sprintf($querySubcatProdsStr, ' LEFT JOIN [|PREFIX|]import_variations v on v.productid = p.productid ');
                 } else {
                     $querySubcatProds = sprintf($querySubcatProdsStr, '');
                 }
                 $resultSubcatProds = $GLOBALS['ISC_CLASS_DB']->Query($querySubcatProds);
                 while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($resultSubcatProds)) {
                     $searchedProductIds[] = $row['productid'];
                 }
                 if (isset($_GET['debug']) && $_GET['debug'] == 1) {
                     //                			    echo $GLOBALS['DoSearchQuery'].'<br/>';
                     //                			    echo $querySubcatProds;echo '<br/>';
                     //                			    var_dump($searchedProductIds);
                     //                			    echo '<br/>';
                 }
                 $hasProds = false;
                 $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                 // description will be added here to show it at the top of subcatg page.
                 $GLOBALS['CustomPage'] = '';
                 foreach ($catg_custom_arr as $subArr) {
                     $pIds = explode(',', $subArr['productids']);
                     if (count($pIds) == 1 && in_array('0', $pIds)) {
                         $condArr = array('category' => $subArr['categoryid'], 'subscategory' => $subArr['subcategoryid'], 'brand' => $subArr['brandid'], 'series' => $subArr['seriesid']);
                         $pIdArr = GetClass('ISC_ADMIN_CUSTOMCONTENTS')->GetProductIds($condArr);
                     } else {
                         $pIdArr = $pIds;
                     }
                     //print_r($pIdArr);
                     if (!empty($searchedProductIds) && $this->is_subarray($pIdArr, $searchedProductIds)) {
                         $hasProds = true;
                         $GLOBALS['CustomPage'] .= $subArr['description'];
                     }
                 }
                 if ($hasProds) {
                     $GLOBALS['YMMTableDisplay'] = 'block';
                 } else {
                     //if there is no static items, show the dynamic page
                     if (!empty($searchedProductIds)) {
                         $GLOBALS['DynamicDisplay'] = 'block';
                     }
                     $GLOBALS['YMMTableDisplay'] = 'block';
                 }
             }
             //lguan_20100612: Show overal product rating at category landing page
             if ($category_rating != 0) {
                 //$GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$category_rating.gif' alt='' /></h2>";
             }
             //		                $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>";
             //wirror_20110324: replace the empyt ymm selector with the given picture
             if (!isset($GLOBALS['YMMTable']) || !$GLOBALS['YMMTable']) {
                 $GLOBALS['YMMTable'] = "<img src='/images/mmy-middle-6.jpg'/>";
             }
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain");
             if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) {
                 $GLOBALS['SearchLink'] = "";
                 if (isset($params['searchtext'])) {
                     $GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['searchtext']));
                 }
                 if (isset($params['search'])) {
                     $GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['search']));
                 }
                 if (isset($params['model']) && !isset($params['make'])) {
                     $GLOBALS['SearchLink'] .= "/model/" . MakeURLSafe(strtolower($params['model']));
                 }
                 if (isset($params['model_flag']) && $params['model_flag'] == 0 && !isset($params['make'])) {
                     $GLOBALS['SearchLink'] .= "/model_flag/" . MakeURLSafe(strtolower($params['model_flag']));
                 }
                 $GLOBALS['SearchResults'] = "";
                 if (isset($GLOBALS['YMMTable']) && $GLOBALS['YMMTable'] !== "<img src='/images/mmy-middle-6.jpg'/>") {
                     $GLOBALS['SearchResults'] .= "<div>" . $GLOBALS['YMMTable'] . "</div>";
                 }
                 if ($_REQUEST['is_smart_search']) {
                     $GLOBALS['SearchResults'] .= '<p class="ErrorMessage">' . GetLang('SearchYourSearch') . ' <strong>"' . htmlspecialchars($GLOBALS['OriginalSearchQuery']) . '"</strong> ' . GetLang('SearchDidNotMatch') . '</p>';
                     if ($GLOBALS['OriginalSearchQuery'] == '') {
                         $GLOBALS['SearchTitle'] = '';
                     } else {
                         $GLOBALS['SearchTitle'] = " " . sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']);
                     }
                 }
                 //$GLOBALS['SearchResults'] .= "<div style='width:100%'><p class='InfoMessage'>Please choose a category or brand</p></div>";
                 $GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t\t\t\t%%Panel.StaticFeaturedBrands%%";
                 $GLOBALS['HidePanels'][] = 'SearchPagingTop';
             }
         }
         $GLOBALS['SearchResults'] .= "<script type=\"text/javascript\"> \$('.focushiddendiv').css({'position':'absolute', 'margin-top':'-200px', 'display':'block'}); </script>";
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']);
         } else {
             $back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING'];
         }
         ISC_SetCookie("back2search", $back2url, 0, "/");
         // Showing the syndication option?
         if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) {
             $GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);
             $GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed");
         }
     } else {
         $this->YMMSelectors($params);
         $GLOBALS['SearchResults'] = "<div>" . $GLOBALS['YMMTable'] . "</div>";
         $GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t%%Panel.StaticFeaturedBrands%%";
         // No search results were found
         // commented below code as need to show the favorite categories and brands as in homepage
         /*$GLOBALS['HideSearchResults'] = "none";
         		$GLOBALS['HidePanels'][] = 'SearchPageProducts';*/
     }
 }
Beispiel #9
0
 public function album($row)
 {
     if ($row) {
         $id = $row['id'];
         $template = $this->load->view('album.html', '', true);
         $pagesize = 50;
         preg_match_all('/{cscms:([\\S]+)\\s+(.*?pagesize=\\"([\\S]+)\\".*?)}([\\s\\S]+?){\\/cscms:\\1}/', $template, $page_arr);
         if (!empty($page_arr) && !empty($page_arr[3][0])) {
             $pagesize = $page_arr[3][0];
         }
         $datacount = $this->db->query("select id from " . CS_SqlPrefix . "dance_topic where yid=0 and singerid=" . $id . "")->num_rows();
         //总数量
         $pagejs = ceil($datacount / $pagesize);
         if ($pagejs == 0) {
             $pagejs = 1;
         }
         for ($i = 1; $i <= $pagejs; $i++) {
             $fids = array('id', 'hits');
             $arr['cid'] = getChild($row['cid']);
             $arr['tags'] = $row['tags'];
             $arr['singerid'] = $id;
             //摧毁部分需要超级链接字段数组
             $rows = $row;
             //先保存数组保留下面使用
             unset($row['tags']);
             foreach ($fids as $fid) {
                 ob_end_flush();
                 //关闭缓存
                 //获取静态路径
                 $Htmllinks = LinkUrl('album', $fid, $row['id'], $i, 'singer');
                 //转换成生成路径
                 $Htmllink = adminhtml($Htmllinks, 'singer');
                 //装载模板并输出
                 $Mark_Text = $this->CsdjTpl->plub_list($row, $id, $fid, $i, $arr, TRUE, 'album.html', 'album', 'singer', $row['name'], $row['name']);
                 //评论
                 $Mark_Text = str_replace("[singer:pl]", get_pl('singer', $id), $Mark_Text);
                 //分类地址、名称
                 $Mark_Text = str_replace("[singer:link]", LinkUrl('show', 'id', $row['id'], 1, 'singer'), $Mark_Text);
                 $Mark_Text = str_replace("[singer:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'singer'), $Mark_Text);
                 $Mark_Text = str_replace("[singer:classname]", $this->CsdjDB->getzd('singer_list', 'name', $row['cid']), $Mark_Text);
                 //标签加超级连接
                 $Mark_Text = str_replace("[singer:tags]", SearchLink($rows['tags']), $Mark_Text);
                 //动态人气
                 $Mark_Text = str_replace("[singer:hits]", "<script  src='" . hitslink('hits/dt/hits/' . $id, 'singer') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[singer:yhits]", "<script src='" . hitslink('hits/dt/yhits/' . $id, 'singer') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[singer:zhits]", "<script src='" . hitslink('hits/dt/zhits/' . $id, 'singer') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[singer:rhits]", "<script src='" . hitslink('hits/dt/rhits/' . $id, 'singer') . "'></script>", $Mark_Text);
                 //生成
                 write_file(FCPATH . $Htmllink, $Mark_Text);
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style=font-size:10pt;color:#006600>生成专辑页按《<font color=#0000ff>" . $fid . "</font>》排序,完成:<a href=" . $Htmllinks . " target=_blank>" . $Htmllinks . "</a></font><br/>";
                 ob_flush();
                 flush();
             }
         }
     }
 }
Beispiel #10
0
		public function SetPanelSettings()
		{
			if (!$GLOBALS["ISC_CLASS_SEARCH"]->searchIsLoaded()) {
				return;
			}

			// Do we have any categories
			$GLOBALS["SearchResultsCategory"] = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("category") > 0) {
				$GLOBALS["SearchResultsCategory"] = ISC_CATEGORY::buildSearchResultsHTML();
			}

			if (trim($GLOBALS["SearchResultsCategory"]) !== "") {
				$GLOBALS["HideSearchResultsCategory"] = "";
			} else {
				$GLOBALS["HideSearchResultsCategory"] = "none";
			}

			// Do we have any brands
			$GLOBALS["SearchResultsBrand"] = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("brand") > 0) {
				$GLOBALS["SearchResultsBrand"] = ISC_BRANDS::buildSearchResultsHTML();
			}

			if (trim($GLOBALS["SearchResultsBrand"]) !== "") {
				$GLOBALS["HideSearchResultsBrand"] = "";
			} else {
				$GLOBALS["HideSearchResultsBrand"] = "none";
			}

			// Now for the products
			$GLOBALS["SearchResultsProduct"] = "";
			$productSearchResults = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product") > 0) {
				$productSearchResults = ISC_PRODUCT::buildSearchResultsHTML();
			}

			if (GetConfig("SearchProductDisplayMode") == "list") {
				$displayMode = "List";
			} else {
				$displayMode = "Grid";
			}

			if (trim($productSearchResults) !== "") {
				$GLOBALS["SectionResults"] = $productSearchResults;
				$GLOBALS["SectionType"] = "ProductList";
				$GLOBALS["SectionExtraClass"] = "";
				$GLOBALS["HideAddButton"] = "none";
				$GLOBALS["CompareButton"] = "";
				$GLOBALS["CompareButtonTop"] = "";

				$totalPages = $GLOBALS['ISC_CLASS_SEARCH']->GetNumPages("product");
				$totalRecords = $GLOBALS['ISC_CLASS_SEARCH']->GetNumResults("product");

				$page = (int)@$_REQUEST['page'];
				if ($page < 1) {
					$page = 1;
				} else if ($page > $totalPages) {
					$page = $totalPages;
				}

				if (GetConfig("SearchProductDisplayMode") == "list") {
					$GLOBALS["SectionExtraClass"] = "List";
					$GLOBALS["HideAddButton"] = "";
					$GLOBALS["ListJS"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ListCheckForm");
					$GLOBALS["CompareButton"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton" . $displayMode);

					if ($totalPages > 1) {
						$GLOBALS["CompareButtonTop"] = $GLOBALS["CompareButton"];
					}
				} else {
					$GLOBALS["CompareButton"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton");
				}

				// generate url with all current GET params except page, ajax and section
				$url = array();
				foreach ($_GET as $key => $value) {
					if ($key == 'page' || $key == 'ajax' || $key == 'section') {
						continue;
					}
					if (is_array($value)) {
						foreach ($value as $subvalue) {
							$url[] = urlencode($key . '[]') . '=' . urlencode($subvalue);
						}
					} else {
						$url[] = urlencode($key) . '=' . urlencode($value);
					}
				}
				$url[] = "page={page}";
				$url[] = "section=product";
				$url = 'search.php?' . implode('&', $url) . '#results';

				$GLOBALS['SectionPaging'] = '';

				$maxPagingLinks = 5;
				if($GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
					$maxPagingLinks = 3;
				}

				$start = max($page - $maxPagingLinks, 1);
				$end = min($page + $maxPagingLinks, $totalPages);

				for ($i = $start; $i <= $end; $i++) {
					if($i == $page) {
						$snippet = "CategoryPagingItemCurrent";
					}
					else {
						$snippet = "CategoryPagingItem";
					}

					$GLOBALS['PageLink'] = str_replace('{page}', $i, $url);
					$GLOBALS['PageNumber'] = $i;
					$GLOBALS['SectionPaging'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
				}

				// Parse the paging snippet
				if($page > 1) {
					$prevPage = $page - 1;
					$GLOBALS['PrevLink'] = str_replace('{page}', $prevPage, $url);
					$GLOBALS['SectionPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious");
				}

				if($page < $totalPages) {
					$prevPage = $page + 1;
					$GLOBALS['NextLink'] = str_replace('{page}', $prevPage, $url);
					$GLOBALS['SectionPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingNext");
				}

				if ($totalPages > 1) {
					$GLOBALS["HideSectionPaging"] = "";
				} else {
					$GLOBALS["HideSectionPaging"] = "none";
				}

				if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product") <= 1) {
					$GLOBALS["HideSectionSorting"] = "none";
				} else {
					$GLOBALS["HideSectionSorting"] = "";
				}

				$GLOBALS["SectionSortingOptions"] = getAdvanceSearchSortOptions("product");
				$GLOBALS["SectionSearchResults"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultGrid");
				$GLOBALS["SearchResultsProduct"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultSectionProduct");
				$GLOBALS["HideSearchResultsProduct"] = "none";

				if(!getProductReviewsEnabled()) {
					$GLOBALS["HideProductRating"] = "display: none";
				}

			} else {
				$GLOBALS["HideSearchResultsProduct"] = "";
			}

			// If no results then show the 'no results found' div
			if (trim($GLOBALS["SearchResultsBrand"]) == "" && trim($GLOBALS["SearchResultsCategory"]) == "" && trim($GLOBALS["SearchResultsProduct"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "none";
				$GLOBALS["HideSearchResultsProduct"] = "none";
				$GLOBALS["HideSearchResultsNoResult"] = "";

			// Else if we just have no categories or brands then do not show the top containing div
			} else if (trim($GLOBALS["SearchResultsBrand"]) == "" && trim($GLOBALS["SearchResultsCategory"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "none";
				$GLOBALS["HideSearchResultsProduct"] = "";
				$GLOBALS["HideSearchResultsNoResult"] = "none";

			// Else if we have categories or brands BUT no products then display the 'no results found' div
			} else if ((trim($GLOBALS["SearchResultsBrand"]) == "" || trim($GLOBALS["SearchResultsCategory"]) !== "") && trim($GLOBALS["SearchResultsProduct"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "";
				$GLOBALS["HideSearchResultsProduct"] = "none";
				$GLOBALS["HideSearchResultsNoResult"] = "";
			} else {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "";
				$GLOBALS["HideSearchResultsProduct"] = "";
				$GLOBALS["HideSearchResultsNoResult"] = "none";
			}

			/*
			 * if the "Enable Product Search Feeds?" is ticked in Store
			 * Settings -> Display and we are searching add the link
			 */
			if (isset($GLOBALS['ISC_CLASS_SEARCH']) && GetConfig('RSSProductSearches')) {
				$GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);
				$GLOBALS['SnippetSearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SearchResultsFeed');
			}
		}
Beispiel #11
0
 public function getplay($row)
 {
     //评论
     $dance_pl = get_pl('vod', $row['id']);
     $rows = $row;
     //先保存数组保留下面使用
     $id = $rows['id'];
     //播放页
     if (!empty($row['purl'])) {
         $Data_Arr = explode("#cscms#", $row['purl']);
         for ($i = 0; $i < count($Data_Arr); $i++) {
             $DataList_Arr = explode("\n", $Data_Arr[$i]);
             for ($j = 0; $j < count($DataList_Arr); $j++) {
                 //摧毁部分需要超级链接字段数组
                 unset($row['zhuyan']);
                 unset($row['daoyan']);
                 unset($row['yuyan']);
                 unset($row['diqu']);
                 unset($row['tags']);
                 unset($row['year']);
                 //动态人气
                 unset($row['hits']);
                 unset($row['yhits']);
                 unset($row['zhits']);
                 unset($row['rhits']);
                 unset($row['dhits']);
                 unset($row['chits']);
                 unset($row['xhits']);
                 unset($row['shits']);
                 $arr['cid'] = getChild($row['cid']);
                 $arr['uid'] = $row['uid'];
                 $arr['singerid'] = $row['singerid'];
                 $arr['tags'] = $rows['tags'];
                 $skins = $row['skins'];
                 if (empty($skins) || $skins == 'play.html') {
                     $skins = getzd('vod_list', 'skins3', $row['cid']);
                 }
                 if (empty($skins)) {
                     $skins = 'play.html';
                 }
                 //装载模板并输出
                 $Mark_Text = $this->CsdjTpl->plub_show('vod', $row, $arr, TRUE, $skins, $row['name'], $row['name']);
                 $Mark_Text = str_replace("[vod:pl]", $dance_pl, $Mark_Text);
                 //分类地址、名称
                 $Mark_Text = str_replace("[vod:link]", LinkUrl('show', 'id', $row['id'], 1, 'vod'), $Mark_Text);
                 $Mark_Text = str_replace("[vod:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'vod'), $Mark_Text);
                 $Mark_Text = str_replace("[vod:classname]", $this->CsdjDB->getzd('vod_list', 'name', $row['cid']), $Mark_Text);
                 //主演、导演、标签、年份、地区、语言加超级连接
                 $Mark_Text = str_replace("[vod:zhuyan]", SearchLink($rows['zhuyan'], 'zhuyan'), $Mark_Text);
                 $Mark_Text = str_replace("[vod:daoyan]", SearchLink($rows['daoyan'], 'daoyan'), $Mark_Text);
                 $Mark_Text = str_replace("[vod:yuyan]", SearchLink($rows['yuyan'], 'yuyan'), $Mark_Text);
                 $Mark_Text = str_replace("[vod:diqu]", SearchLink($rows['diqu'], 'diqu'), $Mark_Text);
                 $Mark_Text = str_replace("[vod:tags]", SearchLink($rows['tags']), $Mark_Text);
                 $Mark_Text = str_replace("[vod:year]", SearchLink($rows['year'], 'year'), $Mark_Text);
                 $Mark_Text = Vod_Playlist($Mark_Text, 'play', $id, $row['purl']);
                 //播放器
                 if ($i >= count($Data_Arr)) {
                     $i = 0;
                 }
                 $DataList_Arr = explode("\n", $Data_Arr[$i]);
                 $Dataurl_Arr = explode('$', $DataList_Arr[$j]);
                 $laiyuan = str_replace("\r", "", @$Dataurl_Arr[2]);
                 //来源
                 $url = $Dataurl_Arr[1];
                 //地址
                 $pname = $Dataurl_Arr[0];
                 //当前集数
                 $Mark_Text = str_replace("[vod:qurl]", $url, $Mark_Text);
                 $Mark_Text = str_replace("[vod:laiy]", $laiyuan, $Mark_Text);
                 $Mark_Text = str_replace("[vod:ji]", $pname, $Mark_Text);
                 if (count($DataList_Arr) > $j + 1) {
                     $DataNext = $DataList_Arr[$j + 1];
                     $DataNextArr = explode('$', $DataNext);
                     if (count($DataNextArr) == 2) {
                         $DataNext = $DataNextArr[1];
                     }
                     $xurl = VodPlayUrl('play', $id, $i, $j + 1);
                     $Dataurl_Arr2 = explode('$', $DataList_Arr[$j + 1]);
                 } else {
                     $DataNext = $DataList_Arr[$j];
                     $DataNextArr = explode('$', $DataNext);
                     if (count($DataNextArr) == 2) {
                         $DataNext = $DataNextArr[1];
                     }
                     $xurl = VodPlayUrl('play', $id, $i, $j);
                 }
                 if ($j == 0) {
                     $surl = VodPlayUrl('play', $id, $i, $j);
                 } else {
                     $surl = VodPlayUrl('play', $id, $i, $j - 1);
                 }
                 $psname = '';
                 for ($a = 0; $a < count($Data_Arr); $a++) {
                     $jis = '';
                     $Ji_Arr = explode("\n", $Data_Arr[$a]);
                     for ($k = 0; $k < count($Ji_Arr); $k++) {
                         $Ly_Arr = explode('$', $Ji_Arr[$k]);
                         $jis .= $Ly_Arr[0] . '$$' . @$Ly_Arr[2] . '====';
                     }
                     $psname .= substr($jis, 0, -4) . '#cscms#';
                 }
                 $player_arr = str_replace("\r", "", substr($psname, 0, -7));
                 if ($laiyuan == 'xgvod' || $laiyuan == 'jjvod' || $laiyuan == 'yyxf' || $laiyuan == 'bdhd' || $laiyuan == 'qvod') {
                     $url = str_replace("+", "__", base64_encode($url));
                 } else {
                     $url = escape($url);
                 }
                 $player = "<script type='text/javascript' src='" . site_url('vod/play/pay/' . $id . '/' . $i . '/' . $j) . "'></script><script type='text/javascript' src='" . hitslink('play/form', 'vod') . "'></script><script type='text/javascript'>var cs_playlink='" . VodPlayUrl('play', $id, $i, $j, 1) . "';var cs_did='" . $id . "';var player_name='" . $player_arr . "';var cs_pid='" . $j . "';var cs_zid='" . $i . "';var cs_vodname='" . $row['name'] . " - " . $pname . "';var cs_root='http://" . Web_Url . Web_Path . "';var cs_width=" . CS_Play_sw . ";var cs_height=" . CS_Play_sh . ";var cs_surl='" . $surl . "';var cs_xurl='" . $xurl . "';var cs_laiy='" . $laiyuan . "';var cs_adloadtime='" . CS_Play_AdloadTime . "';</script>\r\n\t\t\t\t\t\t\t\t   <iframe border=\"0\" name=\"cscms_vodplay\" id=\"cscms_vodplay\" src=\"" . Web_Path . "packs/vod_player/play.html\" marginwidth=\"0\" framespacing=\"0\" marginheight=\"0\" noresize=\"\" vspale=\"0\" style=\"z-index: 9998;\" frameborder=\"0\" height=\"" . (CS_Play_sh + 30) . "\" scrolling=\"no\" width=\"100%\"></iframe>";
                 $Mark_Text = str_replace("[vod:player]", $player, $Mark_Text);
                 $Mark_Text = str_replace("[vod:surl]", $surl, $Mark_Text);
                 $Mark_Text = str_replace("[vod:xurl]", $xurl, $Mark_Text);
                 //解析动态人气标签
                 $Mark_Text = str_replace("[vod:hits]", "<script src='" . hitslink('hits/dt/hits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:yhits]", "<script src='" . hitslink('hits/dt/yhits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:zhits]", "<script src='" . hitslink('hits/dt/zhits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:rhits]", "<script src='" . hitslink('hits/dt/rhits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:shits]", "<script src='" . hitslink('hits/dt/shits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:xhits]", "<script src='" . hitslink('hits/dt/xhits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:dhits]", "<script src='" . hitslink('hits/dt/dhits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:chits]", "<script src='" . hitslink('hits/dt/chits/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:pfen]", "<script src='" . hitslink('hits/dt/pfen/' . $id, 'vod') . "'></script>", $Mark_Text);
                 $Mark_Text = str_replace("[vod:pfenbi]", "<script src='" . hitslink('hits/dt/pfenbi/' . $id, 'vod') . "'></script>", $Mark_Text);
                 //增加人气
                 $Mark_Text = hits_js($Mark_Text, hitslink('hits/ids/' . $id, 'vod'));
                 //替换后台控制器
                 $Mark_Text = str_replace(SELF, 'index.php', $Mark_Text);
                 //获取静态路径
                 $Htmllinks = VodPlayUrl('play', $id, $i, $j);
                 //生成地址转换
                 $Htmllink = adminhtml($Htmllinks, 'vod');
                 //生成
                 write_file(FCPATH . $Htmllink, $Mark_Text);
             }
             echo "&nbsp;&nbsp;&nbsp;<font style=font-size:9pt;color:red;>--生成第" . ($i + 1) . "组播放器:<a href=" . $Htmllinks . " target=_blank>" . $Htmllinks . "</a></font><br/>";
         }
     }
 }
Beispiel #12
0
 public function index($fid = 'id', $id = 0)
 {
     $id = intval($fid) > 0 ? intval($fid) : intval($id);
     //ID
     //判断ID
     if ($id == 0) {
         msg_url(L('dance_09'), Web_Path);
     }
     //获取数据
     $row = $this->CsdjDB->get_row_arr('dance', '*', $id);
     if (!$row || $row['yid'] > 0 || $row['hid'] > 0) {
         msg_url(L('dance_10'), Web_Path);
     }
     //判断运行模式,生成则跳转至静态页面
     $html = config('Html_Uri');
     if (config('Web_Mode') == 3 && $html['down']['check'] == 1) {
         //获取静态路径
         $Htmllink = LinkUrl('play', 'id', $id, 0, 'dance');
         header("Location: " . $Htmllink);
         exit;
     }
     //摧毁部分需要超级链接字段数组
     $rows = $row;
     //先保存数组保留下面使用
     unset($row['tags']);
     //获取当前分类下二级分类ID
     $arr['cid'] = getChild($row['cid']);
     $arr['uid'] = $row['uid'];
     $arr['singerid'] = $row['singerid'];
     $arr['tags'] = $rows['tags'];
     //装载模板并输出
     $Mark_Text = $this->CsdjTpl->plub_show('dance', $row, $arr, TRUE, 'down.html', $row['name'], $row['name']);
     //评论
     $Mark_Text = str_replace("[dance:pl]", get_pl('dance', $id), $Mark_Text);
     //分类地址、名称
     $Mark_Text = str_replace("[dance:link]", LinkUrl('play', 'id', $row['id'], 1, 'news'), $Mark_Text);
     $Mark_Text = str_replace("[dance:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'dance'), $Mark_Text);
     $Mark_Text = str_replace("[dance:classname]", $this->CsdjDB->getzd('dance_list', 'name', $row['cid']), $Mark_Text);
     //专辑
     if ($row['tid'] == 0) {
         $Mark_Text = str_replace("[dance:topiclink]", "###", $Mark_Text);
         $Mark_Text = str_replace("[dance:topicname]", L('dance_11'), $Mark_Text);
     } else {
         $Mark_Text = str_replace("[dance:topiclink]", LinkUrl('topic', 'show', $row['tid'], 1, 'dance'), $Mark_Text);
         $Mark_Text = str_replace("[dance:topicname]", $this->CsdjDB->getzd('dance_topic', 'name', $row['tid']), $Mark_Text);
     }
     //标签加超级连接
     $Mark_Text = str_replace("[dance:tags]", SearchLink($rows['tags']), $Mark_Text);
     //歌曲完整试听、下载地址
     preg_match_all('/[dance:qurl]/', $Mark_Text, $arr);
     if (!empty($arr[0]) && !empty($arr[0][0])) {
         $purl = $row['purl'];
         $durl = $row['durl'];
         if ($row['fid'] > 0) {
             $rowf = $this->db->query("Select purl,durl from " . CS_SqlPrefix . "dance_server where id=" . $row['fid'] . "")->row_array();
             if ($rowf) {
                 $purl = $rowf['purl'] . $row['purl'];
                 $durl = $rowf['durl'] . $row['durl'];
             }
         }
         $purl = annexlink($purl);
         $durl = annexlink($durl);
         $Mark_Text = str_replace("[dance:qurl]", $purl, $Mark_Text);
         $Mark_Text = str_replace("[dance:qxurl]", $durl, $Mark_Text);
     }
     unset($arr);
     echo $Mark_Text;
     $this->cache->end();
     //由于前面不是直接输出,所以这里需要加入写缓存
 }
Beispiel #13
0
	public function SetPanelSettings()
	{
		// Do we have any live chat service code to show in the header?
		$modules = GetConfig('LiveChatModules');
		if(!empty($modules)) {
			$liveChatClass = GetClass('ISC_LIVECHAT');
			$GLOBALS['LiveChatCode'] = $liveChatClass->GetPageTrackingCode('header');
			$GLOBALS['LiveChatCodeEnabled'] = '';
		} else {
			$GLOBALS['LiveChatCodeEnabled'] = 'display:none';
		}

		$GLOBALS['TrackingCode'] = '';

		// Get the visitor tracking Javascript
		$tracker = GetClass('ISC_VISITOR');
		$GLOBALS['TrackingCode'] .= $tracker->GetTrackingJavascript();

		$GLOBALS['CharacterSet'] = GetConfig('CharacterSet');

		// Are quick searches enabled?
		if(GetConfig('QuickSearch') != 0) {
			$GLOBALS['QuickSearchJS'] = sprintf("<script type=\"text/javascript\" src=\"%s/javascript/quicksearch.js\"></script>", GetConfig('ShopPath'));
		}

		$activeTemplate = $GLOBALS['ISC_CLASS_TEMPLATE']->getActiveTemplateName();
		$activeColorScheme = $GLOBALS['ISC_CLASS_TEMPLATE']->getActiveColorScheme();

		if(isset($GLOBALS['TPL_CFG']['HeaderImageElement'])) {
			$headerImageLocation = '';

			$headerImages = array(
				GetConfig('ImageDirectory') . '/header_images/' . $activeTemplate . '_headerImage.jpg',
				GetConfig('ImageDirectory') . '/header_images/' . $activeTemplate . '_headerImage.png',
				'templates/'.$activeTemplate . '/images/' . $activeColorScheme . '/headerImage.jpg',
				'templates/'.$activeTemplate . '/images/' . $activeColorScheme . '/headerImage.png'
			);
			foreach($headerImages as $path) {
				if(file_exists(ISC_BASE_PATH . '/' . $path)) {
					$headerImageLocation = GetConfig('ShopPath') . '/' . $path;
					break;
				}
			}

			if(!empty($headerImageLocation)) {
				$GLOBALS['HeaderImageStyle'] = '<style type="text/css"> ' .$GLOBALS['TPL_CFG']['HeaderImageElement'] . ' { background-image: url("' . $headerImageLocation . '"); } </style>';
			}
		}

		if (GetConfig('FastCartAction') == 'popup' && GetConfig('ShowCartSuggestions')) {
			$GLOBALS['AdditionalScripts'][] = GetConfig('AppPath').'/javascript/jquery/plugins/imodal/imodal.js';
			$GLOBALS['AdditionalStylesheets'][] = GetConfig('AppPath').'/javascript/jquery/plugins/imodal/imodal.css';
		}

		// Any additional stylesheets to include?
		$GLOBALS['Stylesheets'] = '';

		if(!empty($GLOBALS['TPL_CFG']['Stylesheets'])) {
			$stylesheets = $GLOBALS['TPL_CFG']['Stylesheets'];
		}
		else {
			$stylesheets = array(
				array(
					'stylesheet' => 'Styles/styles.css',
				),
				array(
					'stylesheet' => 'Styles/iselector.css'
				)
			);

			// Color overrides
			$colorCSS = 'Styles/'.$activeColorScheme.'.css';
			if(file_exists(ISC_BASE_PATH.'/templates/'.$activeTemplate.'/'.$colorCSS)) {
				$stylesheets[] = array(
					'stylesheet' => $colorCSS
				);
			}

			// Generic Internet Explorer stylesheet
			$genericIE = 'Styles/ie.css';
			if(file_exists(ISC_BASE_PATH.'/templates/'.$activeTemplate.'/'.$genericIE)) {
				$stylesheets[] = array(
					'stylesheet' => $genericIE,
					'condition' => 'IE'
				);
			}

			if(!empty($GLOBALS['TPL_CFG']['AdditionalStylesheets'])) {
				$stylesheets = array_merge($stylesheets, $GLOBALS['TPL_CFG']['AdditionalStylesheets']);
			}
		}

		$GLOBALS['Stylesheets'] = '';

		// Global/common front-end stylesheet
		$masterStylesheet = getConfig('ShopPath') . '/templates/__master/Styles/styles.css?' . getConfig('JSCacheToken');
		$GLOBALS['Stylesheets'] .= '<link href="' . $masterStylesheet . '" type="text/css" rel="stylesheet" />';

		$styleRoot = GetConfig('ShopPath').'/templates/'.$activeTemplate;
		foreach($stylesheets as $stylesheet) {
			if(empty($stylesheet['media'])) {
				$stylesheet['media'] = 'all';
			}

			// Add caching token
			if(strpos($stylesheet['stylesheet'], '?') === false) {
				$stylesheet['stylesheet'] .= '?';
			}
			else {
				$stylesheet['stylesheet'] .= '&';
			}
			$stylesheet['stylesheet'] .= getConfig('JSCacheToken');

			$link = '<link href="'.$styleRoot.'/'.$stylesheet['stylesheet'].'" media="'.$stylesheet['media'].'" type="text/css" rel="stylesheet" />';
			if(!empty($stylesheet['condition'])) {
				$link = '<!--[if '.$stylesheet['condition'].']>'.$link.'<![endif]-->';
			}
			$GLOBALS['Stylesheets'] .= $link."\n";
		}

		// @todo this check should be a method of it's which determines if flyout css is required since flyout support
		// may be disabled by the selected template, and there may be other, non-category flyout menus added in future
		if (ISC_CATEGORY::areCategoryFlyoutsEnabled()) {
			// css for fly-out menus
			if (!isset($GLOBALS['AdditionalStylesheets']) || !is_array($GLOBALS['AdditionalStylesheets'])) {
				$GLOBALS['AdditionalStylesheets'] = array();
			}
			$GLOBALS['AdditionalStylesheets'][] = GetConfig('AppPath') . '/javascript/superfish/css/store.css';
		}

		if(!empty($GLOBALS['AdditionalStylesheets']) && is_array($GLOBALS['AdditionalStylesheets'])) {
			$GLOBALS['AdditionalStylesheets'] = array_unique($GLOBALS['AdditionalStylesheets']);
			$replacements = array(
				':template' => $activeTemplate,
				':color' => $activeColorScheme
			);
			foreach($GLOBALS['AdditionalStylesheets'] as $stylesheet) {
				$stylesheet = strtr($stylesheet, $replacements);

				// Add caching token
				if(strpos($stylesheet, '?') === false) {
					$stylesheet .= '?';
				}
				else {
					$stylesheet .= '&';
				}
				$stylesheet .= getConfig('JSCacheToken');

				$GLOBALS['Stylesheets'] .= '<link href="'.$stylesheet.'" type="text/css" rel="stylesheet" />';
			}
		}


		$GLOBALS['AdditionalScriptTags'] = '';

		if(!empty($GLOBALS['AdditionalScripts']) && is_array($GLOBALS['AdditionalScripts'])) {
			$GLOBALS['AdditionalScripts'] = array_unique($GLOBALS['AdditionalScripts']);
			foreach($GLOBALS['AdditionalScripts'] as $script) {
				// Add caching token
				if(strpos($script, '?') === false) {
					$script .= '?';
				}
				else {
					$script .= '&';
				}
				$script .= getConfig('JSCacheToken');

				$GLOBALS['AdditionalScriptTags'] .= '<script type="text/javascript" src="'.$script.'"></script>';
			}
		}

		// Are site wide RSS feeds enabled?
		if(!isset($GLOBALS['HeadRSSLinks'])) {
			$GLOBALS['HeadRSSLinks'] = '';
		}

		if(GetConfig('RSSLatestBlogEntries') != 0) {
			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($GLOBALS['ShopPathNormal']."/rss.php?action=newblogs", GetLang('HeadRSSLatestNews'));
		}

		if(GetConfig('RSSNewProducts') != 0) {
			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($GLOBALS['ShopPathNormal']."/rss.php", GetLang('HeadRSSNewProducts'));
		}

		if(GetConfig('RSSPopularProducts') != 0) {
			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($GLOBALS['ShopPathNormal']."/rss.php?action=popularproducts", GetLang('HeadRSSPopularProducts'));
		}

		/*
		 * if the "Enable Product Search Feeds?" is ticked in Store
		 * Settings -> Display and we are searching add the link
		 */
		if (isset($GLOBALS['ISC_CLASS_SEARCH']) && GetConfig('RSSProductSearches')) {
			$rssUri = $GLOBALS['ShopPathNormal']
					. '/rss.php?action=searchproducts&amp;type=rss'
					. SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);

			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($rssUri, GetLang('HeadRSSProductSearchFeeds'));
		}

		// Do we need to include the script for design mode?
		if(!empty($_COOKIE['designModeToken']) || !empty($_POST['designModeToken'])) {
			if(GetClass('ISC_ADMIN_AUTH')->isDesignModeAuthenticated()) {
				$GLOBALS['DesignModeStyleSheet'] = sprintf("<link href=\"%s/lib/designmode/designmode.css\" type=\"text/css\" rel=\"stylesheet\" />", $GLOBALS['AppPath']);

				// If the control panel is accessibly only via SSL, we need to send design mode
				// updates to that URL instead.
				if(GetConfig('ForceControlPanelSSL')) {
					$GLOBALS['DesignModeUpdateUrl'] = GetConfig('ShopPathSSL');
				}
				else {
					$GLOBALS['DesignModeUpdateUrl'] = GetConfig('AppPath');
				}
				$GLOBALS['DesignModeUpdateUrl'] .= '/admin/designmode.php';

				$GLOBALS['DesignModeCurrentTemplate'] = $GLOBALS['ISC_CLASS_TEMPLATE']->_tplName.'.html';
				$GLOBALS['DesignModeIdleTime'] = (int)GetConfig('PCILoginIdleTimeMin') * 60 * 1000;
				$GLOBALS['DesignModeScriptTag'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('DesignModeFooter');
			}
		}

		// Include the tracking code for each analytics module
		$GLOBALS['TrackingCode'] .= GetTrackingCodeForAllPackages();

		// Define the favicon link
		$GLOBALS['Favicon'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . GetConfig('Favicon');

		if(!isset($GLOBALS['OptimizerControlScript'])) {
			$GLOBALS['OptimizerControlScript'] = '';
		}
		if(!isset($GLOBALS['OptimizerTrackingScript'])) {
			$GLOBALS['OptimizerTrackingScript'] = '';
		}
		if(!isset($GLOBALS['OptimizerConversionScript'])) {
			$GLOBALS['OptimizerConversionScript'] = '';
		}
		$runStorewideTesting = true;
		//this is product/category/page based optimizer test page, turn off storewide test on this page.
		if ((isset($GLOBALS['PerPageOptimizerEnabled']) && $GLOBALS['PerPageOptimizerEnabled'] == 1)) {
			$runStorewideTesting=false;
		}
		unset($GLOBALS['PerPageOptimizerEnabled']);
		$enabledOptimizerTests = GetConfig('OptimizerMethods');
		//the optimizer methods in the config.php file is not an array. set it to an empty array.
		if(!is_array($enabledOptimizerTests)) {
			$enabledOptimizerTests = array();
		}
		foreach ($enabledOptimizerTests as $moduleId => $date) {

			//if "optimizer" is in the URL, that means this is a request from Google to validate the scripts installed on the page for a paticular test, in this case, we should only insert the scripts for the particular test.
			if(isset($_GET['optimizer']) && 'optimizer_'.$_GET['optimizer'] != $moduleId && $_GET['optimizer'] != 'singlemulticheckout') {
				continue;
			}

			if(getModuleById('optimizer', $module, $moduleId)){
				if($runStorewideTesting) {
					$module->insertControlScript();
					$module->insertTrackingScript();
				}
				$module->insertConversionScript();
			}

			//we are here when optimizer is set, that means the needed optimizer scripts for google to validate have already installed on the page, so get out from the loop.
			if(isset($_GET['optimizer']) && $_GET['optimizer'] != 'singlemulticheckout'){
				break;
			}
		}


		//insert perpage based optimizer conversion script
		$perPageOptimizer = getClass('ISC_OPTIMIZER_PERPAGE');
		$perPageOptimizer->insertConversionScript();

		if(isset($_SESSION['JustAddedProduct'])) {
			$_SESSION['JustAddedProduct'] = '';
		}

		$GLOBALS['ProductThumbImageWidth'] = GetConfig('ProductImagesStorewideThumbnail_width');
		$GLOBALS['ProductThumbImageHeight'] = GetConfig('ProductImagesStorewideThumbnail_height');
	}
Beispiel #14
0
 public function down_save()
 {
     if ($this->huri['down']['check'] == 0) {
         admin_msg(L('plub_47'), 'javascript:history.back();', 'no');
     }
     $day = intval($this->input->get_post('day', true));
     //最近几天
     $ids = $this->input->get_post('ids', true);
     //需要生成的数据ID
     $cid = $this->input->get_post('cid', true);
     //需要生成的分类ID
     $newid = intval($this->input->get_post('newid'));
     //最新个数
     $ksid = intval($this->input->get_post('ksid'));
     //开始ID
     $jsid = intval($this->input->get_post('jsid'));
     //结束ID
     $kstime = $this->input->get_post('kstime', true);
     //开始日期
     $jstime = $this->input->get_post('jstime', true);
     //结束日期
     $pagesize = intval($this->input->get('pagesize'));
     //每页多少条
     $pagejs = intval($this->input->get('pagejs'));
     //总页数
     $datacount = intval($this->input->get('datacount'));
     //数据总数
     $page = intval($this->input->get('page'));
     //当前页
     if ($page == 0) {
         $page = 1;
     }
     $str = '';
     //将数组转换成字符
     if (is_array($cid)) {
         $cid = implode(',', $cid);
     }
     if (is_array($ids)) {
         $ids = implode(',', $ids);
     }
     if ($day > 0) {
         $times = time() - 86400 * $day;
         $str .= ' and addtime>' . $times . '';
     }
     if (!empty($cid)) {
         $str .= ' and cid in (' . $cid . ')';
     }
     if (!empty($ids)) {
         $str .= ' and id in (' . $ids . ')';
     }
     if ($ksid > 0 && $jsid > 0) {
         $str .= ' and id>' . ($ksid - 1) . ' and id<' . ($jsid + 1) . '';
     }
     if (!empty($kstime) && !empty($jstime)) {
         $ktime = strtotime($kstime) - 86400;
         $jtime = strtotime($jstime) + 86400;
         $str .= ' and addtime>' . $ktime . ' and addtime<' . $jtime . '';
     }
     $limit = '';
     if ($newid > 0) {
         $limit = ' order by id desc limit ' . $newid;
     }
     if ($datacount == 0) {
         $sqlstr = "select id from " . CS_SqlPrefix . "dance where yid=0 and hid=0 " . $str . $limit;
         $datacount = $this->db->query($sqlstr)->num_rows();
         //总数量
         $pagejs = ceil($datacount / Html_PageNum);
     }
     if ($datacount == 0) {
         $pagejs = 1;
     }
     $pagesize = Html_PageNum;
     if ($datacount < $pagesize) {
         $pagesize = $datacount;
     }
     //全部生成完毕
     if ($page > $pagejs) {
         admin_msg(L('plub_48'), site_url('dance/admin/html/down'));
     }
     //公众URI
     $uri = '?day=' . $day . '&cid=' . $cid . '&ids=' . $ids . '&newid=' . $newid . '&ksid=' . $ksid . '&jsid=' . $jsid . '&kstime=' . $kstime . '&jstime=' . $jstime . '&pagesize=' . $pagesize . '&pagejs=' . $pagejs . '&datacount=' . $datacount;
     //重新定义模板路径
     $this->load->get_templates('dance', 2);
     echo '<LINK href="' . base_url() . 'packs/admin/css/style.css" type="text/css" rel="stylesheet"><br>';
     echo vsprintf(L('plub_49'), array($pagejs, $page));
     $sql_string = "select * from " . CS_SqlPrefix . "dance where yid=0 and hid=0 " . $str . " order by id desc";
     $sql_string .= ' limit ' . $pagesize * ($page - 1) . ',' . $pagesize;
     $query = $this->db->query($sql_string);
     //获取下载页是否需要生成
     $html = config('Html_Uri', 'dance');
     foreach ($query->result_array() as $row) {
         ob_end_flush();
         //关闭缓存
         $id = $row['id'];
         //获取静态路径
         $Htmllinks = LinkUrl('down', 'id', $row['id'], 0, 'dance', $row['name']);
         //转换成生成路径
         $Htmllink = adminhtml($Htmllinks, 'dance');
         //摧毁部分需要超级链接字段数组
         $rows = $row;
         //先保存数组保留下面使用
         unset($row['tags']);
         unset($row['hits']);
         unset($row['yhits']);
         unset($row['zhits']);
         unset($row['rhits']);
         unset($row['dhits']);
         unset($row['chits']);
         unset($row['shits']);
         unset($row['xhits']);
         //获取当前分类下二级分类ID
         $arr['cid'] = getChild($row['cid']);
         $arr['uid'] = $row['uid'];
         $arr['did'] = $row['id'];
         $arr['singerid'] = $row['singerid'];
         $arr['tags'] = $rows['tags'];
         //装载模板并输出
         $Mark_Text = $this->CsdjTpl->plub_show('dance', $row, $arr, TRUE, 'down.html', $row['name'], $row['name']);
         //评论
         $Mark_Text = str_replace("[dance:pl]", get_pl('dance', $id), $Mark_Text);
         //分类地址、名称
         $Mark_Text = str_replace("[dance:link]", LinkUrl('play', 'id', $row['id'], 1, 'dance'), $Mark_Text);
         $Mark_Text = str_replace("[dance:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'dance'), $Mark_Text);
         $Mark_Text = str_replace("[dance:classname]", $this->CsdjDB->getzd('dance_list', 'name', $row['cid']), $Mark_Text);
         //专辑
         if ($row['tid'] == 0) {
             $Mark_Text = str_replace("[dance:topiclink]", "###", $Mark_Text);
             $Mark_Text = str_replace("[dance:topicname]", "未加入", $Mark_Text);
         } else {
             $Mark_Text = str_replace("[dance:topiclink]", LinkUrl('topic', 'show', $row['tid'], 1, 'dance'), $Mark_Text);
             $Mark_Text = str_replace("[dance:topicname]", $this->CsdjDB->getzd('dance_topic', 'name', $row['tid']), $Mark_Text);
         }
         //获取上下曲
         preg_match_all('/[dance:slink]/', $Mark_Text, $arr);
         if (!empty($arr[0]) && !empty($arr[0][0])) {
             $rowd = $this->db->query("Select id,cid,name from " . CS_SqlPrefix . "dance where yid=0 and hid=0 and id<" . $id . " order by id desc limit 1")->row();
             if ($rowd) {
                 $Mark_Text = str_replace("[dance:slink]", LinkUrl('play', 'id', $rowd->id, 1, 'dance'), $Mark_Text);
                 $Mark_Text = str_replace("[dance:sname]", $rowd->name, $Mark_Text);
                 $Mark_Text = str_replace("[dance:sid]", $rowd->id, $Mark_Text);
             } else {
                 $Mark_Text = str_replace("[dance:slink]", "#", $Mark_Text);
                 $Mark_Text = str_replace("[dance:sname]", L('plub_45'), $Mark_Text);
                 $Mark_Text = str_replace("[dance:sid]", 0, $Mark_Text);
             }
         }
         unset($arr);
         preg_match_all('/[dance:xlink]/', $Mark_Text, $arr);
         if (!empty($arr[0]) && !empty($arr[0][0])) {
             $rowd = $this->db->query("Select id,cid,name from " . CS_SqlPrefix . "dance where yid=0 and hid=0 and id>" . $id . " order by id asc limit 1")->row();
             if ($rowd) {
                 $Mark_Text = str_replace("[dance:xlink]", LinkUrl('play', 'id', $rowd->id, 1, 'dance'), $Mark_Text);
                 $Mark_Text = str_replace("[dance:xname]", $rowd->name, $Mark_Text);
                 $Mark_Text = str_replace("[dance:xid]", $rowd->id, $Mark_Text);
             } else {
                 $Mark_Text = str_replace("[dance:xlink]", "#", $Mark_Text);
                 $Mark_Text = str_replace("[dance:xname]", L('plub_45'), $Mark_Text);
                 $Mark_Text = str_replace("[dance:xid]", 0, $Mark_Text);
             }
         }
         unset($arr);
         //标签加超级连接
         $Mark_Text = str_replace("[dance:tags]", SearchLink($rows['tags']), $Mark_Text);
         //动态人气
         $Mark_Text = str_replace("[dance:hits]", "<script src='" . hitslink('hits/dt/hits/' . $id, 'dance') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[dance:yhits]", "<script src='" . hitslink('hits/dt/yhits/' . $id, 'dance') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[dance:zhits]", "<script src='" . hitslink('hits/dt/zhits/' . $id, 'dance') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[dance:rhits]", "<script src='" . hitslink('hits/dt/rhits/' . $id, 'dance') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[dance:dhits]", "<script src='" . hitslink('hits/dt/dhits/' . $id, 'dance') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[dance:chits]", "<script src='" . hitslink('hits/dt/chits/' . $id, 'dance') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[dance:shits]", "<script src='" . hitslink('hits/dt/shits/' . $id, 'dance') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[dance:xhits]", "<script src='" . hitslink('hits/dt/xhits/' . $id, 'dance') . "'></script>", $Mark_Text);
         //歌曲完整试听、下载地址
         preg_match_all('/[dance:qurl]/', $Mark_Text, $arr);
         if (!empty($arr[0]) && !empty($arr[0][0])) {
             $purl = $row['purl'];
             $durl = $row['durl'];
             if ($row['fid'] > 0) {
                 $rowf = $this->db->query("Select purl,durl from " . CS_SqlPrefix . "dance_server where id=" . $row['fid'] . "")->row_array();
                 if ($rowf) {
                     $purl = $rowf['purl'] . $row['purl'];
                     $durl = $rowf['durl'] . $row['durl'];
                 }
             }
             $purl = annexlink($purl);
             $durl = annexlink($durl);
             $Mark_Text = str_replace("[dance:qurl]", $purl, $Mark_Text);
             $Mark_Text = str_replace("[dance:qxurl]", $durl, $Mark_Text);
         }
         unset($arr);
         //生成
         write_file(FCPATH . $Htmllink, $Mark_Text);
         echo "&nbsp;<font style=font-size:10pt;>" . L('plub_50') . "<font color=red>" . $row['name'] . "</font>" . L('plub_36') . "<a href=" . $Htmllinks . " target=_blank>" . $Htmllinks . "</a></font><br/>";
         ob_flush();
         flush();
     }
     if (!empty($ids)) {
         $url = 'javascript:history.back();';
         $str = "&nbsp;&nbsp;<b>" . L('plub_66') . "&nbsp;>>>>&nbsp;&nbsp;<a href='" . $url . "'>" . L('plub_28') . "</a></b>";
     } else {
         $url = site_url('dance/admin/html/down_save') . $uri . '&page=' . ($page + 1);
         $str = "&nbsp;&nbsp;<b>" . vsprintf(L('plub_27'), array(Html_StopTime)) . "&nbsp;>>>>&nbsp;&nbsp;<a href='" . $url . "'>" . L('plub_28') . "</a></b>";
     }
     echo "</br>" . $str . "<script>setTimeout('updatenext();'," . Html_StopTime . "000);function updatenext(){location.href='" . $url . "';}</script>";
 }
Beispiel #15
0
 public function index($a1, $a2 = 0, $a3 = 0, $a4 = 0)
 {
     if (intval($a1) > 0) {
         $id = intval($a1);
         //ID
         $zu = intval($a2);
         //组
         $ji = intval($a3);
         //集数
     } else {
         $id = intval($a2);
         //ID
         $zu = intval($a3);
         //组
         $ji = intval($a4);
         //集数
     }
     $login = '******';
     //判断ID
     if ($id == 0) {
         msg_url('出错了,ID不能为空!', Web_Path);
     }
     //获取数据
     $row = $this->CsdjDB->get_row_arr('vod', '*', $id);
     if (!$row || $row['yid'] > 0 || $row['hid'] > 0) {
         msg_url('出错了,该数据不存在或者没有审核!', Web_Path);
     }
     if (empty($row['purl'])) {
         msg_url('该视频播放地址不正确!', Web_Path);
     }
     //判断运行模式,生成则跳转至静态页面
     $html = config('Html_Uri');
     if (config('Web_Mode') == 3 && $html['play']['check'] == 1 && !defined('MOBILE')) {
         //获取静态路径
         $Htmllink = VodPlayUrl('play', $id, $zu, $ji);
         header("Location: " . $Htmllink);
         exit;
     }
     //判断收费
     if ($row['vip'] > 0 || $row['level'] > 0 || $row['cion'] > 0) {
         if (!$this->CsdjUser->User_Login(1)) {
             msg_url('观看这部视频需要登录,请先登录!', spacelink('login'));
         }
         $rowu = $this->CsdjDB->get_row_arr('user', 'vip,level,cion', $_SESSION['cscms__id']);
     }
     //判断会员组下载权限
     if ($row['vip'] > 0 && $row['uid'] != $_SESSION['cscms__id']) {
         if ($row['vip'] > $rowu['vip']) {
             msg_url('抱歉,您所在的会员组不能观看该视频,请先升级!', 'javascript:window.close();');
         }
     }
     //判断会员等级下载权限
     if ($row['level'] > 0 && $row['uid'] != $_SESSION['cscms__id']) {
         if ($row['level'] > $rowu['level']) {
             msg_url('抱歉,您等级不够,不能观看该视频!', 'javascript:window.close();');
         }
     }
     //判断金币下载
     $down = 0;
     if ($row['cion'] > 0 && $row['uid'] != $_SESSION['cscms__id']) {
         //判断是否下载过
         $did = $id . '-' . $zu . '-' . $ji;
         $rowd = $this->db->query("SELECT id,addtime FROM " . CS_SqlPrefix . "vod_look where did='" . $did . "' and uid='" . $_SESSION['cscms__id'] . "' and sid=0")->row_array();
         if ($rowd) {
             $down = 1;
             //数据已经存在
             $downtime = User_Downtime * 3600 + $rowd['addtime'];
             if ($downtime > time()) {
                 $down = 2;
                 //在多少时间内不重复扣币
             }
         }
         //判断会员组下载权限
         $rowz = $this->db->query("SELECT id,did FROM " . CS_SqlPrefix . "userzu where id='" . $rowu['vip'] . "'")->row_array();
         if ($rowz && $rowz['did'] == 1) {
             //有免费下载权限
             $down = 2;
             //该会员下载不收费
         }
         if ($down < 2) {
             //判断扣币
             if ($row['cion'] > $rowu['cion']) {
                 msg_url('这部视频观看每集需要' . $row['cion'] . '个金币,您的当前金币不够,请先充值!', 'javascript:window.close();');
             } else {
                 //扣币
                 $edit['cion'] = $rowu['cion'] - $row['cion'];
                 $this->CsdjDB->get_update('user', $_SESSION['cscms__id'], $edit);
                 //写入消费记录
                 $add2['title'] = '观看视频《' . $row['name'] . '》- 第' . ($ji + 1) . '集';
                 $add2['uid'] = $_SESSION['cscms__id'];
                 $add2['nums'] = $row['cion'];
                 $add2['ip'] = getip();
                 $add2['dir'] = 'vod';
                 $add2['addtime'] = time();
                 $this->CsdjDB->get_insert('spend', $add2);
                 //判断分成
                 if (User_DownFun == 1 && $row['uid'] > 0) {
                     //分成比例
                     $bi = User_Downcion < 10 ? '0.0' . User_Downcion : '0.' . User_Downcion;
                     $scion = intval($row['cion'] * $bi);
                     if ($scion > 0) {
                         $this->db->query("update " . CS_SqlPrefix . "user set cion=cion+" . $scion . " where id=" . $row['uid'] . "");
                         //写入分成记录
                         $add3['title'] = '视频《' . $row['name'] . '》- 第' . ($ji + 1) . '集 - 观看分成';
                         $add3['uid'] = $row['uid'];
                         $add3['dir'] = 'vod';
                         $add3['nums'] = $scion;
                         $add3['ip'] = getip();
                         $add3['addtime'] = time();
                         $this->CsdjDB->get_insert('income', $add3);
                     }
                 }
             }
         }
         //增加观看记录
         if ($down == 0) {
             $add['name'] = $row['name'];
             $add['cid'] = $row['cid'];
             $add['sid'] = 0;
             $add['did'] = $did;
             $add['uid'] = $_SESSION['cscms__id'];
             $add['cion'] = $row['cion'];
             $add['addtime'] = time();
             $this->CsdjDB->get_insert('vod_look', $add);
         }
     }
     //摧毁部分需要超级链接字段数组
     $rows = $row;
     //先保存数组保留下面使用
     unset($row['zhuyan']);
     unset($row['daoyan']);
     unset($row['yuyan']);
     unset($row['diqu']);
     unset($row['tags']);
     unset($row['year']);
     unset($row['pfen']);
     unset($row['phits']);
     //获取当前分类下二级分类ID
     $arr['cid'] = getChild($row['cid']);
     $arr['uid'] = $row['uid'];
     $arr['singerid'] = $row['singerid'];
     $arr['tags'] = $rows['tags'];
     $skins = $row['skins'];
     if (empty($skins) || $skins == 'play.html') {
         $skins = getzd('vod_list', 'skins3', $row['cid']);
     }
     if (empty($skins)) {
         $skins = 'play.html';
     }
     //装载模板并输出
     $Mark_Text = $this->CsdjTpl->plub_show('vod', $row, $arr, TRUE, $skins, $row['name'], $row['name']);
     //评论
     $Mark_Text = str_replace("[vod:pl]", get_pl('vod', $id), $Mark_Text);
     //分类地址、名称
     $Mark_Text = str_replace("[vod:zu]", $zu + 1, $Mark_Text);
     $Mark_Text = str_replace("[vod:ji]", $ji + 1, $Mark_Text);
     $Mark_Text = str_replace("[vod:link]", LinkUrl('show', 'id', $row['id'], 1, 'vod'), $Mark_Text);
     $Mark_Text = str_replace("[vod:playlink]", VodPlayUrl('play', $id, $zu, $ji), $Mark_Text);
     $Mark_Text = str_replace("[vod:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'vod'), $Mark_Text);
     $Mark_Text = str_replace("[vod:classname]", $this->CsdjDB->getzd('vod_list', 'name', $row['cid']), $Mark_Text);
     //主演、导演、标签、年份、地区、语言加超级连接
     $Mark_Text = str_replace("[vod:zhuyan]", SearchLink($rows['zhuyan'], 'zhuyan'), $Mark_Text);
     $Mark_Text = str_replace("[vod:daoyan]", SearchLink($rows['daoyan'], 'daoyan'), $Mark_Text);
     $Mark_Text = str_replace("[vod:yuyan]", SearchLink($rows['yuyan'], 'yuyan'), $Mark_Text);
     $Mark_Text = str_replace("[vod:diqu]", SearchLink($rows['diqu'], 'diqu'), $Mark_Text);
     $Mark_Text = str_replace("[vod:tags]", SearchLink($rows['tags']), $Mark_Text);
     $Mark_Text = str_replace("[vod:year]", SearchLink($rows['year'], 'year'), $Mark_Text);
     //评分
     $Mark_Text = str_replace("[vod:pfen]", getpf($rows['pfen'], $rows['phits']), $Mark_Text);
     $Mark_Text = str_replace("[vod:pfenbi]", getpf($rows['pfen'], $rows['phits'], 2), $Mark_Text);
     //解析播放地址
     $Mark_Text = Vod_Playlist($Mark_Text, 'play', $id, $row['purl']);
     //播放器
     $Data_Arr = explode("#cscms#", $row['purl']);
     if ($zu >= count($Data_Arr)) {
         $zu = 0;
     }
     $DataList_Arr = explode("\n", $Data_Arr[$zu]);
     $Dataurl_Arr = explode('$', $DataList_Arr[$ji]);
     $xpurl = "";
     //下集播放地址
     $laiyuan = str_replace("\r", "", @$Dataurl_Arr[2]);
     //来源
     $url = $Dataurl_Arr[1];
     //地址
     $pname = $Dataurl_Arr[0];
     //当前集数
     $Mark_Text = str_replace("[vod:qurl]", $url, $Mark_Text);
     $Mark_Text = str_replace("[vod:laiy]", $laiyuan, $Mark_Text);
     $Mark_Text = str_replace("[vod:ji]", $pname, $Mark_Text);
     //手机播放地址
     if (substr($url, 0, 7) == 'http://') {
         $wapurl = $url;
     } else {
         $wapurl = 'http://download.chshcms.com/mp4/' . $laiyuan . '/' . cs_base64_encode($url) . '/cscms.mp4';
     }
     $Mark_Text = str_replace("[vod:wapurl]", $wapurl, $Mark_Text);
     if (count($DataList_Arr) > $ji + 1) {
         $DataNext = $DataList_Arr[$ji + 1];
         $DataNextArr = explode('$', $DataNext);
         if (count($DataNextArr) == 2) {
             $DataNext = $DataNextArr[1];
         }
         $xurl = VodPlayUrl('play', $id, $zu, $ji + 1);
         $Dataurl_Arr2 = explode('$', $DataList_Arr[$ji + 1]);
         $xpurl = @$Dataurl_Arr2[1];
         //下集播放地址
     } else {
         $DataNext = $DataList_Arr[$ji];
         $DataNextArr = explode('$', $DataNext);
         if (count($DataNextArr) == 2) {
             $DataNext = $DataNextArr[1];
         }
         $xurl = '#';
         $xpurl = '';
         //下集播放地址
     }
     if ($ji == 0) {
         $surl = '#';
     } else {
         $surl = VodPlayUrl('play', $id, $zu, $ji - 1);
     }
     $psname = '';
     for ($j = 0; $j < count($Data_Arr); $j++) {
         $jis = '';
         $Ji_Arr = explode("\n", $Data_Arr[$j]);
         for ($k = 0; $k < count($Ji_Arr); $k++) {
             $Ly_Arr = explode('$', $Ji_Arr[$k]);
             $jis .= $Ly_Arr[0] . '$$' . @$Ly_Arr[2] . '====';
         }
         $psname .= substr($jis, 0, -4) . '#cscms#';
     }
     $player_arr = str_replace("\r", "", substr($psname, 0, -7));
     if ($laiyuan == 'xgvod' || $laiyuan == 'jjvod' || $laiyuan == 'yyxf' || $laiyuan == 'bdhd' || $laiyuan == 'qvod') {
         $xpurl = str_replace("+", "__", base64_encode($xpurl));
         $url = str_replace("+", "__", base64_encode($url));
     } else {
         $xpurl = escape($xpurl);
         $url = escape($url);
     }
     $player = "<script type='text/javascript' src='" . hitslink('play/form', 'vod') . "'></script><script type='text/javascript'>var cs_playlink='" . VodPlayUrl('play', $id, $zu, $ji, 1) . "';var cs_did='" . $id . "';var player_name='" . $player_arr . "';var cs_pid='" . $ji . "';var cs_zid='" . $zu . "';var cs_vodname='" . $row['name'] . " - " . $pname . "';var cs_root='" . Web_Path . "';var cs_width=" . CS_Play_sw . ";var cs_height=" . CS_Play_sh . ";var cs_surl='" . $surl . "';var cs_xurl='" . $xurl . "';var cs_url='" . $url . "';var cs_xpurl='" . $xpurl . "';var cs_laiy='" . $laiyuan . "';var cs_adloadtime='" . CS_Play_AdloadTime . "';</script><iframe border=\"0\" name=\"cscms_vodplay\" id=\"cscms_vodplay\" src=\"" . Web_Path . "packs/vod_player/play.html\" marginwidth=\"0\" framespacing=\"0\" marginheight=\"0\" noresize=\"\" vspale=\"0\" style=\"z-index: 9998;\" frameborder=\"0\" height=\"" . (CS_Play_sh + 30) . "\" scrolling=\"no\" width=\"100%\"></iframe>";
     $Mark_Text = str_replace("[vod:player]", $player, $Mark_Text);
     $Mark_Text = str_replace("[vod:surl]", $surl, $Mark_Text);
     $Mark_Text = str_replace("[vod:xurl]", $xurl, $Mark_Text);
     //增加人气
     $Mark_Text = hits_js($Mark_Text, hitslink('hits/ids/' . $id, 'vod'));
     echo $Mark_Text;
     $this->cache->end();
     //由于前面不是直接输出,所以这里需要加入写缓存
 }
Beispiel #16
0
 public function show_save()
 {
     if ($this->huri['show']['check'] == 0) {
         admin_msg('相册内容页未开启生成~!', 'javascript:history.back();', 'no');
     }
     $day = intval($this->input->get_post('day', true));
     //最近几天
     $ids = $this->input->get_post('ids', true);
     //需要生成的数据ID
     $cid = $this->input->get_post('cid', true);
     //需要生成的分类ID
     $newid = intval($this->input->get_post('newid'));
     //最新个数
     $ksid = intval($this->input->get_post('ksid'));
     //开始ID
     $jsid = intval($this->input->get_post('jsid'));
     //结束ID
     $kstime = $this->input->get_post('kstime', true);
     //开始日期
     $jstime = $this->input->get_post('jstime', true);
     //结束日期
     $pagesize = intval($this->input->get('pagesize'));
     //每页多少条
     $pagejs = intval($this->input->get('pagejs'));
     //总页数
     $datacount = intval($this->input->get('datacount'));
     //数据总数
     $page = intval($this->input->get('page'));
     //当前页
     if ($page == 0) {
         $page = 1;
     }
     $str = '';
     //将数组转换成字符
     if (is_array($cid)) {
         $cid = implode(',', $cid);
     }
     if (is_array($ids)) {
         $ids = implode(',', $ids);
     }
     if ($day > 0) {
         $times = time() - 86400 * $day;
         $str .= ' and addtime>' . $times . '';
     }
     if (!empty($cid)) {
         $str .= ' and cid in (' . $cid . ')';
     }
     if (!empty($ids)) {
         $str .= ' and id in (' . $ids . ')';
     }
     if ($ksid > 0 && $jsid > 0) {
         $str .= ' and id>' . ($ksid - 1) . ' and id<' . ($jsid + 1) . '';
     }
     if (!empty($kstime) && !empty($jstime)) {
         $ktime = strtotime($kstime) - 86400;
         $jtime = strtotime($jstime) + 86400;
         $str .= ' and addtime>' . $ktime . ' and addtime<' . $jtime . '';
     }
     $limit = '';
     if ($newid > 0) {
         $limit = ' order by id desc limit ' . $newid;
     }
     if ($datacount == 0) {
         $sqlstr = "select id from " . CS_SqlPrefix . "pic_type where yid=0 and hid=0 " . $str . $limit;
         $datacount = $this->db->query($sqlstr)->num_rows();
         //总数量
         $pagejs = ceil($datacount / Html_PageNum);
     }
     if ($datacount == 0) {
         $pagejs = 1;
     }
     $pagesize = Html_PageNum;
     if ($datacount < $pagesize) {
         $pagesize = $datacount;
     }
     //全部生成完毕
     if ($page > $pagejs) {
         admin_msg('所有内容页全部生成完毕~!', site_url('pic/admin/html/show'));
     }
     //公众URI
     $uri = '?day=' . $day . '&cid=' . $cid . '&ids=' . $ids . '&newid=' . $newid . '&ksid=' . $ksid . '&jsid=' . $jsid . '&kstime=' . $kstime . '&jstime=' . $jstime . '&pagesize=' . $pagesize . '&pagejs=' . $pagejs . '&datacount=' . $datacount;
     //重新定义模板路径
     $this->load->get_templates('pic', 2);
     echo '<LINK href="' . base_url() . 'packs/admin/css/style.css" type="text/css" rel="stylesheet"><br>';
     echo '&nbsp;&nbsp;<b>正在开始生成相册内容,分<font color=red>' . $pagejs . '</font>次生成,当前第<font color=red>' . $page . '</font>次</b><br/>';
     $sql_string = "select * from " . CS_SqlPrefix . "pic_type where yid=0 and hid=0 " . $str . " order by id desc";
     $sql_string .= ' limit ' . $pagesize * ($page - 1) . ',' . $pagesize;
     $query = $this->db->query($sql_string);
     //获取内容页是否需要生成
     $html = config('Html_Uri', 'pic');
     foreach ($query->result_array() as $row) {
         ob_end_flush();
         //关闭缓存
         $id = $row['id'];
         //获取静态路径
         $Htmllinks = LinkUrl('show', 'id', $row['id'], 0, 'pic');
         //转换成生成路径
         $Htmllink = adminhtml($Htmllinks, 'pic');
         //摧毁部分需要超级链接字段数组
         $rows = $row;
         //先保存数组保留下面使用
         unset($row['tags']);
         unset($row['hits']);
         unset($row['yhits']);
         unset($row['zhits']);
         unset($row['rhits']);
         unset($row['dhits']);
         unset($row['chits']);
         unset($row['content']);
         //默认模板
         $skins = empty($row['skins']) ? 'show.html' : $row['skins'];
         $arr['cid'] = getChild($row['cid']);
         $arr['uid'] = $row['uid'];
         $arr['tags'] = $rows['tags'];
         $arr['sid'] = $row['id'];
         //装载模板并输出
         $Mark_Text = $this->CsdjTpl->plub_show('pic', $row, $arr, TRUE, $skins, $row['name'], $row['name']);
         //评论
         $Mark_Text = str_replace("[pic:pl]", get_pl('pic', $id), $Mark_Text);
         //分类地址、名称
         $Mark_Text = str_replace("[pic:link]", LinkUrl('show', 'id', $row['id'], 1, 'pic'), $Mark_Text);
         $Mark_Text = str_replace("[pic:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'pic'), $Mark_Text);
         $Mark_Text = str_replace("[pic:classname]", $this->CsdjDB->getzd('pic_list', 'name', $row['cid']), $Mark_Text);
         //获取上下篇
         preg_match_all('/[pic:slink]/', $Mark_Text, $arr);
         if (!empty($arr[0]) && !empty($arr[0][0])) {
             $rowd = $this->db->query("Select id,cid,pic,name from " . CS_SqlPrefix . "pic_type where yid=0 and hid=0 and id<" . $id . " order by id desc limit 1")->row();
             if ($rowd) {
                 $Mark_Text = str_replace("[pic:slink]", LinkUrl('show', 'id', $rowd->id, 1, 'pic'), $Mark_Text);
                 $Mark_Text = str_replace("[pic:sname]", $rowd->name, $Mark_Text);
                 $Mark_Text = str_replace("[pic:sid]", $rowd->id, $Mark_Text);
                 $Mark_Text = str_replace("[pic:spic]", piclink('pic', $rowd->pic), $Mark_Text);
             } else {
                 $Mark_Text = str_replace("[pic:slink]", "#", $Mark_Text);
                 $Mark_Text = str_replace("[pic:sname]", "没有了", $Mark_Text);
                 $Mark_Text = str_replace("[pic:sid]", 0, $Mark_Text);
                 $Mark_Text = str_replace("[pic:spic]", piclink('pic', ''), $Mark_Text);
             }
         }
         unset($arr);
         preg_match_all('/[pic:xlink]/', $Mark_Text, $arr);
         if (!empty($arr[0]) && !empty($arr[0][0])) {
             $rowd = $this->db->query("Select id,cid,pic,name from " . CS_SqlPrefix . "pic_type where yid=0 and hid=0 and id>" . $id . " order by id asc limit 1")->row();
             if ($rowd) {
                 $Mark_Text = str_replace("[pic:xlink]", LinkUrl('show', 'id', $rowd->id, 1, 'pic'), $Mark_Text);
                 $Mark_Text = str_replace("[pic:xname]", $rowd->name, $Mark_Text);
                 $Mark_Text = str_replace("[pic:xid]", $rowd->id, $Mark_Text);
                 $Mark_Text = str_replace("[pic:xpic]", piclink('pic', $rowd->pic), $Mark_Text);
             } else {
                 $Mark_Text = str_replace("[pic:xlink]", "#", $Mark_Text);
                 $Mark_Text = str_replace("[pic:xname]", "没有了", $Mark_Text);
                 $Mark_Text = str_replace("[pic:xid]", 0, $Mark_Text);
                 $Mark_Text = str_replace("[pic:xpic]", piclink('pic', ''), $Mark_Text);
             }
         }
         unset($arr);
         //标签加超级连接
         $Mark_Text = str_replace("[pic:tags]", SearchLink($rows['tags']), $Mark_Text);
         //动态人气
         $Mark_Text = str_replace("[pic:hits]", "<script src='" . hitslink('hits/dt/hits/' . $id, 'pic') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[pic:yhits]", "<script src='" . hitslink('hits/dt/yhits/' . $id, 'pic') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[pic:zhits]", "<script src='" . hitslink('hits/dt/zhits/' . $id, 'pic') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[pic:rhits]", "<script src='" . hitslink('hits/dt/rhits/' . $id, 'pic') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[pic:dhits]", "<script src='" . hitslink('hits/dt/dhits/' . $id, 'pic') . "'></script>", $Mark_Text);
         $Mark_Text = str_replace("[pic:chits]", "<script src='" . hitslink('hits/dt/chits/' . $id, 'pic') . "'></script>", $Mark_Text);
         //获取当前相册总数
         $pcount = $this->db->query("Select id from " . CS_SqlPrefix . "pic where sid=" . $id . " and hid=0 and yid=0")->num_rows();
         $Mark_Text = str_replace("[pic:count]", $pcount, $Mark_Text);
         //第一张图片
         $rowp = $this->db->query("Select pic,content from " . CS_SqlPrefix . "pic where sid=" . $id . " and hid=0 and yid=0 order by id desc limit 1")->row();
         $pics = $rowp ? $rowp->pic : '';
         $content = $rowp ? $rowp->content : '';
         $Mark_Text = str_replace("[pic:url]", piclink('pic', $pics), $Mark_Text);
         $Mark_Text = str_replace("[pic:content]", $content, $Mark_Text);
         //增加人气
         $Mark_Text = hits_js($Mark_Text, hitslink('hits/ids/' . $id, 'pic'));
         //生成
         write_file(FCPATH . $Htmllink, $Mark_Text);
         echo "&nbsp;<font style=font-size:10pt;>生成相册:<font color=red>" . $row['name'] . "</font>成功:<a href=" . $Htmllinks . " target=_blank>" . $Htmllinks . "</a></font><br/>";
         ob_flush();
         flush();
     }
     if (!empty($ids)) {
         $url = 'javascript:history.back();';
         $str = "&nbsp;&nbsp;<b>全部生成完毕&nbsp;>>>>&nbsp;&nbsp;<a href='" . $url . "'>如果您的 浏览器没有跳转,请点击继续...</a></b>";
     } else {
         $url = site_url('pic/admin/html/show_save') . $uri . '&page=' . ($page + 1);
         $str = "&nbsp;&nbsp;<b>暂停" . Html_StopTime . "秒后继续&nbsp;>>>>&nbsp;&nbsp;<a href='" . $url . "'>如果您的 浏览器没有跳转,请点击继续...</a></b>";
     }
     echo "</br>" . $str . "<script>setTimeout('updatenext();'," . Html_StopTime . "000);function updatenext(){location.href='" . $url . "';}</script>";
 }
Beispiel #17
0
 public function index($fid = 'id', $id = 0, $return = FALSE)
 {
     $id = intval($fid) > 0 ? intval($fid) : intval($id);
     //ID
     //判断ID
     if ($id == 0) {
         msg_url('出错了,ID不能为空!', Web_Path);
     }
     //获取数据
     $row = $this->CsdjDB->get_row_arr('vod', '*', $id);
     if (!$row || $row['yid'] > 0 || $row['hid'] > 0) {
         msg_url('出错了,该数据不存在或者没有审核!', Web_Path);
     }
     //判断运行模式,生成则跳转至静态页面
     $html = config('Html_Uri');
     if (config('Web_Mode') == 3 && $html['show']['check'] == 1 && !defined('MOBILE')) {
         //获取静态路径
         $Htmllink = LinkUrl('show', $fid, $id, 0, 'vod');
         header("Location: " . $Htmllink);
         exit;
     }
     //摧毁部分需要超级链接字段数组
     $rows = $row;
     //先保存数组保留下面使用
     unset($row['zhuyan']);
     unset($row['daoyan']);
     unset($row['yuyan']);
     unset($row['diqu']);
     unset($row['tags']);
     unset($row['year']);
     unset($row['pfen']);
     unset($row['phits']);
     //获取当前分类下二级分类ID
     $arr['cid'] = getChild($row['cid']);
     $arr['uid'] = $row['uid'];
     $arr['singerid'] = $row['singerid'];
     $arr['tags'] = $rows['tags'];
     $skins = getzd('vod_list', 'skins2', $row['cid']);
     if (empty($skins)) {
         $skins = 'show.html';
     }
     //装载模板并输出
     $Mark_Text = $this->CsdjTpl->plub_show('vod', $row, $arr, TRUE, $skins, $row['name'], $row['name']);
     //评论
     $Mark_Text = str_replace("[vod:pl]", get_pl('vod', $id), $Mark_Text);
     //分类地址、名称
     $Mark_Text = str_replace("[vod:link]", LinkUrl('show', 'id', $row['id'], 1, 'vod'), $Mark_Text);
     $Mark_Text = str_replace("[vod:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'vod'), $Mark_Text);
     $Mark_Text = str_replace("[vod:classname]", $this->CsdjDB->getzd('vod_list', 'name', $row['cid']), $Mark_Text);
     //主演、导演、标签、年份、地区、语言加超级连接
     $Mark_Text = str_replace("[vod:zhuyan]", SearchLink($rows['zhuyan'], 'zhuyan'), $Mark_Text);
     $Mark_Text = str_replace("[vod:daoyan]", SearchLink($rows['daoyan'], 'daoyan'), $Mark_Text);
     $Mark_Text = str_replace("[vod:yuyan]", SearchLink($rows['yuyan'], 'yuyan'), $Mark_Text);
     $Mark_Text = str_replace("[vod:diqu]", SearchLink($rows['diqu'], 'diqu'), $Mark_Text);
     $Mark_Text = str_replace("[vod:tags]", SearchLink($rows['tags']), $Mark_Text);
     $Mark_Text = str_replace("[vod:year]", SearchLink($rows['year'], 'year'), $Mark_Text);
     //评分
     $Mark_Text = str_replace("[vod:pfen]", getpf($rows['pfen'], $rows['phits']), $Mark_Text);
     $Mark_Text = str_replace("[vod:pfenbi]", getpf($rows['pfen'], $rows['phits'], 2), $Mark_Text);
     //解析播放下载地址
     $Mark_Text = Vod_Playlist($Mark_Text, 'play', $id, $row['purl']);
     $Mark_Text = Vod_Playlist($Mark_Text, 'down', $id, $row['durl']);
     echo $Mark_Text;
     $this->cache->end();
     //由于前面不是直接输出,所以这里需要加入写缓存
 }
 public function SetPanelSettings()
 {
     $count = 0;
     $output = "";
     $params = $GLOBALS['ISC_CLASS_SEARCH']->_searchterms;
     $this->searchterms = $params;
     $path = GetConfig('ShopPath');
     /* the below mmy links are passed to the breadcrumbs */
     $mmy_links = "";
     /*---------- This below section is for generating search phrase----------*/
     $GLOBALS['Category'] = "";
     $GLOBALS['MMY'] = "";
     $GLOBALS['PQ'] = "";
     $GLOBALS['VQ'] = "";
     $GLOBALS['SearchPhrase'] = "";
     $ext_links = "";
     // this variable is passed to the product detail page
     $seo_delim = "&";
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $seo_delim = "/";
     }
     if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
         $GLOBALS['Category'] .= $GLOBALS['ISC_SRCH_CATG_NAME'];
     }
     if (isset($params['year'])) {
         $GLOBALS['MMY'] .= $params['year'] . "<br>";
         $ext_links .= $seo_delim . "year=" . $params['year'];
     }
     if (isset($params['make'])) {
         $GLOBALS['MMY'] .= strtoupper($params['make']) . "<br>";
         $ext_links .= $seo_delim . "make=" . MakeURLSafe($params['make']);
     }
     if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) {
         $GLOBALS['MMY'] .= strtoupper($params['model']) . "<br>";
         $ext_links .= $seo_delim . "model=" . MakeURLSafe($params['model']);
     }
     /*else if(isset($params['model']))
       $ext_links .= $seo_delim."model=".$params['model'];*/
     /* this condition has been added seperately here to show submodel at last */
     if (isset($params['submodel'])) {
         $GLOBALS['MMY'] .= MakeURLSafe($params['submodel']) . "<br>";
     }
     /*if(isset($params['year'])) {
       $ext_links .= $seo_delim."year=".$params['year'];                
       }*/
     if (isset($params['dynfilters']) && !empty($params['dynfilters'])) {
         foreach ($params['dynfilters'] as $key => $value) {
             if (eregi('vq', $key)) {
                 $key = str_ireplace('vq', '', $key);
                 $GLOBALS['VQ'] .= ucfirst($key) . ": {$value}<br>";
             } else {
                 if (eregi('pq', $key)) {
                     $key = str_ireplace('pq', '', $key);
                     $GLOBALS['PQ'] .= ucfirst($key) . ": {$value}<br>";
                 }
             }
         }
     }
     $filter_var = array('vq', 'pq');
     /* this below patch is used for getting description of the category. Here currently the selected category id will be last one in the $params['srch_category'] array. if input['category'] is used then it will be the first one */
     if (!empty($params['srch_category'])) {
         if (isset($params['category'])) {
             $selected_catg = $params['srch_category'][0];
         } else {
             $selected_catg = end($params['srch_category']);
         }
         $catg_desc_qry = "select catdesc , categoryfooter from [|PREFIX|]categories where categoryid = " . $selected_catg;
         $catg_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_desc_qry);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($catg_desc_res) > 0) {
             $catg_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res);
         }
         /* this below patch is used to show the display name for the qualifiers from the qualifier association table */
         $map_names = array();
         $display_names = array();
         $filter_names = "select qid , column_name , display_names from [|PREFIX|]qualifier_names where column_name regexp '^(pq|vq)'";
         $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
         while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
             $map_names[$filter_row['qid']] = $filter_row['column_name'];
             $display_names[$filter_row['qid']] = $filter_row['display_names'];
         }
         $this->GetAssocDetails($selected_catg, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
     }
     if (isset($params['brand'])) {
         $brand_desc_arr = array();
         $brand_desc_qry = "select branddescription , brandfooter from [|PREFIX|]brands where brandname = '" . $params['brand'] . "'";
         $brand_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_desc_qry);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($brand_desc_res) > 0) {
             $brand_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_desc_res);
         }
     }
     // for breadcrumbs
     $this->_BuildBreadCrumbs();
     /* the below line has been commented as client told to remove it */
     //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 30) {
         $msg_qry = "select value from [|PREFIX|]display where messageid = 1";
         $msg_res = $GLOBALS['ISC_CLASS_DB']->Query($msg_qry);
         $msg_row = $GLOBALS['ISC_CLASS_DB']->FetchOne($msg_res);
         $GLOBALS['SearchPhrase'] = $msg_row;
         //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase");
     }
     /*if(!empty($params['dynfilters']))
       $GLOBALS['SearchPhrase'] .= " ".implode(" ",$params['dynfilters']);
       /*---------- Ending section for generating search phrase----------*/
     $vq_column_title = "";
     $GLOBALS['SearchResultList'] = "";
     if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 0) {
         $brand_rating = 0;
         if ($GLOBALS['results_page_flag'] == 1) {
             $brand_rating_qry = "select avg(revrating) as rating from [|PREFIX|]reviews r left join [|PREFIX|]products p on r.revproductid = p.productid left join [|PREFIX|]brands b on p.prodbrandid = b.brandid  where r.revstatus = 1 and b.brandname = '" . $params['brand'] . "'";
             $brand_rating_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_rating_qry);
             $brand_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_rating_res);
             if (isset($brand_rating_arr['rating'])) {
                 $brand_rating = (int) $brand_rating_arr['rating'];
             }
         }
         /* displaying the dropdowns for YMM */
         if (!isset($params['make']) || !isset($params['year']) || !isset($params['model']) || isset($params['model_flag']) && $params['model_flag'] == 0) {
             $this->YMMSelectors($params);
         }
         // We have at least one result, let's show it to the world!
         $GLOBALS['HideNoResults'] = "none";
         // Only show the "compare" option if there are 2 or more products on this page
         if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) < 2) {
             $GLOBALS['HideCompareItems'] = "none";
         }
         if (GetConfig('EnableProductReviews') == 0) {
             $GLOBALS['HideProductRating'] = "display: none";
         }
         $GLOBALS['AlternateClass'] = '';
         $counter = 1;
         $CurCatId = 0;
         $mmy_links = $this->GetYMMLinks($params);
         $mmy_links .= $this->GetOtherLinks($params);
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['SearchResults'])) {
             /* Added by Simha to check inf prodcucts comes from different categories*/
             if (empty($params['srch_category']) || !isset($params['srch_category'])) {
                 if ($CurCatId != $row['categoryid']) {
                     $CurCatId = $row['categoryid'];
                     $map_names = array();
                     $display_names = array();
                     $filter_names = "SELECT DISTINCT qn.qid, qn.column_name, qn.display_names from \n                                                [|PREFIX|]qualifier_names qn\n                                                LEFT JOIN [|PREFIX|]qualifier_associations qa ON qa.qualifierid = qn.qid\n                                                WHERE (qa.categoryid = '{$CurCatId}') \n                                                AND qn.column_name regexp '^(pq|vq)'";
                     // || qa.categoryid IN (SELECT catparentid FROM isc_categories WHERE categoryid = '$CurCatId')
                     $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
                     while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
                         $map_names[$filter_row['qid']] = $filter_row['column_name'];
                         $display_names[$filter_row['qid']] = $filter_row['display_names'];
                     }
                     $this->GetAssocDetails($CurCatId, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
                 }
             }
             /* Added by Simha Ends */
             $GLOBALS['SearchTrackClass'] = "TrackLink";
             $imagefile = "";
             if ($GLOBALS['AlternateClass'] == 'Odd') {
                 $GLOBALS['AlternateClass'] = 'Even';
             } else {
                 $GLOBALS['AlternateClass'] = 'Odd';
             }
             $qry_string = $_SERVER['QUERY_STRING'];
             if (isset($_GET['page'])) {
                 $page = "&page=" . $_GET['page'];
                 $qry_string = str_ireplace($page, '', $qry_string);
             }
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 if (isset($_GET['search_key'])) {
                     $qry_string = str_ireplace('&search_key=' . $_GET['search_key'], '', $qry_string);
                 }
                 if (isset($params['search_query']) && !strstr($qry_string, 'search_query=')) {
                     $qry_string .= "search_query=" . MakeURLSafe($params['search_query']);
                 }
                 if (isset($params['make']) && !strstr($qry_string, 'make=')) {
                     $qry_string .= "&make=" . MakeURLSafe($params['make']);
                 }
                 if (isset($params['model']) && !strstr($qry_string, 'model=')) {
                     $qry_string .= "&model=" . MakeURLSafe($params['model']);
                 }
                 if (isset($params['year']) && !strstr($qry_string, 'year=')) {
                     $qry_string .= "&year=" . MakeURLSafe($params['year']);
                 }
                 if (isset($params['make']) && !strstr($qry_string, 'make=')) {
                     $qry_string .= "&make=" . MakeURLSafe($params['make']);
                 }
                 if (isset($params['model_flag']) && !strstr($qry_string, 'model_flag=')) {
                     $qry_string .= "&model_flag=" . MakeURLSafe($params['model_flag']);
                 }
                 if (isset($params['submodel']) && !strstr($qry_string, 'submodel=')) {
                     $qry_string .= "&submodel=" . MakeURLSafe($params['submodel']);
                 }
             }
             if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
                 /*if( isset($params['srch_category']) )  {
                 			$GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of product listing page.
                 		}*/
                 if (isset($params['category']) || !isset($params['subcategory']) && isset($params['series'])) {
                     $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription'];
                     $GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter'];
                     if ((isset($params['category']) || isset($params['subcategory'])) && $GLOBALS['CatgDescandBrandImage'] == "") {
                         $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                         $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : '';
                     }
                 } else {
                     if (isset($params['srch_category'])) {
                         $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                         $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : '';
                         if (isset($params['series']) && $row['seriesdescription'] != "") {
                             $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription'];
                             $GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter'];
                         }
                         if ($GLOBALS['CatgDescandBrandImage'] == '' && $GLOBALS['CatgBrandSeriesFooter'] == '' && isset($params['brand'])) {
                             $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : '';
                             $GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : '';
                         }
                     } else {
                         if (isset($params['brand'])) {
                             $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : '';
                             $GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : '';
                         }
                     }
                 }
                 $GLOBALS['ProductCartQuantity'] = '';
                 if (isset($GLOBALS['CartQuantity' . $row['productid']])) {
                     $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']];
                 }
                 if ($counter % 2 == 0) {
                     $GLOBALS['RowColor'] = 'grayrow';
                 } else {
                     $GLOBALS['RowColor'] = 'whiterow';
                 }
                 $counter++;
                 $GLOBALS['ProductId'] = (int) $row['productid'];
                 $GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
                 $GLOBALS['ProductLink'] = ProdLink($row['prodname']);
                 $GLOBALS['ProductRating'] = (int) $row['prodavgrating'];
                 $GLOBALS['BrandName'] = $row['brandname'];
                 $GLOBALS['ProdCode'] = $row['prodcode'];
                 //$GLOBALS['ProdDesc'] = $this->strip_html_tags($row['proddesc']);
                 //$GLOBALS['ProdOptions'] = $row['productoption'];
                 $GLOBALS['VehicleOptions'] = "";
                 $GLOBALS['ProdOptions'] = "";
                 foreach ($row as $key => $val) {
                     if ($val != "" && $val != "~") {
                         if (($qualifier_id = array_search($key, $map_names)) !== false) {
                             if (eregi('^vq', $key)) {
                                 $val = trim($val, "~");
                                 $val = preg_split('/[~;]+/', $val);
                                 $val = array_unique($val);
                                 $val = array_values($val);
                                 $val = implode(",", $val);
                                 /* -- Setting display name for qualifier name -- */
                                 if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') {
                                     $key = $OwnAssoc[$qualifier_id][0]['qname'];
                                 } else {
                                     if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') {
                                         $key = $ParentAssoc[$qualifier_id][0]['qname'];
                                     } else {
                                         if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) {
                                             $key = $display_names[$qualifier_id];
                                         } else {
                                             $key = ucfirst(str_ireplace($filter_var, "", $key));
                                         }
                                     }
                                 }
                                 /* -- Setting display name for qualifier name ends -- */
                                 /* -- Setting display name for qualifier value -- */
                                 if (($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != "") {
                                     $val = $OwnAssoc[$qualifier_id][$m]['vname'];
                                 } else {
                                     if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentAssoc[$qualifier_id][$m]['vname'] != "") {
                                         $val = $ParentAssoc[$qualifier_id][$m]['vname'];
                                     }
                                 }
                                 /* -- Setting display name for qualifier value ends-- */
                                 $GLOBALS['VehicleOptions'] .= $key . " : " . $val . "<br>";
                             }
                             if (eregi('^pq', $key)) {
                                 $val = trim($val, "~");
                                 $val = preg_split('/[~;]+/', $val);
                                 $val = array_unique($val);
                                 $val = array_values($val);
                                 $val = implode(",", $val);
                                 /* -- Setting display name for qualifier name -- */
                                 if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') {
                                     $key = $OwnAssoc[$qualifier_id][0]['qname'];
                                 } else {
                                     if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') {
                                         $key = $ParentAssoc[$qualifier_id][0]['qname'];
                                     } else {
                                         if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) {
                                             $key = $display_names[$qualifier_id];
                                         } else {
                                             $key = ucfirst(str_ireplace($filter_var, "", $key));
                                         }
                                     }
                                 }
                                 /* -- Setting display name for qualifier name ends -- */
                                 /* -- Setting display name for qualifier value -- */
                                 if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != '') {
                                     $val = $OwnAssoc[$qualifier_id][$m]['vname'];
                                 } else {
                                     if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentValue[$qualifier_id][$m]['vname'] != '') {
                                         $val = $ParentAssoc[$qualifier_id][$m]['vname'];
                                     }
                                 }
                                 /* -- Setting display name for qualifier value ends-- */
                                 $GLOBALS['ProdOptions'] .= $key . " : " . $val . "<br>";
                             }
                         }
                     }
                 }
                 if (isset($row['vehicleoption'])) {
                     $GLOBALS['VehicleOptions'] = $row['vehicleoption'];
                 }
                 if (isset($row['productoption'])) {
                     $GLOBALS['ProdOptions'] = $row['productoption'];
                 }
                 if (isset($row['catuniversal']) && $row['catuniversal'] == 1) {
                     $GLOBALS['VehicleOptions'] = $GLOBALS['ProductName'];
                     if ($vq_column_title == "") {
                         $vq_column_title = "Product Name";
                     } else {
                         if ($vq_column_title != "Product Name") {
                             $vq_column_title = "Product Name / Vehicle Options";
                         }
                     }
                 } else {
                     if ($vq_column_title == "") {
                         $vq_column_title = "Vehicle Options";
                     } else {
                         if ($vq_column_title != "Vehicle Options") {
                             $vq_column_title = "Product Name / Vehicle Options";
                         }
                     }
                 }
                 if (empty($GLOBALS['VehicleOptions'])) {
                     $GLOBALS['VehicleOptions'] = "&nbsp;";
                 }
                 if (empty($GLOBALS['ProdOptions'])) {
                     $GLOBALS['ProdOptions'] = "&nbsp;";
                 }
                 /*--- the below lines are added for back 2 search link in the product detail page. Also modified line no 56 & 60 --- */
                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                     $GLOBALS['ProductLink'] .= "/refer=true" . $ext_links;
                 } else {
                     $GLOBALS['ProductLink'] .= "&refer=true" . $ext_links;
                 }
                 ### Added by Simha for onsale addition
                 // Determine the price of this product
                 //$GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row);
                 $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($row);
                 $FinalPrice = $GLOBALS['ProductPrice'];
                 $SalePrice = $row['prodsaleprice'];
                 //$DiscountAmount = $FinalPrice;
                 $discounttype = 0;
                 if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) {
                     $DiscountPrice = $SalePrice;
                 } else {
                     $DiscountPrice = $FinalPrice;
                     $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $row['categoryid'], $row['brandseriesid'], $discounttype);
                     /*if($discounttype == 0)    {
                           $DiscountPrice = $FinalPrice;
                       }*/
                 }
                 /*
                 							foreach($DiscountInfo as $DiscountInfoSub)   {  
                     if(isset($DiscountInfoSub['catids']))    {
                 								    $catids = explode(",", $DiscountInfoSub['catids']); 
                 								    foreach($catids as $catid) {
                 									    if($catid == $row['categoryid']) {
                 										    $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); 
                 										    if ($DiscountAmount < 0) {
                 											    $DiscountAmount = 0;
                 										    }                                                                         
                 										    $DiscountPrice  = $FinalPrice - $DiscountAmount;  
                 									    } 
                 								    }  
                     }
                 							}       
                 */
                 if (isset($DiscountPrice) && $DiscountPrice < $FinalPrice && $discounttype == 0) {
                     //&& GetConfig('ShowOnSale')
                     $GLOBALS['ProductPrice'] = '<strike>' . CurrencyConvertFormatPrice($FinalPrice) . '</strike>';
                     $GLOBALS['ProductPrice'] .= '<br>' . CurrencyConvertFormatPrice($DiscountPrice) . '';
                     $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                     if (GetConfig('ShowOnSale')) {
                         $GLOBALS['ProductPrice'] .= '<br>' . $GLOBALS['ShowOnSaleImage'] . '';
                     }
                 } else {
                     $GLOBALS['ProductPrice'] = '' . CurrencyConvertFormatPrice($FinalPrice) . '';
                 }
                 ### Added by Simha Ends
                 // commented the below line by vikas
                 //$GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname']));
                 $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], $GLOBALS['ProductLink']);
                 if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) {
                     //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas
                     $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
                     $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
                 } else {
                     //$GLOBALS['ProductURL'] = CartLink($row['productid']);
                     //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas
                     $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
                     //blessen
                     if (intval($row['prodretailprice']) <= 0) {
                         //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); // commented by vikas on 15-7-09
                         $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
                     } else {
                         //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); // commented by vikas on 15-7-09
                         $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
                     }
                     //blessen
                     // original $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink');
                 }
                 if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {
                     $GLOBALS['HideActionAdd'] = '';
                 } else {
                     $GLOBALS['HideActionAdd'] = 'none';
                 }
                 $GLOBALS['HideProductVendorName'] = 'display: none';
                 $GLOBALS['ProductVendor'] = '';
                 if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) {
                     $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors');
                     if (isset($vendorCache[$row['prodvendorid']])) {
                         $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>';
                         $GLOBALS['HideProductVendorName'] = '';
                     }
                 }
                 $GLOBALS['CartURL'] = CartLink($row['productid']);
                 $offer = $this->IsProductMakeanOffer($row['brandseriesid'], $row['brandname'], $row['categoryid']);
                 if ($offer == 'yes') {
                     $GLOBALS['HideOfferButton'] = 'block';
                 } else {
                     $GLOBALS['HideOfferButton'] = 'none';
                 }
                 $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItem");
             } else {
                 if ($GLOBALS['results_page_flag'] == 0) {
                     $mmy_links_modified = $mmy_links;
                     if (!isset($GLOBALS['ISC_SRCH_CATG_ID'])) {
                         $parentid = $GLOBALS['categories_all'][$row['categoryid']]['catparentid'];
                         if ($parentid != 0) {
                             if (isset($GLOBALS['categories_all'][$parentid])) {
                                 // if parent catg is not visible
                                 $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$parentid]['catname'])) . $mmy_links;
                             } else {
                                 $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links;
                             }
                         } else {
                             $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links;
                         }
                     }
                     $subcatg_link = $this->LeftCatLink($mmy_links_modified, 'subcategory', $row['catname']);
                     $link = "<a href='" . $subcatg_link . "'>";
                     $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "'  title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>";
                     $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title='' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>";
                     //$imagelink = "<a href='".$GLOBALS['ShopPath']."/catgbrand.php?categoryid=".$row['categoryid']."&url=$subcatg_link' class='thickbox' title=''>";
                     if (isset($row['imagefile']) && !empty($row['imagefile'])) {
                         $images = explode("~", $row['imagefile']);
                         for ($j = 0; $j < count($images); $j++) {
                             if (!empty($images[$j])) {
                                 $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $images[$j] . "' alt='" . isc_html_escape($row['catimagealt']) . "' title='" . isc_html_escape($row['catimagealt']) . "' class='subcat-image'></a>";
                                 $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>";
                                 break;
                             }
                         }
                     } else {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0 class='subcat-image'></a>";
                             $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>";
                         }
                     }
                     $GLOBALS['LeftImage'] = $imagefile;
                     $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available";
                     $row['brandname'] = str_replace('~', ' , ', $row['brandname']);
                     //$GLOBALS['RelatedBrands'] = $row['brandname'];
                     if (!empty($row['seriesname'])) {
                         $row['brandname'] .= "<br>" . $row['seriesname'];
                     }
                     $GLOBALS['CatgSeriesList'] = "";
                     if ($row['seriesids'] != "") {
                         $seriesids = str_ireplace("~", ",", $row['seriesids']);
                         $seriesids_qry = "select seriesid , brandname , seriesname from isc_brand_series bs left join isc_brands b on bs.brandid = b.brandid where seriesid in (" . $seriesids . ")";
                         $seriesids_res = $GLOBALS['ISC_CLASS_DB']->Query($seriesids_qry);
                         if ($GLOBALS['ISC_CLASS_DB']->CountResult($seriesids_res) > 0) {
                             while ($seriesids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($seriesids_res)) {
                                 if ($GLOBALS['CatgSeriesList'] == "") {
                                     $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['categoryid'] . "')\">View Brands ></a><div id='" . $row['categoryid'] . "' style='display:block'>";
                                 } else {
                                     $GLOBALS['CatgSeriesList'] .= "<br>";
                                 }
                                 $tooltipscript = "onmouseover='createtip(" . $row['categoryid'] . $seriesids_arr['seriesid'] . ")' onmouseout='UnTip()'";
                                 if (!isset($params['brand'])) {
                                     if ($GLOBALS['EnableSEOUrls'] == 1) {
                                         $series_link = $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     } else {
                                         $series_link = $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     }
                                 } else {
                                     if ($GLOBALS['EnableSEOUrls'] == 1) {
                                         $series_link = $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     } else {
                                         $series_link = $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname']));
                                         $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>";
                                     }
                                 }
                                 $GLOBALS['CatgSeriesList'] .= "<span id='span" . $row['categoryid'] . $seriesids_arr['seriesid'] . "' style='display:none'><a class='thickbox1'  href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $seriesids_arr['seriesid'] . "&catname=" . MakeURLSafe($row['catname']) . "&url=" . urlencode($series_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>";
                             }
                             $GLOBALS['CatgSeriesList'] .= "</br></div>";
                         }
                     }
                     $content = $row['brandname'] . "<br>";
                     if (!isset($params['category']) && (isset($params['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))) {
                         $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : '';
                         // description will be added here to show it at the top of subcatg page.
                         $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : '';
                         $content .= "<h3><a href='" . $path . "/search.php?{$qry_string}&subcategory=" . MakeURLSafe($row['catname']) . "'>" . $row['catname'] . "</a></h3>>";
                         $GLOBALS['TitleLink'] = "<h2><a href='" . $subcatg_link . "' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>" . $row['catname'] . "</a></h2>";
                     }
                     /*$ProdStartPrice = GetStartingPrice($row['categoryid'], $row['prodcalculatedprice']);
                                            
                     		$content .= "Price starting from $".number_format($ProdStartPrice, 2, '.', '')."<br>".$imagefile;*/
                     $GLOBALS['leftsidecontent'] = $content;
                     if (number_format($row['prodminprice'], 2) < number_format($row['prodmaxprice'], 2)) {
                         $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', '');
                     } else {
                         $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', '');
                     }
                     $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty'];
                     $GLOBALS['rightsidecontent'] = $content;
                     $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>";
                     $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>";
                     $GLOBALS['ViewDetailsImage'] = "<a href='{$path}/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' class='thickbox'><img src='{$path}/templates/default/images/fastlook_red.gif'></a> ";
                     $content = "{$link}<img src='{$path}/templates/default/images/viewproducts.gif'></a>";
                     $GLOBALS['ViewDetailsImage'] .= $content;
                     if (IsDiscountAvailable('category', $row['categoryid'])) {
                         $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                     }
                     if ($this->IsMakeAnOffer('category', $row['categoryid']) == 'yes') {
                         $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>";
                     }
                     $GLOBALS['RelatedBrands'] = $row['featurepoints'];
                     $GLOBALS['lowersidecontent'] = $content;
                     /* This below conditions is added to have different templates for tonneau covers page */
                     if (isset($params['srch_category']) && !empty($params['srch_category']) && $selected_catg == 4 && $GLOBALS['results_page_flag'] == 0) {
                         $GLOBALS['rightsidecontent'] = $row['featurepoints'];
                         $GLOBALS['warranty'] = "";
                         /*if( trim($row['prodwarranty']) != '' )
                         		{
                         			$GLOBALS['warranty'] = "<img alt='Warranty' src='".$GLOBALS['ShopPath']."/images/warranty-icon.gif' style='margin-right: 7px;'/><strong>".$row['prodwarranty']."</strong>";
                         		}*/
                         if ($GLOBALS['SearchResultList'] != "") {
                             $GLOBALS['SearchResultList'] .= '<hr style="clear: left;"/>';
                         }
                         $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("NewSubCategoryListing");
                     } else {
                         $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing");
                     }
                 } else {
                     $series_link = $this->LeftCatLink($mmy_links, 'series', $row['seriesname']);
                     $link = "<a href='" . $series_link . "'>";
                     //$imagelink = "<a href='".$path."/catgbrand.php?seriesid=".$row['brandseriesid']."&catname=".MakeURLSafe($row['parentcatname'])."&url=$series_link' class='thickbox' title=''>";
                     $main_catg_link = "";
                     $catg_count = array();
                     $GLOBALS['CatgSeriesList'] = "";
                     if ($row['subcatgids'] != "") {
                         $subcatgids = str_ireplace("~", ",", $row['subcatgids']);
                         $subcatgids_qry = "select c.categoryid , c.catname as childcatname , p.categoryid as parentid , p.catname as parentcatname from [|PREFIX|]categories c left join [|PREFIX|]categories p on c.catparentid = p.categoryid where c.categoryid in (" . $subcatgids . ")";
                         $subcatgids_res = $GLOBALS['ISC_CLASS_DB']->Query($subcatgids_qry);
                         //$catg_count = $GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res);
                         if ($GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res) > 0) {
                             while ($subcatgids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($subcatgids_res)) {
                                 if ($subcatgids_arr['parentid'] != 0) {
                                     $main_catg_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname']));
                                     $catg_count[$subcatgids_arr['parentid']] = $subcatgids_arr['parentcatname'];
                                 } else {
                                     $catg_count[$subcatgids_arr['categoryid']] = $subcatgids_arr['childcatname'];
                                 }
                                 if ($GLOBALS['CatgSeriesList'] == "") {
                                     $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['brandseriesid'] . "')\">View Category ></a><div id='" . $row['brandseriesid'] . "' style='display:none'>";
                                 } else {
                                     $GLOBALS['CatgSeriesList'] .= "<br>";
                                 }
                                 $tooltipscript = "onmouseover='createtip(" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . ")' onmouseout='UnTip()'";
                                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                                     if ($subcatgids_arr['parentcatname'] == "") {
                                         $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     } else {
                                         $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "/subcategory/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     }
                                     $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>";
                                 } else {
                                     if ($subcatgids_arr['parentcatname'] == "") {
                                         $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     } else {
                                         $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "&subcategory=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname']));
                                     }
                                     $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>";
                                 }
                                 $GLOBALS['CatgSeriesList'] .= "<span id='span" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . "' style='display:none'><a class='thickbox1'  href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $subcatgids_arr['categoryid'] . "&url=" . urlencode($catgs_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>";
                             }
                             $GLOBALS['CatgSeriesList'] .= "</br></div>";
                         }
                     }
                     $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>";
                     if (count($catg_count) == 1) {
                         $GLOBALS['TitleLink'] = "<h2><a href='" . $main_catg_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>";
                     } else {
                         if (count($catg_count) > 1) {
                             $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()' onclick='return checkcategoryselection()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>";
                         }
                     }
                     $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url=";
                     if (count($catg_count) == 1) {
                         $tiplink .= urlencode($main_catg_link) . "'";
                     } else {
                         if (count($catg_count) > 1) {
                             $tiplink .= "#' ";
                         } else {
                             $tiplink .= urlencode($series_link) . "'";
                         }
                     }
                     $tiplink .= " title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>";
                     $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url=";
                     if (count($catg_count) == 1) {
                         $imagelink .= urlencode($main_catg_link) . "'";
                     } else {
                         if (count($catg_count) > 1) {
                             $imagelink .= "#' ";
                         } else {
                             $imagelink .= urlencode($series_link) . "'";
                         }
                     }
                     $imagelink .= " title='' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>";
                     if (isset($row['imagefile']) && !empty($row['imagefile'])) {
                         $images = explode("~", $row['imagefile']);
                         for ($j = 0; $j < count($images); $j++) {
                             if (!empty($images[$j])) {
                                 $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $images[$j] . "'></a>";
                                 break;
                             }
                         }
                     } else {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>";
                         }
                     }
                     $GLOBALS['LeftImage'] = $imagefile;
                     $row['brandname'] = str_replace('~', ' , ', $row['brandname']);
                     $GLOBALS['RelatedBrands'] = $row['brandname'];
                     if (isset($row['seriesname']) && !empty($row['seriesname']) && (!isset($params['srch_category']) || isset($params['category'])) && isset($GLOBALS['BRAND_SERIES_FLAG'])) {
                         if (empty($row['imagefile']) || empty($imagefile)) {
                             $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif'  alt='" . isc_html_escape($row['seriesimagealt']) . "' title='" . isc_html_escape($row['seriesimagealt']) . "'></a>";
                             $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>";
                         } else {
                             $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/series_images/" . $row['imagefile'] . "' width='140px'  alt='" . isc_html_escape($row['seriesimagealt']) . "' title='" . isc_html_escape($row['seriesimagealt']) . "'></a>";
                             $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>";
                         }
                         //"<h3>".$row['catname']."</h3>
                         $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available";
                         $GLOBALS['RelatedBrands'] = "<ul class='featurepoints'>";
                         if (!empty($row['feature_points1'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points1'] . "</li>";
                         }
                         if (!empty($row['feature_points2'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points2'] . "</li>";
                         }
                         if (!empty($row['feature_points3'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points3'] . "</li>";
                         }
                         if (!empty($row['feature_points4'])) {
                             $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points4'] . "</li>";
                         }
                         $GLOBALS['RelatedBrands'] .= "</ul>";
                         /*if(isset($row['brandlargefile']) && !empty($row['brandlargefile'])) {
                         			$brand_image_path = "product_images/".$row['brandlargefile'];
                         			if(file_exists($brand_image_path)) {
                         				$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandlargefile']."'>";
                         			} else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) {
                         				$brand_image_path = "product_images/".$row['brandimagefile'];
                         				if(file_exists($brand_image_path))
                         					$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>";
                         			}
                         		} else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) {
                         				$brand_image_path = "product_images/".$row['brandimagefile'];
                         				if(file_exists($brand_image_path))
                         					$GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>";
                         		}*/
                     }
                     $GLOBALS['RelatedBrands'] = $row['feature_points'];
                     $GLOBALS['CatgDescandBrandImage'] = $row['branddescription'];
                     $GLOBALS['CatgBrandSeriesFooter'] = $row['brandfooter'];
                     if ($brand_rating != 0) {
                         $GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='" . $GLOBALS['TPL_PATH'] . "/images/IcoRating{$brand_rating}.gif' alt='' /></h2>";
                     }
                     $content = $row['brandname'] . "<br>";
                     $content .= $row['catname'] . "<br>";
                     /*$ProdStartPriceSeries = GetStartingPriceForSeries($row['brandseriesid'], $row['prodcalculatedprice']);
                       
                       $content .= "Price starting from $".number_format($ProdStartPriceSeries, 2, '.', '');*/
                     $GLOBALS['leftsidecontent'] = $content;
                     //$GLOBALS['PriceRange'] = "Price range from $".number_format($row['prodminprice'], 2, '.', '')." to $".number_format($row['prodmaxprice'], 2, '.', '');
                     if (number_format($row['prodminprice'], 2) < number_format($row['prodmaxprice'], 2)) {
                         $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', '');
                     } else {
                         $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', '');
                     }
                     $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty'];
                     $GLOBALS['rightsidecontent'] = $content;
                     $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>";
                     $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>";
                     $GLOBALS['ViewDetailsImage'] = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url=";
                     if (count($catg_count) > 1) {
                         $GLOBALS['ViewDetailsImage'] .= "#'";
                     } else {
                         if (count($catg_count) == 1) {
                             $GLOBALS['ViewDetailsImage'] .= urlencode($main_catg_link) . "'";
                         } else {
                             $GLOBALS['ViewDetailsImage'] .= urlencode($series_link) . "'";
                         }
                     }
                     $GLOBALS['ViewDetailsImage'] .= "><img src='{$path}/templates/default/images/fastlook_red.gif'></a> ";
                     $content = "{$link}";
                     if (count($catg_count) == 1) {
                         $content = "<a href='" . $main_catg_link . "'>";
                     } else {
                         if (count($catg_count) > 1) {
                             $content = "<a href='" . $series_link . "' onclick='return checkcategoryselection()'>";
                         }
                     }
                     $content .= "<img src='{$path}/templates/default/images/viewproducts.gif'></a>";
                     $GLOBALS['ViewDetailsImage'] .= $content;
                     if (IsDiscountAvailable('series', $row['brandseriesid'])) {
                         $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                     }
                     if ($this->IsMakeAnOffer('series', $row['brandseriesid']) == 'yes') {
                         $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>";
                     }
                     $GLOBALS['lowersidecontent'] = $content;
                     $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing");
                     $GLOBALS['HideCompareItems'] = "none";
                 }
             }
         }
         $get_variables = $_GET;
         $sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']);
         unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']);
         $i = 0;
         foreach ($get_variables as $key => $value) {
             $sort_qry .= "&{$key}={$value}";
         }
         if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') {
             $sort = "asc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowDown.gif' border=0>";
         } else {
             $sort = "desc ";
             $img = "&nbsp;<img src='{$path}/templates/default/images/ArrowUp.gif' border=0>";
         }
         //$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas
         if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) {
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Part Number</a>";
                 $GLOBALS['ProductPrice'] = "<a href='{$path}{$mmy_links}/orderby/prodcalculatedprice/sortby/{$sort}'>Price</a>";
             } else {
                 $GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand</a>";
                 $GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Part Number</a>";
                 $GLOBALS['ProductPrice'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcalculatedprice&sortby={$sort}'>Price</a>";
             }
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') {
                 $GLOBALS['ProductBrand'] .= $img;
             }
             $GLOBALS['ProductVQ'] = $vq_column_title;
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname')
             		$GLOBALS['Product_VQ'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') {
                 $GLOBALS['ProductPartNumber'] .= $img;
             }
             $GLOBALS['ProductPQ'] = "Product Options";
             /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption')
             		$GLOBALS['SearchResults'] .= $img;*/
             if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') {
                 $GLOBALS['ProductPrice'] .= $img;
             }
             $GLOBALS['ProductDetails'] = "Details";
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItemHeader");
         } else {
             //		                $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>";
             if (isset($params['srch_category']) && !empty($params['srch_category']) && $GLOBALS['results_page_flag'] == 0 && $selected_catg == 4) {
                 $GLOBALS['FilterTitle'] = "Narrow by Category";
                 $GLOBALS['ResultTitle'] = "Category Details";
                 if (count($GLOBALS['SearchBrands']) > 0) {
                     $GLOBALS['BrandsList'] = "";
                     $brandlistingqry = " select brandname , brandimagefile, brandlargefile, brandaltkeyword from [|PREFIX|]brands where brandid in (" . implode($GLOBALS['SearchBrands'], ",") . ")";
                     $brandlistingresult = $GLOBALS['ISC_CLASS_DB']->Query($brandlistingqry);
                     while ($brandlisting_row = $GLOBALS['ISC_CLASS_DB']->Fetch($brandlistingresult)) {
                         if (isset($params['brand'])) {
                             $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $brandlisting_row['brandlargefile']);
                             if (file_exists($file)) {
                                 $attribs = @getimagesize($file);
                                 $width = $attribs[0];
                                 $height = $attribs[1];
                                 if ($width > 240) {
                                     $width = "240";
                                 }
                                 /*if( $height > 240 )
                                 		$height = "240";*/
                                 $GLOBALS['BrandsList'] .= "<img alt='" . $brandlisting_row['brandaltkeyword'] . "' src='" . $GLOBALS['ShopPath'] . "/product_images/" . $brandlisting_row['brandlargefile'] . "' width='" . $width . "' /> ";
                                 $brandparams = $params;
                                 unset($brandparams['brand'], $brandparams['series']);
                                 $mmylinks = $this->GetYMMLinks($brandparams);
                                 $GLOBALS['BrandsList'] .= "<br><a href='" . $path . $mmylinks . "'>View All Brands</a>";
                             }
                         } else {
                             if (isset($params['srch_category'])) {
                                 $GLOBALS['BrandsList'] .= "<a href='" . $path . $mmy_links . "/brand/" . MakeURLSafe(strtolower($brandlisting_row['brandname'])) . "'>";
                             } else {
                                 $GLOBALS['BrandsList'] .= "<a  href='" . $path . "/" . MakeURLSafe(strtolower($brandlisting_row['brandname'])) . $mmy_links . "'>";
                             }
                             $GLOBALS['BrandsList'] .= "<img alt='" . $brandlisting_row['brandname'] . "'  src='" . $GLOBALS['ShopPath'] . "/product_images/" . $brandlisting_row['brandimagefile'] . "'/></a>";
                         }
                     }
                 } else {
                     $GLOBALS['BrandListStyle'] = "display:none";
                 }
                 $GLOBALS['ResultCategories'] = "";
                 foreach ($GLOBALS['SearchCategories'] as $key => $catid) {
                     $parentid = $GLOBALS['categories_all'][$catid]['catparentid'];
                     if ($parentid != 0) {
                         if (isset($params['srch_category'])) {
                             $mmy_links_modified = $mmy_links;
                         } else {
                             if (isset($GLOBALS['categories_all'][$parentid])) {
                                 // if parent catg is not visible
                                 $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$parentid]['catname'])) . $mmy_links;
                             } else {
                                 $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$catid]['catname'])) . $mmy_links;
                             }
                         }
                     } else {
                         $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$catid]['catname'])) . $mmy_links;
                     }
                     /*echo "<br>".$mmy_links;
                     		exit;*/
                     $subcatg_link = $this->LeftCatLink($mmy_links_modified, 'subcategory', $GLOBALS['categories_all'][$catid]['catname']);
                     $GLOBALS['ResultCategories'] .= "<div class='button'><a href='" . $subcatg_link . "'>" . $GLOBALS['categories_all'][$catid]['catname'] . "</a></div>";
                 }
                 $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("NewSubCategoryListingMain");
             } else {
                 $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain");
             }
         }
         $GLOBALS['SearchResults'] .= "<script type=\"text/javascript\"> \$('.focushiddendiv').css({'position':'absolute', 'margin-top':'-200px', 'display':'block'}); </script>";
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']);
         } else {
             $back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING'];
         }
         ISC_SetCookie("back2search", $back2url, 0, "/");
         // Showing the syndication option?
         if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) {
             $GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);
             $GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed");
         }
     } else {
         $this->YMMSelectors($params);
         $GLOBALS['SearchResults'] = "<div style='float:left'>" . $GLOBALS['YMMTable'] . "</div>";
         $GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t%%Panel.StaticFeaturedBrands%%";
         // No search results were found
         // commented below code as need to show the favorite categories and brands as in homepage
         /*$GLOBALS['HideSearchResults'] = "none";
         		$GLOBALS['HidePanels'][] = 'SearchPageProducts';*/
     }
 }