Ejemplo n.º 1
0
		public function SetPanelSettings()
		{
			$output = "";

			// Get the number of brands
			$query = "select count(brandid) as num from [|PREFIX|]brands";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
			$num_brands = $row['num'];

			if($num_brands > 0) {
				// Get the 5 most popular brands
				$query = "select b.brandid, b.brandname, (select count(productid) from [|PREFIX|]products p where p.prodbrandid=b.brandid and p.prodvisible='1') as num from [|PREFIX|]brands b order by b.brandname asc";

				$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

				while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
					$GLOBALS['BrandLink'] = BrandLink($row['brandname']);
					$GLOBALS['BrandName'] = isc_html_escape($row['brandname']);
					$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandItem");
				}

				if($num_brands > 5) {
					$GLOBALS['SNIPPETS']['ShopByBrandAllItem'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandAllItem");
				}

				$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
				$GLOBALS['SNIPPETS']['SideShopByBrandFullList'] = $output;
			}
			else {
				// Hide the panel
				$this->DontDisplay = true;
				$GLOBALS['HideSideShopByBrandFullPanel'] = "none";
			}
		}
Ejemplo n.º 2
0
 function SetPanelSettings()
 {
     $output = "";
     $GLOBALS['ISC_CategoryBrandCache'] = GetClass('ISC_CACHECATEGORYBRANDS');
     $cachedCategoryBrands = $GLOBALS['ISC_CategoryBrandCache']->getCategoryBrandsData();
     $mybrands = $GLOBALS['ISC_CategoryBrandCache']->GetBrands($cachedCategoryBrands);
     /*// Get the number of brands
     		$query = "select count(brandid) as num from [|PREFIX|]brands";
     		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     		$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);*/
     $num_brands = count($mybrands);
     if ($num_brands > 0) {
         // Get the 5 most popular brands
         /*$query = "select b.brandid, b.brandname, (select count(productid) from [|PREFIX|]products p where p.prodbrandid=b.brandid and p.prodvisible='1') as num from [|PREFIX|]brands b order by b.brandname asc";
         
         				$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         */
         foreach ($mybrands as $brand) {
             $GLOBALS['BrandLink'] = BrandLink($brand['brandname']);
             $GLOBALS['BrandName'] = isc_html_escape($brand['brandname']);
             $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandItem");
         }
         if ($num_brands > 5) {
             $GLOBALS['SNIPPETS']['ShopByBrandAllItem'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandAllItem");
         }
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
         $GLOBALS['SNIPPETS']['SideShopByBrandFullList'] = $output;
     } else {
         // Hide the panel
         $this->DontDisplay = true;
         $GLOBALS['HideSideShopByBrandFullPanel'] = "none";
     }
 }
Ejemplo n.º 3
0
 function SetPanelSettings()
 {
     $output = "";
     $GLOBALS['ISC_CategoryBrandCache'] = GetClass('ISC_CACHECATEGORYBRANDS');
     $cachedCategoryBrands = $GLOBALS['ISC_CategoryBrandCache']->getCategoryBrandsData();
     //var_export($cachedCategoryBrands);
     $mybrands = $GLOBALS['ISC_CategoryBrandCache']->GetBrandsIndexpage($cachedCategoryBrands);
     //$mycategorys = $GLOBALS['ISC_CategoryBrandCache']->GetAllCategories($cachedCategoryBrands);
     //$mysubcategorys = $GLOBALS['ISC_CategoryBrandCache']->GetSubCategories($cachedCategoryBrands);
     //$myCategoryBrands = $GLOBALS['ISC_CategoryBrandCache']->GetCategoryBrands($cachedCategoryBrands);
     //var_dump($mycategorys);
     $path = GetConfig('ShopPath');
     // Get the link to the "all brands" page
     $GLOBALS['AllBrandsLink'] = BrandLink();
     //wirror20110328: show arrow image
     $GLOBALS['arrowimage'] = "<img src='{$path}/templates/default/images/imgHdrDropDownIcon.gif' border='0' id='brand_listimage'/>";
     /*// Get the 10 most popular brands
     		$query = "SELECT brandid, brandname, COUNT(*) AS num
     			FROM [|PREFIX|]brands b, [|PREFIX|]products p
     			WHERE p.prodbrandid = b.brandid
     			AND prodvisible=1
     			GROUP BY prodbrandid
     			ORDER BY brandname ASC
     			";
     		//$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 10+1);
     		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);*/
     $extra_output = "";
     // for brands exceeding more than 10
     $x = 1;
     foreach ($mybrands as $brand) {
         //$GLOBALS['BrandLink'] = BrandLink($row['brandname']);
         $GLOBALS['BrandLink'] = $this->LeftBrandLink($brand['brandname']);
         //Added by Simha
         $GLOBALS['BrandName'] = isc_html_escape($brand['brandname']);
         if ($x <= 10) {
             $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandItem");
         } else {
             $extra_output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandItem");
         }
         ++$x;
     }
     if ($x > 11) {
         $GLOBALS['FilterID'] = "brand";
         $GLOBALS['ExtraValues'] = $extra_output;
         $GLOBALS['SNIPPETS']['ShopByBrandAllItem'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
         //$GLOBALS['SNIPPETS']['ShopByBrandAllItem'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandAllItem");
     }
     if (!$output) {
         $this->DontDisplay = true;
     }
     $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
     $GLOBALS['SNIPPETS']['SideShopByBrandList'] = $output;
 }
Ejemplo n.º 4
0
 function SetPanelSettings()
 {
     // Do we need to show paging?
     if ($GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() > GetConfig('CategoryProductsPerPage')) {
         // Workout the paging data
         $GLOBALS['SNIPPETS']['PagingData'] = "";
         $num_pages_either_side_of_current = 5;
         $start = max($GLOBALS['ISC_CLASS_BRANDS']->GetPage() - $num_pages_either_side_of_current, 1);
         $end = min($GLOBALS['ISC_CLASS_BRANDS']->GetPage() + $num_pages_either_side_of_current, $GLOBALS['ISC_CLASS_BRANDS']->GetNumPages());
         for ($page = $start; $page <= $end; $page++) {
             if ($page == $GLOBALS['ISC_CLASS_BRANDS']->GetPage()) {
                 $snippet = "CategoryPagingItemCurrent";
             } else {
                 $snippet = "CategoryPagingItem";
             }
             $GLOBALS['PageLink'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName(), array('page' => $page, 'sort' => $GLOBALS['ISC_CLASS_BRANDS']->GetSort()));
             $GLOBALS['PageNumber'] = $page;
             $GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
         }
         // Parse the paging snippet
         if ($GLOBALS['ISC_CLASS_BRANDS']->GetPage() > 1) {
             // Do we need to output a "Previous" link?
             $GLOBALS['PrevLink'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName(), array('page' => $GLOBALS['ISC_CLASS_BRANDS']->GetPage() - 1, 'sort' => $GLOBALS['ISC_CLASS_BRANDS']->GetSort()));
             $GLOBALS['SNIPPETS']['CategoryPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious");
         }
         if ($GLOBALS['ISC_CLASS_BRANDS']->GetPage() < $GLOBALS['ISC_CLASS_BRANDS']->GetNumPages()) {
             // Do we need to output a "Next" link?
             $GLOBALS['NextLink'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName(), array('page' => $GLOBALS['ISC_CLASS_BRANDS']->GetPage() + 1, 'sort' => $GLOBALS['ISC_CLASS_BRANDS']->GetSort()));
             $GLOBALS['SNIPPETS']['CategoryPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingNext");
         }
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPaging");
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
         $GLOBALS['SNIPPETS']['BrandPaging'] = $output;
     }
     // Should we show the compare button?
     if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() < 2) {
         $GLOBALS['HideCompareItems'] = "none";
     }
     // Parse the sort select box snippet
     if ($GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() > 1) {
         // Parse the sort select box snippet
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $GLOBALS['URL'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName());
         } else {
             $GLOBALS['URL'] = $GLOBALS['ShopPath'] . "/brands.php";
             $GLOBALS['HiddenSortField'] = "<input type=\"hidden\" name=\"brand\" value=\"" . MakeURLSafe($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName()) . "\" />";
         }
         $GLOBALS['SNIPPETS']['CategorySortBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategorySortBox");
     }
 }
Ejemplo n.º 5
0
 private function GetBrands()
 {
     header('Content-type: text/xml');
     echo '<?xml version="1.0"?>';
     echo '<results>';
     $hasBrands = false;
     $query = "SELECT * FROM [|PREFIX|]brands ORDER BY brandname ASC";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         echo sprintf('<result title="%s" icon="images/brand.gif">%s</result>', isc_html_escape($row['brandname']), BrandLink($row['brandname']));
         $hasBrands = true;
     }
     if (!$hasBrands) {
         echo "<error>" . GetLang('DevEditLinkerNoBrands') . "</error>";
     }
     echo '</results>';
 }
Ejemplo n.º 6
0
	public function SetPanelSettings()
	{
		$output = "";

		// Get the link to the "all brands" page
		$GLOBALS['AllBrandsLink'] = BrandLink();

		// Get the 10 most popular brands
		$query = "SELECT brandid, brandname, COUNT(*) AS num
			FROM [|PREFIX|]brands b, [|PREFIX|]products p
			WHERE p.prodbrandid = b.brandid
			AND prodvisible=1
			GROUP BY prodbrandid
			ORDER BY num DESC, brandname ASC
			";
		$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 11);
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		$x = 1;
		while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			if($x <= 10) {
				$GLOBALS['BrandLink'] = BrandLink($row['brandname']);
				$GLOBALS['BrandName'] = isc_html_escape($row['brandname']);
				$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandItem");
			}
			++$x;
		}

		if($x == 12) {
			$GLOBALS['SNIPPETS']['ShopByBrandAllItem'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandAllItem");
		}

		if(!$output) {
			$this->DontDisplay = true;
		}

		$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
		$GLOBALS['SNIPPETS']['SideShopByBrandList'] = $output;
	}
Ejemplo n.º 7
0
	/**
	* Returns a url pointing to the subsection view for this model
	*
	* @return string
	*/
	public function getSubsectionUrl()
	{
		return BrandLink();
	}
Ejemplo n.º 8
0
 public function SetPanelSettings()
 {
     $GLOBALS['HideProductErrorMessage'] = 'display:none';
     if (isset($_SESSION['ProductErrorMessage']) && $_SESSION['ProductErrorMessage'] != '') {
         $GLOBALS['HideProductErrorMessage'] = '';
         $GLOBALS['ProductErrorMessage'] = $_SESSION['ProductErrorMessage'];
         unset($_SESSION['ProductErrorMessage']);
     }
     $GLOBALS['ProductCartQuantity'] = '';
     if (isset($GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) {
         $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()];
     }
     $GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
     $GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $GLOBALS['ProductPrice'] = '';
     // Get the vendor information
     $vendorInfo = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor();
     $GLOBALS['HideVendorDetails'] = 'display: none';
     $GLOBALS['VendorName'] = '';
     if (is_array($vendorInfo)) {
         //$GLOBALS['HideVendorDetails'] = '';
         $GLOBALS['VendorName'] = '<a href="' . VendorLink($vendorInfo) . '">' . isc_html_escape($vendorInfo['vendorname']) . '</a>';
     }
     // Can this product be gift wrapped? And do we have any gift wrapping options set up?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanBeGiftWrapped() && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
         $GLOBALS['HideGiftWrapMessage'] = '';
         $GLOBALS['GiftWrappingAvailable'] = GetLang('GiftWrappingOptionsAvailable');
     } else {
         $GLOBALS['HideGiftWrapMessage'] = 'display: none';
     }
     $thumb = '';
     $GLOBALS['ImagePopupJavascript'] = "showProductImageNew('" . $this->ProdImageLink($GLOBALS['ProductId']) . "', 0, 0);";
     //$GLOBALS['VideoPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productvideo.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['VideoPopupJavascript'] = "showProductVideoNew('" . $this->ProdVideoLink($GLOBALS['ProductId']) . "');";
     //$GLOBALS['AudioPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productaudio.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['AudioPopupJavascript'] = "showProductVideoNew('" . $this->ProdAudioLink($GLOBALS['ProductId']) . "');";
     // If we're showing images as a lightbox, we need to load up the URLs for the other images for this product
     if (GetConfig('ProductImageMode') == 'lightbox') {
         $GLOBALS['AdditionalStylesheets'] = array(GetConfig('ShopPath') . '/javascript/jquery/plugins/lightbox/lightbox.css');
         $GLOBALS['LightBoxImageList'] = '';
         $query = "\n\t\t\t\t\tSELECT imagefile\n\t\t\t\t\tFROM [|PREFIX|]product_images\n\t\t\t\t\tWHERE imageprodid='" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' AND imageisthumb=0\n\t\t\t\t\tORDER BY imagesort ASC\n\t\t\t\t";
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         while ($image = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $GLOBALS['LightBoxImageList'] .= '<a ';
             $GLOBALS['LightBoxImageList'] .= 'href="' . $GLOBALS['ShopPath'] . '/' . GetConfig('ImageDirectory') . '/' . $image['imagefile'] . '" ';
             $GLOBALS['LightBoxImageList'] .= 'title="' . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()) . '"';
             $GLOBALS['LightBoxImageList'] .= '>&nbsp;</a>';
         }
         $GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox(); return false;";
         $GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
     }
     // Is there a thumbnail image we can show?
     $thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
     $thumbImage = '';
     if ($thumb == '' && GetConfig('DefaultProductImage') != '') {
         if (GetConfig('DefaultProductImage') == 'template') {
             $thumb = GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/ProductDefault.gif';
         } else {
             $thumb = GetConfig('ShopPath') . '/' . GetConfig('DefaultProductImage');
         }
         $thumbImage = '<img src="' . $thumb . '" alt="" />';
     } else {
         if ($thumb != '') {
             $thumbImage = '<img src="' . GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $thumb . '" alt="" />';
         }
     }
     // Is there more than one image? If not, hide the "See more pictures" link
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 0) {
         $GLOBALS['HideMorePicturesLink'] = "none";
         $GLOBALS['ThumbImage'] = $thumbImage;
     } else {
         $GLOBALS['ThumbImage'] = '<a href="#" onclick="' . $GLOBALS['ImagePopupJavascript'] . '">' . $thumbImage . '</a>';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 2) {
             $var = "MorePictures1";
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
                 $var = "SeeLargerImage";
             } else {
                 $var = "MorePictures2";
             }
         }
         $GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
         $this->SetAdditionalView();
     }
     // Is there more than one video? If not, hide the "See videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() == 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() == 0) {
         $GLOBALS['HideVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() > 0) {
             $var = "SeeVideos";
         } else {
             $GLOBALS['HideSpecVideosLink'] = "none";
         }
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() > 0) {
             $avar = "SeeAudios";
         } else {
             $GLOBALS['HideSpecAudiosLink'] = "none";
         }
         $GLOBALS['SeeVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos());
         $GLOBALS['SeeAudios'] = sprintf(GetLang($avar), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios());
     }
     //more Videos link ends Added by Simha
     // Is there more than one video? If not, hide the "See Ins videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() == 0) {
         $GLOBALS['HideInsVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() > 0) {
             $var = "SeeInsVideos";
         }
         $GLOBALS['SeeInsVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos());
     }
     //more Ins Videos link ends Added by Simha
     //Added by Simha to hide Not For Sale Msg
     $GLOBALS['DisplayNotForSaleMsg'] = 'none';
     if ($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         if (!GetConfig('ShowProductShipping')) {
             $GLOBALS['HideShipping'] = 'none';
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost() != 0) {
                     // Is there a fixed shipping cost?
                     $GLOBALS['ShippingPrice'] = sprintf("%s %s", CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost()), GetLang('FixedShippingCost'));
                 } else {
                     if ($GLOBALS['ISC_CLASS_PRODUCT']->HasFreeShipping()) {
                         // Does this product have free shipping?
                         $GLOBALS['ShippingPrice'] = GetLang('FreeShipping');
                     } else {
                         // Shipping calculated at checkout
                         $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
                     }
                 }
             } else {
                 $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
             }
         }
         // Is tax already included in this price?
         if (GetConfig('TaxTypeSelected') > 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductTaxable()) {
             if (GetConfig('PricesIncludeTax')) {
                 if (GetConfig('TaxTypeSelected') == 2 && GetConfig('DefaultTaxRateName')) {
                     //not included
                     $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
                 } else {
                     $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
                 }
             } else {
                 if (GetConfig('TaxTypeSelected') == 2) {
                     if (GetConfig('DefaultTaxRateName')) {
                         $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
                     } else {
                         $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
                     }
                 } else {
                     $GLOBALS['IncludingExcludingTax'] = GetLang('ProductExcludingTax2');
                 }
             }
         }
         $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
         $catquery = " SELECT DISTINCT c.categoryid\n                FROM isc_categories c                                                 \n                LEFT JOIN isc_categoryassociations ca ON c.categoryid = ca.categoryid \n                LEFT JOIN isc_products p ON ca.productid = p.productid AND p.prodvisible='1'\n                WHERE p.productid= " . $GLOBALS['ProductId'] . "";
         $relcats = array();
         $catresult = $GLOBALS['ISC_CLASS_DB']->Query($catquery);
         while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catresult)) {
             $relcats[] = $catrow['categoryid'];
         }
         $productCats = $relcats;
         $DiscountInfo = GetRuleModuleInfo();
         $FinalPrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
         foreach ($DiscountInfo as $DiscountInfoSub) {
             $catids = explode(",", $DiscountInfoSub['catids']);
             foreach ($catids as $catid) {
                 if (in_array($catid, $productCats)) {
                     $DiscountAmount = $FinalPrice * ((int) $DiscountInfoSub['amount'] / 100);
                     if ($DiscountAmount < 0) {
                         $DiscountAmount = 0;
                     }
                     $DiscountAmount = $FinalPrice - $DiscountAmount;
                 }
             }
         }
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['RetailPrice'] = "<strike>" . CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) . "</strike>";
             // blessen
             //$GLOBALS['PriceLabel'] = GetLang('YourPrice');
             $GLOBALS['PriceLabel'] = GetLang('Price');
             $savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
             $GLOBALS['HideRRP'] = "none";
             //$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), "<span class=
             //'YouSaveAmount'>".CurrencyConvertFormatPrice($savings)."</span>")."</span>";
         } else {
             $GLOBALS['PriceLabel'] = GetLang('Price');
             $GLOBALS['HideRRP'] = "none";
         }
     } else {
         $GLOBALS['PriceLabel'] = GetLang('Price');
         $GLOBALS['HideShipping'] = 'none';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->ArePricesHidden() || !GetConfig('ShowProductPrice')) {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()) {
                 $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel());
             } else {
                 $GLOBALS['HidePrice'] = "display: none;";
             }
         } else {
             $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
         }
         $GLOBALS['HideRRP'] = 'none';
         //To display not for sale message Added by Simha
         $GLOBALS['DisplayNotForSaleMsg'] = '';
     }
     // Is this product linked to a brand?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName() != "" && GetConfig('ShowProductBrand')) {
         $GLOBALS['BrandName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
         $GLOBALS['BrandLink'] = BrandLink($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
     } else {
         $GLOBALS['HideBrandLink'] = "none";
     }
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) {
         // It's a physical product
         $prodweight = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         # Added to hide the weight lable while the value is 0.00 Baskaran
         if ($prodweight == '0.00 LBS') {
             $GLOBALS['HideWeight'] = "none";
         } else {
             $GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         }
     } else {
         // It's a digital product
         $GLOBALS['HideWeight'] = "none";
     }
     $product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
     $dimensions = array('ProductHeight' => 'prodheight', 'ProductWidth' => 'prodwidth', 'ProductDepth' => 'proddepth');
     foreach ($dimensions as $global => $field) {
         if ($product[$field] > 0) {
             $GLOBALS[$global] = FormatWeight($product[$field], false);
             $hasDimensions = true;
         } else {
             $GLOBALS['Hide' . $global] = 'display: none';
         }
     }
     if (!isset($hasDimensions)) {
         $GLOBALS['HideDimensions'] = 'display: none';
     }
     // Are reviews disabled? Then don't show anything related to reviews
     if (GetConfig('EnableProductReviews') == 0) {
         $GLOBALS['HideReviewLink'] = "none";
         $GLOBALS['HideRating'] = "none";
         $GLOBALS['HideReviews'] = "none";
     } else {
         // How many reviews are there?
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) {
             $GLOBALS['HideReviewLink'] = "none";
         } else {
             $GLOBALS['HideNoReviewsMessage'] = "none";
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 1) {
                 $GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1');
             } else {
                 $GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews());
             }
         }
     }
     // Has a product availability been given?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability() != "") {
         $GLOBALS['Availability'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability());
     } else {
         $GLOBALS['HideAvailability'] = "none";
     }
     // Is there an SKU for this product?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU() != "" && GetConfig('ShowProductSKU')) {
         $GLOBALS['SKU'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
     } else {
         $GLOBALS['HideSKU'] = "none";
     }
     if (!GetConfig('ShowProductRating')) {
         $GLOBALS['HideRating'] = "none";
     }
     $GLOBALS['Rating'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetRating();
     $GLOBALS['CartLink'] = CartLink();
     /* Baskaran added to display image in product detail page */
     $brandimage = $GLOBALS['ISC_CLASS_PRODUCT']->GetProdbrandimagefile();
     $imageurl = '';
     if ($brandimage != '' || !empty($brandimage)) {
         $imageurl = GetConfig('ShopPath') . "/product_images/" . $brandimage;
     } else {
         $imageurl = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
     }
     $GLOBALS['ImageUrl'] = $imageurl;
     /* Baskaran ends */
     $GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;
     $GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);
     $GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();
     // Does this product have any bulk discount?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanUseBulkDiscounts()) {
         $GLOBALS['HideBulkDiscountLink'] = '';
         $GLOBALS['BulkDiscountThickBoxTitle'] = sprintf(GetLang('BulkDiscountThickBoxTitle'), isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()));
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         $GLOBALS['BulkDiscountThickBoxRates'] = ISC_SIDEPRODUCTADDTOCART_PANEL::GetProductBulkDiscounts();
         $GLOBALS['ProductBulkDiscountThickBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBulkDiscountThickBox");
     } else {
         $GLOBALS['HideBulkDiscountLink'] = 'none';
     }
     if (GetConfig('ShowInventory') == 1 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() > 0) {
         $GLOBALS['InventoryList'] = '';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 2) {
             $variations = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVariations();
             if (empty($options)) {
                 $GLOBALS['HideCurrentStock'] = "display: none;";
             }
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 1) {
                 $currentStock = $GLOBALS['ISC_CLASS_PRODUCT']->GetInventoryLevel();
                 if ($currentStock <= 0) {
                     $GLOBALS['InventoryList'] = GetLang('SoldOut');
                 } else {
                     $GLOBALS['InventoryList'] = $currentStock;
                 }
             }
         }
     } else {
         $GLOBALS['HideCurrentStock'] = "display: none;";
     }
     /* Added for to display the "Make an offer" Button -- Baskaran */
     # Checked for the selected series offer is 'yes'
     $GLOBALS['HideOfferButton'] = 'none';
     if (GetConfig('ShowBestOffer') == '1') {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesOffer() == 'yes') {
             $GLOBALS['HideOfferButton'] = '';
         } else {
             # Checking for the selected sub category offer is 'yes'
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetCategoryOffer() == 'yes') {
                 $GLOBALS['HideOfferButton'] = '';
             } else {
                 # Checking brand offer is 'yes' and corresponding series offer are 'no'
                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesCntOffer() == 0) {
                     $GLOBALS['HideOfferButton'] = '';
                 } else {
                     # Checking for Root category offer is 'yes' and corresponding sub category offer are 'no'
                     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetRootCategoryOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSubCategoryCntOffer() == 0) {
                         $GLOBALS['HideOfferButton'] = '';
                     } else {
                         $GLOBALS['HideOfferButton'] = 'none';
                     }
                 }
             }
         }
     }
     /* Code Ends */
     if (GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
         //blessen
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart1");
         } else {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
         }
         //blessen
         // original $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
     }
     //blessen
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() < $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
         $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice());
         $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike>&nbsp;&nbsp;<b alt='Price may be adjusted. Add to your cart and see the final price.'  Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>";
     }
     $GLOBALS['ShowOnSaleImage'] = '';
     if (isset($DiscountAmount) && $DiscountAmount < $FinalPrice) {
         //&& GetConfig('ShowOnSale')
         $GLOBALS['ProductPrice'] = "<strike>" . CurrencyConvertFormatPrice($FinalPrice) . "</strike>";
         $GLOBALS['DiscountPrice'] = "" . CurrencyConvertFormatPrice($DiscountAmount) . "";
         if (GetConfig('ShowOnSale')) {
             $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
         }
     }
     //blessen
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
 }
