예제 #1
0
 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';
     }
 }
예제 #2
0
 function ShowProductList($mmy_links, $params, $catg_desc_arr, $ext_links, $vq_column_title)
 {
     // dada.wang 2012-04-13 for display script
     $GLOBALS['DisplayScript'] = '';
     $displayScript = array();
     $filter_var = array('vq', 'pq');
     $path = GetConfig('ShopPath');
     $GLOBALS['AlternateClass'] = '';
     $counter = 1;
     $CurCatId = 0;
     $map_names = array();
     $display_names = array();
     $qimg_arr = array();
     $qcmt_arr = array();
     $qimg_par_arr = array();
     $qcmt_par_arr = array();
     //$GLOBALS['SearchResults'] is an array for product data.
     //while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['SearchResults'])) {
     foreach ($GLOBALS["SearProductsInfos"] as $row) {
         /* 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'];
             $filter_names = "SELECT DISTINCT qn.qid, qn.column_name, qn.display_names, qa.hoverimage as qimg, qa.comments as qcmt 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);
             $new_filter = "SELECT qualifierid as qid, hoverimage as qimg, comments as qcmt \n\t\t\t\t\tFROM [|PREFIX|]qualifier_associations \n\t\t\t\t\tWHERE categoryid = '{$CurCatId}'";
             $new_result = $GLOBALS['ISC_CLASS_DB']->Query($new_filter);
             while ($new_row = $GLOBALS['ISC_CLASS_DB']->Fetch($new_result)) {
                 $qimg_arr[$new_row['qid']] = $new_row['qimg'];
                 $qcmt_arr[$new_row['qid']] = $new_row['qcmt'];
             }
             $prt_filter = "SELECT c.catparentid as cpc, qa.qualifierid as qid, qa.hoverimage as qimg, qa.comments as qcmt \n\t\t\t\t\tFROM [|PREFIX|]categories as c\n\t\t\t\t\tLEFT JOIN [|PREFIX|]qualifier_associations as qa ON c.catparentid = qa.categoryid\n\t\t\t\t\tWHERE c.categoryid = '{$CurCatId}'";
             $par_result = $GLOBALS['ISC_CLASS_DB']->Query($prt_filter);
             while ($prt_row = $GLOBALS['ISC_CLASS_DB']->Fetch($par_result)) {
                 $qimg_par_arr[$prt_row['qid']] = $prt_row['qimg'];
                 $qcmt_par_arr[$prt_row['qid']] = $prt_row['qcmt'];
             }
         }
         //}
         /* Added by Simha Ends */
         $GLOBALS['SearchTrackClass'] = "TrackLink";
         $imagefile = "";
         if ($GLOBALS['AlternateClass'] == 'Odd') {
             $GLOBALS['AlternateClass'] = 'Even';
         } else {
             $GLOBALS['AlternateClass'] = 'Odd';
         }
         $qry_string = $this->GetQueryString($params);
         if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) {
             break;
         }
         //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']);
         //alandy_2012-2-20 modify product url = vendorprefix_sku
         //$GLOBALS['ProductLink'] = ProdLink($row['prodname']);
         $prodcode = encode_sku($row['prodcode']);
         $GLOBALS['ProductLink'] = ProdLinkSKU($row['prodvendorprefix'], $prodcode);
         $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['ProductId']
         //$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-- */
                         $qimg = $qimg_arr[$qualifier_id];
                         $qcmt = $qcmt_arr[$qualifier_id];
                         if ($qimg == '' && $qcmt == '') {
                             $qimg = $qimg_par_arr[$qualifier_id];
                             $qcmt = $qcmt_par_arr[$qualifier_id];
                         }
                         $qcmt = nl2br($qcmt);
                         $qcmt = str_replace("\n", "", $qcmt);
                         $qcmt = str_replace("\r", "", $qcmt);
                         $qcmt = str_replace('"', "&quot;", $qcmt);
                         $qcmt = str_replace("'", "\\'", $qcmt);
                         $helpdiv = "<img id='" . $qualifier_id . "' onmouseover=\"showPqVqHelp(this,255, '" . $qimg . "', '" . $qcmt . "');\" onmouseout=\"hidePqVqHelp('" . $qualifier_id . "');\" src='/images/pqvq_help.gif'/></img> ";
                         if ($qimg != '' && $qcmt != '') {
                             $GLOBALS['VehicleOptions'] .= "<div class='qualifierwrap'><div class='qualifiertitle'>" . $key . " :</div> " . $helpdiv . $val . "</div>";
                         } else {
                             //$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-- */
                         $qimg = $qimg_arr[$qualifier_id];
                         $qcmt = $qcmt_arr[$qualifier_id];
                         if ($qimg == '' && $qcmt == '') {
                             $qimg = $qimg_par_arr[$qualifier_id];
                             $qcmt = $qcmt_par_arr[$qualifier_id];
                         }
                         $qcmt = nl2br($qcmt);
                         $qcmt = str_replace("\n", "", $qcmt);
                         $qcmt = str_replace("\r", "", $qcmt);
                         $qcmt = str_replace('"', "&quot;", $qcmt);
                         $qcmt = str_replace("'", "\\'", $qcmt);
                         $helpdiv = "<img id='" . $qualifier_id . "' onmouseover=\"showPqVqHelp(this,255, '" . $qimg . "', '" . $qcmt . "');\" onmouseout=\"hidePqVqHelp('" . $qualifier_id . "');\" src='/images/pqvq_help.gif'/></img> ";
                         if ($qimg != '' && $qcmt != '') {
                             $GLOBALS['ProdOptions'] .= "<div class='qualifierwrap'><div class='qualifiertitle'>" . $key . " :</div> " . $helpdiv . $val . "</div>";
                         } else {
                             //$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) {
             //alandy-2012-1-12 modify.
             //$GLOBALS['ProductLink'] .= "/refer=true".$ext_links;
             if (isset($GLOBALS['SearchId'])) {
                 //$GLOBALS['ProductLink'] .= '/SearchLogId/'.$GLOBALS['SearchId'];
                 $_SESSION['SearchLogId'] = $GLOBALS['SearchId'];
             }
         } else {
             //alandy-2012-1-12 modify.
             //$GLOBALS['ProductLink'] .= "&refer=true".$ext_links;
             if (isset($GLOBALS['SearchId'])) {
                 //$GLOBALS['ProductLink'] .= '&SearchLogId='.$GLOBALS['SearchId'];
                 $_SESSION['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'] = '';
             }
         }
         $qpvq_search = $_SESSION['searchterms']['dynfilters'];
         if (empty($qpvq_search)) {
             $GLOBALS['pqvqSearch'] = 0;
         } else {
             $GLOBALS['pqvqSearch'] = 1;
         }
         //alandy_2011-6-15 modify. add prodallowpurchase check!
         //$GLOBALS['CartURL'] = CartLink($row['productid']);
         $GLOBALS['CartURL'] = NewCartLink($row['productid'], $row['prodallowpurchases']);
         //$GLOBALS['ClickCartButton']=ClickCartButton($row['prodallowpurchases'],$row['productid']);
         //alandy_2011-12-21 modify.continue to check product attribute.
         //if(empty($GLOBALS['ClickCartButton'])){
         //$GLOBALS['ClickCartButton'] = CheckProductAttribute($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';
             $GLOBALS['OfferButtonLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("OfferButtonLink");
             //zcs=
         } else {
             $GLOBALS['HideOfferButton'] = 'none';
             $GLOBALS['OfferButtonLink'] = '';
             //zcs=
         }
         // dada.wang 2012.04.12 call for best price
         $callForBestPrice = GetClass('ISC_PRODUCT_HELPER')->GetProductCallForBestPrice($row);
         $GLOBALS['BestPrice'] = '';
         if ($callForBestPrice) {
             $displayScript[] = $callForBestPrice['displayScript'];
             $GLOBALS['BestPrice'] = '<div data="' . htmlspecialchars($callForBestPrice['popupMessage']) . '" onmouseover="showcallbestprice(this,385);" onmouseout="hidecallbestprice(this)"><img src="/images/call-in-trans.gif"/></div>';
         }
         $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItem");
     }
     if (!empty($displayScript) && count(array_unique($displayScript)) == 1) {
         $GLOBALS['DisplayScript'] = $displayScript[0];
     }
 }
 public function SetPanelSettings()
 {
     $params = $GLOBALS['ISC_CLASS_ABTESTING']->_searchterms;
     $this->searchterms = $params;
     if ($GLOBALS['pagetype'] == 1) {
         return;
     }
     if ($GLOBALS['pagetype'] == 2 && isset($GLOBALS['pagecontent']) && $GLOBALS['pagecontent'] == 1) {
         $this->YMMSelectors($params);
         $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryListingMain");
         return;
     }
     if ($GLOBALS['ISC_CLASS_ABTESTING']->GetNumResults() == 0) {
         $this->YMMSelectors($params);
         $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryListingMain");
         return;
     }
     $count = 0;
     $output = "";
     /* 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);
         }
         /* 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_ABTESTING']->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_ABTESTING']->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: record the searched productids
         $searchedProductIds = 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 ($GLOBALS['pagetype'] == 3) {
                 //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['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['pagetype'] == 2) {
                     //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 = $mmy_links;
                             } else {
                                 $mmy_links_modified = $mmy_links;
                             }
                         } else {
                             $mmy_links_modified = $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']))) {
                         /*$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");
                 }
             }
         }
         ///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) {
             $path = $path . "/a-b-testing";
             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;
             }
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryProductsItemHeader");
         } else {
             //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>";
             $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryListingMain");
             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['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, "/");
     } 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';*/
     }
 }