Ejemplo n.º 9
0
		/**
		 * Build the searched item results HTML
		 *
		 * Method will build the searched item results HMTL. Method will work with the ISC_SEARCH class to get the results
		 * so make sure that the object is initialised and the DoSearch executed.
		 *
		 * @access public
		 * @return string The search item result HTML on success, empty string on error
		 */
		static public function buildSearchResultsHTML()
		{
			if (!isset($GLOBALS["ISC_CLASS_SEARCH"]) || !is_object($GLOBALS["ISC_CLASS_SEARCH"])) {
				return "";
			}

			$totalRecords = $GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("brand");

			if ($totalRecords == 0) {
				return "";
			}

			$results = $GLOBALS["ISC_CLASS_SEARCH"]->GetResults("brand");
			$resultHTML = array();

			if (!array_key_exists("results", $results) || !is_array($results["results"])) {
				return "";
			}

			foreach ($results["results"] as $brand) {
				if (!is_array($brand) || !array_key_exists("brandid", $brand)) {
					continue;
				}

				$resultHTML[] = "<a href=\"" . BrandLink($brand["brandname"]) . "\">" . isc_html_escape($brand["brandname"]) . "</a>";
			}

			$resultHTML = implode(", ", $resultHTML);
			$resultHTML = trim($resultHTML);
			return $resultHTML;
		}
    function SetPanelSettings()
    {
        $output = "";
        $all_makes = array('CHEVROLET', 'GMC', 'FORD', 'DODGE', 'TOYOTA', 'NISSAN', 'HONDA', 'JEEP', 'HYUNDAI', 'CHRYSLER', 'INFINITI', 'LEXUS');
        $colours = array('Red', 'Navy', 'Green', 'Brown', 'Black', 'Silver', 'Dark Gray', 'Tan', 'White');
        $prod_make = array();
        $prod_model = array();
        $prod_submodel = array();
        $prod_year = array();
        $prod_price = array();
        $prod_categoryid = array();
        $count_categoryid = array();
        $brand_id = array();
        $make_link = "";
        $model_link = "";
        $model_flag_link = 0;
        $submodel_link = "";
        $year_link = "";
        $sub_modelrow = array();
        $GLOBALS['SITEPATH'] = GetConfig('ShopPath');
        // Get the link to the "all brands" page
        $GLOBALS['AllBrandsLink'] = BrandLink();
        $params = $this->searchterms;
        if (empty($params)) {
            $params['dynfilters'] = array();
        }
        /*--- Here when brand series is searched directly , brand series is set in seesion to be accessed in other pages --- */
        if (isset($params['series']) && !empty($params['series'])) {
            $_SESSION['absearchterms']['series'] = $params['series'];
        }
        // Build the search query using our terms & the fields we want
        $column_concat = " p.productid , p.prodcode , group_concat(DISTINCT c.categoryid separator '~') as categoryid, group_concat(DISTINCT prodbrandid separator '~') as prodbrandid ";
        $column_concat .= " , group_concat(DISTINCT v.prodmake separator '~') as prodmake , group_concat(DISTINCT v.prodmodel separator '~') as prodmodel , group_concat(DISTINCT v.prodsubmodel separator '~') as prodsubmodel , group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear ";
        if (isset($params['catuniversal']) && $params['catuniversal'] == 1) {
            // this condition has been added as universal category shd be shown only PQ's
            $column_names = $GLOBALS['p_cols'];
            for ($j = 0; $j < count($column_names); $j++) {
                if (isset($GLOBALS['visible_pqvq'][$column_names[$j]]) && $GLOBALS['visible_pqvq'][$column_names[$j]] == 1) {
                    $column_concat .= " , group_concat(DISTINCT " . $column_names[$j] . " separator '~') as  " . $column_names[$j];
                }
            }
        } else {
            if (isset($params['make']) && !empty($params['make']) && (isset($params['model']) && !empty($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) && isset($params['year']) && !empty($params['year']) && isset($GLOBALS['ISC_SRCH_CATG_ID'])) {
                $column_names = array_merge($GLOBALS['v_cols'], $GLOBALS['p_cols']);
                for ($j = 0; $j < count($column_names); $j++) {
                    if (stristr($column_names[$j], 'VQbedsize')) {
                        $column_names[$j] = 'VQbedsize';
                    }
                    if (stristr($column_names[$j], 'VQcabsize')) {
                        $column_names[$j] = 'VQcabsize';
                    }
                    if (isset($GLOBALS['visible_pqvq'][$column_names[$j]]) && $GLOBALS['visible_pqvq'][$column_names[$j]] == 1) {
                        if (eregi('^(vq)', $column_names[$j])) {
                            // the below 2 cases are added for checking only in bedsize and cabsize
                            if ($column_names[$j] == 'VQbedsize' or $column_names[$j] == 'VQcabsize') {
                                if (strcasecmp($column_names[$j], 'VQbedsize') == 0) {
                                    $column_concat .= " , group_concat( DISTINCT if( v.bedsize_generalname != '', v.bedsize_generalname, v.VQbedsize ) separator '~' ) as  " . $column_names[$j];
                                } else {
                                    $column_concat .= " , group_concat( DISTINCT if( v.cabsize_generalname != '', v.cabsize_generalname, v.VQcabsize ) separator '~' ) as  " . $column_names[$j];
                                }
                            } else {
                                $column_concat .= " , group_concat(DISTINCT v." . $column_names[$j] . " separator '~') as  " . $column_names[$j];
                            }
                        } else {
                            if (eregi('^(pq)', $column_names[$j])) {
                                $column_concat .= " , group_concat(DISTINCT " . $column_names[$j] . " separator '~') as  " . $column_names[$j];
                            }
                        }
                    }
                }
            }
        }
        $searchQueries = BuildProductSearchQuery($this->searchterms);
        $searchQueries['query'] = str_replace('USE INDEX (categoryid)', 'USE INDEX (PRIMARY)', $searchQueries['query']);
        //$searchQueries['query'] = str_replace('temp.*',$column_concat,$searchQueries['query']);
        $searchQueries['query'] = str_replace($GLOBALS['srch_where'], $column_concat, $searchQueries['query']);
        // lguan_20100513: If in product detail page, and search terms is empty, should use product id to limit the queries for brand, the original
        //              query was killing the performance
        $showOtherBrandForDetail = false;
        if ($this->searchterms == '') {
            $searchQueries['query'] .= isset($GLOBALS['ISC_CLASS_PRODUCT']) && $GLOBALS['ISC_CLASS_PRODUCT']->_product['prodcatids'] ? ' AND c.categoryid IN (' . $GLOBALS['ISC_CLASS_PRODUCT']->_product['prodcatids'] . ')' : '';
            $showOtherBrandForDetail = true;
        }
        $searchQueries['query'] .= " group by p.productid ";
        $searchQueries['query'] .= $GLOBALS['having_query'];
        $Search_Result1 = $GLOBALS['ISC_CLASS_DB']->Query($searchQueries['query']);
        $numrows = @(int) $GLOBALS['ISC_CLASS_DB']->CountResult($Search_Result1);
        $flag = 0;
        // this flag is used to avoid executing query again and again for submodels
        $filterdata = array();
        $countfilterdata = array();
        $sku = array();
        $count_model = array();
        $count_submodel['all']['count'] = 0;
        $sub_model_flag = 0;
        $sub_catg = "";
        if (!isset($params['model_flag']) || isset($params['model_flag']) && $params['model_flag'] == 1) {
            $model_flag_link = 1;
        }
        $strtocheck = '^(vq|pq)';
        if (isset($params['subcategory'])) {
            $sub_catg = "&subcategory=" . MakeURLSafe(strtolower($params['subcategory']));
        }
        if (isset($params['series'])) {
            $sub_catg .= "&series=" . MakeURLSafe(strtolower($params['series']));
        }
        if (isset($params['category'])) {
            $sub_catg .= "&category=" . MakeURLSafe(strtolower($params['category']));
        }
        while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($Search_Result1)) {
            $temp_prod_year = array();
            $grp_make = explode("~", $row['prodmake']);
            $grp_model = explode("~", $row['prodmodel']);
            if ($row['prodsubmodel'] != '~') {
                $grp_submodel = explode("~", $row['prodsubmodel']);
            } else {
                $grp_submodel = array();
            }
            $grp_startyear = explode("~", $row['prodstartyear']);
            $grp_endyear = explode("~", $row['prodendyear']);
            $grp_brandid = explode("~", $row['prodbrandid']);
            $grp_categoryid = explode("~", $row['categoryid']);
            $columns = array_keys($row);
            foreach ($row as $key => $qval) {
                if (eregi($strtocheck, $key)) {
                    $qval = trim($qval, '~');
                    $qval = strtolower($qval);
                    $grp_dyn = preg_split('/[~;]+/', $qval);
                    $grp_dyn = array_unique($grp_dyn);
                    $grp_dyn = array_values($grp_dyn);
                    for ($g = 0; $g < count($grp_dyn); $g++) {
                        $val = settype($val, "string");
                        $val = strtolower($grp_dyn[$g]);
                        if ($val == '') {
                            //Added by Simha
                            $val = "Others";
                        }
                        if (!empty($val)) {
                            /*$filter_value = explode(";",$val);
                              for($k=0;$k<count($filter_value);$k++)
                              {*/
                            //$val = $filter_value[$k];
                            if ($val != "") {
                                if (!isset($filterdata[$key])) {
                                    $filterdata[$key][] = $val;
                                    $countfilterdata[$key][$val]['count'] = 1;
                                } else {
                                    if (!in_array($val, $filterdata[$key], true)) {
                                        $filterdata[$key][] = $val;
                                        $countfilterdata[$key][$val]['count'] = 1;
                                    } else {
                                        $countfilterdata[$key][$val]['count']++;
                                    }
                                }
                            }
                            //}
                        }
                    }
                }
            }
            $prod_id[] = $row['productid'];
            for ($g = 0; $g < count($grp_brandid); $g++) {
                if ($grp_brandid[$g] != 0) {
                    $brand_id[] = $grp_brandid[$g];
                }
            }
            for ($g = 0; $g < count($grp_categoryid); $g++) {
                if ($grp_categoryid[$g] != "") {
                    if (!in_array($grp_categoryid[$g], $prod_categoryid)) {
                        $prod_categoryid[] = $grp_categoryid[$g];
                        $count_categoryid[$grp_categoryid[$g]]['count'] = 1;
                    } else {
                        $count_categoryid[$grp_categoryid[$g]]['count']++;
                    }
                }
            }
            for ($g = 0; $g < count($grp_make); $g++) {
                if ($grp_make[$g] != '') {
                    $product_make = strtoupper($grp_make[$g]);
                    if ($product_make != "NON-SPEC VEHICLE") {
                        // this condition is addded not to show "NON-SPEC VEHICLE" in list
                        if (!in_array($product_make, $prod_make)) {
                            $prod_make[] = $product_make;
                            $count_make[$product_make]['count'] = 1;
                        } else {
                            $count_make[$product_make]['count']++;
                        }
                    }
                }
            }
            for ($g = 0; $g < count($grp_model); $g++) {
                if (strtolower($grp_model[$g]) != 'all') {
                    // this condition is added not to show "All" in list
                    $sub_model_flag = 1;
                    $grp_model[$g] = strtoupper($grp_model[$g]);
                    if (!in_array($grp_model[$g], $prod_model)) {
                        $prod_model[] = $grp_model[$g];
                        $count_model[$grp_model[$g]]['count'] = 1;
                    } else {
                        $count_model[$grp_model[$g]]['count']++;
                    }
                }
            }
            if (count($grp_submodel) > 0) {
                for ($g = 0; $g < count($grp_submodel); $g++) {
                    if (!empty($grp_submodel[$g])) {
                        $sub_model_flag = 1;
                        $grp_submodel[$g] = ucwords(strtolower($grp_submodel[$g]));
                        if (!in_array($grp_submodel[$g], $prod_submodel)) {
                            $prod_submodel[] = $grp_submodel[$g];
                            $count_submodel[$grp_submodel[$g]]['count'] = 1;
                        } else {
                            $count_submodel[$grp_submodel[$g]]['count']++;
                        }
                    }
                }
            } else {
                if (!in_array('all', $prod_submodel)) {
                    $count_submodel['all']['count'] = 1;
                } else {
                    $count_submodel['all']['count']++;
                }
            }
            for ($g = 0; $g < count($grp_startyear); $g++) {
                $prod_start_year = $grp_startyear[$g];
                $prod_end_year = $grp_endyear[$g];
                if (empty($prod_end_year)) {
                    $prod_end_year = $prod_start_year;
                }
                if (strtolower($prod_start_year) != "all") {
                    // this condition is addded not to show "All" in list
                    if (is_numeric($prod_start_year) && is_numeric($prod_end_year)) {
                        $prod_year_diff = $prod_end_year - $prod_start_year;
                    }
                    if (!is_numeric($prod_start_year) && !is_numeric($prod_end_year)) {
                        if (!in_array($prod_start_year, $temp_prod_year)) {
                            $temp_prod_year[] = $prod_start_year;
                        }
                    } else {
                        if (isset($params['year']) && !empty($params['year'])) {
                            if (in_array($params['year'], $prod_year)) {
                                $count_year[$params['year']]['count']++;
                            } else {
                                $prod_year[] = $params['year'];
                                $count_year[$params['year']]['count'] = 1;
                            }
                        } else {
                            for ($i = 0; $i <= $prod_year_diff; $i++) {
                                $actual_year = $prod_start_year + $i;
                                if (!in_array($actual_year, $temp_prod_year)) {
                                    $temp_prod_year[] = $actual_year;
                                }
                            }
                        }
                    }
                }
            }
            for ($k = 0; $k < count($temp_prod_year); $k++) {
                if (!in_array($temp_prod_year[$k], $prod_year)) {
                    $prod_year[] = $temp_prod_year[$k];
                    $count_year[$temp_prod_year[$k]]['count'] = 1;
                } else {
                    $count_year[$temp_prod_year[$k]]['count']++;
                }
            }
        }
        //Added by Simha // for removing if it has only others in qualifier values
        foreach ($countfilterdata as $key => $value) {
            if (isset($value['Others']) && count($value) == 1 && !isset($params['dynfilters'][$key])) {
                unset($countfilterdata[$key]);
                unset($filterdata[$key]);
            }
        }
        foreach ($filterdata as $key => $num) {
            $keys = array_keys($num, 'Others');
            if (isset($keys) && count($keys) == 1) {
                unset($num[$keys[0]]);
                $num[] = 'Others';
            }
            $num = array_values($num);
            $filterdata[$key] = $num;
        }
        //Added by Simha Ends
        $prod_make_new = array_unique($prod_make);
        asort($prod_make_new);
        $prod_model_new = array_unique($prod_model);
        asort($prod_model_new);
        $prod_submodel_new = array_unique($prod_submodel);
        sort($prod_submodel_new);
        $prod_year_new = array_unique($prod_year);
        arsort($prod_year_new);
        $srch_qry = isset($params['search_query']) ? $params['search_query'] : (isset($params['search_query_adv']) ? $params['search_query_adv'] : '');
        $srch_qry = MakeURLSafe($srch_qry);
        $brand_id = array_unique($brand_id);
        $brand_id = array_values($brand_id);
        $GLOBALS['SearchBrands'] = $brand_id;
        // This variable is used in searchpage.php for displaying brands.
        $GLOBALS['SearchCategories'] = $prod_categoryid;
        // This variable is used in searchpage.php for displaying categories.
        if (isset($params['make']) && !empty($params['make'])) {
            $make_link = "&make=" . MakeURLSafe($params['make']);
        }
        if (isset($params['year']) && !empty($params['year'])) {
            $year_link = "&year=" . $params['year'];
        }
        if (isset($params['model']) && !empty($params['model'])) {
            $model_link = "&model=" . MakeURLSafe($params['model']);
        }
        if (isset($params['model_flag']) && $params['model_flag'] == 0) {
            $model_link .= "&model_flag=0";
        }
        if (isset($params['submodel']) && !empty($params['submodel'])) {
            $submodel_link = "&submodel=" . MakeURLSafe($params['submodel']);
        }
        if (isset($params['partnumber'])) {
            $_GET['partnumber'] = $params['partnumber'];
        }
        $query_string_array = $_GET;
        if (isset($params['make'])) {
            $query_string_array['make'] = $params['make'];
        }
        if (isset($params['model'])) {
            $query_string_array['model'] = $params['model'];
        }
        if (isset($params['model_flag']) && $params['model_flag'] == 0) {
            $query_string_array['model_flag'] = $params['model_flag'];
        }
        if (isset($params['submodel'])) {
            $query_string_array['submodel'] = $params['submodel'];
        }
        if (isset($params['year'])) {
            $query_string_array['year'] = $params['year'];
        }
        if (isset($params['brand'])) {
            $query_string_array['brand'] = $params['brand'];
        }
        if (isset($params['series'])) {
            $query_string_array['series'] = $params['series'];
        }
        if (isset($params['subcategory'])) {
            $query_string_array['subcategory'] = $params['subcategory'];
        }
        if (isset($params['category'])) {
            $query_string_array['category'] = $params['category'];
        }
        if (isset($params['search'])) {
            $query_string_array['searchtext'] = $params['search'];
        }
        if (isset($params['searchtext'])) {
            $query_string_array['searchtext'] = $params['searchtext'];
        }
        if (isset($params['vqsbedsize'])) {
            $query_string_array['vqsbedsize'] = $params['vqsbedsize'];
        }
        if (isset($params['vqscabsize'])) {
            $query_string_array['vqscabsize'] = $params['vqscabsize'];
        }
        foreach ($params['dynfilters'] as $key => $value) {
            $key = strtolower($key);
            $query_string_array[$key] = $value;
        }
        $query_string_array['search_query'] = $srch_qry;
        unset($query_string_array['page'], $query_string_array['search_key'], $query_string_array['x'], $query_string_array['y'], $query_string_array['sortby'], $query_string_array['orderby'], $query_string_array['change'], $query_string_array['product'], $query_string_array['refer']);
        $mmy_string_array = $query_string_array;
        unset($mmy_string_array['make'], $mmy_string_array['model'], $mmy_string_array['submodel'], $mmy_string_array['year'], $mmy_string_array['search_query']);
        $mmy_string_new1 = "";
        foreach ($mmy_string_array as $mmy_key => $mmy_val) {
            $mmy_string_new1 .= "&" . $mmy_key . "=" . $mmy_val;
        }
        $dyn_filter = "";
        // this is the main variable which is used for assigning to the global variable
        $dyn_top = "";
        // this is the variable which will remain on top of the filters
        $dyn_bottom = "";
        // this is the variable which will remain at bottom of the filters
        $dyn_flag = 0;
        // this is the variable which will check which are at top or bottom in the filters, 0 for top and 1 for bottom
        /* The below code will be added to redefine search as we need to pass 'a-b-testing' in all URL's for redefine search */
        $add_url_redefine = "&abtesting=" . MakeURLSafe(strtolower($GLOBALS['PathInfo'][1]));
        if (isset($params['make']) || isset($params['make']) && isset($params['model']) && $model_flag_link == 1 || isset($params['year'])) {
            $mmy_clear_links = $this->path . "/search.php?search_query=" . urlencode($params['search_query']) . $sub_catg;
            if (isset($params['brand'])) {
                $mmy_clear_links .= "&brand=" . $params['brand'];
            }
            $clear_mmy_filter_link = $this->GetClearFilterlink($query_string_array, 0);
            $GLOBALS['DynMsg'] = "<a href='#' onclick=\"deleteMMYcookies('" . $this->path . $clear_mmy_filter_link . "');\">Clear my Vehicle</a>";
            $GLOBALS['RemoveBackgroundImage'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("RemoveBgImage");
        }
        if (isset($params['make']) && (isset($params['model']) && $model_flag_link == 1) && isset($params['year']) && !isset($_REQUEST['change'])) {
            // if MMY is selected
            $GLOBALS['MyVehicleAreaHeader'] = $params['year'] . " " . $params['make'] . " " . $params['model'];
            $GLOBALS['DynmenuFilter'] = "";
        } else {
            $GLOBALS['MyVehicleAreaHeader'] = "Choose My Vehicle";
            $GLOBALS['DynmenuFilter'] = "";
        }
        /*-------- Year -----------------------------------------*/
        $GLOBALS['MouseoverFn'] = "this.style.cursor='pointer'";
        $extra_year = "";
        //if( !empty($make_link) || !empty($year_link) || !empty($model_link) ) {
        if (empty($year_link) || !empty($year_link)) {
            $GLOBALS['dynid'] = "prod_year";
            $GLOBALS['Dynmainmenu'] = "Year";
            $output2 = "";
            $year_counter = 1;
            if (count($prod_year_new) > 0) {
                foreach ($prod_year_new as $key => $value) {
                    if (!isset($_REQUEST['change'])) {
                        // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry;
                    } else {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}";
                    }
                    if (!empty($make_link)) {
                        $GLOBALS['BrandLink'] .= $make_link;
                    }
                    if (!empty($model_link)) {
                        $GLOBALS['BrandLink'] .= $model_link;
                    }
                    if (!empty($submodel_link) && isset($_REQUEST['submodel'])) {
                        $GLOBALS['BrandLink'] .= $submodel_link;
                    }
                    if (!empty($year_link)) {
                        $GLOBALS['BrandLink'] .= $year_link;
                    } else {
                        $GLOBALS['BrandLink'] .= "&year=" . $value;
                    }
                    $GLOBALS['BrandLink'] .= $mmy_string_new1;
                    $GLOBALS['BrandLink'] .= $sub_catg;
                    $GLOBALS['BrandName'] = isc_html_escape($value);
                    $GLOBALS['BrandCount'] = $count_year[$value]['count'];
                    if (!empty($year_link)) {
                        if ($GLOBALS['BrandName'] == 'ALL' && $GLOBALS['BrandName'] != $params['year']) {
                            $GLOBALS['BrandName'] = $params['year'];
                            //$output2 .= "<li>".$params['year']."</li>";
                            $output2 .= "<li></li>";
                        } else {
                            $GLOBALS['BrandName'] = $params['year'];
                            //$output2 .= "<li>$value</li>";
                            $output2 .= "<li></li>";
                        }
                        $dyn_flag = 1;
                        break;
                        // break has been added to display only single listing.
                    } else {
                        $dyn_flag = 0;
                        if ($year_counter < 11) {
                            $output2 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter3");
                            $year_counter++;
                        } else {
                            $extra_year .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter3");
                        }
                    }
                }
            } else {
                if (isset($params['year'])) {
                    $dyn_flag = 1;
                    $GLOBALS['BrandName'] = $params['year'];
                    $output2 .= "<li>" . $params['year'] . "</li>";
                }
            }
            $output2 = "<ul>" . $output2 . "</ul>";
            /* the below code is used to apply more link if records exceed 10 */
            if ($year_counter > 11) {
                $GLOBALS['FilterID'] = "year";
                $GLOBALS['ExtraValues'] = $extra_year;
                $output2 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
            }
            $output2 = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output2, $GLOBALS['SNIPPETS']);
            //if( !empty($_REQUEST['year']) && !empty($year_link) ) {
            $links_year = $srch_qry;
            if (!empty($year_link)) {
                $links_year .= $year_link;
            }
            if (!empty($make_link)) {
                $links_year .= $make_link;
            }
            if (!empty($model_link) && isset($_REQUEST['model'])) {
                $links_year .= $model_link;
            }
            /*if( !empty($submodel_link) && isset($_REQUEST['submodel']))   {
                              $links_year .= $submodel_link;                    
            		}*/
            if (isset($params['brand'])) {
                $links_year .= "&brand=" . MakeURLSafe($params['brand']);
            }
            if (isset($params['search'])) {
                $links_year .= "&searchtext=" . MakeURLSafe(strtolower($params['search']));
            }
            if (isset($params['searchtext'])) {
                $links_year .= "&searchtext=" . MakeURLSafe(strtolower($params['searchtext']));
            }
            if (isset($params['vqsbedsize'])) {
                $links_year .= "&vqsbedsize=" . MakeURLSafe($params['vqsbedsize']);
            }
            if (isset($params['vqscabsize'])) {
                $links_year .= "&vqscabsize=" . MakeURLSafe($params['vqscabsize']);
            }
            $links_year .= $this->GetOtherLinksForRedefine($params);
            $links_year .= $add_url_redefine;
            /* this below lines are not to display the year when clear is clicked */
            if (isset($_REQUEST['change'])) {
                $GLOBALS['BrandName'] = "";
            }
            if ($dyn_flag == 1 || isset($_REQUEST['change'])) {
                $str = "search_query=" . $links_year . $sub_catg . "&column=year";
                $GLOBALS['Dyndisplay1'] = "block";
                $GLOBALS['Dyndisplay'] = "none";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                //$GLOBALS['DynFilterArrow'] .= "&nbsp;&nbsp;&nbsp;".$GLOBALS['BrandName'];
                $GLOBALS['DynmenuFilter1'] = $output2;
                $GLOBALS['DynmenuFilter'] = "";
                $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')";
            } else {
                $GLOBALS['BrandName'] = "";
                $GLOBALS['Dyndisplay1'] = "none";
                $GLOBALS['Dyndisplay'] = "block";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter'] = $output2;
                $GLOBALS['DynmenuFilter1'] = "";
                $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')";
                if (empty($year_link)) {
                    $GLOBALS['DynmenuFilter'] = "";
                    $str = "search_query=" . $links_year . $sub_catg . "&column=year";
                    $GLOBALS['JSfunction'] .= ";getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1')";
                }
            }
            $GLOBALS['mmyid'] = "mmy_year";
            $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch");
            $dyn_filter = $dyn_output;
            //$GLOBALS['SNIPPETS']['SideProductFilter3'] = $output2;
        } else {
            $GLOBALS['HideSideProductFiltersPanelYear'] = "none";
        }
        if ($dyn_flag == 1 && !isset($_REQUEST['change'])) {
            $dyn_top .= $dyn_filter;
        } else {
            $dyn_top .= $dyn_filter;
        }
        $dyn_filter = "";
        /*-------- Make -----------------------------------------*/
        $GLOBALS['dynid'] = "prod_make";
        $GLOBALS['Dynmainmenu'] = "Make";
        if (isset($make_link) && !empty($make_link)) {
            if (count($prod_make_new) > 0) {
                foreach ($prod_make_new as $key => $value) {
                    if (!isset($_REQUEST['change'])) {
                        // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value;
                    } else {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value;
                    }
                    if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) {
                        $GLOBALS['BrandLink'] .= "&model=";
                    }
                    if (isset($_REQUEST['year'])) {
                        $GLOBALS['BrandLink'] .= "&year=" . $_REQUEST['year'];
                    }
                    $GLOBALS['BrandLink'] .= $sub_catg;
                    $GLOBALS['BrandName'] = strtoupper($value);
                    /* this below patch is temporary used when categories with make 'NON-SPEC VEHICLE' are used when searched by redefine category */
                    if (isset($params['catuniversal']) && $params['catuniversal'] == 1 || $GLOBALS['BrandName'] == 'NON-SPEC VEHICLE' && $GLOBALS['BrandName'] != $params['make']) {
                        $GLOBALS['BrandName'] = $params['make'];
                    }
                    if (isset($count_make[$value]['count'])) {
                        $GLOBALS['BrandCount'] = $count_make[$value]['count'];
                    } else {
                        $GLOBALS['BrandCount'] = 0;
                    }
                    $output .= "<li></li>";
                    break;
                    // break has been added to display only single listing.
                }
            } else {
                if (isset($params['make'])) {
                    $GLOBALS['BrandName'] = strtoupper($params['make']);
                    $output .= "<li></li>";
                    //                     $output .= "<li>".$_REQUEST['make']."</li>";
                }
            }
            $dyn_flag = 1;
            $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
        } else {
            $dyn_flag = 0;
            $temp_arr = array_diff($prod_make_new, $all_makes);
            $temp_count_make = "";
            $temp_no_count_make = "";
            $display_count = 1;
            foreach ($all_makes as $key => $value) {
                if (!isset($_REQUEST['change'])) {
                    // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                    $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value;
                } else {
                    $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value;
                }
                if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) {
                    $GLOBALS['BrandLink'] .= "&model=";
                }
                if (isset($params['year'])) {
                    $GLOBALS['BrandLink'] .= "&year=" . $params['year'];
                }
                $GLOBALS['BrandLink'] .= $mmy_string_new1;
                $GLOBALS['BrandLink'] .= $sub_catg;
                $GLOBALS['BrandName'] = isc_html_escape($value);
                if (isset($count_make[$value]['count'])) {
                    $GLOBALS['BrandCount'] = $count_make[$value]['count'];
                } else {
                    $GLOBALS['BrandCount'] = 0;
                }
                /*if($GLOBALS['BrandCount'] == 0)
                  $temp_no_count_make .= "<li>$GLOBALS[BrandName] ($GLOBALS[BrandCount])</li>";*/
                if ($GLOBALS['BrandCount'] != 0) {
                    if ($display_count < 13) {
                        // this condiditon is applied to avoid long listing of make lsit
                        $temp_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    } else {
                        $temp_no_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    }
                    $display_count++;
                    //$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                }
            }
            if (count($temp_arr) > 0) {
                foreach ($temp_arr as $key => $value) {
                    if (!isset($_REQUEST['change'])) {
                        // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value;
                    } else {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value;
                    }
                    if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) {
                        $GLOBALS['BrandLink'] .= "&model=";
                    }
                    if (isset($params['year'])) {
                        $GLOBALS['BrandLink'] .= "&year=" . $params['year'];
                    }
                    $GLOBALS['BrandName'] = isc_html_escape($value);
                    if (isset($count_make[$value]['count'])) {
                        $GLOBALS['BrandCount'] = $count_make[$value]['count'];
                    } else {
                        $GLOBALS['BrandCount'] = 0;
                    }
                    $GLOBALS['BrandLink'] .= $mmy_string_new1;
                    $GLOBALS['BrandLink'] .= $sub_catg;
                    /*if($GLOBALS['BrandCount'] == 0)
                      $temp_no_count_make .= "<li>$GLOBALS[BrandName] ($GLOBALS[BrandCount])</li>";*/
                    if ($GLOBALS['BrandCount'] != 0) {
                        if ($display_count < 13) {
                            // this condiditon is applied to avoid long listing of make list
                            $temp_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                        } else {
                            $temp_no_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                        }
                        $display_count++;
                    }
                }
            }
            $output = "<ul>{$temp_count_make}</ul>";
            if ($display_count > 13) {
                $GLOBALS['FilterID'] = "make";
                $GLOBALS['ExtraValues'] = $temp_no_count_make;
                $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                //$output .= "<ul class='more'><li><a href=\"javascript:onclick=show_hide('make')\" id='make_more'>More...</a></li></ul>";
            }
            $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
        }
        /* this below lines are not to display the make when clear is clicked */
        if (isset($_REQUEST['change'])) {
            $GLOBALS['BrandName'] = "";
        }
        if ($dyn_flag == 1 || isset($_REQUEST['change'])) {
            //$str = "search_query=".$srch_qry.$make_link."&model=".$year_link.$sub_catg."&column=make";
            $GLOBALS['Dyndisplay1'] = "block";
            $GLOBALS['Dyndisplay'] = "none";
            $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
            //$GLOBALS['DynFilterArrow'] .= "&nbsp;&nbsp;&nbsp;".$GLOBALS['BrandName'];
            $GLOBALS['DynmenuFilter1'] = "<ul>" . $output . "</ul>";
            $GLOBALS['DynmenuFilter'] = "";
            //$GLOBALS['JSfunction'] = "getvalueswithajax('".$GLOBALS['dynid']."','$str');checkanimate('".$GLOBALS['dynid']."')";
            //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
        } else {
            $GLOBALS['BrandName'] = "";
            $GLOBALS['Dyndisplay1'] = "none";
            $GLOBALS['Dyndisplay'] = "block";
            $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
            $GLOBALS['DynmenuFilter'] = $output;
            $GLOBALS['DynmenuFilter1'] = "";
            //$GLOBALS['JSfunction'] = "checkanimate('".$GLOBALS['dynid']."')";
            if (empty($make_link)) {
                $GLOBALS['DynmenuFilter'] = "";
            }
        }
        $str = "search_query=" . $srch_qry . $make_link . "&model=" . $year_link . $sub_catg . "&column=make";
        if (isset($params['brand'])) {
            $str .= "&brand=" . $params['brand'];
        }
        if (isset($params['search'])) {
            $str .= "&searchtext=" . MakeURLSafe(strtolower($params['search']));
        }
        if (isset($params['searchtext'])) {
            $str .= "&searchtext=" . MakeURLSafe(strtolower($params['searchtext']));
        }
        if (isset($params['vqsbedsize'])) {
            $str .= "&vqsbedsize=" . MakeURLSafe($params['vqsbedsize']);
        }
        if (isset($params['vqscabsize'])) {
            $str .= "&vqscabsize=" . MakeURLSafe($params['vqscabsize']);
        }
        $str .= $this->GetOtherLinksForRedefine($params);
        $str .= $add_url_redefine;
        $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')";
        $GLOBALS['mmyid'] = "mmy_make";
        $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch");
        $dyn_filter = $dyn_output;
        if ($dyn_flag == 1 && !isset($_REQUEST['change'])) {
            $dyn_top .= $dyn_filter;
        } else {
            $dyn_top .= $dyn_filter;
        }
        $dyn_filter = "";
        //$GLOBALS['SNIPPETS']['SideProductFilter1'] = $output;
        /*-------- Model - Starts -----------------------------------------*/
        $GLOBALS['dynid'] = "prod_model";
        $GLOBALS['Dynmainmenu'] = 'Model';
        $output1 = "";
        $display_count = 1;
        $extra = "";
        if (isset($params['make'])) {
            // if make is selected then need to enter the loop
            if (isset($params['model']) && $model_flag_link == 1) {
                // if make is selected need to show only that make
                $GLOBALS['BrandName'] = strtoupper($params['model']);
                $dyn_flag = 1;
            } else {
                $dyn_flag = 0;
                $model_string_array = $query_string_array;
                unset($model_string_array['model_flag'], $model_string_array['model']);
                $ymm_links = $this->GetYMMLinks($model_string_array);
                $ymm_links .= $this->GetOtherLinks($params);
                foreach ($prod_model_new as $key => $value) {
                    if ($GLOBALS['EnableSEOUrls'] == 0) {
                        $GLOBALS['BrandLink'] = $this->path . "/search.php?search_query=" . $srch_qry;
                        $GLOBALS['BrandLink'] .= $ymm_links;
                        $GLOBALS['BrandLink'] .= "&model=" . $value;
                    } else {
                        $GLOBALS['BrandLink'] = $this->path;
                        if ($srch_qry != "") {
                            $GLOBALS['BrandLink'] .= "/" . $srch_qry;
                        }
                        $GLOBALS['BrandLink'] .= $ymm_links;
                        $GLOBALS['BrandLink'] .= "/model/" . MakeURLSafe(strtolower($value));
                    }
                    $GLOBALS['BrandName'] = isc_html_escape($value);
                    $GLOBALS['BrandCount'] = $count_model[$value]['count'];
                    if ($display_count < 11) {
                        $output1 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter2");
                    } else {
                        $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter2");
                    }
                    $display_count++;
                }
                $output1 = "<ul>" . $output1 . "</ul>";
                if ($display_count > 11) {
                    $GLOBALS['FilterID'] = "model";
                    $GLOBALS['ExtraValues'] = $extra;
                    $output1 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                }
            }
            /* the below links are passes for redefine search - starts*/
            $links = $srch_qry;
            $links .= $make_link;
            $links .= $year_link;
            if (isset($params['model']) && $model_flag_link == 1) {
                $links .= $model_link;
            }
            $links .= $sub_catg;
            if (isset($params['brand'])) {
                $links .= "&brand=" . MakeURLSafe($params['brand']);
            }
            if (isset($params['search'])) {
                $links .= "&searchtext=" . MakeURLSafe(strtolower($params['search']));
            }
            if (isset($params['searchtext'])) {
                $links .= "&searchtext=" . MakeURLSafe(strtolower($params['searchtext']));
            }
            if (isset($params['vqsbedsize'])) {
                $links .= "&vqsbedsize=" . MakeURLSafe(strtolower($params['vqsbedsize']));
            }
            if (isset($params['vqscabsize'])) {
                $links .= "&vqscabsize=" . MakeURLSafe(strtolower($params['vqscabsize']));
            }
            $links .= $this->GetOtherLinksForRedefine($params);
            $links .= "&column=model";
            $links .= $add_url_redefine;
            /* the below links are passes for redefine search - ends*/
            /* this below lines are not to display the make when clear is clicked */
            if (isset($_REQUEST['change'])) {
                $GLOBALS['BrandName'] = "";
            }
            if ($dyn_flag == 1 || isset($_REQUEST['change'])) {
                $GLOBALS['Dyndisplay1'] = "block";
                $GLOBALS['Dyndisplay'] = "none";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter1'] = $output1;
                $GLOBALS['DynmenuFilter'] = "";
                $str = "search_query=" . $links;
                if (!isset($_REQUEST['change'])) {
                    $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')";
                } else {
                    $GLOBALS['mousedefaultpointer'] = "mousedefaultpointer";
                    $GLOBALS['JSfunction'] = "";
                }
            } else {
                $GLOBALS['BrandName'] = "";
                $GLOBALS['Dyndisplay1'] = "none";
                $GLOBALS['Dyndisplay'] = "block";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynmenuFilter'] = "";
                if (isset($params['model_flag']) && $params['model_flag'] == 0 && (!isset($params['catuniversal']) || $params['catuniversal'] == 0)) {
                    $GLOBALS['DynmenuFilter'] = $output1;
                    $GLOBALS['dynidStyle'] = "style='display:block'";
                    $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif";
                }
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter1'] = "";
                $str = "search_query=" . $links;
                $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')";
            }
        } else {
            $GLOBALS['BrandName'] = "";
            $GLOBALS['mousedefaultpointer'] = "mousedefaultpointer";
            $GLOBALS['DynmenuFilter'] = "";
            $GLOBALS['JSfunction'] = "";
        }
        $GLOBALS['mmyid'] = "mmy_model";
        $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch");
        $dyn_filter = $dyn_output;
        $dyn_top .= $dyn_filter;
        $dyn_filter = "";
        /*-------- Model - Ends -----------------------------------------*/
        $filter1 = <<<P1
    <div class="Block BrandList Moveable" id="SideProductFilters" style="">
P1;
        $filter2 = <<<P1
       <div class="BlockContent">
        <ul>
P1;
        $filter3 = <<<P3
        </ul>
        </div>                
        </div>
P3;
        $GLOBALS['MyVehicleArea'] = $dyn_top;
        $GLOBALS['MyVehicleArea'] .= "<p id='fit'>Guaranteed to Fit Your Vehicle!</p>";
        if (isset($GLOBALS['DynMsg'])) {
            $GLOBALS['MyVehicleArea'] .= "<ul id='modifyvehicle'><li>" . $GLOBALS['DynMsg'] . "</li></ul>";
        }
        if (isset($params['srch_category']) || isset($params['brand']) || isset($params['submodel'])) {
            $clear_filter_below_link = $this->GetClearFilterlink($query_string_array, 1);
            if ($clear_filter_below_link != "/") {
                $clear_filter_below_link = "/" . MakeURLSafe(strtolower($GLOBALS['PathInfo'][1])) . $clear_filter_below_link;
            }
            $GLOBALS['MyVehicleArea'] .= "<ul id='modifyvehicle'><li><a href='" . $this->path . "{$clear_filter_below_link}' ";
            if ($clear_filter_below_link == '/') {
                $GLOBALS['MyVehicleArea'] .= "onclick='return clearOtherFilters();'";
            }
            $GLOBALS['MyVehicleArea'] .= " >Clear All Filters Below</a></li></ul>";
        }
        if (isset($params['search'])) {
            $GLOBALS['QualiferValue'] = "";
            if (isset($params['vqsbedsize'])) {
                $GLOBALS['QualiferValue'] .= "/vqsbedsize/" . MakeURLSafe(strtolower($params['vqsbedsize'])) . "/";
            }
            if (isset($params['vqscabsize'])) {
                $GLOBALS['QualiferValue'] .= "/vqscabsize/" . MakeURLSafe(strtolower($params['vqscabsize'])) . "/";
            }
            $GLOBALS['QualiferValue'] .= $this->GetOtherLinks($params);
            $GLOBALS['QualiferValue'] = trim($GLOBALS['QualiferValue'], "/");
            if (trim($GLOBALS['QualiferValue']) != "") {
                $GLOBALS['QualiferValue'] = " var SearchQualVal = '" . $GLOBALS['QualiferValue'] . "/'; ";
            }
            $GLOBALS['QualiferValue'] .= " var SearchStringVal = '" . MakeURLSafe(strtolower($params['search'])) . "/'; ";
        }
        $dyn_top = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleArea");
        /************** Category Listing ********************/
        $str = "search_query=" . $srch_qry . $make_link . $model_link . $year_link . "&column=categories";
        //$str .= isset($params['brand']) ? "&brand=".MakeURLSafe($params['brand']) : '';
        $str .= isset($GLOBALS['ISC_SRCH_CATG_NAME']) ? "&catg_name=" . MakeURLSafe($GLOBALS['ISC_SRCH_CATG_NAME']) : '';
        $str .= isset($params['search']) ? "&searchtext=" . MakeURLSafe($params['search']) : '';
        $str .= isset($params['searchtext']) ? "&searchtext=" . MakeURLSafe($params['searchtext']) : '';
        $str .= isset($params['vqsbedsize']) ? "&vqsbedsize=" . MakeURLSafe($params['vqsbedsize']) : '';
        $str .= isset($params['vqscabsize']) ? "&vqscabsize=" . MakeURLSafe($params['vqscabsize']) : '';
        $str .= $this->GetOtherLinksForRedefine($params);
        $str .= $add_url_redefine;
        $dyn_top .= $this->GetCategoryListing($prod_categoryid, $count_categoryid, $str, (int) $numrows);
        /*------------ Brand Filter --------------------*/
        if (count($brand_id) > 0 || isset($params['brand'])) {
            $title = "<h2>Brand</h2>";
            //$dyn_filter .=  $filter1.$title.$filter2;
            $brand_link = "";
            $GLOBALS['dynid'] = "dyn_brand";
            $GLOBALS['Dynmainmenu'] = "Brand";
            $count_brand = 1;
            $extra = "";
            $str = "";
            $brand_string_array = $query_string_array;
            unset($brand_string_array['brand'], $brand_string_array['series'], $brand_string_array['search_query']);
            $get_mmy_links = "";
            $brand_string_new1 = "";
            if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
                $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['PathInfo'][1]));
                $brand_string_new1 .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME']));
            }
            /*else if(isset($GLOBALS['ISC_SRCH_BRAND_NAME']))
            		$get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));*/
            if ($get_mmy_links != "") {
                if ($GLOBALS['EnableSEOUrls'] == 1) {
                    $get_mmy_links = "/" . $get_mmy_links;
                }
            }
            /* this condition was added when brand & catg is selected and for clear functionality, no need to pass the $params['category'] */
            if (isset($params['brand']) && isset($params['category']) && strtolower($params['category']) == strtolower($GLOBALS['ISC_SRCH_CATG_NAME'])) {
                unset($brand_string_array['category']);
            }
            $get_mmy_links .= $this->GetYMMLinks($brand_string_array);
            $get_mmy_links .= $this->GetOtherLinks($params);
            foreach ($brand_string_array as $br_key => $br_val) {
                $brand_string_new1 .= "&" . $br_key . "=" . MakeURLSafe($br_val);
            }
            //$brand_string_new1 .= $sub_catg;
            if (isset($params['brand']) && !empty($params['brand'])) {
                $dyn_flag = 1;
                $params['brand'] = ucwords(strtolower($params['brand']));
                $dyn_filter .= <<<P2
        <li><img src='{$this->path}/templates/default/images/check.gif'>&nbsp;&nbsp;{$params['brand']}</li>
P2;
                if (strtolower($params['brand']) == strtolower(urldecode($srch_qry))) {
                    // if searched only by brand
                    $brandclearurl = "{$this->path}/search.php?search_query=brands";
                    $str = "search_query=";
                } else {
                    // if searched with other combinations
                    $search_query = trim(str_ireplace($params['brand'], '', MakeURLNormal($srch_qry)));
                    $brandclearurl = "{$this->path}/search.php?search_query=" . MakeURLSafe($search_query);
                    $str = "search_query=";
                    /* the below condition is added not to add the category name again as it is being added in $brand_string_new1 at the top */
                    if (strtolower($search_query) != strtolower(isset($GLOBALS['ISC_SRCH_CATG_NAME']) ? $GLOBALS['ISC_SRCH_CATG_NAME'] : '')) {
                        $str .= MakeURLSafe($search_query);
                    }
                }
                $str .= $brand_string_new1 . "&brand=" . MakeURLSafe($params['brand']) . "&column=prodbrandid";
                $str .= $this->GetOtherLinksForRedefine($params);
                $str .= $add_url_redefine;
                if (!empty($brand_string_new1)) {
                    $brandclearurl .= $brand_string_new1;
                }
                $GLOBALS['ClearURL'] = "<a href='" . $this->LeftClearLink($get_mmy_links) . "'>Clear</a>";
            } else {
                $other_brands = "";
                // this variables is used to show brand list in "other brands"
                $dyn_flag = 0;
                $brand_query = "select distinct brandid , brandname from [|PREFIX|]brands b inner join [|PREFIX|]products p on b.brandid = p.prodbrandid order by brandname asc ";
                $brand_result = $GLOBALS['ISC_CLASS_DB']->Query($brand_query);
                while ($brand_row = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_result)) {
                    if (in_array($brand_row['brandid'], $brand_id)) {
                        $GLOBALS['BrandName'] = $brand_row['brandname'];
                        $search_query = $srch_qry;
                        if (urldecode($srch_qry) == 'brands' || urldecode($srch_qry) == 'categories') {
                            $search_query = MakeURLSafe($GLOBALS['BrandName']);
                        }
                        //$GLOBALS['BrandLink'] = "$this->path/search.php?search_query=$search_query$brand_string_new1&brand=".$brand_row['brandid'];
                        if (!isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
                            if ($GLOBALS['EnableSEOUrls'] == 1) {
                                $GLOBALS['BrandLink'] = $this->path . "/" . MakeURLSafe(strtolower($brand_row['brandname'])) . $get_mmy_links;
                            } else {
                                $GLOBALS['BrandLink'] = $this->path . "/search.php?search_query=" . MakeURLSafe($brand_row['brandname']) . $get_mmy_links;
                            }
                        } else {
                            $GLOBALS['BrandLink'] = $this->LeftLink($get_mmy_links, 'brand', strtolower($brand_row['brandname']));
                        }
                        if ($count_brand < 11) {
                            $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                        } else {
                            $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                        }
                        $count_brand++;
                    } else {
                        $ymm_links_for_brands = $this->GetClearFilterlink($params, 1);
                        $ymm_links_for_brands = rtrim($ymm_links_for_brands, "/");
                        $GLOBALS['BrandName'] = $brand_row['brandname'];
                        if ($GLOBALS['EnableSEOUrls'] == 1) {
                            $GLOBALS['BrandLink'] = $this->LeftLink($get_mmy_links, 'brand', strtolower($brand_row['brandname']));
                            //$GLOBALS['BrandLink'] = $this->path."/".MakeURLSafe(strtolower($brand_row['brandname'])).$ymm_links_for_brands;
                        } else {
                            $ymm_links_for_brands = str_replace('categories', MakeURLSafe(strtolower($brand_row['brandname'])), $ymm_links_for_brands);
                            $GLOBALS['BrandLink'] = $this->path . $ymm_links_for_brands;
                        }
                        $other_brands .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    }
                }
                $dyn_filter = "<ul>" . $dyn_filter . "</ul>";
                if ($count_brand > 11) {
                    $GLOBALS['FilterID'] = "brand";
                    $GLOBALS['ExtraValues'] = $extra;
                    $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                }
                // lguan_20100513: Added a condition to show other brand when user enter the product detail page without any search teams in session,
                //          So that the other brands will be available for user
                if ($other_brands != "" && (isset($params['srch_category']) || $showOtherBrandForDetail)) {
                    $GLOBALS['OtherBrands'] = $other_brands;
                    $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("OtherBrands");
                }
                //$GLOBALS['ClearURL'] = "$this->path/search.php?search_query=$srch_qry$brand_string_new1";
                $GLOBALS['ClearURL'] = "";
            }
            if ($dyn_flag == 1) {
                //$str = "search_query=".$links.$model_link."&column=model";
                $GLOBALS['Dyndisplay1'] = "showlist";
                $GLOBALS['Dyndisplay'] = "hidelist";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter1'] = $dyn_filter;
                $GLOBALS['DynmenuFilter'] = "";
                $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
                //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            } else {
                $GLOBALS['Dyndisplay1'] = "hidelist";
                $GLOBALS['Dyndisplay'] = "showlist";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter'] = $dyn_filter;
                $GLOBALS['DynmenuFilter1'] = "";
                $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')";
            }
            $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter");
            $dyn_filter = $dyn_output;
            if ($dyn_flag == 1) {
                $dyn_bottom .= $dyn_filter;
            } else {
                $dyn_top .= $dyn_filter;
            }
            $dyn_filter = "";
        }
        /*------------ Brand Filter ends --------------------*/
        /*------------ Submodel Filter - starts --------------------*/
        if (isset($params['model']) && $model_flag_link == 1 && (count($prod_submodel_new) > 0 || isset($params['submodel']))) {
            $GLOBALS['dynid'] = "dyn_submodel";
            $GLOBALS['Dynmainmenu'] = "Submodel";
            $count_sub_model = 1;
            $extra = "";
            $submodel_string = $query_string_array;
            unset($submodel_string['submodel'], $submodel_string['search_query']);
            $get_mmy_links = "";
            /*if(isset($GLOBALS['ISC_SRCH_CATG_NAME']))
            			$get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME']));
            	else if(isset($GLOBALS['ISC_SRCH_BRAND_NAME']))
            			$get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));*/
            if (isset($params['search_query'])) {
                $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['PathInfo'][1]));
            }
            if ($get_mmy_links != "") {
                if ($GLOBALS['EnableSEOUrls'] == 1) {
                    $get_mmy_links = "/" . $get_mmy_links;
                }
            }
            $get_mmy_links .= $this->GetYMMLinks($submodel_string);
            $submodel_string_new1 = "";
            foreach ($submodel_string as $br_key => $br_val) {
                if (is_array($br_val)) {
                    $br_val = implode("&" . $br_key . "[]=", $br_val);
                    $br_key = $br_key . "[]";
                } else {
                    $br_val = MakeURLSafe($br_val);
                }
                $submodel_string_new1 .= "&" . $br_key . "=" . $br_val;
            }
            //$submodel_string_new1 .= $sub_catg;
            if (isset($params['submodel']) && !empty($params['submodel'])) {
                $params['submodel'] = ucwords(strtolower($params['submodel']));
                $dyn_flag = 1;
                $dyn_filter .= <<<P2
        <ul><li><img src='{$this->path}/templates/default/images/check.gif'>&nbsp;&nbsp;{$params['submodel']}</li></ul>
P2;
                $str = "search_query=" . $srch_qry;
                $submodelclearurl = $this->path . "/search.php?" . $str;
                $str .= $submodel_string_new1 . "&submodel=" . $params['submodel'] . "&column=submodel";
                $str .= $add_url_redefine;
                $submodelclearurl .= $submodel_string_new1;
                $GLOBALS['ClearURL'] = "<a href='" . $this->LeftClearLink($get_mmy_links) . $this->GetOtherLinks($params) . "'>Clear</a>";
            } else {
                $dyn_flag = 0;
                for ($s = 0; $s < count($prod_submodel_new); $s++) {
                    $GLOBALS['BrandName'] = $prod_submodel_new[$s];
                    $search_query = $srch_qry;
                    $GLOBALS['BrandLink'] = $this->LeftLink($get_mmy_links, 'submodel', $prod_submodel_new[$s]);
                    $GLOBALS['BrandLink'] .= $this->GetOtherLinks($params);
                    if ($count_sub_model < 11) {
                        $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    } else {
                        $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    }
                    $count_sub_model++;
                }
                $dyn_filter = "<ul>" . $dyn_filter . "</ul>";
                if ($count_sub_model > 11) {
                    $GLOBALS['FilterID'] = "submodel";
                    $GLOBALS['ExtraValues'] = $extra;
                    $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                }
                $GLOBALS['ClearURL'] = "";
            }
            if ($dyn_flag == 1) {
                //$str = "search_query=".$links.$model_link."&column=model";
                $GLOBALS['Dyndisplay1'] = "showlist";
                $GLOBALS['Dyndisplay'] = "hidelist";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter1'] = $dyn_filter;
                $GLOBALS['DynmenuFilter'] = "";
                $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
                //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            } else {
                $GLOBALS['Dyndisplay1'] = "hidelist";
                $GLOBALS['Dyndisplay'] = "showlist";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter'] = $dyn_filter;
                $GLOBALS['DynmenuFilter1'] = "";
                $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')";
            }
            $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter");
            $dyn_filter = $dyn_output;
            if ($dyn_flag == 1) {
                $dyn_bottom .= $dyn_filter;
            } else {
                $dyn_top .= $dyn_filter;
            }
            $dyn_filter = "";
        }
        /*------------ Submodel Filter - ends --------------------*/
        /*-------- Other Filters -----------------------------------------*/
        if ((isset($params['catuniversal']) && $params['catuniversal'] == 1 || !empty($make_link) && (!empty($model_link) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) && !empty($year_link)) && ($numrows > 0 || isset($_REQUEST['GO']) && $numrows > 0) && isset($GLOBALS['ISC_SRCH_CATG_ID'])) {
            //    include('includes/display/ProdDynamicFilters.php');
            $map_names = array();
            $filter_names = "select * from [|PREFIX|]qualifier_names";
            $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
            while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
                if ($filter_row['display_names'] != '') {
                    $map_names[$filter_row['column_name']]['name'] = $filter_row['display_names'];
                }
                $map_names[$filter_row['column_name']]['qid'] = $filter_row['qid'];
            }
            $query_string_new = $this->path . "/search.php?";
            $get_mmy_links = "";
            /*if(isset($GLOBALS['ISC_SRCH_CATG_NAME']) && !isset($params['category']))
            			$get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME']));
            		else if(isset($GLOBALS['ISC_SRCH_BRAND_NAME']))
            			$get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));*/
            if (isset($params['search_query'])) {
                $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['PathInfo'][1]));
            }
            if ($get_mmy_links != "") {
                if ($GLOBALS['EnableSEOUrls'] == 1) {
                    $get_mmy_links = "/" . $get_mmy_links;
                }
            }
            $get_mmy_links .= $this->GetYMMLinks($params);
            $get_all_param_links = $this->GetOtherLinks($params);
            //$dyn_filter = "";
            for ($u = 0; $u < count($columns); $u++) {
                // loop for the filters . Here columns are the filters.
                if (eregi('^(vq|pq)', $columns[$u])) {
                    // checking whether the name of the column starts with vq or pq
                    if (isset($filterdata[$columns[$u]]) && count($filterdata[$columns[$u]]) > 0) {
                        $filter_var = array('vq', 'pq');
                        //$title = ucfirst(str_ireplace($filter_var,"",$columns[$u]));
                        if (!isset($map_names[$columns[$u]]['name']) || empty($map_names[$columns[$u]]['name'])) {
                            $title = ucfirst(str_ireplace($filter_var, "", $columns[$u]));
                        } else {
                            $title = $map_names[$columns[$u]]['name'];
                        }
                        $Qualifier_id = $map_names[$columns[$u]]['qid'];
                        $GLOBALS['CategoryId'] = isset($params['subcategory']) ? $this->subcatgid : $GLOBALS['ISC_SRCH_CATG_ID'];
                        $this->GetAssocDetails($GLOBALS['CategoryId'], $Qualifier_id, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
                        $qvalue_mapping_array = $OwnAssoc;
                        /* The below code is added to have the values sorted in alphabetical order and "Others" added at the end - starts */
                        if ($columns[$u] == "PQbodylength" || $columns[$u] == "PQbodywidth") {
                            asort($filterdata[$columns[$u]], SORT_NUMERIC);
                        } else {
                            $temp_filterdata = array();
                            foreach ($filterdata[$columns[$u]] as $k => $kval) {
                                $CurrentValueItem = array();
                                $CurrentValueItem['vimage'] = '';
                                $CurrentValueItem['vname'] = '';
                                $CurrentValueItem['vcomments'] = '';
                                if (($m = array_search($kval, $OwnValue)) !== false) {
                                    $CurrentValueItem = $qvalue_mapping_array[$m];
                                    if ($CurrentValueItem['vname'] != '') {
                                        $kval = $CurrentValueItem['vname'];
                                    }
                                }
                                if ($CurrentValueItem['vimage'] == "" && $CurrentValueItem['vcomments'] == "" && $CurrentValueItem['vname'] == "") {
                                    if (($n = array_search($kval, $ParentValue)) !== false) {
                                        $CurrentValueItem = $ParentAssoc[$n];
                                        if ($CurrentValueItem['vname'] != '') {
                                            $kval = $CurrentValueItem['vname'];
                                        }
                                    }
                                }
                                $temp_filterdata[$k] = strtolower($kval);
                            }
                            asort($filterdata[$columns[$u]]);
                            asort($temp_filterdata);
                            $temp_arr1 = array_keys($temp_filterdata);
                            $temp_arr2 = array();
                            foreach ($temp_arr1 as $key) {
                                $temp_arr2[] = $filterdata[$columns[$u]][$key];
                            }
                            $filterdata[$columns[$u]] = array_combine($temp_arr1, $temp_arr2);
                        }
                        if (($others_key = array_search('Others', $filterdata[$columns[$u]])) !== FALSE) {
                            unset($filterdata[$columns[$u]][$others_key]);
                            $filterdata[$columns[$u]][$others_key] = 'Others';
                        }
                        /* - ends - */
                        $GLOBALS['dynid'] = "dyn" . ($u + 1);
                        //$GLOBALS['Dynmainmenu'] = $title;
                        $dyn_filter = "";
                        $extra = "";
                        // this is used to hide the values if exceed 10
                        $count_pqvq = 1;
                        //$dyn_filter .=  $filter1.$title.$filter2;
                        //for($k=0;$k<count($filterdata[$columns[$u]]);$k++)       // this loop is for showing the list in the filters column
                        foreach ($filterdata[$columns[$u]] as $k => $kval) {
                            //$countfilterdata[$key][$val]['count']
                            $value = $filterdata[$columns[$u]][$k];
                            $original_value = $filterdata[$columns[$u]][$k];
                            $GLOBALS['HoverImage'] = "";
                            $GLOBALS['Comments'] = "";
                            /*-------------- Below code is used to cehck comments in subcategory and main category ------------ */
                            $CurrentValueItem = array();
                            $CurrentValueItem['vimage'] = '';
                            $CurrentValueItem['vname'] = '';
                            $CurrentValueItem['vcomments'] = '';
                            if (($m = array_search($value, $OwnValue)) !== false) {
                                $CurrentValueItem = $qvalue_mapping_array[$m];
                            }
                            if ($CurrentValueItem['vimage'] == "" && $CurrentValueItem['vcomments'] == "" && $CurrentValueItem['vname'] == "") {
                                if (($n = array_search($value, $ParentValue)) !== false) {
                                    $CurrentValueItem = $ParentAssoc[$n];
                                }
                            }
                            if ($CurrentValueItem['vname'] != "" || $CurrentValueItem['vimage'] != "" || $CurrentValueItem['vcomments'] != "") {
                                if (!empty($CurrentValueItem['vname'])) {
                                    $value = $CurrentValueItem['vname'];
                                }
                                if (!empty($CurrentValueItem['vimage'])) {
                                    $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $CurrentValueItem['vimage']);
                                    if (file_exists($file)) {
                                        $GLOBALS['HoverImage'] = $this->path . "/" . GetConfig('ImageDirectory') . "/" . $CurrentValueItem['vimage'];
                                    }
                                }
                                $GLOBALS['Comments'] = $CurrentValueItem['vcomments'];
                            }
                            /*-------------- Below code is used to cehck comments in subcategory and main category Ends ------------ */
                            if (isset($params['dynfilters'][$columns[$u]]) && !empty($params['dynfilters'][$columns[$u]])) {
                                $dyn_flag = 1;
                                $query_string_mod_array = $query_string_array;
                                //*$query_string_mod_array[$columns[$u]]= "";
                                //$query_string_new1 = $query_string_new;
                                //*$query_string_new1 = "redefine_filters.php?";
                                $query_string_new1 = "";
                                $qualifierclearurl = "search.php?";
                                foreach ($query_string_mod_array as $qs_key => $qs_val) {
                                    //*if($query_string_new1 != $query_string_new)
                                    if (!empty($query_string_new1)) {
                                        $query_string_new1 .= "&";
                                    }
                                    if ($qs_key != "search_query") {
                                        $qs_val = MakeURLSafe($qs_val);
                                    }
                                    $query_string_new1 .= $qs_key . "=" . $qs_val;
                                    if ($qs_key != $columns[$u]) {
                                        if ($qualifierclearurl != "search.php?") {
                                            $qualifierclearurl .= "&";
                                        }
                                        $qualifierclearurl .= $qs_key . "=" . $qs_val;
                                    }
                                }
                                $get_qualifier_links = $this->GetOtherLinks($params, $columns[$u]);
                                if ($GLOBALS['EnableSEOUrls'] == 1) {
                                    $qualifierclearurl = $this->path . $get_mmy_links . $get_qualifier_links;
                                } else {
                                    $qualifierclearurl = $this->path . "/search.php?search_query=" . $get_mmy_links . $get_qualifier_links;
                                }
                                if (strtolower($original_value) == strtolower($params['dynfilters'][$columns[$u]])) {
                                    $GLOBALS['ClearURL'] = "<a href='{$qualifierclearurl}'>Clear</a>";
                                    $dyn_filter .= "<li><img src='{$this->path}/templates/default/images/check.gif'>&nbsp;&nbsp;" . ucwords($value) . "</li>";
                                    //*$dyn_filter .= "<li><a class='thickbox' href='$query_string_new1&column=$columns[$u]'><b>Redefine search...</b></a></li>";
                                    $str = "{$query_string_new1}&column=" . strtolower($columns[$u]);
                                    $str .= $add_url_redefine;
                                    break;
                                }
                            } else {
                                $dyn_flag = 0;
                                $query_string_mod_array = $query_string_array;
                                $query_string_new1 = $query_string_new . "search_query=" . $query_string_mod_array['search_query'];
                                unset($query_string_mod_array['search_query']);
                                //if(array_key_exists($columns[$u],$query_string_mod_array)) {
                                //$query_string_mod_array[$columns[$u]] = $original_value;
                                //}
                                foreach ($query_string_mod_array as $qs_key => $qs_val) {
                                    if ($query_string_new1 != $query_string_new) {
                                        $query_string_new1 .= "&";
                                    }
                                    if ($qs_key != "search_query") {
                                        $qs_val = MakeURLSafe($qs_val);
                                    }
                                    $query_string_new1 .= $qs_key . "=" . $qs_val;
                                }
                                //$GLOBALS['ClearURL'] = $query_string_new1;
                                $GLOBALS['ClearURL'] = "";
                                if ($GLOBALS['EnableSEOUrls'] == 1) {
                                    $query_string_new1 = "/" . strtolower($columns[$u]) . "/" . MakeURLSafe(strtolower($original_value));
                                    // this is added to pass the listing value
                                    $GLOBALS['QualifierLink'] = $this->path . $get_mmy_links . $get_all_param_links . $query_string_new1;
                                } else {
                                    $query_string_new1 = "&" . strtolower($columns[$u]) . "=" . MakeURLSafe(strtolower($original_value));
                                    // this is added to pass the listing value
                                    $GLOBALS['QualifierLink'] = $this->path . "/search.php?search_query=" . $get_mmy_links . $get_all_param_links . $query_string_new1;
                                }
                                $GLOBALS['QualifierId'] = $Qualifier_id;
                                $GLOBALS['QualifierValue'] = ucwords($value);
                                $GLOBALS['QualifierCount'] = $countfilterdata[$columns[$u]][$original_value]['count'];
                                //$dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage");
                                //$dyn_filter .= "<li><a href='$query_string_new1'>".$value."</a> (".$countfilterdata[$columns[$u]][$value]['count'].")</li>";
                                if ($count_pqvq < 11) {
                                    $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage");
                                } else {
                                    $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage");
                                }
                                $count_pqvq++;
                            }
                        }
                        $dyn_filter = "<ul>" . $dyn_filter . "</ul>";
                        if ($count_pqvq > 11) {
                            $GLOBALS['FilterID'] = $GLOBALS['dynid'];
                            $GLOBALS['ExtraValues'] = $extra;
                            $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                        }
                        if ($dyn_flag == 1) {
                            //$str = "search_query=".$links.$model_link."&column=model";
                            $GLOBALS['Dyndisplay1'] = "showlist";
                            $GLOBALS['Dyndisplay'] = "hidelist";
                            $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                            $GLOBALS['DynmenuFilter1'] = $dyn_filter;
                            $GLOBALS['DynmenuFilter'] = "";
                            $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
                            //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                        } else {
                            $GLOBALS['Dyndisplay1'] = "hidelist";
                            $GLOBALS['Dyndisplay'] = "showlist";
                            $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif";
                            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                            $GLOBALS['DynmenuFilter'] = $dyn_filter;
                            $GLOBALS['DynmenuFilter1'] = "";
                            $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')";
                        }
                        /* Filter Title related assiciation */
                        $CurrentItem = $qvalue_mapping_array[0];
                        if ($CurrentItem['qimage'] == "" && $CurrentItem['qcomments'] == "" && $CurrentItem['qname'] == "") {
                            $CurrentItem = $ParentAssoc[0];
                        }
                        if (isset($CurrentItem['qname']) && !empty($CurrentItem['qname'])) {
                            $GLOBALS['Dynmainmenu'] = $CurrentItem['qname'];
                        } else {
                            $GLOBALS['Dynmainmenu'] = $title;
                        }
                        $mover_comment = "";
                        if (isset($CurrentItem) && !empty($CurrentItem['qcomments'])) {
                            $mover_comment = $CurrentItem['qcomments'];
                        }
                        $mover_image = "";
                        if (isset($CurrentItem['qimage']) && !empty($CurrentItem['qimage'])) {
                            $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $CurrentItem['qimage']);
                            if (file_exists($file)) {
                                $mover_image = $GLOBALS['SITEPATH'] . "/" . GetConfig('ImageDirectory') . "/" . $CurrentItem['qimage'];
                            }
                        }
                        $GLOBALS['MouseoverFn'] = "loadHoverImage(event, '" . $mover_image . "', '" . $mover_comment . "');";
                        $GLOBALS['MouseoutFn'] = "hideTip();";
                        $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter");
                        //$dyn_filter .=  $filter3;
                        if ($dyn_flag == 1) {
                            $dyn_bottom .= $dyn_output;
                        } else {
                            $dyn_top .= $dyn_output;
                        }
                        $dyn_filter = "";
                        //$dyn_filter .=  $filter3;
                    }
                }
            }
            $dyn_filter = $dyn_top . $dyn_bottom;
            /* form action */
            $qry_string = $_SERVER['QUERY_STRING'];
            if (isset($_REQUEST['page'])) {
                $page = $_REQUEST['page'];
                $search_link = str_ireplace('&page=' . $page, '', $qry_string);
            } else {
                $search_link = $qry_string;
            }
            $GLOBALS['formaction'] = "search.php?" . $search_link;
        } else {
            $GLOBALS['HideSideProductFiltersPanelPrice'] = "none";
        }
        $dyn_filter = $dyn_top . $dyn_bottom;
        $GLOBALS['DynFilter'] = $dyn_filter;
        if (!isset($params['flag_srch_category']) || $params['flag_srch_category'] == 0 || !eregi('search.php', $_SERVER['REQUEST_URI'])) {
            $GLOBALS['HideSideProductFiltersPanelPrice'] = "none";
        } else {
            $GLOBALS['HideSideProductFiltersPanelPrice'] = "block";
        }
        $GLOBALS['FromPrice'] = "0.00";
        if (isset($_REQUEST['price_from'])) {
            $GLOBALS['FromPrice'] = $_REQUEST['price_from'];
        }
        if (isset($_REQUEST['price_to'])) {
            $GLOBALS['ToPrice'] = $_REQUEST['price_to'];
        }
        if (empty($output1) && empty($output2) && empty($output)) {
            $this->DontDisplay = true;
        }
        /*$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
        		$GLOBALS['SNIPPETS']['SideProductFilter1'] = $output;*/
    }