예제 #4
0
include dirname(__FILE__) . "/init.php";
require_once ISC_BASE_PATH . "/lib/discountcalcs.php";
$GLOBALS['args'] = $argv;
/*$getval = print_r($argv , true);
$updatepricequery		=	"INSERT INTO [|PREFIX|]orderlogs (ordervalue) VALUES('$getval')"; 
$GLOBALS['ISC_CLASS_DB']->Query($updatepricequery);

exit;
*/
$GLOBALS['ISC_CLASS_UPDATEFINALPRICE'] = GetClass('ISC_UPDATEFINALPRICE');
exit;
$pricequery = "select\tp.productid , c.categoryid , brandseriesid , categoryid , prodhideprice ,  prodistaxable , \n\t\t\t\t\t\tprodprice , prodretailprice , prodsaleprice , prodcalculatedprice \n\t\t\t\t\t\tfrom  [|PREFIX|]products p \n\t\t\t\t\t\tinner join [|PREFIX|]categoryassociations c on p.productid = c.productid ";
$priceresult = $GLOBALS['ISC_CLASS_DB']->Query($pricequery);
while ($pricerow = $GLOBALS['ISC_CLASS_DB']->Fetch($priceresult)) {
    $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($pricerow);
    $FinalPrice = $GLOBALS['ProductPrice'];
    $SalePrice = $pricerow['prodsaleprice'];
    $discounttype = 0;
    if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) {
        $DiscountPrice = $SalePrice;
    } else {
        $DiscountPrice = $FinalPrice;
        $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $pricerow['categoryid'], $pricerow['brandseriesid'], $discounttype);
        /*if($discounttype == 0)    {
        			$DiscountPrice = $FinalPrice;
        		}*/
    }
    $updatepricequery = "\tINSERT INTO [|PREFIX|]product_finalprice(productid,prodfinalprice,prodcatid,prodseriesid) \n\t\t\t\t\t\t\t\t\tVALUES( " . $pricerow['productid'] . " , " . $DiscountPrice . " , " . $pricerow['categoryid'] . " , " . $pricerow['brandseriesid'] . " ) \n\t\t\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE prodcatid = " . $pricerow['productid'] . ", prodseriesid = " . $pricerow['brandseriesid'] . ", prodfinalprice = " . $DiscountPrice;
    $updatepriceresult = $GLOBALS['ISC_CLASS_DB']->Query($updatepricequery);
}
예제 #5
0
 public function ReviewOrder()
 {
     $orderId = $_REQUEST['review'];
     //2010-12-6 Ronnie add,orderId decode
     $orderId2 = base64_decode($_REQUEST['review']);
     $GLOBALS['ImagePart'] = '<a href="#">' . GetLang('ImagePart') . '</a>';
     $GLOBALS['ProductDescTitle'] = GetLang('ProductDesc');
     $GLOBALS['ProductPriceLabel'] = '<a href="#">' . GetLang('ProductPrice') . '</a>';
     $GLOBALS['ProductDetails'] = GetLang('ProductDetails');
     $GLOBALS['AddReviewText'] = GetLang('AddReview');
     //2010-12-06 Ronnie modify
     /*$GLOBALS['OrderCouponCode'] = $this->GetCouponCode($orderId);
     		if(empty($GLOBALS['OrderCouponCode']))
     		{
     			$GLOBALS['ShowOrderCouponCode'] = "display:none";
     		}
     		else
     		{
     			$GLOBALS['ShowOrderCouponCode'] = "";
     		}*/
     //2010-11-11 Ronnie modify ,Does not show goods of not exist ,sql and p.prodvisible=1
     /*$query = "
     		SELECT o.*, p.*,pi.imagefile
     		FROM [|PREFIX|]order_products o
     		LEFT JOIN [|PREFIX|]products p ON (p.productid=o.ordprodid)
     		LEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)
     		WHERE orderorderid='" . $orderId . "' and pi.imageisthumb=1 and p.prodvisible=1
     		ORDER BY ordprodname";*/
     $query = "\n\t\t\t\tSELECT oa.orddate,o.*, p.*,pi.imagefile\n\t\t\t\tFROM [|PREFIX|]order_products o\n\t\t\t\tLEFT JOIN [|PREFIX|]products p ON (p.productid=o.ordprodid)\n\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)\n\t\t\t\tLEFT JOIN [|PREFIX|]orders oa ON (oa.orderid=o.orderorderid) \n\t\t\t\tWHERE (orderorderid='" . $orderId . "' or orderorderid='" . $orderId2 . "') and pi.imageisthumb=1 and p.prodvisible=1\n\t\t\t\tORDER BY ordprodname";
     $pResult = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $counter = 1;
     $orderdate = "";
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($pResult)) {
         //2010-12-6 Ronnie add
         $orderId = $row['orderorderid'];
         $GLOBALS['OrderCouponCode'] = $this->GetCouponCode($orderId);
         if (empty($GLOBALS['OrderCouponCode'])) {
             $GLOBALS['ShowOrderCouponCode'] = "display:none";
         } else {
             $GLOBALS['ShowOrderCouponCode'] = "";
         }
         if ($counter % 2 == 0) {
             $GLOBALS['RowColor'] = 'grayrow';
         } else {
             $GLOBALS['RowColor'] = 'whiterow';
         }
         $counter++;
         $GLOBALS['ReviewURL'] = $_SERVER['REQUEST_URI'] . '/productItem/' . $row['productid'] . '/operation/add';
         //product thumbnail
         $prodimage = '';
         $file = realpath(ISC_BASE_PATH . '/product_images/' . $row['imagefile']);
         if ($row['imagefile'] != '' && file_exists($file)) {
             $prodimage = GetConfig('ShopPath') . "/product_images/" . $row['imagefile'];
         } else {
             $prodimage = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
         }
         $GLOBALS['ProductThumb'] = '<img src="' . $prodimage . '"/>';
         $GLOBALS['ProductCode'] = isc_html_escape($row['ordprodsku']);
         $GLOBALS['ProductDesc'] = $row['ordprodqty'] . " x " . $row['ordprodname'];
         $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($row);
         $GLOBALS['ProductLink'] = ProdLink($row['prodname']);
         if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) {
             $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
             $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
         } else {
             $GLOBALS['ProductURL'] = $GLOBALS['ProductLink'];
             //blessen
             if (intval($row['prodretailprice']) <= 0) {
                 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
             } else {
                 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>";
             }
         }
         $GLOBALS['ProductList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("OrderedProductsItem");
         //2010-12-6 Ronnie modify
         $orderdate = isc_date('m/d/y', $row['orddate']);
         //date('m/d/Y',$row['orddate']);
     }
     $GLOBALS['OrderReviewTitle'] = sprintf(GetLang('OrderReviewTitle'), $orderdate) . '#[' . $orderId . ']';
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle("Order Review");
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("order.review");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
예제 #6
0
 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';*/
     }
 }