Ejemplo n.º 11
0
 public function LoadProductsToCompare()
 {
     $count = 0;
     $output = "";
     $tOutput = "";
     $products = array();
     // First row - the "Remove" link
     $GLOBALS['SNIPPETS']['TD1'] = "";
     $GLOBALS['SNIPPETS']['TD2'] = "";
     $GLOBALS['SNIPPETS']['TD3'] = "";
     $GLOBALS['SNIPPETS']['TD4'] = "";
     $GLOBALS['SNIPPETS']['TD5'] = "";
     $GLOBALS['SNIPPETS']['TD6'] = "";
     $GLOBALS['SNIPPETS']['TD7'] = "";
     $GLOBALS['SNIPPETS']['TD8'] = "";
     $GLOBALS['SNIPPETS']['TD9'] = "";
     $GLOBALS['SNIPPETS']['TD10'] = "";
     $GLOBALS['SNIPPETS']['TD11'] = "";
     // Do we need to sort?
     if ($this->_comparesort != "") {
         $sort = sprintf("order by %s", $this->_comparesort);
     } else {
         $sort = "";
     }
     $product_ids = $this->GetProductIds();
     if (empty($product_ids)) {
         return;
     }
     $productids_array = explode('/', $this->GetIds());
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $GLOBALS['BaseCompareLink'] = CompareLink($productids_array) . '?';
     } else {
         $GLOBALS['BaseCompareLink'] = CompareLink($productids_array) . '&amp;';
     }
     $compareWidth = 100 - 20;
     $compareWidth = floor($compareWidth / count($this->_compareproducts));
     $GLOBALS['CompareWidth'] = $compareWidth . "%";
     $GLOBALS['CompareHeadWidth'] = 100 - $compareWidth * count($this->_compareproducts) . "%";
     $query = "\n\t\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . ",\n\t\t\t\t(SELECT brandname FROM [|PREFIX|]brands WHERE brandid=prodbrandid) AS brand,\n\t\t\t\t(select count(fieldid) from [|PREFIX|]product_customfields where fieldprodid=p.productid) as numcustomfields,\n\t\t\t\t(select count(reviewid) from [|PREFIX|]reviews where revproductid=p.productid and revstatus='1') AS numreviews\n\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)\n\t\t\t\tWHERE p.prodvisible='1' AND p.productid IN (" . $product_ids . ") AND (pi.imageisthumb=1 OR ISNULL(pi.imageisthumb))\n\t\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\t" . $sort;
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         $GLOBALS['ProductNumber'] = $count++;
         if ($row['brand'] != "") {
             $GLOBALS['ProductBrand'] = sprintf("<a href='%s'>%s</a>", BrandLink($row['brand']), isc_html_escape($row['brand']));
         } else {
             $GLOBALS['ProductBrand'] = GetLang('NA');
         }
         // Build the page title
         $this->_comparetitle .= sprintf("%s %s ", isc_html_escape($row['prodname']), GetLang('VS'));
         $GLOBALS['ProductId'] = $row['productid'];
         $GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
         $GLOBALS['ProductLink'] = ProdLink($row['prodname']);
         $GLOBALS['NumReviews'] = $row['numreviews'];
         if ($row['numreviews'] == 0) {
             $GLOBALS['HideComparisonReviewLink'] = "none";
         } else {
             $GLOBALS['HideComparisonReviewLink'] = "";
         }
         $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname']));
         // Determine the price of this product
         $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row);
         if ($row['prodavailability'] != "") {
             $GLOBALS['ProductAvailability'] = isc_html_escape($row['prodavailability']);
         } else {
             $GLOBALS['ProductAvailability'] = GetLang('NA');
         }
         $compare_ids = array_diff($this->_compareproducts, array($row['productid']));
         if (count($compare_ids) == 1) {
             $GLOBALS['RemoveCompareLink'] = "javascript:alert('%%LNG_CompareTwoProducts%%');";
         } else {
             $GLOBALS['RemoveCompareLink'] = CompareLink($compare_ids);
             if (!empty($this->_comparesort)) {
                 $GLOBALS['RemoveCompareLink'] .= '?sort=' . $_GET['sort'];
             }
         }
         $GLOBALS['ProductRating'] = (int) $row['prodavgrating'];
         if ($row['proddesc'] != "") {
             // Strip out HTML from the description first
             $row['proddesc'] = strip_tags($row['proddesc']);
             if (isc_strlen($row['proddesc']) > 200) {
                 $GLOBALS['ProductSummary'] = isc_substr($row['proddesc'], 0, 200) . "...";
             } else {
                 $GLOBALS['ProductSummary'] = $row['proddesc'];
             }
         } else {
             $GLOBALS['ProductSummary'] = GetLang('NA');
         }
         // Are there any custom fields?
         if ($row['numcustomfields'] > 0) {
             $GLOBALS['CustomFields'] = "";
             // Get the custom fields for this product
             $query = sprintf("select * from [|PREFIX|]product_customfields where fieldprodid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($row['productid']));
             $cResult = $GLOBALS['ISC_CLASS_DB']->Query($query);
             while ($cRow = $GLOBALS['ISC_CLASS_DB']->Fetch($cResult)) {
                 $GLOBALS['CustomFieldName'] = isc_html_escape($cRow['fieldname']);
                 $GLOBALS['CustomFieldValue'] = $cRow['fieldvalue'];
                 $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductCustomField");
             }
         } else {
             $GLOBALS['CustomFields'] = GetLang('NA');
         }
         $GLOBALS['SNIPPETS']['TD1'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD1");
         $GLOBALS['SNIPPETS']['TD2'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD2");
         $GLOBALS['SNIPPETS']['TD3'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD3");
         $GLOBALS['SNIPPETS']['TD4'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD4");
         $GLOBALS['SNIPPETS']['TD5'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD5");
         $GLOBALS['SNIPPETS']['TD6'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD6");
         $GLOBALS['SNIPPETS']['TD7'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD7");
         $GLOBALS['SNIPPETS']['TD8'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD8");
         $GLOBALS['SNIPPETS']['TD9'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD9");
     }
     if (GetConfig('EnableProductReviews') == 0) {
         $GLOBALS['HideProductRating'] = "display: none;";
     }
     $output1 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR1");
     $output2 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR2");
     $output3 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR3");
     $output4 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR4");
     $output5 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR5");
     $output6 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR6");
     $output7 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR7");
     $output8 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR8");
     $output9 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR9");
     $output = $output1 . $output2 . $output3 . $output4 . $output9 . $output5 . $output6 . $output7 . $output8;
     $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
     $GLOBALS['SNIPPETS']['ComparisonList'] = $output;
 }
Ejemplo n.º 12
0
 public function _SetBrandData()
 {
     // Retrieve the query string variables. Can't use the $_GET array
     // because of SEO friendly links in the URL
     SetPGQVariablesManually();
     // Grab the page sort details
     $GLOBALS['URL'] = implode("/", $GLOBALS['PathInfo']);
     $this->SetSort();
     if (isset($_REQUEST['brand'])) {
         $brand = $_REQUEST['brand'];
     } else {
         if (isset($GLOBALS['PathInfo'][1])) {
             $brand = preg_replace('#\\.html\\??.*$#i', "", $GLOBALS['PathInfo'][1]);
         } else {
             $brand = '';
         }
     }
     $brand = MakeURLNormal($brand);
     // Get the link to the "all brands" page
     $GLOBALS['AllBrandsLink'] = BrandLink();
     // Get the Id of the brand
     $query = sprintf("select * from [|PREFIX|]brands where brandname='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($brand));
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         // Store the brand name
         $this->SetBrand($brand);
         $this->SetBrandName($row['brandname']);
         // Store the brand Id
         $this->SetId($row['brandid']);
         $this->SetBrandPageTitle($row['brandpagetitle']);
         // Store brand meta details
         $this->SetMetaKeywords($row['brandmetakeywords']);
         $this->SetMetaDesc($row['brandmetadesc']);
     }
     $this->SetNumProducts();
     $this->SetPage();
     $this->SetStart();
     $this->SetNumPages();
     // Load the products for the brand
     $this->LoadProductsForBrand();
 }
Ejemplo n.º 13
0
		private function ManageBannersGrid(&$numBanners)
		{
			$GLOBALS['BannerGrid'] = '';
			$GLOBALS['Nav'] = '';
			$searchURL = '';

			if (isset($_GET['searchQuery'])) {
				$query = $_GET['searchQuery'];
				$GLOBALS['Query'] = isc_html_escape($query);
				$searchURL .= '&amp;searchQuery='.urlencode($query);
			} else {
				$query = "";
				$GLOBALS['Query'] = "";
			}

			if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
				$sortOrder = 'desc';
			} else {
				$sortOrder = "asc";
			}

			$sortLinks = array(
				"Name" => "name",
				"Location" => "page",
				"Date" => "datecreated",
				"Status" => "status"
			);

			if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
				$sortField = $_GET['sortField'];
				SaveDefaultSortField("ManageBanners", $_REQUEST['sortField'], $sortOrder);
			}
			else {
				list($sortField, $sortOrder) = GetDefaultSortField("ManageBanners", "name", $sortOrder);
			}

			if (isset($_GET['page'])) {
				$page = (int)$_GET['page'];
			} else {
				$page = 1;
			}

			$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
			$GLOBALS['SortURL'] = $sortURL;

			// Get the results for the query
			$bannerResult = $this->_GetBannerList($query, $sortField, $sortOrder, $numBanners);

			if(!$numBanners) {
				return '';
			}

			$GLOBALS['SearchQuery'] = isc_html_escape($query);
			$GLOBALS['SortField'] = $sortField;
			$GLOBALS['SortOrder'] = $sortOrder;

			BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewBanners&amp;".$searchURL."&amp;page=".$page, $sortField, $sortOrder);


			$GLOBALS['NameSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=name&sortOrder=asc", $query);
			$GLOBALS['NameSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=name&sortOrder=desc", $query);

			$GLOBALS['LocationSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=page&sortOrder=asc", $query);
			$GLOBALS['LocationSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=page&sortOrder=desc", $query);

			$GLOBALS['DateSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=datecreated&sortOrder=asc", $query);
			$GLOBALS['DateSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=datecreated&sortOrder=desc", $query);

			$GLOBALS['StatusSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=status&sortOrder=asc", $query);
			$GLOBALS['StatusSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=status&sortOrder=desc", $query);

			while ($banner = $GLOBALS["ISC_CLASS_DB"]->Fetch($bannerResult)) {
				$GLOBALS['BannerId'] = (int) $banner['bannerid'];
				$GLOBALS['Name'] = isc_html_escape($banner['name']);

				$GLOBALS['Location'] = "";

				switch ($banner['page']) {
					case "home_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='../'>%s</a>", GetLang('BannerHomePage'));
						break;
					}
					case "category_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='%s'>%s %s</a>", CatLink($banner['catorbrandid'], $banner["location_name"]), $banner['name'], GetLang('BannerCategory'));
						break;
					}
					case "brand_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='%s'>%s %s</a>", BrandLink($banner['location_name']), $banner["location_name"], GetLang('ProductsPage'));
						break;
					}
					case "search_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='../search.php?mode=advanced'>%s</a>", GetLang('SearchResultsPage'));
						break;
					}
				}

				if ($banner['location'] == "top") {
					$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerTopOfPage'));
				}
				else {
					$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerBottomOfPage'));
				}

				$GLOBALS['Date'] = isc_date(GetConfig('ExportDateFormat'), $banner['datecreated']);

				if ($banner['status'] == 1) {
					$GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editBannerVisibility&amp;bannerId=%d&amp;visible=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToHideBanner'), $banner['bannerid']);
				}
				else {
					$GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editBannerVisibility&amp;bannerId=%d&amp;visible=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToShowBanner'), $banner['bannerid']);
				}

				$GLOBALS['BannerGrid'] .= $this->template->render('banner.manage.row.tpl');
			}
			return $this->template->render('banners.manage.grid.tpl');
		}
Ejemplo n.º 14
0
		public function SetPanelSettings()
		{
			$count = 0;
			$output = "";
			$products = array();

			$GLOBALS['BrandsMessage'] = '';

			// If we're showing the "All brands" page then we to display a list of all the brands
			if($GLOBALS['ISC_CLASS_BRANDS']->ShowingAllBrands()) {

				// Output sub-categories
				$GLOBALS['SNIPPETS']['SubBrands'] = "";
				$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]brands ORDER BY brandname ASC");

				if($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {

					// Check to see if we need to add in place holder images or if we are just displaying text
					if (!($rtn = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['ISC_CLASS_DB']->Query("SELECT COUNT(*) AS Total FROM [|PREFIX|]brands WHERE brandimagefile != ''"))) || !$rtn['Total']) {
						$useImages = false;
					} else {
						$useImages = true;
						if (GetConfig('BrandDefaultImage') !== '') {
							$defaultImage = GetConfig('ShopPath') . '/' . GetConfig('BrandDefaultImage');
						} else {
							$defaultImage = $GLOBALS['IMG_PATH'].'/BrandDefault.gif';
						}
					}

					for ($i=1; ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)); $i++) {
						$GLOBALS['SubBrandName'] = isc_html_escape($row['brandname']);
						$GLOBALS['SubBrandLink'] = BrandLink($row['brandname']);
						if ($useImages) {
							if ($row['brandimagefile'] !== '') {
								$GLOBALS['SubBrandImage'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $row['brandimagefile'];
							} else {
								$GLOBALS['SubBrandImage'] = $defaultImage;
							}

							$GLOBALS['ISC_CLASS_TEMPLATE']->assign('width', getConfig('BrandImageWidth'));
							$GLOBALS['ISC_CLASS_TEMPLATE']->assign('height', getConfig('BrandImageHeight') + 50);

							$GLOBALS['SNIPPETS']['SubBrands'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandItemImage");

							if ($i%GetConfig('BrandPerRow') === 0) {
								$GLOBALS['SNIPPETS']['SubBrands'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SubBrandDivider');
							}
						} else {
							$GLOBALS['SNIPPETS']['SubBrands'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandItem");
						}
					}

					if ($useImages) {
						$output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandsGrid");
					} else {
						$output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrands");
					}

					$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
					$GLOBALS['BrandsMessage'] = $output;

				} else {
					$GLOBALS['BrandsMessage'] = GetLang('ViewAllBrandsInstructions');
				}

				$GLOBALS['BrandProductListing'] = "<li>&nbsp;</li>";
				$GLOBALS['HideBrandProductListing'] = "none";
				return;
			}

			// Load the products into the reference array
			$GLOBALS['ISC_CLASS_BRANDS']->GetProducts($products);
			$GLOBALS['BrandProductListing'] = "";

			if($GLOBALS['BrandName'] == "") {
				// We're on the 'All Brands' page and the brands list is on the right
				$GLOBALS['ChooseBrandFromList'] = sprintf(GetLang('ChooseBrandFromList'), GetLang('Right'));
				$GLOBALS['BrandProductListing'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BrandMainPageMessage");
			}
			else {
				// Show products for a specific brand
				if(!GetConfig('ShowProductRating')) {
					$GLOBALS['HideProductRating'] = "display: none";
				}

				$GLOBALS['AlternateClass'] = '';
				foreach($products as $row) {
					$this->setProductGlobals($row);
					$GLOBALS['BrandProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BrandProductsItem");
				}

				if($GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() == 0) {
					// There are no products in this category
					$GLOBALS['BrandsMessage'] = GetLang('NoProductsInBrand');
					$GLOBALS['BrandProductListing'] = "<li>&nbsp;</li>";
					$GLOBALS['HideBrandProductListing'] = "none";
				}
			}
		}
    function SetPanelSettings()
    {
        $output = "";
        $all_makes = array('CHEVROLET', 'GMC', 'FORD', 'DODGE', 'TOYOTA', 'NISSAN', 'HONDA', 'JEEP', 'HYUNDAI', 'CHRYSLER', 'INFINITI', 'LEXUS');
        $colours = array('Red', 'Navy', 'Green', 'Brown', 'Black', 'Silver', 'Dark Gray', 'Tan', 'White');
        $prod_make = array();
        $prod_model = array();
        $prod_year = array();
        $prod_price = array();
        $prod_categoryid = array();
        $count_categoryid = array();
        $brand_id = array();
        $make_link = "";
        $model_link = "";
        $model_flag_link = 0;
        $submodel_link = "";
        $year_link = "";
        $sub_modelrow = array();
        $GLOBALS['SITEPATH'] = GetConfig('ShopPath');
        // Get the link to the "all brands" page
        $GLOBALS['AllBrandsLink'] = BrandLink();
        $params = $this->searchterms;
        if (empty($params)) {
            $params['dynfilters'] = array();
        }
        /*--- Here when brand series is searched directly , brand series is set in seesion to be accessed in other pages --- */
        if (isset($params['brand_series']) && !empty($params['brand_series'])) {
            $_SESSION['searchterms']['brand_series'] = $params['brand_series'];
        }
        // Build the search query using our terms & the fields we want
        $column_concat = " p.productid , p.prodcode , group_concat(DISTINCT c.categoryid separator '~') as categoryid, group_concat(DISTINCT prodbrandid separator '~') as prodbrandid ";
        $column_concat .= " , group_concat(DISTINCT v.prodmake separator '~') as prodmake , group_concat(DISTINCT v.prodmodel separator '~') as prodmodel , group_concat(DISTINCT v.prodsubmodel separator '~') as prodsubmodel , group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear ";
        if (isset($params['catuniversal']) && $params['catuniversal'] == 1) {
            // this condition has been added as universal category shd be shown only PQ's
            $column_names = $GLOBALS['p_cols'];
            for ($j = 0; $j < count($column_names); $j++) {
                $column_concat .= " , group_concat(DISTINCT " . $column_names[$j] . " separator '~') as  " . $column_names[$j];
            }
        } else {
            if (isset($params['make']) && !empty($params['make']) && (isset($params['model']) && !empty($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) && isset($params['year']) && !empty($params['year']) && isset($GLOBALS['ISC_SRCH_CATG_ID'])) {
                $column_names = array_merge($GLOBALS['v_cols'], $GLOBALS['p_cols']);
                for ($j = 0; $j < count($column_names); $j++) {
                    if (stristr($column_names[$j], 'VQbedsize')) {
                        $column_names[$j] = 'VQbedsize';
                    }
                    if (stristr($column_names[$j], 'VQcabsize')) {
                        $column_names[$j] = 'VQcabsize';
                    }
                    if (eregi('^(vq)', $column_names[$j])) {
                        // the below 2 cases are added for checking only in bedsize and cabsize
                        if ($column_names[$j] == 'VQbedsize' or $column_names[$j] == 'VQcabsize') {
                            if (strcasecmp($column_names[$j], 'VQbedsize') == 0) {
                                $column_concat .= " , group_concat( DISTINCT if( v.bedsize_generalname != '', v.bedsize_generalname, v.VQbedsize ) separator '~' ) as  " . $column_names[$j];
                            } else {
                                $column_concat .= " , group_concat( DISTINCT if( v.cabsize_generalname != '', v.cabsize_generalname, v.VQcabsize ) separator '~' ) as  " . $column_names[$j];
                            }
                        } else {
                            $column_concat .= " , group_concat(DISTINCT v." . $column_names[$j] . " separator '~') as  " . $column_names[$j];
                        }
                    } else {
                        if (eregi('^(pq)', $column_names[$j])) {
                            $column_concat .= " , group_concat(DISTINCT " . $column_names[$j] . " separator '~') as  " . $column_names[$j];
                        }
                    }
                }
            }
        }
        $searchQueries = BuildProductSearchQuery($this->searchterms);
        $searchQueries['query'] = str_replace('USE INDEX (categoryid)', 'USE INDEX (PRIMARY)', $searchQueries['query']);
        //$searchQueries['query'] = str_replace('temp.*',$column_concat,$searchQueries['query']);
        $searchQueries['query'] = str_replace($GLOBALS['srch_where'], $column_concat, $searchQueries['query']);
        $searchQueries['query'] .= " group by p.productid ";
        $Search_Result1 = $GLOBALS['ISC_CLASS_DB']->Query($searchQueries['query']);
        $numrows = $GLOBALS['ISC_CLASS_DB']->CountResult($Search_Result1);
        $flag = 0;
        // this flag is used to avoid executing query again and again for submodels
        $filterdata = array();
        $countfilterdata = array();
        $sku = array();
        $count_model['all']['count'] = 0;
        $sub_model_flag = 0;
        $sub_catg = "";
        if (!isset($params['model_flag']) || isset($params['model_flag']) && $params['model_flag'] == 1) {
            $model_flag_link = 1;
        }
        $strtocheck = '^(vq|pq)';
        if (isset($_REQUEST['sub_category'])) {
            $sub_catg = "&sub_category=" . $_REQUEST['sub_category'];
        }
        if (isset($params['brand_series'])) {
            $sub_catg .= "&brand_series=" . $params['brand_series'];
        }
        while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($Search_Result1)) {
            $temp_prod_year = array();
            $grp_make = explode("~", $row['prodmake']);
            $grp_model = explode("~", $row['prodmodel']);
            if ($row['prodsubmodel'] != '~') {
                $grp_submodel = explode("~", $row['prodsubmodel']);
            } else {
                $grp_submodel = "";
            }
            $grp_startyear = explode("~", $row['prodstartyear']);
            $grp_endyear = explode("~", $row['prodendyear']);
            $grp_brandid = explode("~", $row['prodbrandid']);
            $grp_categoryid = explode("~", $row['categoryid']);
            $columns = array_keys($row);
            foreach ($row as $key => $val) {
                if (eregi($strtocheck, $key)) {
                    $grp_dyn = explode('~', $row[$key]);
                    for ($g = 0; $g < count($grp_dyn); $g++) {
                        $val = strtolower($grp_dyn[$g]);
                        if (!empty($val)) {
                            $filter_value = explode(";", $val);
                            for ($k = 0; $k < count($filter_value); $k++) {
                                $val = $filter_value[$k];
                                if (!isset($filterdata[$key])) {
                                    $filterdata[$key][] = $val;
                                    $countfilterdata[$key][$val]['count'] = 1;
                                } else {
                                    if (!in_array($val, $filterdata[$key])) {
                                        $filterdata[$key][] = $val;
                                        $countfilterdata[$key][$val]['count'] = 1;
                                    } else {
                                        $countfilterdata[$key][$val]['count']++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $prod_id[] = $row['productid'];
            for ($g = 0; $g < count($grp_brandid); $g++) {
                if ($grp_brandid[$g] != 0) {
                    $brand_id[] = $grp_brandid[$g];
                }
            }
            for ($g = 0; $g < count($grp_categoryid); $g++) {
                if ($grp_categoryid[$g] != "") {
                    if (!in_array($grp_categoryid[$g], $prod_categoryid)) {
                        $prod_categoryid[] = $grp_categoryid[$g];
                        $count_categoryid[$grp_categoryid[$g]]['count'] = 1;
                    } else {
                        $count_categoryid[$grp_categoryid[$g]]['count']++;
                    }
                }
            }
            for ($g = 0; $g < count($grp_make); $g++) {
                if ($grp_make[$g] != '') {
                    $product_make = strtoupper($grp_make[$g]);
                    if ($product_make != "NON-SPEC VEHICLE") {
                        // this condition is addded not to show "NON-SPEC VEHICLE" in list
                        if (!in_array($product_make, $prod_make)) {
                            $prod_make[] = $product_make;
                            $count_make[$product_make]['count'] = 1;
                        } else {
                            $count_make[$product_make]['count']++;
                        }
                    }
                }
            }
            if (isset($params['submodel']) && !empty($params['submodel'])) {
                $sub_model_flag = 1;
                if (!in_array($params['submodel'], $prod_model)) {
                    $prod_model[] = $params['submodel'];
                    $count_model[$params['submodel']]['count'] = 1;
                } else {
                    $count_model[$params['submodel']]['count']++;
                }
            } else {
                if (isset($params['model']) && !empty($params['model']) && $model_flag_link == 1) {
                    for ($g = 0; $g < count($grp_submodel); $g++) {
                        if (!empty($grp_submodel[$g])) {
                            $sub_model_flag = 1;
                            if (!in_array($grp_submodel[$g], $prod_model)) {
                                $prod_model[] = $grp_submodel[$g];
                                $count_model[$grp_submodel[$g]]['count'] = 1;
                            } else {
                                $count_model[$grp_submodel[$g]]['count']++;
                            }
                        } else {
                            if (empty($grp_submodel[$g])) {
                                if (!in_array('ALL', $prod_model)) {
                                    $prod_model[] = 'ALL';
                                    $count_model['ALL']['count'] = 1;
                                } else {
                                    $count_model['ALL']['count']++;
                                }
                            }
                        }
                    }
                } else {
                    for ($g = 0; $g < count($grp_model); $g++) {
                        if (strtolower($grp_model[$g]) != 'all') {
                            // this condition is added not to show "All" in list
                            $sub_model_flag = 1;
                            if (!in_array($grp_model[$g], $prod_model)) {
                                $prod_model[] = $grp_model[$g];
                                $count_model[$grp_model[$g]]['count'] = 1;
                            } else {
                                $count_model[$grp_model[$g]]['count']++;
                            }
                        }
                    }
                }
            }
            for ($g = 0; $g < count($grp_startyear); $g++) {
                $prod_start_year = $grp_startyear[$g];
                $prod_end_year = $grp_endyear[$g];
                if (empty($prod_end_year)) {
                    $prod_end_year = $prod_start_year;
                }
                if (strtolower($prod_start_year) != "all") {
                    // this condition is addded not to show "All" in list
                    if (is_numeric($prod_start_year) && is_numeric($prod_end_year)) {
                        $prod_year_diff = $prod_end_year - $prod_start_year;
                    }
                    if (!is_numeric($prod_start_year) && !is_numeric($prod_end_year)) {
                        if (!in_array($prod_start_year, $temp_prod_year)) {
                            $temp_prod_year[] = $prod_start_year;
                        }
                    } else {
                        if (isset($params['year']) && !empty($params['year'])) {
                            if (in_array($params['year'], $prod_year)) {
                                $count_year[$params['year']]['count']++;
                            } else {
                                $prod_year[] = $params['year'];
                                $count_year[$params['year']]['count'] = 1;
                            }
                        } else {
                            for ($i = 0; $i <= $prod_year_diff; $i++) {
                                $actual_year = $prod_start_year + $i;
                                if (!in_array($actual_year, $temp_prod_year)) {
                                    $temp_prod_year[] = $actual_year;
                                }
                            }
                        }
                    }
                }
            }
            for ($k = 0; $k < count($temp_prod_year); $k++) {
                if (!in_array($temp_prod_year[$k], $prod_year)) {
                    $prod_year[] = $temp_prod_year[$k];
                    $count_year[$temp_prod_year[$k]]['count'] = 1;
                } else {
                    $count_year[$temp_prod_year[$k]]['count']++;
                }
            }
        }
        $prod_make_new = array_unique($prod_make);
        asort($prod_make_new);
        $prod_model_new = array_unique($prod_model);
        asort($prod_model_new);
        $prod_year_new = array_unique($prod_year);
        arsort($prod_year_new);
        $srch_qry = isset($params['search_query']) ? $params['search_query'] : (isset($params['search_query_adv']) ? $params['search_query_adv'] : '');
        $srch_qry = urlencode($srch_qry);
        $brand_id = array_unique($brand_id);
        $brand_id = array_values($brand_id);
        if (isset($params['make']) && !empty($params['make'])) {
            $make_link = "&make=" . urlencode($params['make']);
        }
        if (isset($params['year']) && !empty($params['year'])) {
            $year_link = "&year=" . $params['year'];
        }
        if (isset($params['model']) && !empty($params['model'])) {
            $model_link = "&model=" . urlencode($params['model']);
        }
        if (isset($params['model_flag']) && $params['model_flag'] == 0) {
            $model_link .= "&model_flag=0";
        }
        if (isset($params['submodel']) && !empty($params['submodel'])) {
            $submodel_link = "&submodel=" . urlencode($params['submodel']);
        }
        if (isset($params['partnumber'])) {
            $_GET['partnumber'] = $params['partnumber'];
        }
        $query_string_array = $_GET;
        if (isset($params['make'])) {
            $query_string_array['make'] = $params['make'];
        }
        if (isset($params['model'])) {
            $query_string_array['model'] = $params['model'];
        }
        if (isset($params['model_flag']) && $params['model_flag'] == 0) {
            $query_string_array['model_flag'] = $params['model_flag'];
        }
        if (isset($params['year'])) {
            $query_string_array['year'] = $params['year'];
        }
        foreach ($params['dynfilters'] as $key => $value) {
            $query_string_array[$key] = $value;
        }
        $query_string_array['search_query'] = $srch_qry;
        unset($query_string_array['page'], $query_string_array['search_key'], $query_string_array['x'], $query_string_array['y'], $query_string_array['sortby'], $query_string_array['orderby'], $query_string_array['change'], $query_string_array['product'], $query_string_array['refer']);
        $mmy_string_array = $query_string_array;
        unset($mmy_string_array['make'], $mmy_string_array['model'], $mmy_string_array['submodel'], $mmy_string_array['year'], $mmy_string_array['search_query']);
        $mmy_string_new1 = "";
        foreach ($mmy_string_array as $mmy_key => $mmy_val) {
            $mmy_string_new1 .= "&" . $mmy_key . "=" . $mmy_val;
        }
        $dyn_filter = "";
        // this is the main variable which is used for assigning to the global variable
        $dyn_top = "";
        // this is the variable which will remain on top of the filters
        $dyn_bottom = "";
        // this is the variable which will remain at bottom of the filters
        $dyn_flag = 0;
        // this is the variable which will check which are at top or bottom in the filters, 0 for top and 1 for bottom
        if (isset($params['make']) || isset($params['model']) && $model_flag_link == 1 || isset($params['year'])) {
            $mmy_clear_links = $this->path . "/search.php?search_query=" . urlencode($params['search_query']);
            if (isset($params['brand'])) {
                $mmy_clear_links .= "&brand=" . $params['brand'];
            }
            $GLOBALS['DynMsg'] = "<a href='" . $mmy_clear_links . "&change=1'>Clear my Vehicle</a>";
            $GLOBALS['RemoveBackgroundImage'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("RemoveBgImage");
        }
        if (isset($params['make']) && (isset($params['model']) && $model_flag_link == 1) && isset($params['year']) && !isset($_REQUEST['change'])) {
            // if MMY is selected
            $GLOBALS['MyVehicleAreaHeader'] = $params['year'] . " " . $params['make'] . " " . $params['model'];
            $GLOBALS['DynmenuFilter'] = "";
        } else {
            $GLOBALS['MyVehicleAreaHeader'] = "Choose My Vehicle";
            $GLOBALS['DynmenuFilter'] = "";
        }
        /*-------- Year -----------------------------------------*/
        $GLOBALS['MouseoverFn'] = "this.style.cursor='pointer'";
        $extra_year = "";
        //if( !empty($make_link) || !empty($year_link) || !empty($model_link) ) {
        if (empty($year_link) || !empty($year_link)) {
            $GLOBALS['dynid'] = "prod_year";
            $GLOBALS['Dynmainmenu'] = "Year";
            $output2 = "";
            $year_counter = 1;
            if (count($prod_year_new) > 0) {
                foreach ($prod_year_new as $key => $value) {
                    if (!isset($_REQUEST['change'])) {
                        // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry;
                    } else {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}";
                    }
                    if (!empty($make_link)) {
                        $GLOBALS['BrandLink'] .= $make_link;
                    }
                    if (!empty($model_link)) {
                        $GLOBALS['BrandLink'] .= $model_link;
                    }
                    if (!empty($submodel_link) && isset($_REQUEST['submodel'])) {
                        $GLOBALS['BrandLink'] .= $submodel_link;
                    }
                    if (!empty($year_link)) {
                        $GLOBALS['BrandLink'] .= $year_link;
                    } else {
                        $GLOBALS['BrandLink'] .= "&year=" . $value;
                    }
                    $GLOBALS['BrandLink'] .= $mmy_string_new1;
                    $GLOBALS['BrandLink'] .= $sub_catg;
                    $GLOBALS['BrandName'] = isc_html_escape($value);
                    $GLOBALS['BrandCount'] = $count_year[$value]['count'];
                    if (!empty($year_link)) {
                        if ($GLOBALS['BrandName'] == 'ALL' && $GLOBALS['BrandName'] != $params['year']) {
                            $GLOBALS['BrandName'] = $params['year'];
                            //$output2 .= "<li>".$params['year']."</li>";
                            $output2 .= "<li></li>";
                        } else {
                            $GLOBALS['BrandName'] = $value;
                            //$output2 .= "<li>$value</li>";
                            $output2 .= "<li></li>";
                        }
                        $dyn_flag = 1;
                        break;
                        // break has been added to display only single listing.
                    } else {
                        $dyn_flag = 0;
                        if ($year_counter < 11) {
                            $output2 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter3");
                            $year_counter++;
                        } else {
                            $extra_year .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter3");
                        }
                    }
                }
            } else {
                if (isset($params['year'])) {
                    $dyn_flag = 1;
                    $GLOBALS['BrandName'] = $params['year'];
                    $output2 .= "<li>" . $params['year'] . "</li>";
                }
            }
            $output2 = "<ul>" . $output2 . "</ul>";
            /* the below code is used to apply more link if records exceed 10 */
            if ($year_counter > 11) {
                $GLOBALS['FilterID'] = "year";
                $GLOBALS['ExtraValues'] = $extra_year;
                $output2 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
            }
            $output2 = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output2, $GLOBALS['SNIPPETS']);
            //if( !empty($_REQUEST['year']) && !empty($year_link) ) {
            $links_year = $srch_qry;
            if (!empty($year_link)) {
                $links_year .= $year_link;
                if (!empty($make_link)) {
                    $links_year .= $make_link;
                }
                if (!empty($model_link) && isset($_REQUEST['model'])) {
                    $links_year .= $model_link;
                }
                if (!empty($submodel_link) && isset($_REQUEST['submodel'])) {
                    $links_year .= $submodel_link;
                }
            }
            if (isset($params['brand'])) {
                $links_year .= "&brand=" . $params['brand'];
            }
            if (isset($params['brand_series'])) {
                $links_year .= "&brand_series=" . $params['brand_series'];
            }
            /* this below lines are not to display the year when clear is clicked */
            if (isset($_REQUEST['change'])) {
                $GLOBALS['BrandName'] = "";
            }
            if ($dyn_flag == 1 || isset($_REQUEST['change'])) {
                $str = "search_query=" . $links_year . $sub_catg . "&column=year";
                $GLOBALS['Dyndisplay1'] = "block";
                $GLOBALS['Dyndisplay'] = "none";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                //$GLOBALS['DynFilterArrow'] .= "&nbsp;&nbsp;&nbsp;".$GLOBALS['BrandName'];
                $GLOBALS['DynmenuFilter1'] = $output2;
                $GLOBALS['DynmenuFilter'] = "";
                $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
            } else {
                $GLOBALS['BrandName'] = "";
                $GLOBALS['Dyndisplay1'] = "none";
                $GLOBALS['Dyndisplay'] = "block";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter'] = $output2;
                $GLOBALS['DynmenuFilter1'] = "";
                $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')";
                if (empty($year_link)) {
                    $GLOBALS['DynmenuFilter'] = "";
                    $str = "search_query=" . $links_year . $sub_catg . "&column=year";
                    $GLOBALS['JSfunction'] .= ";getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}')";
                }
            }
            $GLOBALS['mmyid'] = "mmy_year";
            $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch");
            $dyn_filter = $dyn_output;
            //$GLOBALS['SNIPPETS']['SideProductFilter3'] = $output2;
        } else {
            $GLOBALS['HideSideProductFiltersPanelYear'] = "none";
        }
        if ($dyn_flag == 1 && !isset($_REQUEST['change'])) {
            $dyn_top .= $dyn_filter;
        } else {
            $dyn_top .= $dyn_filter;
        }
        $dyn_filter = "";
        /*-------- Make -----------------------------------------*/
        $GLOBALS['dynid'] = "prod_make";
        $GLOBALS['Dynmainmenu'] = "Make";
        if (isset($make_link) && !empty($make_link)) {
            if (count($prod_make_new) > 0) {
                foreach ($prod_make_new as $key => $value) {
                    if (!isset($_REQUEST['change'])) {
                        // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value;
                    } else {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value;
                    }
                    if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) {
                        $GLOBALS['BrandLink'] .= "&model=";
                    }
                    if (isset($_REQUEST['year'])) {
                        $GLOBALS['BrandLink'] .= "&year=" . $_REQUEST['year'];
                    }
                    $GLOBALS['BrandLink'] .= $sub_catg;
                    $GLOBALS['BrandName'] = isc_html_escape($value);
                    /* this below patch is temporary used when categories with make 'NON-SPEC VEHICLE' are used when searched by redefine category */
                    if (isset($params['catuniversal']) && $params['catuniversal'] == 1 || $GLOBALS['BrandName'] == 'NON-SPEC VEHICLE' && $GLOBALS['BrandName'] != $params['make']) {
                        $GLOBALS['BrandName'] = $params['make'];
                    }
                    if (isset($count_make[$value]['count'])) {
                        $GLOBALS['BrandCount'] = $count_make[$value]['count'];
                    } else {
                        $GLOBALS['BrandCount'] = 0;
                    }
                    $output .= "<li></li>";
                    break;
                    // break has been added to display only single listing.
                }
            } else {
                if (isset($params['make'])) {
                    $GLOBALS['BrandName'] = $params['make'];
                    $output .= "<li></li>";
                    //                     $output .= "<li>".$_REQUEST['make']."</li>";
                }
            }
            $dyn_flag = 1;
            $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
        } else {
            $dyn_flag = 0;
            $temp_arr = array_diff($prod_make_new, $all_makes);
            $temp_count_make = "";
            $temp_no_count_make = "";
            $display_count = 1;
            foreach ($all_makes as $key => $value) {
                if (!isset($_REQUEST['change'])) {
                    // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                    $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value;
                } else {
                    $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value;
                }
                if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) {
                    $GLOBALS['BrandLink'] .= "&model=";
                }
                if (isset($params['year'])) {
                    $GLOBALS['BrandLink'] .= "&year=" . $params['year'];
                }
                $GLOBALS['BrandLink'] .= $mmy_string_new1;
                $GLOBALS['BrandLink'] .= $sub_catg;
                $GLOBALS['BrandName'] = isc_html_escape($value);
                if (isset($count_make[$value]['count'])) {
                    $GLOBALS['BrandCount'] = $count_make[$value]['count'];
                } else {
                    $GLOBALS['BrandCount'] = 0;
                }
                /*if($GLOBALS['BrandCount'] == 0)
                  $temp_no_count_make .= "<li>$GLOBALS[BrandName] ($GLOBALS[BrandCount])</li>";*/
                if ($GLOBALS['BrandCount'] != 0) {
                    if ($display_count < 13) {
                        // this condiditon is applied to avoid long listing of make lsit
                        $temp_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    } else {
                        $temp_no_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    }
                    $display_count++;
                    //$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                }
            }
            if (count($temp_arr) > 0) {
                foreach ($temp_arr as $key => $value) {
                    if (!isset($_REQUEST['change'])) {
                        // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value;
                    } else {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value;
                    }
                    if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) {
                        $GLOBALS['BrandLink'] .= "&model=";
                    }
                    if (isset($params['year'])) {
                        $GLOBALS['BrandLink'] .= "&year=" . $params['year'];
                    }
                    $GLOBALS['BrandName'] = isc_html_escape($value);
                    if (isset($count_make[$value]['count'])) {
                        $GLOBALS['BrandCount'] = $count_make[$value]['count'];
                    } else {
                        $GLOBALS['BrandCount'] = 0;
                    }
                    $GLOBALS['BrandLink'] .= $mmy_string_new1;
                    $GLOBALS['BrandLink'] .= $sub_catg;
                    /*if($GLOBALS['BrandCount'] == 0)
                      $temp_no_count_make .= "<li>$GLOBALS[BrandName] ($GLOBALS[BrandCount])</li>";*/
                    if ($GLOBALS['BrandCount'] != 0) {
                        if ($display_count < 13) {
                            // this condiditon is applied to avoid long listing of make list
                            $temp_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                        } else {
                            $temp_no_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                        }
                        $display_count++;
                    }
                }
            }
            $output = "<ul>{$temp_count_make}</ul>";
            if ($display_count > 13) {
                $GLOBALS['FilterID'] = "make";
                $GLOBALS['ExtraValues'] = $temp_no_count_make;
                $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                //$output .= "<ul class='more'><li><a href=\"javascript:onclick=show_hide('make')\" id='make_more'>More...</a></li></ul>";
            }
            $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
        }
        /* this below lines are not to display the make when clear is clicked */
        if (isset($_REQUEST['change'])) {
            $GLOBALS['BrandName'] = "";
        }
        if ($dyn_flag == 1 || isset($_REQUEST['change'])) {
            //$str = "search_query=".$srch_qry.$make_link."&model=".$year_link.$sub_catg."&column=make";
            $GLOBALS['Dyndisplay1'] = "block";
            $GLOBALS['Dyndisplay'] = "none";
            $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
            //$GLOBALS['DynFilterArrow'] .= "&nbsp;&nbsp;&nbsp;".$GLOBALS['BrandName'];
            $GLOBALS['DynmenuFilter1'] = "<ul>" . $output . "</ul>";
            $GLOBALS['DynmenuFilter'] = "";
            //$GLOBALS['JSfunction'] = "getvalueswithajax('".$GLOBALS['dynid']."','$str');checkanimate('".$GLOBALS['dynid']."')";
            //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
        } else {
            $GLOBALS['BrandName'] = "";
            $GLOBALS['Dyndisplay1'] = "none";
            $GLOBALS['Dyndisplay'] = "block";
            $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
            $GLOBALS['DynmenuFilter'] = $output;
            $GLOBALS['DynmenuFilter1'] = "";
            //$GLOBALS['JSfunction'] = "checkanimate('".$GLOBALS['dynid']."')";
            if (empty($make_link)) {
                $GLOBALS['DynmenuFilter'] = "";
            }
        }
        $str = "search_query=" . $srch_qry . $make_link . "&model=" . $year_link . $sub_catg . "&column=make";
        if (isset($params['brand'])) {
            $str .= "&brand=" . $params['brand'];
        }
        if (isset($params['brand_series'])) {
            $str .= "&brand_series=" . $params['brand_series'];
        }
        $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
        $GLOBALS['mmyid'] = "mmy_make";
        $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch");
        $dyn_filter = $dyn_output;
        if ($dyn_flag == 1 && !isset($_REQUEST['change'])) {
            $dyn_top .= $dyn_filter;
        } else {
            $dyn_top .= $dyn_filter;
        }
        $dyn_filter = "";
        //$GLOBALS['SNIPPETS']['SideProductFilter1'] = $output;
        /*-------- Model -----------------------------------------*/
        if (!empty($make_link) || !empty($model_link)) {
            $GLOBALS['dynid'] = "prod_model";
            $GLOBALS['Dynmainmenu'] = 'Model';
            $output1 = "";
            $display_count = 1;
            $extra = "";
            if (count($prod_model_new) > 0 && $sub_model_flag == 1 && (!isset($params['catuniversal']) || $params['catuniversal'] == 0)) {
                $dyn_flag = 0;
                foreach ($prod_model_new as $key => $value) {
                    if (!empty($model_link) && $model_flag_link == 1) {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . $model_link . "&submodel=" . urlencode($value);
                    } else {
                        $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&model=" . urlencode($value);
                    }
                    if (!empty($make_link)) {
                        $GLOBALS['BrandLink'] .= $make_link;
                    }
                    if (!empty($model_link) && !isset($_REQUEST['model'])) {
                        // when searched " chevy silverado " and also to revert back to list of silverados
                        $GLOBALS['BrandLink'] .= "&list=" . $params['model'];
                    }
                    if (!empty($year_link)) {
                        $GLOBALS['BrandLink'] .= $year_link;
                    }
                    $mmy_string_new1 = str_ireplace('&model_flag=0', '', $mmy_string_new1);
                    $GLOBALS['BrandLink'] .= $mmy_string_new1;
                    $GLOBALS['BrandLink'] .= $sub_catg;
                    $GLOBALS['BrandName'] = isc_html_escape($value);
                    $GLOBALS['BrandCount'] = $count_model[$value]['count'];
                    if (isset($_REQUEST['submodel']) && !empty($_REQUEST['submodel'])) {
                        $dyn_flag = 1;
                        $GLOBALS['BrandName'] = $_REQUEST['submodel'];
                        //$output1 .= "<li>$_REQUEST[submodel]</li>";
                        $output1 .= "<li></li>";
                    } else {
                        if ($display_count < 11) {
                            $output1 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter2");
                        } else {
                            $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter2");
                        }
                        $display_count++;
                    }
                }
                /*if(count($prod_model_new) > 1 && isset($_REQUEST['model']) && !empty($_REQUEST['model']))
                  $output1 .= "<li><a href='".$GLOBALS['BrandLink']."'>ALL</a> (".$count_model['all']['count'].")</li>";*/
                $output1 = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output1, $GLOBALS['SNIPPETS']);
            } else {
                $dyn_flag = 1;
                $GLOBALS['BrandName'] = "";
                if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) {
                    $GLOBALS['BrandName'] = strtoupper($params['model']);
                    //$output1 = "<li>".strtoupper($_REQUEST['model'])."</li>";
                    $output1 = "<li></li>";
                }
            }
            $output1 = "<ul>" . $output1 . "</ul>";
            if ($display_count > 11) {
                $GLOBALS['FilterID'] = "model";
                $GLOBALS['ExtraValues'] = $extra;
                $output1 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                //$output .= "<ul class='more'><li><a href=\"javascript:onclick=show_hide('make')\" id='make_more'>More...</a></li></ul>";
            }
            $links = "";
            //if( ( !empty($model_link) || !empty($submodel_link) )) {
            $links = $srch_qry;
            if (isset($make_link)) {
                $links .= $make_link;
            }
            if (isset($params['year'])) {
                $links .= "&year=" . $params['year'];
            }
            if (!empty($submodel_link)) {
                // only shwing submodel
                $links .= $model_link . $submodel_link;
            } else {
                if (isset($_REQUEST['list'])) {
                    // when searched with "chevy silverado", silverado is auto selected as model. For that list is passed as paramater.
                    $links .= "";
                } else {
                    if (isset($_REQUEST['model']) && !empty($_REQUEST['model'])) {
                        // submodel listing page
                        $links .= $model_link;
                    }
                }
            }
            /*else {
                  $links .= "&model="; 
                  $links .= "&year="; 
              }*/
            $links .= $sub_catg;
            if (isset($params['brand'])) {
                $links .= "&brand=" . $params['brand'];
            }
            if (isset($params['brand_series'])) {
                $links .= "&brand_series=" . $params['brand_series'];
            }
            if (!empty($submodel_link)) {
                $links .= "&column=submodel";
            } else {
                $links .= "&column=model";
            }
            //*$output1 .= "<li><a class='thickbox' href='redefine_filters.php?search_query=".$links."'><b>Redefine Search...</b></a></li>";
            //}
            /* this below lines are not to display the make when clear is clicked */
            if (isset($_REQUEST['change'])) {
                $GLOBALS['BrandName'] = "";
            }
            if ($dyn_flag == 1 || isset($_REQUEST['change'])) {
                //*$str = "search_query=".$links;
                $GLOBALS['Dyndisplay1'] = "block";
                $GLOBALS['Dyndisplay'] = "none";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                //$GLOBALS['DynFilterArrow'] .= "&nbsp;&nbsp;&nbsp;".$GLOBALS['BrandName'];
                $GLOBALS['DynmenuFilter1'] = $output1;
                $GLOBALS['DynmenuFilter'] = "";
                //*$GLOBALS['JSfunction'] = "getvalueswithajax('".$GLOBALS['dynid']."','$str');checkanimate('".$GLOBALS['dynid']."')";
                //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            } else {
                $GLOBALS['BrandName'] = "";
                $GLOBALS['Dyndisplay1'] = "none";
                $GLOBALS['Dyndisplay'] = "block";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                //*$GLOBALS['DynmenuFilter'] = $output1;
                $GLOBALS['DynmenuFilter1'] = "";
                //*$GLOBALS['JSfunction'] = "checkanimate('".$GLOBALS['dynid']."')";
            }
            $str = "search_query=" . $links;
            $GLOBALS['DynmenuFilter'] = "";
            $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
            $GLOBALS['mmyid'] = "mmy_model";
            $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch");
            //$dyn_filter .=  $output1.$filter3;
            $dyn_filter = $dyn_output;
            //$GLOBALS['SNIPPETS']['SideProductFilter2'] = $output1;
        } else {
            $GLOBALS['mousedefaultpointer'] = "mousedefaultpointer";
            $GLOBALS['mmyid'] = "mmy_model";
            $GLOBALS['dynid'] = "prod_model";
            $GLOBALS['Dynmainmenu'] = 'Model';
            $GLOBALS['DynmenuFilter'] = "";
            //$GLOBALS['JSfunction'] = "checkanimate('".$GLOBALS['dynid']."')";
            $GLOBALS['JSfunction'] = "";
            $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch");
            $dyn_filter = $dyn_output;
            //$GLOBALS['HideSideProductFiltersPanelModel'] = "none";
        }
        if ($dyn_flag == 1 && !isset($_REQUEST['change'])) {
            $dyn_top .= $dyn_filter;
        } else {
            $dyn_top .= $dyn_filter;
        }
        $dyn_filter = "";
        $filter1 = <<<P1
    <div class="Block BrandList Moveable" id="SideProductFilters" style="">
P1;
        $filter2 = <<<P1
       <div class="BlockContent">
        <ul>
P1;
        $filter3 = <<<P3
        </ul>
        </div>                
        </div>
P3;
        $GLOBALS['MyVehicleArea'] = $dyn_top;
        $GLOBALS['MyVehicleArea'] .= "<p id='fit'>Guaranteed to Fit Your Vehicle!</p>";
        if (isset($GLOBALS['DynMsg'])) {
            $GLOBALS['MyVehicleArea'] .= "<ul id='modifyvehicle'><li>" . $GLOBALS['DynMsg'] . "</li></ul>";
        }
        $dyn_top = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleArea");
        /************** Category Listing ********************/
        $str = "search_query=" . $srch_qry . $make_link . $model_link . $year_link . "&column=categories";
        $str .= isset($params['brand']) ? "&brand=" . $params['brand'] : '';
        $str .= isset($GLOBALS['ISC_SRCH_CATG_NAME']) ? "&catg_name=" . $GLOBALS['ISC_SRCH_CATG_NAME'] : '';
        $dyn_top .= $this->GetCategoryListing($prod_categoryid, $count_categoryid, $str);
        /*------------ Brand Filter --------------------*/
        if (count($brand_id) > 0 || isset($params['brand'])) {
            $title = "<h2>Brand</h2>";
            //$dyn_filter .=  $filter1.$title.$filter2;
            $brand_link = "";
            $GLOBALS['dynid'] = "dyn_brand";
            $GLOBALS['Dynmainmenu'] = "Brand";
            $count_brand = 1;
            $extra = "";
            $brand_string_array = $query_string_array;
            unset($brand_string_array['brand'], $brand_string_array['brand_series'], $brand_string_array['search_query']);
            $brand_string_new1 = "";
            foreach ($brand_string_array as $br_key => $br_val) {
                $brand_string_new1 .= "&" . $br_key . "=" . urlencode($br_val);
            }
            if (isset($params['brand']) && !empty($params['brand'])) {
                $dyn_flag = 1;
                $brand_query = "select brandname from [|PREFIX|]brands where brandid = " . $params['brand'];
                $brand_result = $GLOBALS['ISC_CLASS_DB']->Query($brand_query);
                $brand_row = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_result);
                $dyn_filter .= <<<P2
        <li><img src='{$this->path}/templates/default/images/check.gif'>&nbsp;&nbsp;{$brand_row['brandname']}</li>
P2;
                if (strtolower($brand_row['brandname']) == strtolower(urldecode($srch_qry))) {
                    // if searched only by brand
                    $brandclearurl = "{$this->path}/search.php?search_query=brands";
                    $str = "search_query=";
                } else {
                    // if searched with other combinations
                    $search_query = trim(str_ireplace($brand_row['brandname'], '', urldecode($srch_qry)));
                    $brandclearurl = "{$this->path}/search.php?search_query=" . urlencode($search_query);
                    $str = "search_query=" . urlencode($search_query);
                }
                $str .= $brand_string_new1 . "&brand=" . $params['brand'] . "&column=prodbrandid";
                if (!empty($brand_string_new1)) {
                    $brandclearurl .= $brand_string_new1;
                }
                $GLOBALS['ClearURL'] = "<a href='{$brandclearurl}'>Clear</a>";
                //$dyn_filter .= "<li><a class='thickbox' href='redefine_filters.php?search_query=".$srch_qry.$brand_string_new1."&brand=&column=prodbrandid'><b>Redefine Search...</b></a></li>";
            } else {
                $dyn_flag = 0;
                $brand_query = "select brandid , brandname from [|PREFIX|]brands where brandid in ( " . implode(",", $brand_id) . " ) order by brandname asc ";
                $brand_result = $GLOBALS['ISC_CLASS_DB']->Query($brand_query);
                while ($brand_row = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_result)) {
                    $GLOBALS['BrandName'] = $brand_row['brandname'];
                    $search_query = $srch_qry;
                    if (urldecode($srch_qry) == 'brands' || urldecode($srch_qry) == 'categories') {
                        $search_query = urlencode($GLOBALS['BrandName']);
                    }
                    $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$search_query}{$brand_string_new1}&brand=" . $brand_row['brandid'];
                    if ($count_brand < 11) {
                        $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    } else {
                        $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1");
                    }
                    $count_brand++;
                }
                $dyn_filter = "<ul>" . $dyn_filter . "</ul>";
                if ($count_brand > 11) {
                    $GLOBALS['FilterID'] = "brand";
                    $GLOBALS['ExtraValues'] = $extra;
                    $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                }
                //$GLOBALS['ClearURL'] = "$this->path/search.php?search_query=$srch_qry$brand_string_new1";
                $GLOBALS['ClearURL'] = "";
            }
            if ($dyn_flag == 1) {
                //$str = "search_query=".$links.$model_link."&column=model";
                $GLOBALS['Dyndisplay1'] = "showlist";
                $GLOBALS['Dyndisplay'] = "hidelist";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter1'] = $dyn_filter;
                $GLOBALS['DynmenuFilter'] = "";
                $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
                //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
            } else {
                $GLOBALS['Dyndisplay1'] = "hidelist";
                $GLOBALS['Dyndisplay'] = "showlist";
                $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif";
                $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                $GLOBALS['DynmenuFilter'] = $dyn_filter;
                $GLOBALS['DynmenuFilter1'] = "";
                $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')";
            }
            $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter");
            $dyn_filter = $dyn_output;
            if ($dyn_flag == 1) {
                $dyn_bottom .= $dyn_filter;
            } else {
                $dyn_top .= $dyn_filter;
            }
            $dyn_filter = "";
        }
        /*-------- Other Filters -----------------------------------------*/
        if (!empty($make_link) && (!empty($model_link) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) && !empty($year_link) && ($numrows > 0 || isset($_REQUEST['GO']) && $numrows > 0) && isset($GLOBALS['ISC_SRCH_CATG_ID'])) {
            //    include('includes/display/ProdDynamicFilters.php');
            $map_names = array();
            $filter_names = "select * from [|PREFIX|]qualifier_names";
            $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names);
            while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) {
                if ($filter_row['display_names'] != '') {
                    $map_names[$filter_row['column_name']]['name'] = $filter_row['display_names'];
                }
                $map_names[$filter_row['column_name']]['qid'] = $filter_row['qid'];
            }
            $query_string_new = $this->path . "/search.php?";
            //$dyn_filter = "";
            for ($u = 0; $u < count($columns); $u++) {
                // loop for the filters . Here columns are the filters.
                if (eregi('^(vq|pq)', $columns[$u])) {
                    // checking whether the name of the column starts with vq or pq
                    if (isset($filterdata[$columns[$u]]) && count($filterdata[$columns[$u]]) > 0) {
                        $filter_var = array('vq', 'pq');
                        $title = ucfirst(str_ireplace($filter_var, "", $columns[$u]));
                        $Qualifier_id = $map_names[$columns[$u]]['qid'];
                        $GLOBALS['CategoryId'] = isset($_REQUEST['sub_category']) ? $_REQUEST['sub_category'] : $GLOBALS['ISC_SRCH_CATG_ID'];
                        $this->GetAssocDetails($GLOBALS['CategoryId'], $Qualifier_id, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue);
                        $qvalue_mapping_array = $OwnAssoc;
                        $GLOBALS['dynid'] = "dyn" . ($u + 1);
                        //$GLOBALS['Dynmainmenu'] = $title;
                        $dyn_filter = "";
                        $extra = "";
                        // this is used to hide the values if exceed 10
                        $count_pqvq = 1;
                        //$dyn_filter .=  $filter1.$title.$filter2;
                        for ($k = 0; $k < count($filterdata[$columns[$u]]); $k++) {
                            //$countfilterdata[$key][$val]['count']
                            $value = $filterdata[$columns[$u]][$k];
                            $original_value = $filterdata[$columns[$u]][$k];
                            $GLOBALS['HoverImage'] = "";
                            $GLOBALS['Comments'] = "";
                            /*-------------- Below code is used to cehck comments in subcategory and main category ------------ */
                            $CurrentValueItem = array();
                            $CurrentValueItem['vimage'] = '';
                            $CurrentValueItem['vname'] = '';
                            $CurrentValueItem['vcomments'] = '';
                            if (($m = array_search($value, $OwnValue)) !== false) {
                                $CurrentValueItem = $qvalue_mapping_array[$m];
                            }
                            if ($CurrentValueItem['vimage'] == "" && $CurrentValueItem['vcomments'] == "" && $CurrentValueItem['vname'] == "") {
                                if (($n = array_search($value, $ParentValue)) !== false) {
                                    $CurrentValueItem = $ParentAssoc[$n];
                                }
                            }
                            if ($CurrentValueItem['vname'] != "" && $CurrentValueItem['vimage'] != "" && $CurrentValueItem['vcomments'] != "") {
                                if (!empty($CurrentValueItem['vname'])) {
                                    $value = $CurrentValueItem['vname'];
                                }
                                if (!empty($CurrentValueItem['vimage'])) {
                                    $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $CurrentValueItem['vimage']);
                                    if (file_exists($file)) {
                                        $GLOBALS['HoverImage'] = $this->path . "/" . GetConfig('ImageDirectory') . "/" . $CurrentValueItem['vimage'];
                                    }
                                }
                                $GLOBALS['Comments'] = $CurrentValueItem['vcomments'];
                            }
                            /*-------------- Below code is used to cehck comments in subcategory and main category Ends ------------ */
                            if (isset($params['dynfilters'][$columns[$u]]) && !empty($params['dynfilters'][$columns[$u]])) {
                                $dyn_flag = 1;
                                $query_string_mod_array = $query_string_array;
                                //*$query_string_mod_array[$columns[$u]]= "";
                                //$query_string_new1 = $query_string_new;
                                //*$query_string_new1 = "redefine_filters.php?";
                                $query_string_new1 = "";
                                $qualifierclearurl = "search.php?";
                                foreach ($query_string_mod_array as $qs_key => $qs_val) {
                                    //*if($query_string_new1 != $query_string_new)
                                    if (!empty($query_string_new1)) {
                                        $query_string_new1 .= "&";
                                    }
                                    if ($qs_key != "search_query") {
                                        $qs_val = urlencode($qs_val);
                                    }
                                    $query_string_new1 .= $qs_key . "=" . $qs_val;
                                    if ($qs_key != $columns[$u]) {
                                        if ($qualifierclearurl != "search.php?") {
                                            $qualifierclearurl .= "&";
                                        }
                                        $qualifierclearurl .= $qs_key . "=" . $qs_val;
                                    }
                                }
                                if (strtolower($original_value) == strtolower($params['dynfilters'][$columns[$u]])) {
                                    $GLOBALS['ClearURL'] = "<a href='{$qualifierclearurl}'>Clear</a>";
                                    $dyn_filter .= "<li><img src='{$this->path}/templates/default/images/check.gif'>&nbsp;&nbsp;" . ucwords($value) . "</li>";
                                    //*$dyn_filter .= "<li><a class='thickbox' href='$query_string_new1&column=$columns[$u]'><b>Redefine search...</b></a></li>";
                                    $str = "{$query_string_new1}&column=" . $columns[$u];
                                    break;
                                }
                            } else {
                                $dyn_flag = 0;
                                $query_string_mod_array = $query_string_array;
                                $query_string_new1 = $query_string_new . "search_query=" . $query_string_mod_array['search_query'];
                                unset($query_string_mod_array['search_query']);
                                //if(array_key_exists($columns[$u],$query_string_mod_array)) {
                                //$query_string_mod_array[$columns[$u]] = $original_value;
                                //}
                                foreach ($query_string_mod_array as $qs_key => $qs_val) {
                                    if ($query_string_new1 != $query_string_new) {
                                        $query_string_new1 .= "&";
                                    }
                                    if ($qs_key != "search_query") {
                                        $qs_val = urlencode($qs_val);
                                    }
                                    $query_string_new1 .= $qs_key . "=" . $qs_val;
                                }
                                //$GLOBALS['ClearURL'] = $query_string_new1;
                                $GLOBALS['ClearURL'] = "";
                                $query_string_new1 .= "&" . $columns[$u] . "=" . urlencode($original_value);
                                // this is added to pass the listing value
                                $GLOBALS['QualifierLink'] = $query_string_new1;
                                $GLOBALS['QualifierId'] = $Qualifier_id;
                                $GLOBALS['QualifierValue'] = ucwords($value);
                                $GLOBALS['QualifierCount'] = $countfilterdata[$columns[$u]][$original_value]['count'];
                                //$dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage");
                                //$dyn_filter .= "<li><a href='$query_string_new1'>".$value."</a> (".$countfilterdata[$columns[$u]][$value]['count'].")</li>";
                                if ($count_pqvq < 11) {
                                    $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage");
                                } else {
                                    $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage");
                                }
                                $count_pqvq++;
                            }
                        }
                        $dyn_filter = "<ul>" . $dyn_filter . "</ul>";
                        if ($count_pqvq > 11) {
                            $GLOBALS['FilterID'] = $GLOBALS['dynid'];
                            $GLOBALS['ExtraValues'] = $extra;
                            $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink");
                        }
                        if ($dyn_flag == 1) {
                            //$str = "search_query=".$links.$model_link."&column=model";
                            $GLOBALS['Dyndisplay1'] = "showlist";
                            $GLOBALS['Dyndisplay'] = "hidelist";
                            $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                            $GLOBALS['DynmenuFilter1'] = $dyn_filter;
                            $GLOBALS['DynmenuFilter'] = "";
                            $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')";
                            //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif";
                        } else {
                            $GLOBALS['Dyndisplay1'] = "hidelist";
                            $GLOBALS['Dyndisplay'] = "showlist";
                            $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif";
                            $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage");
                            $GLOBALS['DynmenuFilter'] = $dyn_filter;
                            $GLOBALS['DynmenuFilter1'] = "";
                            $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')";
                        }
                        /* Filter Title related assiciation */
                        $CurrentItem = $qvalue_mapping_array[0];
                        if ($CurrentItem['qimage'] == "" && $CurrentItem['qcomments'] == "" && $CurrentItem['qname'] == "") {
                            $CurrentItem = $ParentAssoc[0];
                        }
                        if (isset($CurrentItem['qname']) && !empty($CurrentItem['qname'])) {
                            $GLOBALS['Dynmainmenu'] = $CurrentItem['qname'];
                        } else {
                            $GLOBALS['Dynmainmenu'] = $title;
                        }
                        $mover_comment = "";
                        if (isset($CurrentItem) && !empty($CurrentItem['qcomments'])) {
                            $mover_comment = $CurrentItem['qcomments'];
                        }
                        $mover_image = "";
                        if (isset($CurrentItem['qimage']) && !empty($CurrentItem['qimage'])) {
                            $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $CurrentItem['qimage']);
                            if (file_exists($file)) {
                                $mover_image = $GLOBALS['SITEPATH'] . "/" . GetConfig('ImageDirectory') . "/" . $CurrentItem['qimage'];
                            }
                        }
                        $GLOBALS['MouseoverFn'] = "loadHoverImage(event, '" . $mover_image . "', '" . $mover_comment . "');";
                        $GLOBALS['MouseoutFn'] = "hideTip();";
                        $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter");
                        //$dyn_filter .=  $filter3;
                        if ($dyn_flag == 1) {
                            $dyn_bottom .= $dyn_output;
                        } else {
                            $dyn_top .= $dyn_output;
                        }
                        $dyn_filter = "";
                        //$dyn_filter .=  $filter3;
                    }
                }
            }
            $dyn_filter = $dyn_top . $dyn_bottom;
            /* form action */
            $qry_string = $_SERVER['QUERY_STRING'];
            if (isset($_REQUEST['page'])) {
                $page = $_REQUEST['page'];
                $search_link = str_ireplace('&page=' . $page, '', $qry_string);
            } else {
                $search_link = $qry_string;
            }
            $GLOBALS['formaction'] = "search.php?" . $search_link;
        } else {
            $GLOBALS['HideSideProductFiltersPanelPrice'] = "none";
        }
        $dyn_filter = $dyn_top . $dyn_bottom;
        $GLOBALS['DynFilter'] = $dyn_filter;
        if (!isset($params['flag_srch_category']) || $params['flag_srch_category'] == 0 || !eregi('search.php', $_SERVER['REQUEST_URI'])) {
            $GLOBALS['HideSideProductFiltersPanelPrice'] = "none";
        } else {
            $GLOBALS['HideSideProductFiltersPanelPrice'] = "block";
        }
        $GLOBALS['FromPrice'] = "0.00";
        if (isset($_REQUEST['price_from'])) {
            $GLOBALS['FromPrice'] = $_REQUEST['price_from'];
        }
        if (isset($_REQUEST['price_to'])) {
            $GLOBALS['ToPrice'] = $_REQUEST['price_to'];
        }
        if (empty($output1) && empty($output2) && empty($output)) {
            $this->DontDisplay = true;
        }
        /*$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
        		$GLOBALS['SNIPPETS']['SideProductFilter1'] = $output;*/
    }
Ejemplo n.º 16
0
		echo '<url>',"\n";
		echo '<loc>',$url,'</loc>',"\n";
		echo '</url>',"\n";
	}


	$query = "
		SELECT brandname
		FROM [|PREFIX|]brands
		LIMIT ".$GLOBALS['ISC_CLASS_DB']->Quote((int)$limit);

	$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

	while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
		$limit--;
		$url = makeSafeUrl(BrandLink($row['brandname']));
		echo '<url>',"\n";
		echo '<loc>',$url,'</loc>',"\n";
		echo '</url>',"\n";
	}

	$query = "
		SELECT newsid, newstitle
		FROM [|PREFIX|]news
		WHERE newsvisible=1
		LIMIT ".$GLOBALS['ISC_CLASS_DB']->Quote((int)$limit);

	$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

	while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
		$limit--;
Ejemplo n.º 17
0
 public function SetPanelSettings()
 {
     $count = 0;
     $output = "";
     $products = array();
     $GLOBALS['BrandsMessage'] = '';
     // If we're showing the "All brands" page then we to display a list of all the brands
     if ($GLOBALS['ISC_CLASS_BRANDS']->ShowingAllBrands()) {
         // Output sub-categories
         $GLOBALS['SNIPPETS']['SubBrands'] = "";
         $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]brands ORDER BY brandname ASC");
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
             // Check to see if we need to add in place holder images or if we are just displaying text
             if (!($rtn = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['ISC_CLASS_DB']->Query("SELECT COUNT(*) AS Total FROM [|PREFIX|]brands WHERE brandimagefile != ''"))) || !$rtn['Total']) {
                 $useImages = false;
             } else {
                 $useImages = true;
                 if (GetConfig('BrandDefaultImage') !== '') {
                     $defaultImage = GetConfig('ShopPath') . '/' . GetConfig('BrandDefaultImage');
                 } else {
                     $defaultImage = GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/BrandDefault.gif';
                 }
             }
             for ($i = 1; $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $i++) {
                 $GLOBALS['SubBrandName'] = isc_html_escape($row['brandname']);
                 $GLOBALS['SubBrandLink'] = BrandLink($row['brandname']);
                 if ($useImages) {
                     if ($row['brandimagefile'] !== '') {
                         $GLOBALS['SubBrandImage'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $row['brandimagefile'];
                     } else {
                         $GLOBALS['SubBrandImage'] = $defaultImage;
                     }
                     $GLOBALS['SNIPPETS']['SubBrands'] .= '<li style="width: ' . GetConfig('BrandImageWidth') . 'px; height: ' . (GetConfig('BrandImageHeight') + 50) . 'px">' . $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandItemImage") . '</li>';
                     if ($i % GetConfig('BrandPerRow') === 0) {
                         $GLOBALS['SNIPPETS']['SubBrands'] .= '<li style="float:none; clear:both;"></li>';
                     }
                 } else {
                     $GLOBALS['SNIPPETS']['SubBrands'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandItem");
                 }
             }
             if ($useImages) {
                 $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandsGrid");
             } else {
                 $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrands");
             }
             $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
             $GLOBALS['BrandsMessage'] = $output;
         } else {
             $GLOBALS['BrandsMessage'] = GetLang('ViewAllBrandsInstructions');
         }
         $GLOBALS['BrandProductListing'] = "<li>&nbsp;</li>";
         $GLOBALS['HideBrandProductListing'] = "none";
         return;
     }
     // Load the products into the reference array
     $GLOBALS['ISC_CLASS_BRANDS']->GetProducts($products);
     $GLOBALS['BrandProductListing'] = "";
     if ($GLOBALS['BrandName'] == "") {
         // We're on the 'All Brands' page and the brands list is on the right
         $GLOBALS['ChooseBrandFromList'] = sprintf(GetLang('ChooseBrandFromList'), GetLang('Right'));
         $GLOBALS['BrandProductListing'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BrandMainPageMessage");
     } else {
         // Show products for a specific brand
         if (GetConfig('EnableProductReviews') == 0) {
             $GLOBALS['HideProductRating'] = "display: none";
         }
         $GLOBALS['AlternateClass'] = '';
         foreach ($products as $row) {
             if ($GLOBALS['AlternateClass'] == 'Odd') {
                 $GLOBALS['AlternateClass'] = 'Even';
             } else {
                 $GLOBALS['AlternateClass'] = 'Odd';
             }
             $GLOBALS['ProductCartQuantity'] = '';
             if (isset($GLOBALS['CartQuantity' . $row['productid']])) {
                 $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']];
             }
             $GLOBALS['ProductId'] = (int) $row['productid'];
             $GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
             $GLOBALS['ProductLink'] = ProdLink($row['prodname']);
             $GLOBALS['ProductRating'] = (int) $row['prodavgrating'];
             // Determine the price of this product
             $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row);
             $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname']));
             if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) {
                 $GLOBALS['ProductURL'] = ProdLink($row['prodname']);
                 $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
             } else {
                 //$GLOBALS['ProductURL'] = CartLink($row['productid']);
                 $GLOBALS['ProductURL'] = ProdLink($row['prodname']);
                 //blessen
                 if (intval($row['prodretailprice']) <= 0) {
                     $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink');
                 } else {
                     $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1');
                 }
                 //blessen
                 //$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['BrandProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BrandProductsItem");
         }
         if ($GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() == 0) {
             // There are no products in this category
             $GLOBALS['BrandsMessage'] = GetLang('NoProductsInBrand');
             $GLOBALS['BrandProductListing'] = "<li>&nbsp;</li>";
             $GLOBALS['HideBrandProductListing'] = "none";
         }
     }
 }
Ejemplo n.º 18
0
	/**
	 * Setup selected brand for this product.
	 */
	public function SetBrandDetails()
	{
		if(!$this->productClass->GetBrandName() || !GetConfig('ShowProductBrand')) {
			$GLOBALS['HideBrandLink'] = 'none';
			return false;
		}

		$GLOBALS['BrandName'] = isc_html_escape($this->productClass->GetBrandName());
		$GLOBALS['BrandLink'] = BrandLink($this->productClass->GetBrandName());
	}
Ejemplo n.º 19
0
 public function SetPanelSettings()
 {
     $output = "";
     $brands = array();
     $min = 0;
     $max = 0;
     $diff = 0;
     $distribution = 0;
     // Get the number of brands
     $query = "select count(brandid) as num from [|PREFIX|]brands";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     $num_brands = $row['num'];
     if ($num_brands > 0 && GetConfig('TagCloudsEnabled')) {
         // Hide the alternate side brand panel
         $GLOBALS['HideSideShopByBrandFullPanel'] = "none";
         // Get the 5 most popular brands
         $query = "select b.brandid, b.brandname, (\n\t\t\t\t\tselect count(productid) from [|PREFIX|]products p where p.prodbrandid=b.brandid and p.prodvisible='1'\n\t\t\t\t) as num\n\t\t\t\tfrom [|PREFIX|]brands b\n\t\t\t\torder by b.brandname asc";
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $brands[] = $row;
         }
         // Find the minimum and maximum products per brand
         foreach ($brands as $k => $v) {
             // Is it the new minimum?
             if ($min == 0) {
                 $min = $brands[$k]['num'];
             }
             if ($brands[$k]['num'] > 0 && $brands[$k]['num'] < $min) {
                 $min = $brands[$k]['num'];
             }
             // Is it the new maximum?
             if ($brands[$k]['num'] > $max) {
                 $max = $brands[$k]['num'];
             }
         }
         // Is there only one brand?
         if ($min == $max) {
             $min = 0;
         }
         // Workout the differences and distribution
         $diff = $max - $min;
         if ($diff == 0) {
             $diff = 1;
         }
         $tagCount = count($brands);
         $min_size = GetConfig('TagCloudMinSize');
         $max_size = GetConfig('TagCloudMaxSize');
         $step = ($max_size - $min_size) / $diff;
         foreach ($brands as $k => $v) {
             // Workout the tag size and output the brandname
             $num = $brands[$k]['num'];
             $size = $min_size + ($num - $min) * $step;
             $GLOBALS['TagSize'] = ceil($size);
             // Create a snippet for the template system
             $GLOBALS['BrandLink'] = BrandLink($brands[$k]['brandname']);
             $GLOBALS['BrandName'] = isc_html_escape($brands[$k]['brandname']);
             $GLOBALS['NumProducts'] = (int) $num;
             $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BrandCloudItem");
         }
         $GLOBALS['SNIPPETS']['SideBrandTagCloud'] = $output;
     } else {
         // Hide the panel
         $this->DontDisplay = true;
         $GLOBALS['HideBrandTagCloudPanel'] = "none";
     }
 }
Ejemplo n.º 20
0
    $limit--;
    // We can't just pass ENT_QUOTES to htmlspecialchars because that converts a ' to &#39; rather than &apos;
    // Google sitemaps requires ' to be encoded as &apos; so we have to do things a little differently
    $url = htmlspecialchars(CatLink($row['categoryid'], $row['catname']), ENT_COMPAT, 'UTF-8');
    $url = str_replace("'", '&apos;', $url);
    echo '<url>', "\n";
    echo '<loc>', $url, '</loc>', "\n";
    echo '</url>', "\n";
}
$query = "\n\t\tSELECT brandname\n\t\tFROM [|PREFIX|]brands\n\t\tLIMIT " . $GLOBALS['ISC_CLASS_DB']->Quote((int) $limit);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
    $limit--;
    // We can't just pass ENT_QUOTES to htmlspecialchars because that converts a ' to &#39; rather than &apos;
    // Google sitemaps requires ' to be encoded as &apos; so we have to do things a little differently
    $url = htmlspecialchars(BrandLink($row['brandname']), ENT_COMPAT, 'UTF-8');
    $url = str_replace("'", '&apos;', $url);
    echo '<url>', "\n";
    echo '<loc>', $url, '</loc>', "\n";
    echo '</url>', "\n";
}
$query = "\n\t\tSELECT newsid, newstitle\n\t\tFROM [|PREFIX|]news\n\t\tWHERE newsvisible=1\n\t\tLIMIT " . $GLOBALS['ISC_CLASS_DB']->Quote((int) $limit);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
    $limit--;
    // We can't just pass ENT_QUOTES to htmlspecialchars because that converts a ' to &#39; rather than &apos;
    // Google sitemaps requires ' to be encoded as &apos; so we have to do things a little differently
    $url = htmlspecialchars(BlogLink($row['newsid'], $row['newstitle']), ENT_COMPAT, 'UTF-8');
    $url = str_replace("'", '&apos;', $url);
    echo '<url>', "\n";
    echo '<loc>', $url, '</loc>', "\n";
Ejemplo n.º 21
0
 public function SetPanelSettings()
 {
     $GLOBALS['HideProductErrorMessage'] = 'display:none';
     if (isset($_SESSION['ProductErrorMessage']) && $_SESSION['ProductErrorMessage'] != '') {
         $GLOBALS['HideProductErrorMessage'] = '';
         $GLOBALS['ProductErrorMessage'] = $_SESSION['ProductErrorMessage'];
         unset($_SESSION['ProductErrorMessage']);
     }
     $GLOBALS['ProductCartQuantity'] = '';
     if (isset($GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) {
         $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()];
     }
     //temp script to shortern the product name
     $pid = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $querytemp = "SELECT prodbrandid FROM  [|PREFIX|]products where productid = " . $pid . "  ";
     $resulttemp = $GLOBALS['ISC_CLASS_DB']->Query($querytemp);
     $brand = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp);
     if ($brand['prodbrandid'] == 37) {
         $querytemp1 = "SELECT c.catname, c.catcombine FROM [|PREFIX|]categories \tc left join [|PREFIX|]categoryassociations ca on c.categoryid = ca.categoryid  left join [|PREFIX|]products p on ca.productid = p.productid where p.productid =  '" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' ";
         $resulttemp1 = $GLOBALS['ISC_CLASS_DB']->Query($querytemp1);
         $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp1);
         if ($cat['catcombine'] != "") {
             $GLOBALS['ProductName'] = $cat['catcombine'] . " Part Number " . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
         } else {
             $GLOBALS['ProductName'] = $cat['catname'] . " Part Number " . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
         }
     } else {
         $GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
     }
     //temp script to shortern the product name
     //$GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
     $GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $GLOBALS['ProductPrice'] = '';
     // Get the vendor information
     $vendorInfo = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor();
     $GLOBALS['HideVendorDetails'] = 'display: none';
     $GLOBALS['VendorName'] = '';
     if (is_array($vendorInfo)) {
         //$GLOBALS['HideVendorDetails'] = '';
         $GLOBALS['VendorName'] = '<a href="' . VendorLink($vendorInfo) . '">' . isc_html_escape($vendorInfo['vendorname']) . '</a>';
     }
     // Can this product be gift wrapped? And do we have any gift wrapping options set up?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanBeGiftWrapped() && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
         $GLOBALS['HideGiftWrapMessage'] = '';
         $GLOBALS['GiftWrappingAvailable'] = GetLang('GiftWrappingOptionsAvailable');
     } else {
         $GLOBALS['HideGiftWrapMessage'] = 'display: none';
     }
     $thumb = '';
     $GLOBALS['ImagePopupJavascript'] = "showProductImageNew('" . $this->ProdImageLink($GLOBALS['ProductId']) . "', 0, 0);";
     //$GLOBALS['VideoPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productvideo.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['VideoPopupJavascript'] = "showProductVideoNew('" . $this->ProdVideoLink($GLOBALS['ProductId']) . "');";
     //$GLOBALS['AudioPopupJavascript'] =  "showProductVideoNew('".GetConfig('ShopPath')."/productaudio.php', ".$GLOBALS['ProductId'].");";
     $GLOBALS['AudioPopupJavascript'] = "showProductVideoNew('" . $this->ProdAudioLink($GLOBALS['ProductId']) . "');";
     // If we're showing images as a lightbox, we need to load up the URLs for the other images for this product
     if (GetConfig('ProductImageMode') == 'lightbox') {
         $GLOBALS['AdditionalStylesheets'] = array(GetConfig('ShopPath') . '/javascript/jquery/plugins/lightbox/lightbox.css');
         $GLOBALS['LightBoxImageList'] = '';
         $query = "\n\t\t\t\t\tSELECT imagefile\n\t\t\t\t\tFROM [|PREFIX|]product_images\n\t\t\t\t\tWHERE imageprodid='" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' AND imageisthumb=0\n\t\t\t\t\tORDER BY imagesort ASC\n\t\t\t\t";
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         while ($image = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $GLOBALS['LightBoxImageList'] .= '<a ';
             $GLOBALS['LightBoxImageList'] .= 'href="' . $GLOBALS['ShopPath'] . '/' . GetConfig('ImageDirectory') . '/' . $image['imagefile'] . '" ';
             $GLOBALS['LightBoxImageList'] .= 'title="' . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()) . '"';
             $GLOBALS['LightBoxImageList'] .= '>&nbsp;</a>';
         }
         $GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox(); return false;";
         $GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox');
     }
     // Is there a thumbnail image we can show?
     $thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
     $thumbImage = '';
     if ($thumb == '' && GetConfig('DefaultProductImage') != '') {
         if (GetConfig('DefaultProductImage') == 'template') {
             $thumb = GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/ProductDefault.gif';
         } else {
             $thumb = GetConfig('ShopPath') . '/' . GetConfig('DefaultProductImage');
         }
         $thumbImage = '<img src="' . $thumb . '" alt="" />';
     } else {
         if ($thumb != '') {
             $thumbImage = '<img src="' . GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $thumb . '" alt="" />';
         }
     }
     // Is there more than one image? If not, hide the "See more pictures" link
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 0) {
         $GLOBALS['HideMorePicturesLink'] = "none";
         $GLOBALS['ThumbImage'] = $thumbImage;
     } else {
         $GLOBALS['ThumbImage'] = '<a href="#" onclick="' . $GLOBALS['ImagePopupJavascript'] . '">' . $thumbImage . '</a>';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 2) {
             $var = "MorePictures1";
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) {
                 $var = "SeeLargerImage";
             } else {
                 $var = "MorePictures2";
             }
         }
         $GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1);
         $this->SetAdditionalView();
     }
     // Is there more than one video? If not, hide the "See videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() == 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() == 0) {
         $GLOBALS['HideVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() > 0) {
             $var = "SeeVideos";
         } else {
             $GLOBALS['HideSpecVideosLink'] = "none";
         }
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() > 0) {
             $avar = "SeeAudios";
         } else {
             $GLOBALS['HideSpecAudiosLink'] = "none";
         }
         $GLOBALS['SeeVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos());
         $GLOBALS['SeeAudios'] = sprintf(GetLang($avar), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios());
     }
     //more Videos link ends Added by Simha
     // Is there more than one video? If not, hide the "See Ins videos" link     Added by Simha
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() == 0) {
         $GLOBALS['HideInsVideosLink'] = "none";
     } else {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() > 0) {
             $var = "SeeInsVideos";
         }
         $GLOBALS['SeeInsVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos());
     }
     //more Ins Videos link ends Added by Simha
     //Added by Simha to hide Not For Sale Msg
     $GLOBALS['DisplayNotForSaleMsg'] = 'none';
     if ($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         if (!GetConfig('ShowProductShipping')) {
             $GLOBALS['HideShipping'] = 'none';
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) {
                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost() != 0) {
                     // Is there a fixed shipping cost?
                     $GLOBALS['ShippingPrice'] = sprintf("%s %s", CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost()), GetLang('FixedShippingCost'));
                 } else {
                     if ($GLOBALS['ISC_CLASS_PRODUCT']->HasFreeShipping()) {
                         // Does this product have free shipping?
                         $GLOBALS['ShippingPrice'] = GetLang('FreeShipping');
                     } else {
                         // Shipping calculated at checkout
                         $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
                     }
                 }
             } else {
                 $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout');
             }
         }
         // Is tax already included in this price?
         if (GetConfig('TaxTypeSelected') > 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductTaxable()) {
             if (GetConfig('PricesIncludeTax')) {
                 if (GetConfig('TaxTypeSelected') == 2 && GetConfig('DefaultTaxRateName')) {
                     //not included
                     $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
                 } else {
                     $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
                 }
             } else {
                 if (GetConfig('TaxTypeSelected') == 2) {
                     if (GetConfig('DefaultTaxRateName')) {
                         $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName')));
                     } else {
                         $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2');
                     }
                 } else {
                     $GLOBALS['IncludingExcludingTax'] = GetLang('ProductExcludingTax2');
                 }
             }
         }
         $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
         $catquery = " SELECT DISTINCT c.categoryid, p.brandseriesid\n                FROM isc_categories c                                                 \n                LEFT JOIN isc_categoryassociations ca ON c.categoryid = ca.categoryid \n                LEFT JOIN isc_products p ON ca.productid = p.productid AND p.prodvisible='1'\n                WHERE p.productid= " . $GLOBALS['ProductId'] . "";
         $relcats = array();
         $brandseries = 0;
         $catresult = $GLOBALS['ISC_CLASS_DB']->Query($catquery);
         while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catresult)) {
             $relcats[] = $catrow['categoryid'];
             $brandseries = $catrow['brandseriesid'];
         }
         $productCats = $relcats;
         $discounttype = 0;
         //$DiscountInfo = GetRuleModuleInfo();
         //$FinalPrice    = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
         //$FinalPrice    = $GLOBALS['ProductPrice'];
         $FinalPrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetPrice();
         $SalePrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetSalePrice();
         if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) {
             $DiscountPrice = $SalePrice;
         } else {
             $DiscountPrice = $FinalPrice;
             $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $productCats[0], $brandseries, $discounttype);
         }
         /*
         foreach($DiscountInfo as $DiscountInfoSub)   {  
             $catids = explode(",", $DiscountInfoSub['catids']);
             foreach($catids as $catid) {
                 if(in_array($catid, $productCats)) {     
                     $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); 
                     if ($DiscountAmount < 0) {
                         $DiscountAmount = 0;
                     }
                     $DiscountAmount  = $FinalPrice - $DiscountAmount; 
                 } 
             }  
         }
         */
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['RetailPrice'] = "<strike>" . CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice()) . "</strike>";
             // blessen
             //$GLOBALS['PriceLabel'] = GetLang('YourPrice');
             $GLOBALS['PriceLabel'] = GetLang('Price');
             $savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice();
             $GLOBALS['HideRRP'] = "none";
             //$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), "<span class=
             //'YouSaveAmount'>".CurrencyConvertFormatPrice($savings)."</span>")."</span>";
         } else {
             $GLOBALS['PriceLabel'] = GetLang('Price');
             $GLOBALS['HideRRP'] = "none";
         }
     } else {
         $GLOBALS['PriceLabel'] = GetLang('Price');
         $GLOBALS['HideShipping'] = 'none';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->ArePricesHidden() || !GetConfig('ShowProductPrice')) {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()) {
                 $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel());
             } else {
                 $GLOBALS['HidePrice'] = "display: none;";
             }
         } else {
             $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice();
         }
         $GLOBALS['HideRRP'] = 'none';
         //To display not for sale message Added by Simha
         $GLOBALS['DisplayNotForSaleMsg'] = '';
     }
     // Is this product linked to a brand?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName() != "" && GetConfig('ShowProductBrand')) {
         $GLOBALS['BrandName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
         $GLOBALS['BrandLink'] = BrandLink($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName());
     } else {
         $GLOBALS['HideBrandLink'] = "none";
     }
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) {
         // It's a physical product
         $prodweight = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         # Added to hide the weight lable while the value is 0.00 Baskaran
         if ($prodweight == '0.00 LBS') {
             $GLOBALS['HideWeight'] = "none";
         } else {
             $GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight();
         }
     } else {
         // It's a digital product
         $GLOBALS['HideWeight'] = "none";
     }
     $product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
     $dimensions = array('ProductHeight' => 'prodheight', 'ProductWidth' => 'prodwidth', 'ProductDepth' => 'proddepth');
     foreach ($dimensions as $global => $field) {
         if ($product[$field] > 0) {
             $GLOBALS[$global] = FormatWeight($product[$field], false);
             $hasDimensions = true;
         } else {
             $GLOBALS['Hide' . $global] = 'display: none';
         }
     }
     if (!isset($hasDimensions)) {
         $GLOBALS['HideDimensions'] = 'display: none';
     }
     // Are reviews disabled? Then don't show anything related to reviews
     if (GetConfig('EnableProductReviews') == 0) {
         $GLOBALS['HideReviewLink'] = "none";
         $GLOBALS['HideRating'] = "none";
         $GLOBALS['HideReviews'] = "none";
     } else {
         // How many reviews are there?
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) {
             $GLOBALS['HideReviewLink'] = "none";
         } else {
             $GLOBALS['HideNoReviewsMessage'] = "none";
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 1) {
                 $GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1');
             } else {
                 $GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews());
             }
         }
     }
     // Has a product availability been given?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability() != "") {
         $GLOBALS['Availability'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability());
     } else {
         $GLOBALS['HideAvailability'] = "none";
     }
     // Is there an SKU for this product?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU() != "" && GetConfig('ShowProductSKU')) {
         $GLOBALS['SKU'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU());
     } else {
         $GLOBALS['HideSKU'] = "none";
     }
     if (!GetConfig('ShowProductRating')) {
         $GLOBALS['HideRating'] = "none";
     }
     $GLOBALS['Rating'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetRating();
     $GLOBALS['CartLink'] = CartLink();
     /* Baskaran added to display image in product detail page */
     $brandimage = $GLOBALS['ISC_CLASS_PRODUCT']->GetProdbrandimagefile();
     $imageurl = '';
     if ($brandimage != '' || !empty($brandimage)) {
         $imageurl = GetConfig('ShopPath') . "/product_images/" . $brandimage;
     } else {
         $imageurl = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
     }
     $GLOBALS['ImageUrl'] = $imageurl;
     /* Baskaran ends */
     $GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid;
     $GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']);
     $GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();
     // Does this product have any bulk discount?
     if ($GLOBALS['ISC_CLASS_PRODUCT']->CanUseBulkDiscounts()) {
         $GLOBALS['HideBulkDiscountLink'] = '';
         $GLOBALS['BulkDiscountThickBoxTitle'] = sprintf(GetLang('BulkDiscountThickBoxTitle'), isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()));
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         $GLOBALS['BulkDiscountThickBoxRates'] = ISC_SIDEPRODUCTADDTOCART_PANEL::GetProductBulkDiscounts();
         $GLOBALS['ProductBulkDiscountThickBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBulkDiscountThickBox");
     } else {
         $GLOBALS['HideBulkDiscountLink'] = 'none';
     }
     if (GetConfig('ShowInventory') == 1 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() > 0) {
         $GLOBALS['InventoryList'] = '';
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 2) {
             $variations = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVariations();
             if (empty($options)) {
                 $GLOBALS['HideCurrentStock'] = "display: none;";
             }
         } else {
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 1) {
                 $currentStock = $GLOBALS['ISC_CLASS_PRODUCT']->GetInventoryLevel();
                 if ($currentStock <= 0) {
                     $GLOBALS['InventoryList'] = GetLang('SoldOut');
                 } else {
                     $GLOBALS['InventoryList'] = $currentStock;
                 }
             }
         }
     } else {
         $GLOBALS['HideCurrentStock'] = "display: none;";
     }
     /* Added for to display the "Make an offer" Button -- Baskaran */
     # Checked for the selected series offer is 'yes'
     $GLOBALS['HideOfferButton'] = 'none';
     if (GetConfig('ShowBestOffer') == '1') {
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesOffer() == 'yes') {
             $GLOBALS['HideOfferButton'] = '';
         } else {
             # Checking for the selected sub category offer is 'yes'
             if ($GLOBALS['ISC_CLASS_PRODUCT']->GetCategoryOffer() == 'yes') {
                 $GLOBALS['HideOfferButton'] = '';
             } else {
                 # Checking brand offer is 'yes' and corresponding series offer are 'no'
                 if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesCntOffer() == 0) {
                     $GLOBALS['HideOfferButton'] = '';
                 } else {
                     # Checking for Root category offer is 'yes' and corresponding sub category offer are 'no'
                     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetRootCategoryOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSubCategoryCntOffer() == 0) {
                         $GLOBALS['HideOfferButton'] = '';
                     } else {
                         $GLOBALS['HideOfferButton'] = 'none';
                     }
                 }
             }
         }
     }
     //Check for item in Cart Session
     $CartItems = $_SESSION['CART']['ITEMS'];
     $compids = array();
     $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     //print_r($CartItems);
     foreach ($CartItems as $key => $item) {
         if ($item['product_id'] == $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()) {
             if ($item['compitem'] == 1) {
                 foreach ($item['complementary'] as $citem) {
                     $compids[$citem['comp_productid']] = $citem['quantity'];
                 }
             }
             break;
         }
     }
     //Check for item in Cart Session Ends
     # Complementary items -- Baskaran
     $productid = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();
     $make = '';
     $model = '';
     $year = '';
     if ($GLOBALS['EnableSEOUrls'] == 0) {
         if (isset($_REQUEST['make']) && $_REQUEST['make'] != '') {
             $make = MakeURLNormal($_REQUEST['make']);
         }
         if (isset($_REQUEST['model']) && $_REQUEST['model'] != '') {
             $model = MakeURLNormal($_REQUEST['model']);
         }
         if (isset($_REQUEST['year']) && $_REQUEST['year'] != '') {
             $year = $_REQUEST['year'];
         }
     } else {
         if (count($GLOBALS['PathInfo']) > 0) {
             foreach ($GLOBALS['PathInfo'] as $key => $value) {
                 if (eregi('make=', $value)) {
                     $make = MakeURLNormal(substr($value, strpos($value, '=') + 1));
                 } else {
                     if (eregi('model=', $value)) {
                         $model = MakeURLNormal(substr($value, strpos($value, '=') + 1));
                     } else {
                         if (eregi('year=', $value)) {
                             $year = substr($value, strpos($value, '=') + 1);
                         }
                     }
                 }
             }
         }
     }
     $where = '';
     if ($make != '') {
         $where .= "and (prodmake = '" . $make . "' or prodmake = 'NON-SPEC VEHICLE')";
     }
     if ($model != '') {
         $where .= " and (prodmodel = '" . $model . "' or prodmodel = 'ALL')";
     }
     if ($year != '') {
         $where .= " and (({$year} between prodstartyear and prodendyear) or (prodstartyear = 'ALL'and prodendyear = 'ALL'))";
     }
     $result = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT id,productid FROM [|PREFIX|]import_variations where productid = '" . $productid . "' {$where} order by id");
     $impvariationid = '';
     while ($improw = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
         $impvariationid[] = $improw['id'];
     }
     $impid = implode("','", $impvariationid);
     $impquery = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT complementaryitems FROM [|PREFIX|]application_data where variationid in('" . $impid . "') AND complementaryitems != ''");
     if ($GLOBALS["ISC_CLASS_DB"]->countResult($impquery) > 0) {
         $compitems = '';
         while ($joinrecord = $GLOBALS["ISC_CLASS_DB"]->Fetch($impquery)) {
             $compitems .= $joinrecord['complementaryitems'] . ",";
         }
         $comp = substr($compitems, 0, -1);
         if ($comp != '') {
             # Spliting the string with [ ] with regular expression -- Baskaran
             $temp = $comp;
             $temp = htmlspecialchars_decode($temp);
             preg_match_all('/\\[([^\\]]+)\\]/', $temp, $matches);
             $compexplode = $matches[1];
             $cntproducts = count($compexplode);
             /*$arraycnt = array_count_values($compexplode);    
               asort($arraycnt);
               $compunique = array_keys($arraycnt);
               rsort($compunique);
               $cntproducts = count($compunique);*/
             $originalarray = array();
             $tempArr = array();
             $tempArr1 = array();
             # Checking whether the SKU are valid and present in the db -- Baskaran
             for ($i = 0; $i < $cntproducts; $i++) {
                 $split = split(",", $compexplode[$i]);
                 $sku = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'");
                 if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) == 1 and $split[0] != 0) {
                     if (in_array($split[0], $tempArr)) {
                         continue;
                     }
                     $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2];
                     $tempArr[] = $split[0];
                 } else {
                     if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) != 1 and $split[0] == 0) {
                         if (in_array($split[0], $tempArr1)) {
                             continue;
                         }
                         $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2];
                         $tempArr1[] = $split[0];
                     }
                 }
             }
             $cntoriginal = count($originalarray);
             # Ordering the resultent array which is come from above one with the no thanks option '0' is the key to create the array -- Baskaran
             $arrManipulate = array();
             $nothanks = array();
             for ($i = 0; $i < $cntoriginal; $i++) {
                 $orsplit = split(",", $originalarray[$i]);
                 if ($i == 0 and $orsplit[0] == 0) {
                     $arrManipulate[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2];
                 } else {
                     if ($i != 0 and $orsplit[0] == 0) {
                         $nothanks[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2];
                     } else {
                         $arrManipulate[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2];
                     }
                 }
             }
             if (count($nothanks) > 0) {
                 $arrOrder = array_merge($arrManipulate, $nothanks);
             } else {
                 $arrOrder = $arrManipulate;
             }
             $cntarrOrder = count($arrOrder);
             if ($cntarrOrder > 0) {
                 $complementary = "<table cellspacing='2' cellpadding='0' border='0' width='100%'>";
                 for ($i = 0; $i < $cntarrOrder; $i++) {
                     $split = split(",", $arrOrder[$i]);
                     $sku = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'");
                     $skurow = $GLOBALS["ISC_CLASS_DB"]->Fetch($sku);
                     $brandname = $skurow['brandname'];
                     $catname = $skurow['catname'];
                     $skucode = $skurow['prodcode'];
                     $productid = $split[0] != 0 ? $skurow['productid'] : '0';
                     # $split[0] is sku code, $split[1] is comp. price
                     $path = $skurow['imagefile'];
                     $feature = $skurow['proddescfeature'];
                     $prodimage = '';
                     if ($skurow['imagefile'] != '') {
                         $prodimage = GetConfig('ShopPath') . "/product_images/{$path}";
                     } else {
                         $prodimage = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
                     }
                     $compdesc = html_entity_decode($split[2]);
                     $compprice = "<b>Price :" . CurrencyConvertFormatPrice($split[1]) . "</b>";
                     $price = CurrencyConvertFormatPrice($split[1]);
                     $feature = addslashes($feature);
                     $esc = htmlentities($feature, ENT_QUOTES);
                     $pricefeature = $esc . isc_html_escape($compprice);
                     $pricefeature = $esc . isc_html_escape($compprice);
                     if (isset($compids[$productid])) {
                         $sel = $compids[$productid];
                         $styleval = "style='display: block;'";
                         $checked = "checked = 'checked'";
                     } else {
                         $sel = 0;
                         $styleval = "style='display: none;'";
                         $checked = "";
                     }
                     if ($i == 0 and $productid != 0) {
                         if (count($compids) == 0) {
                             $styleval = "style='display: block;'";
                             $checked = " checked = 'checked' ";
                         }
                         $complementary .= '<input type="hidden" name="hidmake" value="' . $make . '" id="hidmake" />';
                         $complementary .= '<input type="hidden" name="hidmodel" value="' . $model . '" id="hidmodel" />';
                         $complementary .= '<input type="hidden" name="hidyear" value="' . $year . '" id="hidyear" />';
                         $complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_" . $i . "' value='" . $productid . "' {$checked} onclick='ActiveProductTab(\"CompItem_Tab\");ShowCompDesc(\"{$skucode}\",this.id);unCheck()'>" . "<label id='complabel' for='rdprod_" . $i . "' onmouseover= 'loadHoverImage(event, \"{$prodimage}\", \"{$pricefeature}\");' onmouseout = 'hideTip();'>&nbsp;<a href='#Compl'>{$catname} {$brandname} {$skucode}</a></label>" . "{$compdesc}" . "</td>\n                            <td><div {$styleval} id='compqty_" . $productid . "'>" . $this->BuildOption('compqty[' . $productid . ']', $sel) . "</div></td><td><div id='pr_" . $productid . "' {$styleval}><b>{$price}<b></div></td>\n                                </tr>";
                     } else {
                         if ($i == 0 and $productid == 0) {
                             if (count($compids) == 0) {
                                 $checked = " checked = 'checked' ";
                             }
                             $complementary .= '<input type="hidden" name="hidmake" value="' . $make . '" id="hidmake" />';
                             $complementary .= '<input type="hidden" name="hidmodel" value="' . $model . '" id="hidmodel" />';
                             $complementary .= '<input type="hidden" name="hidyear" value="' . $year . '" id="hidyear" />';
                             //						$complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_".$i."' value='".$productid."' checked = 'checked'>"."<label for='rdprod_".$i."'>&nbsp;$split[2]</label>"."</td></tr>";
                             $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' {$checked} onclick='Check()'>" . "<label for='nothanks'>&nbsp;{$split['2']}</label><input type = 'hidden' name = 'isremovable' value = '1' />" . "</td></tr>";
                         } else {
                             if ($i != 0 and $productid != 0) {
                                 $complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_" . $i . "' value='" . $productid . "' {$checked} onclick='ActiveProductTab(\"CompItem_Tab\");ShowCompDesc(\"{$skucode}\",this.id);unCheck()'>" . "<label id='complabel' for='rdprod_" . $i . "' onmouseover= 'loadHoverImage(event, \"{$prodimage}\", \"{$pricefeature}\");' onmouseout = 'hideTip();'>&nbsp;<a href='#Compl'>{$catname} {$brandname} {$skucode}</a></label>" . "{$compdesc}" . "</td>\n                            <td><div {$styleval} id='compqty_" . $productid . "'>" . $this->BuildOption('compqty[' . $productid . ']', $sel) . "</div></td><td><div id='pr_" . $productid . "' {$styleval}><b>{$price}</b></div></td>\n                                </tr>";
                             } else {
                                 if ($i != 0 and $productid == 0) {
                                     $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' onclick='Check()'>" . "<label for='nothanks'>&nbsp;{$split['2']}</label><input type = 'hidden' name = 'isremovable' value = '1' />" . "</td></tr>";
                                 }
                             }
                         }
                     }
                     $complementary .= '<input type="hidden" name="hidRadio" value="' . $brandname . " " . $skucode . '" id="hid_rdprod_' . $i . '" />';
                 }
                 $complementary .= "</table>";
                 $GLOBALS['complementaryproducts'] = $complementary;
                 $GLOBALS['complementarypaneltoshow'] = "%%Panel.ComplementartyItems%%<hr />";
             }
         }
     }
     /* Code Ends */
     if (GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
         require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php';
         ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
         //blessen
         if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart1");
         } else {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
         }
         //Added by Simha
         if (isc_strtolower($GLOBALS['ISC_CLASS_PRODUCT']->IsTestData()) == 'yes') {
             $GLOBALS['SNIPPETS']['ProductAddToCart'] = "<hr>" . GetLang('ThisIsTestData');
         }
         //blessen
         // original $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
     }
     $price_for_shipping = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice();
     //blessen
     //$GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() replaced by GetPrice
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() && (double) $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() > 0) {
         $price_for_shipping = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice();
         $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice());
         $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike>&nbsp;&nbsp;<b alt='Price may be adjusted. Add to your cart and see the final price.'  Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>";
     }
     if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $DiscountPrice && $discounttype == 1) {
         $price_for_shipping = $DiscountPrice;
         $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice());
         $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike>&nbsp;&nbsp;<b alt='Price may be adjusted. Add to your cart and see the final price.'  Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>";
     }
     $GLOBALS['ShowOnSaleImage'] = '';
     if (isset($DiscountPrice) && $discounttype == 0 && $DiscountPrice < $FinalPrice) {
         //&& GetConfig('ShowOnSale')
         $price_for_shipping = $DiscountPrice;
         $GLOBALS['ProductPrice'] = "<strike>" . CurrencyConvertFormatPrice($FinalPrice) . "</strike>";
         $GLOBALS['DiscountPrice'] = "" . CurrencyConvertFormatPrice($DiscountPrice) . "";
         if (GetConfig('ShowOnSale')) {
             $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
         }
     }
     $price = 0;
     $upper_price = 0;
     $shipping_qry = "SELECT variablename, variableval FROM isc_shipping_vars WHERE methodid='1' AND modulename='shipping_bytotal' AND ( variablename LIKE 'cost_0' OR variablename LIKE 'lower_0' OR variablename LIKE 'upper_0' )";
     $shipping_res = $GLOBALS['ISC_CLASS_DB']->Query($shipping_qry);
     while ($shipping_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($shipping_res)) {
         if ($shipping_arr['variablename'] == 'cost_0') {
             $price = $shipping_arr['variableval'];
         }
         if ($shipping_arr['variablename'] == 'upper_0') {
             $upper_price = $shipping_arr['variableval'];
         }
     }
     if ($price_for_shipping < $upper_price) {
         $GLOBALS['ShippingPrice'] = "\$" . $price;
     } else {
         $GLOBALS['ShippingPrice'] = "Ships Freight Free, see <a href='" . $GLOBALS['ShopPath'] . "/pages/8'>policy</a> for details";
     }
     //blessen
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle());
 }
Ejemplo n.º 22
0
	/**
	 * Returns the URL for a brand based on it's id
	 *
	 * @param integer $brandId The ID number of the brand to generate the URL for
	 */
	public static function getBrandUrl($brandId, $returnTitle=false)
	{
		$brandId = (int)$brandId;
		if($brandId < 1) {
			return false;
		}

		$brandName = $GLOBALS['ISC_CLASS_DB']->FetchOne('select brandname from `[|PREFIX|]brands` where brandid=' . $brandId, 'brandname');

		if(empty($brandName)) {
			return false;
		}

		if($returnTitle) {
			return array('title'=>$brandName, 'url'=> BrandLink($brandName));
		}

		return BrandLink($brandName);
	}