/** * Set the panel settings. */ public function SetPanelSettings() { $cVendor = GetClass('ISC_VENDORS'); $vendor = $cVendor->GetVendor(); $GLOBALS['VendorId'] = $vendor['vendorid']; $GLOBALS['VendorName'] = $vendor['vendorname']; // Set the field we're sorting results by if (isset($_REQUEST['sort'])) { $sort = $_REQUEST['sort']; } else { $sort = ''; } switch ($sort) { case 'newest': $sortField = 'p.productid DESC'; $GLOBALS['SortNewestSelected'] = 'selected="selected"'; break; case 'bestselling': $sortField = 'p.prodnumsold DESC'; $GLOBALS['SortBestSellingSelected'] = 'selected="selected"'; break; case 'alphaasc': $sortField = 'p.prodname ASC'; $GLOBALS['SortAlphaAsc'] = 'selected="selected"'; break; case 'alphadesc': $sortField = 'p.prodname DESC'; $GLOBALS['SortAlphaDesc'] = 'selected="selected"'; break; case 'avgcustomerreview': $sortField = 'prodavgrating DESC'; $GLOBALS['SortAvgReview'] = 'selected="selected"'; break; case 'priceasc': $sortField = 'p.prodcalculatedprice ASC'; $GLOBALS['SortPriceAsc'] = 'selected="selected"'; break; case 'pricedesc': $sortField = 'p.prodcalculatedprice DESC'; $GLOBALS['SortPriceDesc'] = 'selected="selected"'; break; default: $sortField = 'p.prodvendorfeatured DESC'; $sort = 'featured'; $GLOBALS['SortFeaturedSelected'] = 'selected="selected"'; break; } // If we're viewing a certain page, fetch our starting position if (isset($_REQUEST['page']) && IsId($_REQUEST['page'])) { $page = (int) $_REQUEST['page']; $start = $page * GetConfig('CategoryProductsPerPage') - GetConfig('CategoryProductsPerPage'); } else { $page = 1; $start = 0; } // Count the number of products that belong in this vendor $query = "\n\t\t\tSELECT COUNT(p.productid) AS numproducts\n\t\t\tFROM [|PREFIX|]products p\n\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\tWHERE p.prodvisible='1' AND p.prodvendorid='" . (int) $vendor['vendorid'] . "'\n\t\t"; $numProducts = $GLOBALS['ISC_CLASS_DB']->FetchOne($query); $numPages = ceil($numProducts / GetConfig('CategoryProductsPerPage')); // Now load the actual products for this vendor $query = "\n\t\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid AND imageisthumb=1)\n\t\t\t\tWHERE prodvisible='1' AND p.prodvendorid='" . (int) $vendor['vendorid'] . "'\n\t\t\t\tORDER BY " . $sortField . ", prodname ASC\n\t\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, GetConfig('CategoryProductsPerPage')); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $GLOBALS['SNIPPETS']['VendorProducts'] = ''; if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } // Should we show the compare button? if (GetConfig('EnableProductComparisons') == 0 || $numProducts < 2) { $GLOBALS['HideCompareItems'] = "none"; } else { $GLOBALS['CompareLink'] = CompareLink(); } $GLOBALS['AlternateClass'] = ''; while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { 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($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['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['SNIPPETS']['VendorProducts'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("VendorProductsItem"); } // Does paging need to be shown? if ($numProducts > GetConfig('CategoryProductsPerPage')) { $GLOBALS['SNIPPETS']['PagingData'] = ""; $numEitherSide = 5; $start = max($page - $numEitherSide, 1); $end = min($page + $numEitherSide, $numPages); for ($i = $start; $i <= $end; $i++) { if ($i == $page) { $snippet = "CategoryPagingItemCurrent"; } else { $snippet = "CategoryPagingItem"; } $pageData = array('page' => $i, 'sort' => $sort); $GLOBALS['PageLink'] = VendorProductsLink($vendor, $pageData); $GLOBALS['PageNumber'] = $i; $GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet); } // Do we need to output a "Previous" link? if ($page > 1) { $pageData = array('page' => $page - 1, 'sort' => $sort); $GLOBALS['PrevLink'] = VendorProductsLink($vendor, $pageData); $GLOBALS['SNIPPETS']['CategoryPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious"); } // Do we need to output a "Next" link? if ($page < $numPages) { $pageData = array('page' => $page + 1, 'sort' => $sort); $GLOBALS['NextLink'] = VendorProductsLink($vendor, $pageData); $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']['ProductPaging'] = $output; } // Parse the sort select box snippet if ($numProducts > 1) { // Parse the sort select box snippet if ($GLOBALS['EnableSEOUrls'] == 1 && $vendor['vendorfriendlyname']) { $GLOBALS['URL'] = VendorProductsLink($vendor); } else { $GLOBALS['URL'] = $GLOBALS['ShopPath'] . "/vendors.php"; $GLOBALS['HiddenSortField'] = "<input type=\"hidden\" name=\"vendorid\" value=\"" . (int) $vendor['vendorid'] . "\" />"; $GLOBALS['HiddenSortField'] .= "<input type=\"hidden\" name=\"action\" value=\"products\" />"; } $GLOBALS['SNIPPETS']['CategorySortBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategorySortBox"); } }
public function SetPanelSettings() { if(!gzte11(ISC_HUGEPRINT) || $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor() === false) { $this->DontDisplay = true; return false; } $vendor = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor(); $GLOBALS['SNIPPETS']['VendorsOtherProducts'] = ''; if(!getProductReviewsEnabled()) { $GLOBALS['HideProductRating'] = "display: none"; } $query = $this->getProductQuery( 'p.prodvendorid='.(int)$vendor['vendorid'].' AND p.productid!='.$GLOBALS['ISC_CLASS_PRODUCT']->getProductId(), 'p.prodvendorfeatured DESC, RAND() DESC', 10 // Select 1 more than will be shown to check if we need to show the "has more" link ); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $productsDone = 0; $hasMore = false; $GLOBALS['AlternateClass'] = ''; while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { ++$productsDone; if($productsDone == 9) { $hasMore = true; break; } 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'] = formatProductCatalogPrice($row); $GLOBALS['ProductThumb'] = ImageThumb($row, 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['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['SNIPPETS']['VendorsOtherProducts'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductVendorsOtherProductsItem"); } if(!$GLOBALS['SNIPPETS']['VendorsOtherProducts']) { $this->DontDisplay = true; } $GLOBALS['VendorProductsLink'] = VendorProductsLink($vendor); if($hasMore == true) { $GLOBALS['HideViewAllLink'] = ''; } else { $GLOBALS['HideViewAllLink'] = 'display: none'; } }
public function setProductGlobals($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'] = ''; if (GetConfig('ShowProductPrice') && !$row['prodhideprice']) { $GLOBALS['ProductPrice'] = formatProductCatalogPrice($row); } // Workout the product description $desc = strip_tags($row['proddesc']); if (isc_strlen($desc) < 120) { $GLOBALS['ProductSummary'] = $desc; } else { $GLOBALS['ProductSummary'] = isc_substr($desc, 0, 120) . "..."; } $GLOBALS['ProductThumb'] = ImageThumb($row, ProdLink($row['prodname'])); $GLOBALS['ProductDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['proddateadded']); $GLOBALS['ProductPreOrder'] = false; $GLOBALS['ProductReleaseDate'] = ''; $GLOBALS['HideProductReleaseDate'] = 'display:none'; if ($row['prodpreorder']) { $GLOBALS['ProductPreOrder'] = true; if ($row['prodreleasedate'] && $row['prodreleasedateremove'] && time() >= (int)$row['prodreleasedate']) { $GLOBALS['ProductPreOrder'] = false; } else if ($row['prodreleasedate']) { $GLOBALS['ProductReleaseDate'] = GetLang('ProductListReleaseDate', array('releasedate' => isc_date(GetConfig('DisplayDateFormat'), (int)$row['prodreleasedate']))); $GLOBALS['HideProductReleaseDate'] = ''; } } 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']); if ($GLOBALS['ProductPreOrder']) { $GLOBALS['ProductAddText'] = GetLang('ProductPreOrderCartLink'); } else { $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'] = ''; } } }
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'] .= '> </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();'> <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."'> $split[2]</label>"."</td></tr>"; $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' {$checked} onclick='Check()'>" . "<label for='nothanks'> {$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();'> <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'> {$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> <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> <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()); }
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'] .= '> </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> <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()); }
public function SetPanelSettings() { $count = 0; $output = ""; $params = $GLOBALS['ISC_CLASS_SEARCH']->_searchterms; $this->searchterms = $params; $path = GetConfig('ShopPath'); /* the below mmy links are passed to the breadcrumbs */ $mmy_links = ""; /*---------- This below section is for generating search phrase----------*/ $GLOBALS['Category'] = ""; $GLOBALS['MMY'] = ""; $GLOBALS['PQ'] = ""; $GLOBALS['VQ'] = ""; $GLOBALS['SearchPhrase'] = ""; $ext_links = ""; // this variable is passed to the product detail page $seo_delim = "&"; if ($GLOBALS['EnableSEOUrls'] == 1) { $seo_delim = "/"; } if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) { $GLOBALS['Category'] .= $GLOBALS['ISC_SRCH_CATG_NAME']; } if (isset($params['year'])) { $GLOBALS['MMY'] .= $params['year'] . "<br>"; $ext_links .= $seo_delim . "year=" . $params['year']; } if (isset($params['make'])) { $GLOBALS['MMY'] .= strtoupper($params['make']) . "<br>"; $ext_links .= $seo_delim . "make=" . $params['make']; } if (isset($_REQUEST['model']) && !empty($_REQUEST['model']) && (!isset($params['model_flag']) || $params['model_flag'] != 0)) { $GLOBALS['MMY'] .= strtoupper($_REQUEST['model']) . "<br>"; $ext_links .= $seo_delim . "model=" . strtoupper($params['model']); } else { if (isset($params['model'])) { $ext_links .= $seo_delim . "model=" . $params['model']; } } /* this condition has been added seperately here to show submodel at last */ if (isset($params['submodel'])) { $GLOBALS['MMY'] .= strtoupper($params['submodel']) . "<br>"; } /*if(isset($params['year'])) { $ext_links .= $seo_delim."year=".$params['year']; }*/ if (isset($params['dynfilters']) && !empty($params['dynfilters'])) { foreach ($params['dynfilters'] as $key => $value) { if (eregi('vq', $key)) { $key = str_ireplace('vq', '', $key); $GLOBALS['VQ'] .= ucfirst($key) . ": {$value}<br>"; } else { if (eregi('pq', $key)) { $key = str_ireplace('pq', '', $key); $GLOBALS['PQ'] .= ucfirst($key) . ": {$value}<br>"; } } } } $filter_var = array('vq', 'pq'); /* this below patch is used for getting description of the category. Here currently the selected category id will be last one in the $params['srch_category'] array. if input['category'] is used then it will be the first one */ if (!empty($params['srch_category'])) { if (isset($params['category'])) { $selected_catg = $params['srch_category'][0]; } else { $selected_catg = end($params['srch_category']); } $catg_desc_qry = "select catdesc from [|PREFIX|]categories where categoryid = " . $selected_catg; $catg_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_desc_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($catg_desc_res) > 0) { $catg_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res); } /* this below patch is used to show the display name for the qualifiers from the qualifier association table */ $map_names = array(); $display_names = array(); $filter_names = "select qid , column_name , display_names from [|PREFIX|]qualifier_names where column_name regexp '^(pq|vq)'"; $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names); while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) { $map_names[$filter_row['qid']] = $filter_row['column_name']; $display_names[$filter_row['qid']] = $filter_row['display_names']; } $this->GetAssocDetails($selected_catg, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue); } // for breadcrumbs $this->_BuildBreadCrumbs(); /* the below line has been commented as client told to remove it */ //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase"); if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 30) { $msg_qry = "select value from [|PREFIX|]display where messageid = 1"; $msg_res = $GLOBALS['ISC_CLASS_DB']->Query($msg_qry); $msg_row = $GLOBALS['ISC_CLASS_DB']->FetchOne($msg_res); $GLOBALS['SearchPhrase'] = $msg_row; //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase"); } /*if(!empty($params['dynfilters'])) $GLOBALS['SearchPhrase'] .= " ".implode(" ",$params['dynfilters']); /*---------- Ending section for generating search phrase----------*/ $vq_column_title = ""; $GLOBALS['SearchResultList'] = ""; if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 0) { // We have at least one result, let's show it to the world! $GLOBALS['HideNoResults'] = "none"; // Only show the "compare" option if there are 2 or more products on this page if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) < 2) { $GLOBALS['HideCompareItems'] = "none"; } if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $GLOBALS['AlternateClass'] = ''; $counter = 1; $CurCatId = 0; $mmy_links = $this->GetYMMLinks($params); $mmy_links .= $this->GetOtherLinks($params); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['SearchResults'])) { /* Added by Simha to check inf prodcucts comes from different categories*/ if (empty($params['srch_category']) || !isset($params['srch_category'])) { if ($CurCatId != $row['categoryid']) { $CurCatId = $row['categoryid']; $map_names = array(); $display_names = array(); $filter_names = "SELECT DISTINCT qn.qid, qn.column_name, qn.display_names from \n [|PREFIX|]qualifier_names qn\n LEFT JOIN [|PREFIX|]qualifier_associations qa ON qa.qualifierid = qn.qid\n WHERE (qa.categoryid = '{$CurCatId}') \n AND qn.column_name regexp '^(pq|vq)'"; // || qa.categoryid IN (SELECT catparentid FROM isc_categories WHERE categoryid = '$CurCatId') $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names); while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) { $map_names[$filter_row['qid']] = $filter_row['column_name']; $display_names[$filter_row['qid']] = $filter_row['display_names']; } $this->GetAssocDetails($CurCatId, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue); } } /* Added by Simha Ends */ $GLOBALS['SearchTrackClass'] = "TrackLink"; $imagefile = ""; if ($GLOBALS['AlternateClass'] == 'Odd') { $GLOBALS['AlternateClass'] = 'Even'; } else { $GLOBALS['AlternateClass'] = 'Odd'; } $qry_string = $_SERVER['QUERY_STRING']; if (isset($_GET['page'])) { $page = "&page=" . $_GET['page']; $qry_string = str_ireplace($page, '', $qry_string); } if ($GLOBALS['EnableSEOUrls'] == 1) { if (isset($_GET['search_key'])) { $qry_string = str_ireplace('&search_key=' . $_GET['search_key'], '', $qry_string); } if (isset($params['search_query']) && !strstr($qry_string, 'search_query=')) { $qry_string .= "search_query=" . MakeURLSafe($params['search_query']); } if (isset($params['make']) && !strstr($qry_string, 'make=')) { $qry_string .= "&make=" . MakeURLSafe($params['make']); } if (isset($params['model']) && !strstr($qry_string, 'model=')) { $qry_string .= "&model=" . MakeURLSafe($params['model']); } if (isset($params['year']) && !strstr($qry_string, 'year=')) { $qry_string .= "&year=" . MakeURLSafe($params['year']); } if (isset($params['make']) && !strstr($qry_string, 'make=')) { $qry_string .= "&make=" . MakeURLSafe($params['make']); } if (isset($params['model_flag']) && !strstr($qry_string, 'model_flag=')) { $qry_string .= "&model_flag=" . MakeURLSafe($params['model_flag']); } if (isset($params['submodel']) && !strstr($qry_string, 'submodel=')) { $qry_string .= "&submodel=" . MakeURLSafe($params['submodel']); } } if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) { if (isset($params['srch_category'])) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of product listing page. } $GLOBALS['ProductCartQuantity'] = ''; if (isset($GLOBALS['CartQuantity' . $row['productid']])) { $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']]; } if ($counter % 2 == 0) { $GLOBALS['RowColor'] = 'grayrow'; } else { $GLOBALS['RowColor'] = 'whiterow'; } $counter++; $GLOBALS['ProductId'] = (int) $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; $GLOBALS['BrandName'] = $row['brandname']; $GLOBALS['ProdCode'] = $row['prodcode']; //$GLOBALS['ProdDesc'] = $this->strip_html_tags($row['proddesc']); //$GLOBALS['ProdOptions'] = $row['productoption']; $GLOBALS['VehicleOptions'] = ""; $GLOBALS['ProdOptions'] = ""; foreach ($row as $key => $val) { if ($val != "" && $val != "~") { if (($qualifier_id = array_search($key, $map_names)) !== false) { if (eregi('^vq', $key)) { $val = trim($val, "~"); $val = preg_split('/[~;]+/', $val); $val = array_unique($val); $val = array_values($val); $val = implode(",", $val); /* -- Setting display name for qualifier name -- */ if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') { $key = $OwnAssoc[$qualifier_id][0]['qname']; } else { if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') { $key = $ParentAssoc[$qualifier_id][0]['qname']; } else { if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) { $key = $display_names[$qualifier_id]; } else { $key = ucfirst(str_ireplace($filter_var, "", $key)); } } } /* -- Setting display name for qualifier name ends -- */ /* -- Setting display name for qualifier value -- */ if (($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != "") { $val = $OwnAssoc[$qualifier_id][$m]['vname']; } else { if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentAssoc[$qualifier_id][$m]['vname'] != "") { $val = $ParentAssoc[$qualifier_id][$m]['vname']; } } /* -- Setting display name for qualifier value ends-- */ $GLOBALS['VehicleOptions'] .= $key . " : " . $val . "<br>"; } if (eregi('^pq', $key)) { $val = trim($val, "~"); $val = preg_split('/[~;]+/', $val); $val = array_unique($val); $val = array_values($val); $val = implode(",", $val); /* -- Setting display name for qualifier name -- */ if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') { $key = $OwnAssoc[$qualifier_id][0]['qname']; } else { if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') { $key = $ParentAssoc[$qualifier_id][0]['qname']; } else { if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) { $key = $display_names[$qualifier_id]; } else { $key = ucfirst(str_ireplace($filter_var, "", $key)); } } } /* -- Setting display name for qualifier name ends -- */ /* -- Setting display name for qualifier value -- */ if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != '') { $val = $OwnAssoc[$qualifier_id][$m]['vname']; } else { if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentValue[$qualifier_id][$m]['vname'] != '') { $val = $ParentAssoc[$qualifier_id][$m]['vname']; } } /* -- Setting display name for qualifier value ends-- */ $GLOBALS['ProdOptions'] .= $key . " : " . $val . "<br>"; } } } } if (isset($row['vehicleoption'])) { $GLOBALS['VehicleOptions'] = $row['vehicleoption']; } if (isset($row['productoption'])) { $GLOBALS['ProdOptions'] = $row['productoption']; } if (isset($row['catuniversal']) && $row['catuniversal'] == 1) { $GLOBALS['VehicleOptions'] = $GLOBALS['ProductName']; if ($vq_column_title == "") { $vq_column_title = "Product Name"; } else { if ($vq_column_title != "Product Name") { $vq_column_title = "Product Name / Vehicle Options"; } } } else { if ($vq_column_title == "") { $vq_column_title = "Vehicle Options"; } else { if ($vq_column_title != "Vehicle Options") { $vq_column_title = "Product Name / Vehicle Options"; } } } if (empty($GLOBALS['VehicleOptions'])) { $GLOBALS['VehicleOptions'] = " "; } if (empty($GLOBALS['ProdOptions'])) { $GLOBALS['ProdOptions'] = " "; } /*--- the below lines are added for back 2 search link in the product detail page. Also modified line no 56 & 60 --- */ if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductLink'] .= "/refer=true" . $ext_links; } else { $GLOBALS['ProductLink'] .= "&refer=true" . $ext_links; } ### Added by Simha for onsale addition // Determine the price of this product //$GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($row); $FinalPrice = $GLOBALS['ProductPrice']; $SalePrice = $row['prodsaleprice']; //$DiscountAmount = $FinalPrice; if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) { $DiscountPrice = $SalePrice; } else { $DiscountPrice = $FinalPrice; $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $row['categoryid'], $row['brandseriesid']); } /* foreach($DiscountInfo as $DiscountInfoSub) { if(isset($DiscountInfoSub['catids'])) { $catids = explode(",", $DiscountInfoSub['catids']); foreach($catids as $catid) { if($catid == $row['categoryid']) { $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); if ($DiscountAmount < 0) { $DiscountAmount = 0; } $DiscountPrice = $FinalPrice - $DiscountAmount; } } } } */ if (isset($DiscountPrice) && $DiscountPrice < $FinalPrice) { //&& GetConfig('ShowOnSale') $GLOBALS['ProductPrice'] = '<strike>' . CurrencyConvertFormatPrice($FinalPrice) . '</strike>'; $GLOBALS['ProductPrice'] .= '<br>' . CurrencyConvertFormatPrice($DiscountPrice) . ''; $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; if (GetConfig('ShowOnSale')) { $GLOBALS['ProductPrice'] .= '<br>' . $GLOBALS['ShowOnSaleImage'] . ''; } } else { $GLOBALS['ProductPrice'] = '' . CurrencyConvertFormatPrice($FinalPrice) . ''; } ### Added by Simha Ends // commented the below line by vikas //$GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], $GLOBALS['ProductLink']); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas $GLOBALS['ProductURL'] = $GLOBALS['ProductLink']; $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas $GLOBALS['ProductURL'] = $GLOBALS['ProductLink']; //blessen if (intval($row['prodretailprice']) <= 0) { //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); // commented by vikas on 15-7-09 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>"; } else { //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); // commented by vikas on 15-7-09 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>"; } //blessen // original $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $GLOBALS['CartURL'] = CartLink($row['productid']); $offer = $this->IsProductMakeanOffer($row['brandseriesid'], $row['brandname'], $row['categoryid']); if ($offer == 'yes') { $GLOBALS['HideOfferButton'] = 'block'; } else { $GLOBALS['HideOfferButton'] = 'none'; } $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItem"); } else { if ($GLOBALS['results_page_flag'] == 0) { $subcatg_link = $this->LeftCatLink($mmy_links, 'subcategory', $row['catname']); $link = "<a href='" . $subcatg_link . "'>"; if (isset($row['imagefile']) && !empty($row['imagefile'])) { $images = explode("~", $row['imagefile']); for ($j = 0; $j < count($images); $j++) { if (!empty($images[$j])) { $imagefile = "{$link}<img src='{$path}/category_images/" . $images[$j] . "'></a>"; break; } } } else { if (empty($row['imagefile']) || empty($imagefile)) { $imagefile = "{$link}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>"; } } $GLOBALS['LeftImage'] = $imagefile; $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available"; $row['brandname'] = str_replace('~', ' , ', $row['brandname']); //$GLOBALS['RelatedBrands'] = $row['brandname']; if (!empty($row['seriesname'])) { $row['brandname'] .= "<br>" . $row['seriesname']; } if ($row['seriesids'] != "") { $seriesids = str_ireplace("~", ",", $row['seriesids']); $seriesids_qry = "select brandname , seriesname from isc_brand_series bs left join isc_brands b on bs.brandid = b.brandid where seriesid in (" . $seriesids . ")"; $seriesids_res = $GLOBALS['ISC_CLASS_DB']->Query($seriesids_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($seriesids_res) > 0) { while ($seriesids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($seriesids_res)) { if (!isset($params['brand'])) { if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } else { if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $GLOBALS['ProductsCount'] .= "<br><a href='" . $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "'>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } } } } $content = $row['brandname'] . "<br>"; if (!isset($params['category']) && (isset($params['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of subcatg page. $content .= "<h3><a href='" . $path . "/search.php?{$qry_string}&subcategory=" . MakeURLSafe($row['catname']) . "'>" . $row['catname'] . "</a></h3>>"; $GLOBALS['TitleLink'] = "<h2><a href='" . $subcatg_link . "'>" . $row['catname'] . "</a></h2>"; } $content .= "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', '') . "<br>" . $imagefile; $GLOBALS['leftsidecontent'] = $content; $GLOBALS['PriceRange'] = "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', ''); $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty']; $GLOBALS['rightsidecontent'] = $content; $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>"; $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>"; $content = "{$link}<img src='{$path}/templates/default/images/view.gif'></a>"; $GLOBALS['ViewDetailsImage'] = $content; if (IsDiscountAvailable('category', $row['categoryid'])) { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; } if ($this->IsMakeAnOffer('category', $row['categoryid']) == 'yes') { $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>"; } $GLOBALS['lowersidecontent'] = $content; $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing"); } else { $series_link = $this->LeftCatLink($mmy_links, 'series', $row['seriesname']); $link = "<a href='" . $series_link . "'>"; if (isset($row['imagefile']) && !empty($row['imagefile'])) { $images = explode("~", $row['imagefile']); for ($j = 0; $j < count($images); $j++) { if (!empty($images[$j])) { $imagefile = "{$link}<img src='{$path}/category_images/" . $images[$j] . "'></a>"; break; } } } else { if (empty($row['imagefile']) || empty($imagefile)) { $imagefile = "{$link}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>"; } } $GLOBALS['LeftImage'] = $imagefile; $row['brandname'] = str_replace('~', ' , ', $row['brandname']); $GLOBALS['RelatedBrands'] = $row['brandname']; if (isset($row['seriesname']) && !empty($row['seriesname']) && (!isset($params['srch_category']) || isset($params['category'])) && isset($GLOBALS['BRAND_SERIES_FLAG'])) { if (empty($row['imagefile']) || empty($imagefile)) { $GLOBALS['LeftImage'] = "{$link}<img src='{$path}/templates/default/images/ProductDefault.gif'></a>"; } else { $GLOBALS['LeftImage'] = "{$link}<img src='{$path}/series_images/" . $row['imagefile'] . "' width='140px'></a>"; } $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>"; //"<h3>".$row['catname']."</h3> $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available"; $GLOBALS['RelatedBrands'] = "<ul class='featurepoints'>"; if (!empty($row['feature_points1'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points1'] . "</li>"; } if (!empty($row['feature_points2'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points2'] . "</li>"; } if (!empty($row['feature_points3'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points3'] . "</li>"; } if (!empty($row['feature_points4'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points4'] . "</li>"; } $GLOBALS['RelatedBrands'] .= "</ul>"; /*if(isset($row['brandlargefile']) && !empty($row['brandlargefile'])) { $brand_image_path = "product_images/".$row['brandlargefile']; if(file_exists($brand_image_path)) { $GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandlargefile']."'>"; } else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) { $brand_image_path = "product_images/".$row['brandimagefile']; if(file_exists($brand_image_path)) $GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>"; } } else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) { $brand_image_path = "product_images/".$row['brandimagefile']; if(file_exists($brand_image_path)) $GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>"; }*/ } $GLOBALS['CatgDescandBrandImage'] = $row['branddescription']; if ($row['subcatgids'] != "") { $subcatgids = str_ireplace("~", ",", $row['subcatgids']); $subcatgids_qry = "select catname from [|PREFIX|]categories where categoryid in (" . $subcatgids . ")"; $subcatgids_res = $GLOBALS['ISC_CLASS_DB']->Query($subcatgids_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res) > 0) { while ($subcatgids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($subcatgids_res)) { if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductsCount'] .= "<br><a href='" . $series_link . "/subcategory/" . MakeURLSafe(Strtolower($subcatgids_arr['catname'])) . "'>" . $subcatgids_arr['catname'] . "</a>"; } else { $GLOBALS['ProductsCount'] .= "<br><a href='" . $series_link . "&subcategory=" . MakeURLSafe(Strtolower($subcatgids_arr['catname'])) . "'>" . $subcatgids_arr['catname'] . "</a>"; } } } } $content = $row['brandname'] . "<br>"; $content .= $row['catname'] . "<br>"; $content .= "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', ''); $GLOBALS['leftsidecontent'] = $content; $GLOBALS['PriceRange'] = "Price starting from \$" . number_format($row['prodcalculatedprice'], 2, '.', ''); $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty']; $GLOBALS['rightsidecontent'] = $content; $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>"; $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>"; $content = "{$link}<img src='{$path}/templates/default/images/view.gif'></a>"; $GLOBALS['ViewDetailsImage'] = $content; if (IsDiscountAvailable('series', $row['brandseriesid'])) { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; } if ($this->IsMakeAnOffer('series', $row['brandseriesid']) == 'yes') { $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>"; } $GLOBALS['lowersidecontent'] = $content; $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing"); $GLOBALS['HideCompareItems'] = "none"; } } } $get_variables = $_GET; $sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']); unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']); $i = 0; foreach ($get_variables as $key => $value) { $sort_qry .= "&{$key}={$value}"; } if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') { $sort = "asc "; $img = " <img src='{$path}/templates/default/images/ArrowDown.gif' border=0>"; } else { $sort = "desc "; $img = " <img src='{$path}/templates/default/images/ArrowUp.gif' border=0>"; } //$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) { if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand</a>"; $GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Part Number</a>"; $GLOBALS['ProductPrice'] = "<a href='{$path}{$mmy_links}/orderby/prodcalculatedprice/sortby/{$sort}'>Price</a>"; } else { $GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand</a>"; $GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Part Number</a>"; $GLOBALS['ProductPrice'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcalculatedprice&sortby={$sort}'>Price</a>"; } if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') { $GLOBALS['ProductBrand'] .= $img; } $GLOBALS['ProductVQ'] = $vq_column_title; /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname') $GLOBALS['Product_VQ'] .= $img;*/ if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') { $GLOBALS['ProductPartNumber'] .= $img; } $GLOBALS['ProductPQ'] = "Product Options"; /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption') $GLOBALS['SearchResults'] .= $img;*/ if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') { $GLOBALS['ProductPrice'] .= $img; } $GLOBALS['ProductDetails'] = "Details"; $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItemHeader"); } else { // $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>"; $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain"); } if ($GLOBALS['EnableSEOUrls'] == 1) { $back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']); } else { $back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING']; } ISC_SetCookie("back2search", $back2url, 0, "/"); // Showing the syndication option? if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) { $GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false); $GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed"); } } else { // No search results were found $GLOBALS['HideSearchResults'] = "none"; $GLOBALS['HidePanels'][] = 'SearchPageProducts'; } }
/** * Set the panel settings */ public function SetPanelSettings() { $count = 1; if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $output = ""; $vendorRestriction = ''; // If we're on a vendor page, only show top sellers from this particular vendor if (isset($GLOBALS['ISC_CLASS_VENDORS'])) { $vendor = $GLOBALS['ISC_CLASS_VENDORS']->GetVendor(); $vendorRestriction = " AND p.prodvendorid='" . (int) $vendor['vendorid'] . "'"; } $query = "\n\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\tFROM [|PREFIX|]products p\n\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid AND pi.imageisthumb=1)\n\t\t\tWHERE p.prodnumsold > '0' AND p.prodvisible='1' " . $vendorRestriction . "\n\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\tORDER BY p.prodnumsold DESC\n\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 5); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $GLOBALS['AlternateClass'] = ''; while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { 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']]; } // Use the SideTopSellersFirst snippet for the first product only if ($count == 1) { $snippet = "SideTopSellersFirst"; } else { $snippet = "SideTopSellers"; } $GLOBALS['ProductThumb'] = ImageThumbNew($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['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['ProductNumber'] = $count++; $GLOBALS['ProductId'] = $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice($row); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet); } $GLOBALS['SNIPPETS']['SideTopSellers'] = $output; if (!$output) { $this->DontDisplay = true; } }
public function SetPanelSettings() { $params = $GLOBALS['ISC_CLASS_ABTESTING']->_searchterms; $this->searchterms = $params; if ($GLOBALS['pagetype'] == 1) { return; } if ($GLOBALS['pagetype'] == 2 && isset($GLOBALS['pagecontent']) && $GLOBALS['pagecontent'] == 1) { $this->YMMSelectors($params); $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryListingMain"); return; } if ($GLOBALS['ISC_CLASS_ABTESTING']->GetNumResults() == 0) { $this->YMMSelectors($params); $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryListingMain"); return; } $count = 0; $output = ""; /* Checking the search string. If it is used in any search, will be retained. else it will not be retained - starts */ if (isset($this->searchterms['search'])) { $search_str = trim(str_ireplace($this->searchterms['search_string'], "", $this->searchterms['search'])); if ($search_str == '') { unset($this->searchterms['search'], $params['search']); } else { $this->searchterms['search'] = $params['search'] = $search_str; } } $path = GetConfig('ShopPath'); /* the below mmy links are passed to the breadcrumbs */ $mmy_links = ""; /*---------- This below section is for generating search phrase----------*/ $GLOBALS['Category'] = ""; $GLOBALS['MMY'] = ""; $GLOBALS['PQ'] = ""; $GLOBALS['VQ'] = ""; $GLOBALS['SearchPhrase'] = ""; $ext_links = ""; // this variable is passed to the product detail page $seo_delim = "&"; if ($GLOBALS['EnableSEOUrls'] == 1) { $seo_delim = "/"; } if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) { $GLOBALS['Category'] .= $GLOBALS['ISC_SRCH_CATG_NAME']; } if (isset($params['year'])) { $GLOBALS['MMY'] .= $params['year'] . "<br>"; $ext_links .= $seo_delim . "year=" . $params['year']; } if (isset($params['make'])) { $GLOBALS['MMY'] .= strtoupper($params['make']) . "<br>"; $ext_links .= $seo_delim . "make=" . MakeURLSafe($params['make']); } if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) { $GLOBALS['MMY'] .= strtoupper($params['model']) . "<br>"; $ext_links .= $seo_delim . "model=" . MakeURLSafe($params['model']); } /*else if(isset($params['model'])) $ext_links .= $seo_delim."model=".$params['model'];*/ /* this condition has been added seperately here to show submodel at last */ if (isset($params['submodel'])) { $GLOBALS['MMY'] .= MakeURLSafe($params['submodel']) . "<br>"; } /*if(isset($params['year'])) { $ext_links .= $seo_delim."year=".$params['year']; }*/ if (isset($params['dynfilters']) && !empty($params['dynfilters'])) { foreach ($params['dynfilters'] as $key => $value) { if (eregi('vq', $key)) { $key = str_ireplace('vq', '', $key); $GLOBALS['VQ'] .= ucfirst($key) . ": {$value}<br>"; } else { if (eregi('pq', $key)) { $key = str_ireplace('pq', '', $key); $GLOBALS['PQ'] .= ucfirst($key) . ": {$value}<br>"; } } } } $filter_var = array('vq', 'pq'); /* this below patch is used for getting description of the category. Here currently the selected category id will be last one in the $params['srch_category'] array. if input['category'] is used then it will be the first one */ if (!empty($params['srch_category'])) { if (isset($params['category'])) { $selected_catg = $params['srch_category'][0]; } else { $selected_catg = end($params['srch_category']); } //wirror_20100806: add selected files like pagecontenttype and customcontentid; $catg_desc_qry = "select pagecontenttype, customcontentid, catdesc , categoryfooter from [|PREFIX|]categories where categoryid = " . $selected_catg; $catg_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_desc_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($catg_desc_res) > 0) { $catg_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res); } /* this below patch is used to show the display name for the qualifiers from the qualifier association table */ $map_names = array(); $display_names = array(); $filter_names = "select qid , column_name , display_names from [|PREFIX|]qualifier_names where column_name regexp '^(pq|vq)'"; $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names); while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) { $map_names[$filter_row['qid']] = $filter_row['column_name']; $display_names[$filter_row['qid']] = $filter_row['display_names']; } $this->GetAssocDetails($selected_catg, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue); } if (isset($params['brand'])) { $brand_desc_arr = array(); $brand_desc_qry = "select branddescription , brandfooter from [|PREFIX|]brands where brandname = '" . $params['brand'] . "'"; $brand_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_desc_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($brand_desc_res) > 0) { $brand_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_desc_res); } } // for breadcrumbs $this->_BuildBreadCrumbs(); /* the below line has been commented as client told to remove it */ //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase"); if ($GLOBALS['ISC_CLASS_ABTESTING']->GetNumResults() > 30) { $msg_qry = "select value from [|PREFIX|]display where messageid = 1"; $msg_res = $GLOBALS['ISC_CLASS_DB']->Query($msg_qry); $msg_row = $GLOBALS['ISC_CLASS_DB']->FetchOne($msg_res); $GLOBALS['SearchPhrase'] = $msg_row; //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase"); } /*if(!empty($params['dynfilters'])) $GLOBALS['SearchPhrase'] .= " ".implode(" ",$params['dynfilters']); /*---------- Ending section for generating search phrase----------*/ $vq_column_title = ""; $GLOBALS['SearchResultList'] = ""; if ($GLOBALS['ISC_CLASS_ABTESTING']->GetNumResults() > 0) { $brand_rating = 0; $category_rating = 0; if ($GLOBALS['results_page_flag'] == 1) { $brand_rating_qry = "select avg(revrating) as rating from [|PREFIX|]reviews r left join [|PREFIX|]products p on r.revproductid = p.productid left join [|PREFIX|]brands b on p.prodbrandid = b.brandid where r.revstatus = 1 and b.brandname = '" . $params['brand'] . "'"; $brand_rating_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_rating_qry); $brand_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_rating_res); if (isset($brand_rating_arr['rating'])) { $brand_rating = (int) $brand_rating_arr['rating']; } } else { if ($GLOBALS['results_page_flag'] == 0 && isset($selected_catg)) { // 3rdAug2010: added the condition "isset($selected_catg)" as no need to show rating when only YMM is selected // lguan_20100612: Category page mode, calculate the rating $catquery = $GLOBALS['ISC_CLASS_DB']->Query("SELECT categoryid FROM [|PREFIX|]categories where catparentid = {$selected_catg}"); $catlistid = array(); while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catquery)) { $catlistid[] = $catrow['categoryid']; } $catcountlist = implode(",", $catlistid); //lguan_20100612: Changed following codes to get product rating for categories if (count($catlistid) > 0) { $catcountlist = $selected_catg . "," . $catcountlist; } $cat_rating_res = $GLOBALS['ISC_CLASS_DB']->Query("SELECT floor(SUM(p.prodratingtotal)/SUM(p.prodnumratings))AS prodavgrating FROM [|PREFIX|]categoryassociations c INNER JOIN [|PREFIX|]products p on c.productid=p.productid where c.categoryid IN ({$catcountlist})"); $cat_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($cat_rating_res); if (isset($cat_rating_arr['prodavgrating'])) { $category_rating = (int) $cat_rating_arr['prodavgrating']; } } } /* displaying the dropdowns for YMM */ if (!isset($params['make']) || !isset($params['year']) || !isset($params['model']) || isset($params['model_flag']) && $params['model_flag'] == 0) { $this->YMMSelectors($params); } // We have at least one result, let's show it to the world! $GLOBALS['HideNoResults'] = "none"; // Only show the "compare" option if there are 2 or more products on this page if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) < 2) { $GLOBALS['HideCompareItems'] = "none"; } if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $GLOBALS['AlternateClass'] = ''; $counter = 1; $CurCatId = 0; $mmy_links = $this->GetYMMLinks($params); $mmy_links .= $this->GetOtherLinks($params); //wirror_code_mark_begin //wirror_20100809: record the searched productids $searchedProductIds = array(); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['SearchResults'])) { /* Added by Simha to check inf prodcucts comes from different categories*/ if (empty($params['srch_category']) || !isset($params['srch_category'])) { if ($CurCatId != $row['categoryid']) { $CurCatId = $row['categoryid']; $map_names = array(); $display_names = array(); $filter_names = "SELECT DISTINCT qn.qid, qn.column_name, qn.display_names from \n [|PREFIX|]qualifier_names qn\n LEFT JOIN [|PREFIX|]qualifier_associations qa ON qa.qualifierid = qn.qid\n WHERE (qa.categoryid = '{$CurCatId}') \n AND qn.column_name regexp '^(pq|vq)'"; // || qa.categoryid IN (SELECT catparentid FROM isc_categories WHERE categoryid = '$CurCatId') $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names); while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) { $map_names[$filter_row['qid']] = $filter_row['column_name']; $display_names[$filter_row['qid']] = $filter_row['display_names']; } $this->GetAssocDetails($CurCatId, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue); } } /* Added by Simha Ends */ $GLOBALS['SearchTrackClass'] = "TrackLink"; $imagefile = ""; if ($GLOBALS['AlternateClass'] == 'Odd') { $GLOBALS['AlternateClass'] = 'Even'; } else { $GLOBALS['AlternateClass'] = 'Odd'; } $qry_string = $_SERVER['QUERY_STRING']; if (isset($_GET['page'])) { $page = "&page=" . $_GET['page']; $qry_string = str_ireplace($page, '', $qry_string); } if ($GLOBALS['EnableSEOUrls'] == 1) { if (isset($_GET['search_key'])) { $qry_string = str_ireplace('&search_key=' . $_GET['search_key'], '', $qry_string); } if (isset($params['search_query']) && !strstr($qry_string, 'search_query=')) { $qry_string .= "search_query=" . MakeURLSafe($params['search_query']); } if (isset($params['make']) && !strstr($qry_string, 'make=')) { $qry_string .= "&make=" . MakeURLSafe($params['make']); } if (isset($params['model']) && !strstr($qry_string, 'model=')) { $qry_string .= "&model=" . MakeURLSafe($params['model']); } if (isset($params['year']) && !strstr($qry_string, 'year=')) { $qry_string .= "&year=" . MakeURLSafe($params['year']); } if (isset($params['make']) && !strstr($qry_string, 'make=')) { $qry_string .= "&make=" . MakeURLSafe($params['make']); } if (isset($params['model_flag']) && !strstr($qry_string, 'model_flag=')) { $qry_string .= "&model_flag=" . MakeURLSafe($params['model_flag']); } if (isset($params['submodel']) && !strstr($qry_string, 'submodel=')) { $qry_string .= "&submodel=" . MakeURLSafe($params['submodel']); } } if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) { break; } if ($GLOBALS['pagetype'] == 3) { //wirror_mark_condition1 /*if( isset($params['srch_category']) ) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of product listing page. }*/ /*if(isset($params['category']) || ( !isset($params['subcategory']) && isset($params['series']) )) { $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription']; //$GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter']; $GLOBALS['CatgBrandSeriesFooter'] = ""; if( ( isset($params['category']) || isset($params['subcategory']) ) && $GLOBALS['CatgDescandBrandImage'] == "" ) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; //$GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = ""; } } else if(isset($params['srch_category'])) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : ''; if( isset($params['series']) && $row['seriesdescription'] != "" ) { $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription']; //$GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter']; $GLOBALS['CatgBrandSeriesFooter'] = ""; } if($GLOBALS['CatgDescandBrandImage'] == '' && $GLOBALS['CatgBrandSeriesFooter'] == '' && isset($params['brand'])) { $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : ''; //$GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = ""; } } else if(isset($params['brand'])) { $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : ''; }*/ /* No need to show footer description when YMM are selected */ /*if( isset($params['make']) || isset($params['model']) || isset($params['year']) ) { $GLOBALS['CatgBrandSeriesFooter'] = ""; }*/ $GLOBALS['ProductCartQuantity'] = ''; if (isset($GLOBALS['CartQuantity' . $row['productid']])) { $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']]; } if ($counter % 2 == 0) { $GLOBALS['RowColor'] = 'grayrow'; } else { $GLOBALS['RowColor'] = 'whiterow'; } $counter++; $GLOBALS['ProductId'] = (int) $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; //$GLOBALS['BrandName'] = $row['brandname']; /* -- The below code is added to display the brand and series logo -- */ $GLOBALS['BrandName'] = ""; $brandlogo = realpath(ISC_BASE_PATH . '/product_images/' . $row['brandimagefile']); if ($row['brandimagefile'] != '' && file_exists($brandlogo)) { $GLOBALS['BrandName'] .= "<img src=\"" . $GLOBALS['ShopPath'] . "/product_images/" . $row['brandimagefile'] . "\" class=\"BrandSeriesLogo\" />"; } else { $GLOBALS['BrandName'] .= $row['brandname']; } $serieslogo = realpath(ISC_BASE_PATH . '/series_images/' . $row['serieslogoimage']); if ($row['serieslogoimage'] != '' && file_exists($serieslogo)) { $GLOBALS['BrandName'] .= "<br><img src=\"" . $GLOBALS['ShopPath'] . "/series_images/" . $row['serieslogoimage'] . "\" />"; } else { $GLOBALS['BrandName'] .= "<br>" . $row['seriesname']; } /* --- ends --- */ $GLOBALS['ProdCode'] = $row['prodcode']; //$GLOBALS['ProdDesc'] = $this->strip_html_tags($row['proddesc']); //$GLOBALS['ProdOptions'] = $row['productoption']; $GLOBALS['VehicleOptions'] = ""; $GLOBALS['ProdOptions'] = ""; foreach ($row as $key => $val) { if ($val != "" && $val != "~") { if (($qualifier_id = array_search($key, $map_names)) !== false) { if (eregi('^vq', $key)) { $val = trim($val, "~"); $val = preg_split('/[~;]+/', $val); $val = array_unique($val); $val = array_values($val); $val = implode(",", $val); /* -- Setting display name for qualifier name -- */ if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') { $key = $OwnAssoc[$qualifier_id][0]['qname']; } else { if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') { $key = $ParentAssoc[$qualifier_id][0]['qname']; } else { if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) { $key = $display_names[$qualifier_id]; } else { $key = ucfirst(str_ireplace($filter_var, "", $key)); } } } /* -- Setting display name for qualifier name ends -- */ /* -- Setting display name for qualifier value -- */ if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != "") { $val = $OwnAssoc[$qualifier_id][$m]['vname']; } else { if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentAssoc[$qualifier_id][$m]['vname'] != "") { $val = $ParentAssoc[$qualifier_id][$m]['vname']; } } /* -- Setting display name for qualifier value ends-- */ //$GLOBALS['VehicleOptions'] .= "<b>".$key."</b> : ".$val."<br>"; $GLOBALS['VehicleOptions'] .= "<div class='qualifierwrap'><div class='qualifiertitle'>" . $key . " :</div> " . $val . "</div>"; } if (eregi('^pq', $key)) { $val = trim($val, "~"); $val = preg_split('/[~;]+/', $val); $val = array_unique($val); $val = array_values($val); $val = implode(",", $val); /* -- Setting display name for qualifier name -- */ if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') { $key = $OwnAssoc[$qualifier_id][0]['qname']; } else { if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') { $key = $ParentAssoc[$qualifier_id][0]['qname']; } else { if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) { $key = $display_names[$qualifier_id]; } else { $key = ucfirst(str_ireplace($filter_var, "", $key)); } } } /* -- Setting display name for qualifier name ends -- */ /* -- Setting display name for qualifier value -- */ if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != '') { $val = $OwnAssoc[$qualifier_id][$m]['vname']; } else { if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentValue[$qualifier_id][$m]['vname'] != '') { $val = $ParentAssoc[$qualifier_id][$m]['vname']; } } /* -- Setting display name for qualifier value ends-- */ //$GLOBALS['ProdOptions'] .= "<b>".$key."</b> : ".$val."<br>"; $GLOBALS['ProdOptions'] .= "<div class='qualifierwrap'><div class='qualifiertitle'>" . $key . " :</div> " . $val . "</div>"; } } } } if (isset($row['vehicleoption'])) { $GLOBALS['VehicleOptions'] = $row['vehicleoption']; } if (isset($row['productoption'])) { $GLOBALS['ProdOptions'] = $row['productoption']; } if (isset($row['catuniversal']) && $row['catuniversal'] == 1) { $GLOBALS['VehicleOptions'] = $GLOBALS['ProductName']; if ($vq_column_title == "") { $vq_column_title = "Product Name"; } else { if ($vq_column_title != "Product Name") { $vq_column_title = "Product Name / Vehicle"; } } } else { if ($vq_column_title == "") { $vq_column_title = "Vehicle Options"; } else { if ($vq_column_title != "Vehicle Options") { $vq_column_title = "Product Name / Vehicle"; } } } if (empty($GLOBALS['ProdOptions']) && empty($GLOBALS['VehicleOptions'])) { $GLOBALS['ProdOptions'] = " "; } if (empty($GLOBALS['VehicleOptions'])) { $GLOBALS['VehicleOptions'] = " "; } /*--- the below lines are added for back 2 search link in the product detail page. Also modified line no 56 & 60 --- */ if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductLink'] .= "/refer=true" . $ext_links; if (isset($GLOBALS['SearchId'])) { $GLOBALS['ProductLink'] .= '/SearchLogId/' . $GLOBALS['SearchId']; } } else { $GLOBALS['ProductLink'] .= "&refer=true" . $ext_links; if (isset($GLOBALS['SearchId'])) { $GLOBALS['ProductLink'] .= '&SearchLogId=' . $GLOBALS['SearchId']; } } ### Added by Simha for onsale addition // Determine the price of this product //$GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($row); $FinalPrice = $GLOBALS['ProductPrice']; $SalePrice = $row['prodsaleprice']; //$DiscountAmount = $FinalPrice; $discounttype = 0; $discountname = ''; if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) { $DiscountPrice = $SalePrice; } else { $DiscountPrice = $FinalPrice; $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $row['categoryid'], $row['brandseriesid'], $discounttype, $discountname); /*if($discounttype == 0) { $DiscountPrice = $FinalPrice; }*/ } /* foreach($DiscountInfo as $DiscountInfoSub) { if(isset($DiscountInfoSub['catids'])) { $catids = explode(",", $DiscountInfoSub['catids']); foreach($catids as $catid) { if($catid == $row['categoryid']) { $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); if ($DiscountAmount < 0) { $DiscountAmount = 0; } $DiscountPrice = $FinalPrice - $DiscountAmount; } } } } */ if (isset($DiscountPrice) && $DiscountPrice < $FinalPrice && $discounttype == 0) { //&& GetConfig('ShowOnSale') $GLOBALS['ProductPrice'] = '<strike>' . CurrencyConvertFormatPrice($FinalPrice) . '</strike>'; $GLOBALS['ProductPrice'] .= '<br><div class="finalprice">' . CurrencyConvertFormatPrice($DiscountPrice) . '</div> '; if (strtolower($discountname) == "clearance") { $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/clearance.gif" alt="">'; } else { $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; } if (GetConfig('ShowOnSale')) { $GLOBALS['ProductPrice'] .= '' . $GLOBALS['ShowOnSaleImage'] . ''; } } else { $GLOBALS['ProductPrice'] = '<div class="finalprice">' . CurrencyConvertFormatPrice($FinalPrice) . '</div>'; } ### Added by Simha Ends // commented the below line by vikas //$GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], $GLOBALS['ProductLink']); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas $GLOBALS['ProductURL'] = $GLOBALS['ProductLink']; $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas $GLOBALS['ProductURL'] = $GLOBALS['ProductLink']; //blessen if (intval($row['prodretailprice']) <= 0) { //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); // commented by vikas on 15-7-09 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>"; } else { //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); // commented by vikas on 15-7-09 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>"; } //blessen // original $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $GLOBALS['CartURL'] = CartLink($row['productid']); if (isset($GLOBALS['SearchId'])) { $GLOBALS['CartURL'] .= '&SearchLogId=' . $GLOBALS['SearchId']; } $offer = $this->IsProductMakeanOffer($row['brandseriesid'], $row['brandname'], $row['categoryid']); if ($offer == 'yes') { $GLOBALS['HideOfferButton'] = 'block'; } else { $GLOBALS['HideOfferButton'] = 'none'; } $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItem"); } else { if ($GLOBALS['pagetype'] == 2) { //wirror_mark_condition2 $isDynamicPage = $catg_desc_arr['pagecontenttype'] == 0 ? true : false; $mmy_links_modified = $mmy_links; if (!isset($GLOBALS['ISC_SRCH_CATG_ID'])) { $parentid = $GLOBALS['categories_all'][$row['categoryid']]['catparentid']; if ($parentid != 0) { if (isset($GLOBALS['categories_all'][$parentid])) { // if parent catg is not visible $mmy_links_modified = $mmy_links; } else { $mmy_links_modified = $mmy_links; } } else { $mmy_links_modified = $mmy_links; } } $subcatg_link = $this->LeftCatLink($mmy_links_modified, 'subcategory', $row['catname']); $link = "<a href='" . $subcatg_link . "'>"; $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>"; $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title='' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>"; //$imagelink = "<a href='".$GLOBALS['ShopPath']."/catgbrand.php?categoryid=".$row['categoryid']."&url=$subcatg_link' class='thickbox' title=''>"; if (isset($row['imagefile']) && !empty($row['imagefile'])) { $images = explode("~", $row['imagefile']); for ($j = 0; $j < count($images); $j++) { if (!empty($images[$j])) { $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $images[$j] . "' alt='" . $row['catimagealt'] . "' title='" . $row['catimagealt'] . "'></a>"; $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>"; break; } } } else { if (empty($row['imagefile']) || empty($imagefile)) { $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>"; $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>"; } } $GLOBALS['LeftImage'] = $imagefile; $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available"; $row['brandname'] = str_replace('~', ' , ', $row['brandname']); //$GLOBALS['RelatedBrands'] = $row['brandname']; if (!empty($row['seriesname'])) { $row['brandname'] .= "<br>" . $row['seriesname']; } $GLOBALS['CatgSeriesList'] = ""; if ($row['seriesids'] != "") { $seriesids = str_ireplace("~", ",", $row['seriesids']); $seriesids_qry = "select seriesid , brandname , seriesname from isc_brand_series bs left join isc_brands b on bs.brandid = b.brandid where seriesid in (" . $seriesids . ")"; $seriesids_res = $GLOBALS['ISC_CLASS_DB']->Query($seriesids_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($seriesids_res) > 0) { while ($seriesids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($seriesids_res)) { if ($GLOBALS['CatgSeriesList'] == "") { $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['categoryid'] . "')\">View Brands ></a><div id='" . $row['categoryid'] . "' style='display:block'>"; } else { $GLOBALS['CatgSeriesList'] .= "<br>"; } $tooltipscript = "onmouseover='createtip(" . $row['categoryid'] . $seriesids_arr['seriesid'] . ")' onmouseout='UnTip()'"; if (!isset($params['brand'])) { if ($GLOBALS['EnableSEOUrls'] == 1) { $series_link = $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $series_link = $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } else { if ($GLOBALS['EnableSEOUrls'] == 1) { $series_link = $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $series_link = $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } //wirror20100728: keep the catname consistent with the displayname $GLOBALS['CatgSeriesList'] .= "<span id='span" . $row['categoryid'] . $seriesids_arr['seriesid'] . "' style='display:none'><a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $seriesids_arr['seriesid'] . "&catname=" . rawurlencode($row['catname']) . "&url=" . urlencode($series_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>"; } $GLOBALS['CatgSeriesList'] .= "</br></div>"; } } $content = $row['brandname'] . "<br>"; if (!isset($params['category']) && (isset($params['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))) { /*$GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : ''; if( isset($params['make']) || isset($params['model']) || isset($params['year']) || isset($params['brand']) ) { $GLOBALS['CatgBrandSeriesFooter'] = ""; }*/ $content .= "<h3><a href='" . $path . "/search.php?{$qry_string}&subcategory=" . MakeURLSafe($row['catname']) . "'>" . $row['catname'] . "</a></h3>>"; $GLOBALS['TitleLink'] = "<h2><a href='" . $subcatg_link . "' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>" . $row['catname'] . "</a></h2>"; } /* copy the code to outer //lguan_20100612: Show overal product rating at category landing page if($category_rating != 0) { $GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$category_rating.gif' alt='' /></h2>"; } */ /*$ProdStartPrice = GetStartingPrice($row['categoryid'], $row['prodcalculatedprice']); $content .= "Price starting from $".number_format($ProdStartPrice, 2, '.', '')."<br>".$imagefile;*/ $GLOBALS['leftsidecontent'] = $content; if (number_format($row['prodminprice'], 2, '.', '') < number_format($row['prodmaxprice'], 2, '.', '')) { $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', ''); } else { $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', ''); } //lguan_20100612: Show product ratings in categories/sub-categories page $GLOBALS['Rating'] = isset($row['prodavgrating']) ? $row['prodavgrating'] : 0; $GLOBALS['RatingVisible'] = $GLOBALS['Rating'] == 0 ? 'display:none' : ''; $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty']; $GLOBALS['rightsidecontent'] = $content; $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>"; $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>"; $GLOBALS['ViewDetailsImage'] = "<a href='{$path}/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' class='thickbox'><img src='{$path}/templates/default/images/fastlook_red.gif'></a> "; $content = "{$link}<img src='{$path}/templates/default/images/viewproducts.gif'></a>"; $GLOBALS['ViewDetailsImage'] .= $content; $discountname = ''; if (IsDiscountAvailable('category', $row['categoryid'], $discountname)) { if (strtolower($discountname) == "clearance") { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/clearance.gif" alt="">'; } else { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; } } if ($this->IsMakeAnOffer('category', $row['categoryid']) == 'yes') { $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>"; } $GLOBALS['RelatedBrands'] = $row['featurepoints']; $GLOBALS['lowersidecontent'] = $content; $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing"); } } } ///wirror_code_mark_end $get_variables = $_GET; $sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']); unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']); $i = 0; foreach ($get_variables as $key => $value) { $sort_qry .= "&{$key}={$value}"; } if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') { $sort = "asc "; $img = " <img src='{$path}/templates/default/images/ArrowDown.gif' border=0>"; } else { $sort = "desc "; $img = " <img src='{$path}/templates/default/images/ArrowUp.gif' border=0>"; } //wirror_code_mark_begin //$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) { $path = $path . "/a-b-testing"; if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand / Series</a>"; $GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Image / Part#</a>"; $GLOBALS['ProductDetails'] = "<a href='{$path}{$mmy_links}/orderby/prodfinalprice/sortby/{$sort}'>Price</a>"; } else { $GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand / Series</a>"; $GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Image / Part#</a>"; $GLOBALS['ProductDetails'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodfinalprice&sortby={$sort}'>Price</a>"; } if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') { $GLOBALS['ProductBrand'] .= $img; } $GLOBALS['ProductVQ'] = $vq_column_title; /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname') $GLOBALS['Product_VQ'] .= $img;*/ if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') { $GLOBALS['ProductPartNumber'] .= $img; } $GLOBALS['ProductPQ'] = "Product Options"; /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption') $GLOBALS['SearchResults'] .= $img;*/ if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') { $GLOBALS['ProductPrice'] .= $img; } if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodfinalprice') { $GLOBALS['ProductDetails'] .= $img; } $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryProductsItemHeader"); } else { //lguan_20100612: Show overal product rating at category landing page /*if($category_rating != 0) { $GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='".$GLOBALS['TPL_PATH']."/images/IcoRating$category_rating.gif' alt='' /></h2>"; }*/ // $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>"; $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AbSubCategoryListingMain"); if ($GLOBALS['results_page_flag'] == 0 && !isset($params['srch_category'])) { $GLOBALS['SearchLink'] = ""; if (isset($params['searchtext'])) { $GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['searchtext'])); } if (isset($params['search'])) { $GLOBALS['SearchLink'] .= "/searchtext/" . MakeURLSafe(strtolower($params['search'])); } if (isset($params['model']) && !isset($params['make'])) { $GLOBALS['SearchLink'] .= "/model/" . MakeURLSafe(strtolower($params['model'])); } if (isset($params['model_flag']) && $params['model_flag'] == 0 && !isset($params['make'])) { $GLOBALS['SearchLink'] .= "/model_flag/" . MakeURLSafe(strtolower($params['model_flag'])); } $GLOBALS['SearchResults'] = ""; if (isset($GLOBALS['YMMTable'])) { $GLOBALS['SearchResults'] .= "<div>" . $GLOBALS['YMMTable'] . "</div>"; } if ($_REQUEST['is_smart_search']) { $GLOBALS['SearchResults'] .= '<p class="ErrorMessage">' . GetLang('SearchYourSearch') . ' <strong>"' . htmlspecialchars($GLOBALS['OriginalSearchQuery']) . '"</strong> ' . GetLang('SearchDidNotMatch') . '</p>'; if ($GLOBALS['OriginalSearchQuery'] == '') { $GLOBALS['SearchTitle'] = ''; } else { $GLOBALS['SearchTitle'] = " " . sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']); } } //$GLOBALS['SearchResults'] .= "<div style='width:100%'><p class='InfoMessage'>Please choose a category or brand</p></div>"; $GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t\t\t\t%%Panel.StaticFeaturedBrands%%"; $GLOBALS['HidePanels'][] = 'SearchPagingTop'; } } $GLOBALS['SearchResults'] .= "<script type=\"text/javascript\"> \$('.focushiddendiv').css({'position':'absolute', 'margin-top':'-200px', 'display':'block'}); </script>"; if ($GLOBALS['EnableSEOUrls'] == 1) { $back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']); } else { $back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING']; } ISC_SetCookie("back2search", $back2url, 0, "/"); } else { $this->YMMSelectors($params); $GLOBALS['SearchResults'] = "<div>" . $GLOBALS['YMMTable'] . "</div>"; $GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t%%Panel.StaticFeaturedBrands%%"; // No search results were found // commented below code as need to show the favorite categories and brands as in homepage /*$GLOBALS['HideSearchResults'] = "none"; $GLOBALS['HidePanels'][] = 'SearchPageProducts';*/ } }
public function SetPanelSettings() { $tagId = $GLOBALS['ISC_CLASS_TAGS']->GetTagId(); $tagFriendlyName = $GLOBALS['ISC_CLASS_TAGS']->GetTagFriendlyName(); $GLOBALS['TaggedProducts'] = sprintf(GetLang('ProductsTaggedWith'), $GLOBALS['ISC_CLASS_TAGS']->GetTagName()); // Does paging need to be shown? if ($GLOBALS['ISC_CLASS_TAGS']->GetNumProducts() > GetConfig('CategoryProductsPerPage')) { $GLOBALS['SNIPPETS']['PagingData'] = ""; $numEitherSide = 5; $start = max($GLOBALS['ISC_CLASS_TAGS']->GetPage() - $numEitherSide, 1); $end = min($GLOBALS['ISC_CLASS_TAGS']->GetPage() + $numEitherSide, $GLOBALS['ISC_CLASS_TAGS']->GetNumPages()); for ($page = $start; $page <= $end; $page++) { if ($page == $GLOBALS['ISC_CLASS_TAGS']->GetPage()) { $snippet = "CategoryPagingItemCurrent"; } else { $snippet = "CategoryPagingItem"; } $pageData = array('page' => $page, 'sort' => $GLOBALS['ISC_CLASS_TAGS']->GetSort()); $GLOBALS['PageLink'] = TagLink($tagFriendlyName, $tagId, $pageData); $GLOBALS['PageNumber'] = $page; $GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet); } // Do we need to output a "Previous" link? if ($GLOBALS['ISC_CLASS_TAGS']->GetPage() > 1) { $pageData = array('page' => $GLOBALS['ISC_CLASS_TAGS']->GetPage() - 1, 'sort' => $GLOBALS['ISC_CLASS_TAGS']->GetSort()); $GLOBALS['PrevLink'] = TagLink($tagFriendlyName, $tagId, $pageData); $GLOBALS['SNIPPETS']['CategoryPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious"); } // Do we need to output a "Next" link? if ($GLOBALS['ISC_CLASS_TAGS']->GetPage() < $GLOBALS['ISC_CLASS_TAGS']->GetNumPages()) { $pageData = array('page' => $GLOBALS['ISC_CLASS_TAGS']->GetPage() + 1, 'sort' => $GLOBALS['ISC_CLASS_TAGS']->GetSort()); $GLOBALS['NextLink'] = TagLink($tagFriendlyName, $tagId, $pageData); $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']['TagPaging'] = $output; } // Should we show the compare button? if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_TAGS']->GetNumProducts() < 2) { $GLOBALS['HideCompareItems'] = "display: none"; } else { $GLOBALS['CompareLink'] = CompareLink(); } // Parse the sort select box snippet if ($GLOBALS['ISC_CLASS_TAGS']->GetNumProducts() > 1) { // Parse the sort select box snippet if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['URL'] = TagLink($tagFriendlyName, $tagId); } else { $GLOBALS['URL'] = $GLOBALS['ShopPath'] . "/tags.php"; $GLOBALS['HiddenSortField'] = "<input type=\"hidden\" name=\"tagid\" value=\"" . (int) $tagId . "\" />"; } $GLOBALS['SNIPPETS']['CategorySortBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategorySortBox"); } // Actually load the products $products = $GLOBALS['ISC_CLASS_TAGS']->GetProducts(); $GLOBALS['TagProductListing'] = ''; // Show products for a specific tag 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($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['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['TagProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("TagProductsItem"); } }
/** * Setup the purchasing options such as quantity box, stock messages, * add to cart button, product fields etc. */ private function SetPurchasingOptions() { if(!$this->productClass->IsPurchasingAllowed()) { $GLOBALS['DisplayAdd'] = 'none'; return; } $GLOBALS['AddToCartButton'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductAddToCartButton'); $GLOBALS['CartLink'] = CartLink(); $GLOBALS['ProductCartQuantity'] = ''; if(isset($GLOBALS['CartQuantity'.$this->productClass->GetProductId()])) { $GLOBALS['ProductCartQuantity'] = (int)$GLOBALS['CartQuantity'.$this->productClass->GetProductId()]; } // If we're using a cart quantity drop down, load that if (GetConfig('TagCartQuantityBoxes') == 'dropdown') { if ($this->productClass->GetMinQty()) { $GLOBALS['Quantity' . $this->productClass->GetMinQty()] = 'selected="selected"'; } else { $GLOBALS['Quantity1'] = 'selected="selected"'; } $GLOBALS['QtyOptionZero'] = ""; $GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect"); } // Otherwise, load the textbox else { $GLOBALS['ProductQuantity'] = 1; $GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText"); } // Can we sell this product/option $saleable = IsProductSaleable($this->productClass->GetProduct()); $variations = $this->productClass->GetProductVariationOptions(); if(!empty($variations) && $this->productClass->GetProductInventoryTracking() == 2) { $productInStock = true; } else { $productInStock = $saleable; } if($productInStock == true) { $GLOBALS['SNIPPETS']['SideAddItemSoldOut'] = ''; $GLOBALS['DisplayAdd'] = ""; if (GetConfig('FastCartAction') == 'popup' && GetConfig('ShowCartSuggestions')) { $GLOBALS['FastCartButtonJs'] = ' && fastCartAction(event)'; } } else if($this->productClass->IsPurchasingAllowed()) { $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideAddItemSoldOut"); $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']); $GLOBALS['SNIPPETS']['SideAddItemSoldOut'] = $output; $GLOBALS['BuyBoxSoldOut'] = "ProductBuyBoxSoldOut"; $GLOBALS['DisplayAdd'] = "none"; $GLOBALS['ISC_LANG']['BuyThisItem'] = GetLang('ItemUnavailable'); } if(GetConfig('ShowAddToCartQtyBox') == 1) { $GLOBALS['DisplayAddQty'] = $GLOBALS['DisplayAdd']; } else { $GLOBALS['DisplayAddQty'] = "none"; } if($this->productClass->IsPurchasingAllowed()) { $this->LoadEventDate(); $this->LoadProductFieldsLayout(); } $GLOBALS['ShowAddToCartQtyBox'] = GetConfig('ShowAddToCartQtyBox'); }
/** * 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("product"); if ($totalRecords == 0) { return ""; } $altCount = -1; $results = $GLOBALS["ISC_CLASS_SEARCH"]->GetResults("product"); $resultHTML = ""; if (!array_key_exists("results", $results) || !is_array($results["results"])) { return ""; } if (GetConfig("SearchProductDisplayMode") == "list") { $displayMode = "List"; $GLOBALS["AlternateClass"] = "ListView "; } else { $displayMode = "Grid"; $GLOBALS["AlternateClass"] = ""; } // Should we hide the comparison button? if(GetConfig('EnableProductComparisons') == 0 || $totalRecords < 2) { $GLOBALS['HideCompareItems'] = "none"; } foreach ($results["results"] as $product) { if (!is_array($product) || !array_key_exists("productid", $product)) { continue; } if (++$altCount%2 > 0) { $GLOBALS["AlternateClass"] .= "Odd"; } else { $GLOBALS["AlternateClass"] .= "Even"; } if (GetConfig("SearchProductDisplayMode") == "list") { $GLOBALS["AlternateClass"] .= " ListView"; } $GLOBALS["ProductCartQuantity"] = ""; if (isset($GLOBALS["CartQuantity" . $product["productid"]])) { $GLOBALS["ProductCartQuantity"] = (int)$GLOBALS["CartQuantity" . $product["productid"]]; } $GLOBALS["ProductId"] = (int)$product["productid"]; $GLOBALS["ProductName"] = isc_html_escape($product["prodname"]); $GLOBALS["ProductLink"] = ProdLink($product["prodname"]); $GLOBALS["ProductRating"] = (int)$product["prodavgrating"]; // Determine the price of this product $GLOBALS['ProductPrice'] = ''; if (GetConfig('ShowProductPrice') && !$product['prodhideprice']) { $GLOBALS['ProductPrice'] = formatProductCatalogPrice($product); } $GLOBALS["ProductThumb"] = ImageThumb($product, ProdLink($product["prodname"]), "", "TrackLink"); if (isId($product["prodvariationid"]) || trim($product["prodconfigfields"]) !== "" || $product["prodeventdaterequired"] == 1) { $GLOBALS["ProductURL"] = ProdLink($product["prodname"]); $GLOBALS["ProductAddText"] = GetLang("ProductChooseOptionLink"); } else { $GLOBALS["ProductURL"] = CartLink($product["productid"]); $GLOBALS["ProductAddText"] = GetLang("ProductAddToCartLink"); } if (CanAddToCart($product) && GetConfig("ShowAddToCartLink")) { $GLOBALS["HideActionAdd"] = ""; } else { $GLOBALS["HideActionAdd"] = "none"; } $GLOBALS["HideProductVendorName"] = "display: none"; $GLOBALS["ProductVendor"] = ""; if (GetConfig("ShowProductVendorNames") && $product["prodvendorid"] > 0) { $vendorCache = $GLOBALS["ISC_CLASS_DATA_STORE"]->Read("Vendors"); if (isset($vendorCache[$product["prodvendorid"]])) { $GLOBALS["ProductVendor"] = "<a href=\"" . VendorLink($vendorCache[$product["prodvendorid"]]) . "\">" . isc_html_escape($vendorCache[$product["prodvendorid"]]["vendorname"]) . "</a>"; $GLOBALS["HideProductVendorName"] = ""; } } // for list style if ($displayMode == "List") { // get a small chunk of the product description $desc = isc_substr(strip_tags($product["proddesc"]), 0, 250); if (isc_strlen($product["proddesc"]) > 250) { // trim the description back to the last period or space so words aren"t cut off $period_pos = isc_strrpos($desc, "."); $space_pos = isc_strrpos($desc, " "); // find the character that we should trim back to. -1 on space pos for a space that follows a period, so we dont end up with 4 periods if ($space_pos - 1 > $period_pos) { $pos = $space_pos; } else { $pos = $period_pos; } $desc = isc_substr($desc, 0, $pos); $desc .= "..."; } $GLOBALS["ProductDescription"] = $desc; $GLOBALS["AddToCartQty"] = ""; if (CanAddToCart($product) && GetConfig("ShowAddToCartLink")) { if (isId($product["prodvariationid"]) || trim($product["prodconfigfields"]) !== "" || $product["prodeventdaterequired"]) { $GLOBALS["AddToCartQty"] = "<a href=\"" . $GLOBALS["ProductURL"] . "\">" . $GLOBALS["ProductAddText"] . "</a>"; } else { $GLOBALS["CartItemId"] = $GLOBALS["ProductId"]; // If we"re using a cart quantity drop down, load that if (GetConfig("TagCartQuantityBoxes") == "dropdown") { $GLOBALS["Quantity0"] = "selected=\"selected\""; $GLOBALS["QtyOptionZero"] = "<option %%GLOBAL_Quantity0%% value=\"0\">Quantity</option>"; $GLOBALS["QtySelectStyle"] = "width: auto;"; $GLOBALS["AddToCartQty"] = $GLOBALS["ISC_CLASS_TEMPLATE"]->GetSnippet("CartItemQtySelect"); // Otherwise, load the textbox } else { $GLOBALS["ProductQuantity"] = 0; $GLOBALS["AddToCartQty"] = $GLOBALS["ISC_CLASS_TEMPLATE"]->GetSnippet("CartItemQtyText"); } } } // for grid style } else { $GLOBALS["CompareOnSubmit"] = "onsubmit=\"return compareProducts(config.CompareLink)\""; } $resultHTML .= $GLOBALS["ISC_CLASS_TEMPLATE"]->GetSnippet("SearchResultProduct" . $displayMode); } $resultHTML = trim($resultHTML); return $resultHTML; }
public function SetPanelSettings() { $count = 0; $output = ""; $params = $GLOBALS['ISC_CLASS_SEARCH']->_searchterms; $this->searchterms = $params; $path = GetConfig('ShopPath'); /* the below mmy links are passed to the breadcrumbs */ $mmy_links = ""; /*---------- This below section is for generating search phrase----------*/ $GLOBALS['Category'] = ""; $GLOBALS['MMY'] = ""; $GLOBALS['PQ'] = ""; $GLOBALS['VQ'] = ""; $GLOBALS['SearchPhrase'] = ""; $ext_links = ""; // this variable is passed to the product detail page $seo_delim = "&"; if ($GLOBALS['EnableSEOUrls'] == 1) { $seo_delim = "/"; } if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) { $GLOBALS['Category'] .= $GLOBALS['ISC_SRCH_CATG_NAME']; } if (isset($params['year'])) { $GLOBALS['MMY'] .= $params['year'] . "<br>"; $ext_links .= $seo_delim . "year=" . $params['year']; } if (isset($params['make'])) { $GLOBALS['MMY'] .= strtoupper($params['make']) . "<br>"; $ext_links .= $seo_delim . "make=" . MakeURLSafe($params['make']); } if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) { $GLOBALS['MMY'] .= strtoupper($params['model']) . "<br>"; $ext_links .= $seo_delim . "model=" . MakeURLSafe($params['model']); } /*else if(isset($params['model'])) $ext_links .= $seo_delim."model=".$params['model'];*/ /* this condition has been added seperately here to show submodel at last */ if (isset($params['submodel'])) { $GLOBALS['MMY'] .= MakeURLSafe($params['submodel']) . "<br>"; } /*if(isset($params['year'])) { $ext_links .= $seo_delim."year=".$params['year']; }*/ if (isset($params['dynfilters']) && !empty($params['dynfilters'])) { foreach ($params['dynfilters'] as $key => $value) { if (eregi('vq', $key)) { $key = str_ireplace('vq', '', $key); $GLOBALS['VQ'] .= ucfirst($key) . ": {$value}<br>"; } else { if (eregi('pq', $key)) { $key = str_ireplace('pq', '', $key); $GLOBALS['PQ'] .= ucfirst($key) . ": {$value}<br>"; } } } } $filter_var = array('vq', 'pq'); /* this below patch is used for getting description of the category. Here currently the selected category id will be last one in the $params['srch_category'] array. if input['category'] is used then it will be the first one */ if (!empty($params['srch_category'])) { if (isset($params['category'])) { $selected_catg = $params['srch_category'][0]; } else { $selected_catg = end($params['srch_category']); } $catg_desc_qry = "select catdesc , categoryfooter from [|PREFIX|]categories where categoryid = " . $selected_catg; $catg_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_desc_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($catg_desc_res) > 0) { $catg_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_desc_res); } /* this below patch is used to show the display name for the qualifiers from the qualifier association table */ $map_names = array(); $display_names = array(); $filter_names = "select qid , column_name , display_names from [|PREFIX|]qualifier_names where column_name regexp '^(pq|vq)'"; $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names); while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) { $map_names[$filter_row['qid']] = $filter_row['column_name']; $display_names[$filter_row['qid']] = $filter_row['display_names']; } $this->GetAssocDetails($selected_catg, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue); } if (isset($params['brand'])) { $brand_desc_arr = array(); $brand_desc_qry = "select branddescription , brandfooter from [|PREFIX|]brands where brandname = '" . $params['brand'] . "'"; $brand_desc_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_desc_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($brand_desc_res) > 0) { $brand_desc_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_desc_res); } } // for breadcrumbs $this->_BuildBreadCrumbs(); /* the below line has been commented as client told to remove it */ //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase"); if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 30) { $msg_qry = "select value from [|PREFIX|]display where messageid = 1"; $msg_res = $GLOBALS['ISC_CLASS_DB']->Query($msg_qry); $msg_row = $GLOBALS['ISC_CLASS_DB']->FetchOne($msg_res); $GLOBALS['SearchPhrase'] = $msg_row; //$GLOBALS['SearchPhrase'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchPhrase"); } /*if(!empty($params['dynfilters'])) $GLOBALS['SearchPhrase'] .= " ".implode(" ",$params['dynfilters']); /*---------- Ending section for generating search phrase----------*/ $vq_column_title = ""; $GLOBALS['SearchResultList'] = ""; if ($GLOBALS['ISC_CLASS_SEARCH']->GetNumResults() > 0) { $brand_rating = 0; if ($GLOBALS['results_page_flag'] == 1) { $brand_rating_qry = "select avg(revrating) as rating from [|PREFIX|]reviews r left join [|PREFIX|]products p on r.revproductid = p.productid left join [|PREFIX|]brands b on p.prodbrandid = b.brandid where r.revstatus = 1 and b.brandname = '" . $params['brand'] . "'"; $brand_rating_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_rating_qry); $brand_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_rating_res); if (isset($brand_rating_arr['rating'])) { $brand_rating = (int) $brand_rating_arr['rating']; } } /* displaying the dropdowns for YMM */ if (!isset($params['make']) || !isset($params['year']) || !isset($params['model']) || isset($params['model_flag']) && $params['model_flag'] == 0) { $this->YMMSelectors($params); } // We have at least one result, let's show it to the world! $GLOBALS['HideNoResults'] = "none"; // Only show the "compare" option if there are 2 or more products on this page if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) < 2) { $GLOBALS['HideCompareItems'] = "none"; } if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $GLOBALS['AlternateClass'] = ''; $counter = 1; $CurCatId = 0; $mmy_links = $this->GetYMMLinks($params); $mmy_links .= $this->GetOtherLinks($params); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['SearchResults'])) { /* Added by Simha to check inf prodcucts comes from different categories*/ if (empty($params['srch_category']) || !isset($params['srch_category'])) { if ($CurCatId != $row['categoryid']) { $CurCatId = $row['categoryid']; $map_names = array(); $display_names = array(); $filter_names = "SELECT DISTINCT qn.qid, qn.column_name, qn.display_names from \n [|PREFIX|]qualifier_names qn\n LEFT JOIN [|PREFIX|]qualifier_associations qa ON qa.qualifierid = qn.qid\n WHERE (qa.categoryid = '{$CurCatId}') \n AND qn.column_name regexp '^(pq|vq)'"; // || qa.categoryid IN (SELECT catparentid FROM isc_categories WHERE categoryid = '$CurCatId') $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names); while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) { $map_names[$filter_row['qid']] = $filter_row['column_name']; $display_names[$filter_row['qid']] = $filter_row['display_names']; } $this->GetAssocDetails($CurCatId, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue); } } /* Added by Simha Ends */ $GLOBALS['SearchTrackClass'] = "TrackLink"; $imagefile = ""; if ($GLOBALS['AlternateClass'] == 'Odd') { $GLOBALS['AlternateClass'] = 'Even'; } else { $GLOBALS['AlternateClass'] = 'Odd'; } $qry_string = $_SERVER['QUERY_STRING']; if (isset($_GET['page'])) { $page = "&page=" . $_GET['page']; $qry_string = str_ireplace($page, '', $qry_string); } if ($GLOBALS['EnableSEOUrls'] == 1) { if (isset($_GET['search_key'])) { $qry_string = str_ireplace('&search_key=' . $_GET['search_key'], '', $qry_string); } if (isset($params['search_query']) && !strstr($qry_string, 'search_query=')) { $qry_string .= "search_query=" . MakeURLSafe($params['search_query']); } if (isset($params['make']) && !strstr($qry_string, 'make=')) { $qry_string .= "&make=" . MakeURLSafe($params['make']); } if (isset($params['model']) && !strstr($qry_string, 'model=')) { $qry_string .= "&model=" . MakeURLSafe($params['model']); } if (isset($params['year']) && !strstr($qry_string, 'year=')) { $qry_string .= "&year=" . MakeURLSafe($params['year']); } if (isset($params['make']) && !strstr($qry_string, 'make=')) { $qry_string .= "&make=" . MakeURLSafe($params['make']); } if (isset($params['model_flag']) && !strstr($qry_string, 'model_flag=')) { $qry_string .= "&model_flag=" . MakeURLSafe($params['model_flag']); } if (isset($params['submodel']) && !strstr($qry_string, 'submodel=')) { $qry_string .= "&submodel=" . MakeURLSafe($params['submodel']); } } if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) { /*if( isset($params['srch_category']) ) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of product listing page. }*/ if (isset($params['category']) || !isset($params['subcategory']) && isset($params['series'])) { $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription']; $GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter']; if ((isset($params['category']) || isset($params['subcategory'])) && $GLOBALS['CatgDescandBrandImage'] == "") { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : ''; } } else { if (isset($params['srch_category'])) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : ''; if (isset($params['series']) && $row['seriesdescription'] != "") { $GLOBALS['CatgDescandBrandImage'] = $row['seriesdescription']; $GLOBALS['CatgBrandSeriesFooter'] = $row['seriesfooter']; } if ($GLOBALS['CatgDescandBrandImage'] == '' && $GLOBALS['CatgBrandSeriesFooter'] == '' && isset($params['brand'])) { $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : ''; } } else { if (isset($params['brand'])) { $GLOBALS['CatgDescandBrandImage'] = isset($brand_desc_arr['branddescription']) ? $brand_desc_arr['branddescription'] : ''; $GLOBALS['CatgBrandSeriesFooter'] = isset($brand_desc_arr['brandfooter']) ? $brand_desc_arr['brandfooter'] : ''; } } } $GLOBALS['ProductCartQuantity'] = ''; if (isset($GLOBALS['CartQuantity' . $row['productid']])) { $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']]; } if ($counter % 2 == 0) { $GLOBALS['RowColor'] = 'grayrow'; } else { $GLOBALS['RowColor'] = 'whiterow'; } $counter++; $GLOBALS['ProductId'] = (int) $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; $GLOBALS['BrandName'] = $row['brandname']; $GLOBALS['ProdCode'] = $row['prodcode']; //$GLOBALS['ProdDesc'] = $this->strip_html_tags($row['proddesc']); //$GLOBALS['ProdOptions'] = $row['productoption']; $GLOBALS['VehicleOptions'] = ""; $GLOBALS['ProdOptions'] = ""; foreach ($row as $key => $val) { if ($val != "" && $val != "~") { if (($qualifier_id = array_search($key, $map_names)) !== false) { if (eregi('^vq', $key)) { $val = trim($val, "~"); $val = preg_split('/[~;]+/', $val); $val = array_unique($val); $val = array_values($val); $val = implode(",", $val); /* -- Setting display name for qualifier name -- */ if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') { $key = $OwnAssoc[$qualifier_id][0]['qname']; } else { if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') { $key = $ParentAssoc[$qualifier_id][0]['qname']; } else { if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) { $key = $display_names[$qualifier_id]; } else { $key = ucfirst(str_ireplace($filter_var, "", $key)); } } } /* -- Setting display name for qualifier name ends -- */ /* -- Setting display name for qualifier value -- */ if (($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != "") { $val = $OwnAssoc[$qualifier_id][$m]['vname']; } else { if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentAssoc[$qualifier_id][$m]['vname'] != "") { $val = $ParentAssoc[$qualifier_id][$m]['vname']; } } /* -- Setting display name for qualifier value ends-- */ $GLOBALS['VehicleOptions'] .= $key . " : " . $val . "<br>"; } if (eregi('^pq', $key)) { $val = trim($val, "~"); $val = preg_split('/[~;]+/', $val); $val = array_unique($val); $val = array_values($val); $val = implode(",", $val); /* -- Setting display name for qualifier name -- */ if (isset($OwnAssoc[$qualifier_id]) && $OwnAssoc[$qualifier_id][0]['qname'] != '') { $key = $OwnAssoc[$qualifier_id][0]['qname']; } else { if (isset($ParentAssoc[$qualifier_id]) && $ParentAssoc[$qualifier_id][0]['qname'] != '') { $key = $ParentAssoc[$qualifier_id][0]['qname']; } else { if (isset($display_names[$qualifier_id]) && !empty($display_names[$qualifier_id])) { $key = $display_names[$qualifier_id]; } else { $key = ucfirst(str_ireplace($filter_var, "", $key)); } } } /* -- Setting display name for qualifier name ends -- */ /* -- Setting display name for qualifier value -- */ if (isset($OwnValue[$qualifier_id]) && ($m = array_search(strtolower($val), $OwnValue[$qualifier_id])) !== false && $OwnAssoc[$qualifier_id][$m]['vname'] != '') { $val = $OwnAssoc[$qualifier_id][$m]['vname']; } else { if (isset($ParentValue[$qualifier_id]) && ($m = array_search(strtolower($val), $ParentValue[$qualifier_id])) !== false && $ParentValue[$qualifier_id][$m]['vname'] != '') { $val = $ParentAssoc[$qualifier_id][$m]['vname']; } } /* -- Setting display name for qualifier value ends-- */ $GLOBALS['ProdOptions'] .= $key . " : " . $val . "<br>"; } } } } if (isset($row['vehicleoption'])) { $GLOBALS['VehicleOptions'] = $row['vehicleoption']; } if (isset($row['productoption'])) { $GLOBALS['ProdOptions'] = $row['productoption']; } if (isset($row['catuniversal']) && $row['catuniversal'] == 1) { $GLOBALS['VehicleOptions'] = $GLOBALS['ProductName']; if ($vq_column_title == "") { $vq_column_title = "Product Name"; } else { if ($vq_column_title != "Product Name") { $vq_column_title = "Product Name / Vehicle Options"; } } } else { if ($vq_column_title == "") { $vq_column_title = "Vehicle Options"; } else { if ($vq_column_title != "Vehicle Options") { $vq_column_title = "Product Name / Vehicle Options"; } } } if (empty($GLOBALS['VehicleOptions'])) { $GLOBALS['VehicleOptions'] = " "; } if (empty($GLOBALS['ProdOptions'])) { $GLOBALS['ProdOptions'] = " "; } /*--- the below lines are added for back 2 search link in the product detail page. Also modified line no 56 & 60 --- */ if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductLink'] .= "/refer=true" . $ext_links; } else { $GLOBALS['ProductLink'] .= "&refer=true" . $ext_links; } ### Added by Simha for onsale addition // Determine the price of this product //$GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); $GLOBALS['ProductPrice'] = CalculateProductPriceRetail($row); $FinalPrice = $GLOBALS['ProductPrice']; $SalePrice = $row['prodsaleprice']; //$DiscountAmount = $FinalPrice; $discounttype = 0; if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) { $DiscountPrice = $SalePrice; } else { $DiscountPrice = $FinalPrice; $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $row['categoryid'], $row['brandseriesid'], $discounttype); /*if($discounttype == 0) { $DiscountPrice = $FinalPrice; }*/ } /* foreach($DiscountInfo as $DiscountInfoSub) { if(isset($DiscountInfoSub['catids'])) { $catids = explode(",", $DiscountInfoSub['catids']); foreach($catids as $catid) { if($catid == $row['categoryid']) { $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); if ($DiscountAmount < 0) { $DiscountAmount = 0; } $DiscountPrice = $FinalPrice - $DiscountAmount; } } } } */ if (isset($DiscountPrice) && $DiscountPrice < $FinalPrice && $discounttype == 0) { //&& GetConfig('ShowOnSale') $GLOBALS['ProductPrice'] = '<strike>' . CurrencyConvertFormatPrice($FinalPrice) . '</strike>'; $GLOBALS['ProductPrice'] .= '<br>' . CurrencyConvertFormatPrice($DiscountPrice) . ''; $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; if (GetConfig('ShowOnSale')) { $GLOBALS['ProductPrice'] .= '<br>' . $GLOBALS['ShowOnSaleImage'] . ''; } } else { $GLOBALS['ProductPrice'] = '' . CurrencyConvertFormatPrice($FinalPrice) . ''; } ### Added by Simha Ends // commented the below line by vikas //$GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], $GLOBALS['ProductLink']); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas $GLOBALS['ProductURL'] = $GLOBALS['ProductLink']; $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); //$GLOBALS['ProductURL'] = ProdLink($row['prodname']); // commented by vikas $GLOBALS['ProductURL'] = $GLOBALS['ProductLink']; //blessen if (intval($row['prodretailprice']) <= 0) { //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); // commented by vikas on 15-7-09 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>"; } else { //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); // commented by vikas on 15-7-09 $GLOBALS['ProductAddText'] = "<img src='{$path}/templates/default/images/view.gif' border=0>"; } //blessen // original $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $GLOBALS['CartURL'] = CartLink($row['productid']); $offer = $this->IsProductMakeanOffer($row['brandseriesid'], $row['brandname'], $row['categoryid']); if ($offer == 'yes') { $GLOBALS['HideOfferButton'] = 'block'; } else { $GLOBALS['HideOfferButton'] = 'none'; } $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItem"); } else { if ($GLOBALS['results_page_flag'] == 0) { $mmy_links_modified = $mmy_links; if (!isset($GLOBALS['ISC_SRCH_CATG_ID'])) { $parentid = $GLOBALS['categories_all'][$row['categoryid']]['catparentid']; if ($parentid != 0) { if (isset($GLOBALS['categories_all'][$parentid])) { // if parent catg is not visible $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$parentid]['catname'])) . $mmy_links; } else { $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links; } } else { $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links; } } $subcatg_link = $this->LeftCatLink($mmy_links_modified, 'subcategory', $row['catname']); $link = "<a href='" . $subcatg_link . "'>"; $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>"; $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title='' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>"; //$imagelink = "<a href='".$GLOBALS['ShopPath']."/catgbrand.php?categoryid=".$row['categoryid']."&url=$subcatg_link' class='thickbox' title=''>"; if (isset($row['imagefile']) && !empty($row['imagefile'])) { $images = explode("~", $row['imagefile']); for ($j = 0; $j < count($images); $j++) { if (!empty($images[$j])) { $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $images[$j] . "' alt='" . isc_html_escape($row['catimagealt']) . "' title='" . isc_html_escape($row['catimagealt']) . "' class='subcat-image'></a>"; $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>"; break; } } } else { if (empty($row['imagefile']) || empty($imagefile)) { $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0 class='subcat-image'></a>"; $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>"; } } $GLOBALS['LeftImage'] = $imagefile; $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available"; $row['brandname'] = str_replace('~', ' , ', $row['brandname']); //$GLOBALS['RelatedBrands'] = $row['brandname']; if (!empty($row['seriesname'])) { $row['brandname'] .= "<br>" . $row['seriesname']; } $GLOBALS['CatgSeriesList'] = ""; if ($row['seriesids'] != "") { $seriesids = str_ireplace("~", ",", $row['seriesids']); $seriesids_qry = "select seriesid , brandname , seriesname from isc_brand_series bs left join isc_brands b on bs.brandid = b.brandid where seriesid in (" . $seriesids . ")"; $seriesids_res = $GLOBALS['ISC_CLASS_DB']->Query($seriesids_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($seriesids_res) > 0) { while ($seriesids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($seriesids_res)) { if ($GLOBALS['CatgSeriesList'] == "") { $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['categoryid'] . "')\">View Brands ></a><div id='" . $row['categoryid'] . "' style='display:block'>"; } else { $GLOBALS['CatgSeriesList'] .= "<br>"; } $tooltipscript = "onmouseover='createtip(" . $row['categoryid'] . $seriesids_arr['seriesid'] . ")' onmouseout='UnTip()'"; if (!isset($params['brand'])) { if ($GLOBALS['EnableSEOUrls'] == 1) { $series_link = $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $series_link = $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } else { if ($GLOBALS['EnableSEOUrls'] == 1) { $series_link = $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $series_link = $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } $GLOBALS['CatgSeriesList'] .= "<span id='span" . $row['categoryid'] . $seriesids_arr['seriesid'] . "' style='display:none'><a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $seriesids_arr['seriesid'] . "&catname=" . MakeURLSafe($row['catname']) . "&url=" . urlencode($series_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>"; } $GLOBALS['CatgSeriesList'] .= "</br></div>"; } } $content = $row['brandname'] . "<br>"; if (!isset($params['category']) && (isset($params['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of subcatg page. $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : ''; $content .= "<h3><a href='" . $path . "/search.php?{$qry_string}&subcategory=" . MakeURLSafe($row['catname']) . "'>" . $row['catname'] . "</a></h3>>"; $GLOBALS['TitleLink'] = "<h2><a href='" . $subcatg_link . "' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>" . $row['catname'] . "</a></h2>"; } /*$ProdStartPrice = GetStartingPrice($row['categoryid'], $row['prodcalculatedprice']); $content .= "Price starting from $".number_format($ProdStartPrice, 2, '.', '')."<br>".$imagefile;*/ $GLOBALS['leftsidecontent'] = $content; if (number_format($row['prodminprice'], 2) < number_format($row['prodmaxprice'], 2)) { $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', ''); } else { $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', ''); } $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty']; $GLOBALS['rightsidecontent'] = $content; $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>"; $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>"; $GLOBALS['ViewDetailsImage'] = "<a href='{$path}/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' class='thickbox'><img src='{$path}/templates/default/images/fastlook_red.gif'></a> "; $content = "{$link}<img src='{$path}/templates/default/images/viewproducts.gif'></a>"; $GLOBALS['ViewDetailsImage'] .= $content; if (IsDiscountAvailable('category', $row['categoryid'])) { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; } if ($this->IsMakeAnOffer('category', $row['categoryid']) == 'yes') { $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>"; } $GLOBALS['RelatedBrands'] = $row['featurepoints']; $GLOBALS['lowersidecontent'] = $content; /* This below conditions is added to have different templates for tonneau covers page */ if (isset($params['srch_category']) && !empty($params['srch_category']) && $selected_catg == 4 && $GLOBALS['results_page_flag'] == 0) { $GLOBALS['rightsidecontent'] = $row['featurepoints']; $GLOBALS['warranty'] = ""; /*if( trim($row['prodwarranty']) != '' ) { $GLOBALS['warranty'] = "<img alt='Warranty' src='".$GLOBALS['ShopPath']."/images/warranty-icon.gif' style='margin-right: 7px;'/><strong>".$row['prodwarranty']."</strong>"; }*/ if ($GLOBALS['SearchResultList'] != "") { $GLOBALS['SearchResultList'] .= '<hr style="clear: left;"/>'; } $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("NewSubCategoryListing"); } else { $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing"); } } else { $series_link = $this->LeftCatLink($mmy_links, 'series', $row['seriesname']); $link = "<a href='" . $series_link . "'>"; //$imagelink = "<a href='".$path."/catgbrand.php?seriesid=".$row['brandseriesid']."&catname=".MakeURLSafe($row['parentcatname'])."&url=$series_link' class='thickbox' title=''>"; $main_catg_link = ""; $catg_count = array(); $GLOBALS['CatgSeriesList'] = ""; if ($row['subcatgids'] != "") { $subcatgids = str_ireplace("~", ",", $row['subcatgids']); $subcatgids_qry = "select c.categoryid , c.catname as childcatname , p.categoryid as parentid , p.catname as parentcatname from [|PREFIX|]categories c left join [|PREFIX|]categories p on c.catparentid = p.categoryid where c.categoryid in (" . $subcatgids . ")"; $subcatgids_res = $GLOBALS['ISC_CLASS_DB']->Query($subcatgids_qry); //$catg_count = $GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res); if ($GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res) > 0) { while ($subcatgids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($subcatgids_res)) { if ($subcatgids_arr['parentid'] != 0) { $main_catg_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])); $catg_count[$subcatgids_arr['parentid']] = $subcatgids_arr['parentcatname']; } else { $catg_count[$subcatgids_arr['categoryid']] = $subcatgids_arr['childcatname']; } if ($GLOBALS['CatgSeriesList'] == "") { $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['brandseriesid'] . "')\">View Category ></a><div id='" . $row['brandseriesid'] . "' style='display:none'>"; } else { $GLOBALS['CatgSeriesList'] .= "<br>"; } $tooltipscript = "onmouseover='createtip(" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . ")' onmouseout='UnTip()'"; if ($GLOBALS['EnableSEOUrls'] == 1) { if ($subcatgids_arr['parentcatname'] == "") { $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } else { $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "/subcategory/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>"; } else { if ($subcatgids_arr['parentcatname'] == "") { $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } else { $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "&subcategory=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>"; } $GLOBALS['CatgSeriesList'] .= "<span id='span" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . "' style='display:none'><a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $subcatgids_arr['categoryid'] . "&url=" . urlencode($catgs_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>"; } $GLOBALS['CatgSeriesList'] .= "</br></div>"; } } $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>"; if (count($catg_count) == 1) { $GLOBALS['TitleLink'] = "<h2><a href='" . $main_catg_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>"; } else { if (count($catg_count) > 1) { $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()' onclick='return checkcategoryselection()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>"; } } $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url="; if (count($catg_count) == 1) { $tiplink .= urlencode($main_catg_link) . "'"; } else { if (count($catg_count) > 1) { $tiplink .= "#' "; } else { $tiplink .= urlencode($series_link) . "'"; } } $tiplink .= " title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>"; $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url="; if (count($catg_count) == 1) { $imagelink .= urlencode($main_catg_link) . "'"; } else { if (count($catg_count) > 1) { $imagelink .= "#' "; } else { $imagelink .= urlencode($series_link) . "'"; } } $imagelink .= " title='' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>"; if (isset($row['imagefile']) && !empty($row['imagefile'])) { $images = explode("~", $row['imagefile']); for ($j = 0; $j < count($images); $j++) { if (!empty($images[$j])) { $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $images[$j] . "'></a>"; break; } } } else { if (empty($row['imagefile']) || empty($imagefile)) { $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>"; } } $GLOBALS['LeftImage'] = $imagefile; $row['brandname'] = str_replace('~', ' , ', $row['brandname']); $GLOBALS['RelatedBrands'] = $row['brandname']; if (isset($row['seriesname']) && !empty($row['seriesname']) && (!isset($params['srch_category']) || isset($params['category'])) && isset($GLOBALS['BRAND_SERIES_FLAG'])) { if (empty($row['imagefile']) || empty($imagefile)) { $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' alt='" . isc_html_escape($row['seriesimagealt']) . "' title='" . isc_html_escape($row['seriesimagealt']) . "'></a>"; $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>"; } else { $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/series_images/" . $row['imagefile'] . "' width='140px' alt='" . isc_html_escape($row['seriesimagealt']) . "' title='" . isc_html_escape($row['seriesimagealt']) . "'></a>"; $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>"; } //"<h3>".$row['catname']."</h3> $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available"; $GLOBALS['RelatedBrands'] = "<ul class='featurepoints'>"; if (!empty($row['feature_points1'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points1'] . "</li>"; } if (!empty($row['feature_points2'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points2'] . "</li>"; } if (!empty($row['feature_points3'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points3'] . "</li>"; } if (!empty($row['feature_points4'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points4'] . "</li>"; } $GLOBALS['RelatedBrands'] .= "</ul>"; /*if(isset($row['brandlargefile']) && !empty($row['brandlargefile'])) { $brand_image_path = "product_images/".$row['brandlargefile']; if(file_exists($brand_image_path)) { $GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandlargefile']."'>"; } else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) { $brand_image_path = "product_images/".$row['brandimagefile']; if(file_exists($brand_image_path)) $GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>"; } } else if(isset($row['brandimagefile']) && !empty($row['brandimagefile'])) { $brand_image_path = "product_images/".$row['brandimagefile']; if(file_exists($brand_image_path)) $GLOBALS['CatgDescandBrandImage'] = "<img src='$path/product_images/".$row['brandimagefile']."'>"; }*/ } $GLOBALS['RelatedBrands'] = $row['feature_points']; $GLOBALS['CatgDescandBrandImage'] = $row['branddescription']; $GLOBALS['CatgBrandSeriesFooter'] = $row['brandfooter']; if ($brand_rating != 0) { $GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='" . $GLOBALS['TPL_PATH'] . "/images/IcoRating{$brand_rating}.gif' alt='' /></h2>"; } $content = $row['brandname'] . "<br>"; $content .= $row['catname'] . "<br>"; /*$ProdStartPriceSeries = GetStartingPriceForSeries($row['brandseriesid'], $row['prodcalculatedprice']); $content .= "Price starting from $".number_format($ProdStartPriceSeries, 2, '.', '');*/ $GLOBALS['leftsidecontent'] = $content; //$GLOBALS['PriceRange'] = "Price range from $".number_format($row['prodminprice'], 2, '.', '')." to $".number_format($row['prodmaxprice'], 2, '.', ''); if (number_format($row['prodminprice'], 2) < number_format($row['prodmaxprice'], 2)) { $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', ''); } else { $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', ''); } $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty']; $GLOBALS['rightsidecontent'] = $content; $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>"; $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>"; $GLOBALS['ViewDetailsImage'] = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url="; if (count($catg_count) > 1) { $GLOBALS['ViewDetailsImage'] .= "#'"; } else { if (count($catg_count) == 1) { $GLOBALS['ViewDetailsImage'] .= urlencode($main_catg_link) . "'"; } else { $GLOBALS['ViewDetailsImage'] .= urlencode($series_link) . "'"; } } $GLOBALS['ViewDetailsImage'] .= "><img src='{$path}/templates/default/images/fastlook_red.gif'></a> "; $content = "{$link}"; if (count($catg_count) == 1) { $content = "<a href='" . $main_catg_link . "'>"; } else { if (count($catg_count) > 1) { $content = "<a href='" . $series_link . "' onclick='return checkcategoryselection()'>"; } } $content .= "<img src='{$path}/templates/default/images/viewproducts.gif'></a>"; $GLOBALS['ViewDetailsImage'] .= $content; if (IsDiscountAvailable('series', $row['brandseriesid'])) { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; } if ($this->IsMakeAnOffer('series', $row['brandseriesid']) == 'yes') { $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>"; } $GLOBALS['lowersidecontent'] = $content; $GLOBALS['SearchResultList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListing"); $GLOBALS['HideCompareItems'] = "none"; } } } $get_variables = $_GET; $sort_qry = "{$path}/search.php?search_query=" . urlencode($params['search_query']); unset($get_variables['orderby'], $get_variables['sort'], $get_variables['search_query'], $get_variables['sortby']); $i = 0; foreach ($get_variables as $key => $value) { $sort_qry .= "&{$key}={$value}"; } if (isset($_REQUEST['sortby']) && $_REQUEST['sortby'] == 'desc') { $sort = "asc "; $img = " <img src='{$path}/templates/default/images/ArrowDown.gif' border=0>"; } else { $sort = "desc "; $img = " <img src='{$path}/templates/default/images/ArrowUp.gif' border=0>"; } //$GLOBALS['SearchResults'] = $GLOBALS['SearchResultList']; // commented by vikas if (isset($params['partnumber']) || $params['flag_srch_category'] == 1 || isset($params['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1) { if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['ProductBrand'] = "<a href='{$path}{$mmy_links}/orderby/brandname/sortby/{$sort}'>Brand</a>"; $GLOBALS['ProductPartNumber'] = "<a href='{$path}{$mmy_links}/orderby/prodcode/sortby/{$sort}'>Part Number</a>"; $GLOBALS['ProductPrice'] = "<a href='{$path}{$mmy_links}/orderby/prodcalculatedprice/sortby/{$sort}'>Price</a>"; } else { $GLOBALS['ProductBrand'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=brandname&sortby={$sort}'>Brand</a>"; $GLOBALS['ProductPartNumber'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcode&sortby={$sort}'>Part Number</a>"; $GLOBALS['ProductPrice'] = "<a href='{$path}/search.php?search_query={$mmy_links}&orderby=prodcalculatedprice&sortby={$sort}'>Price</a>"; } if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'brandname') { $GLOBALS['ProductBrand'] .= $img; } $GLOBALS['ProductVQ'] = $vq_column_title; /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'brandname') $GLOBALS['Product_VQ'] .= $img;*/ if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcode') { $GLOBALS['ProductPartNumber'] .= $img; } $GLOBALS['ProductPQ'] = "Product Options"; /*if(isset($_GET['orderby']) && $_GET['orderby'] == 'productoption') $GLOBALS['SearchResults'] .= $img;*/ if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'prodcalculatedprice') { $GLOBALS['ProductPrice'] .= $img; } $GLOBALS['ProductDetails'] = "Details"; $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryProductsItemHeader"); } else { // $GLOBALS['SearchResults'] = "<div>".$GLOBALS['SearchResultList']."</div>"; if (isset($params['srch_category']) && !empty($params['srch_category']) && $GLOBALS['results_page_flag'] == 0 && $selected_catg == 4) { $GLOBALS['FilterTitle'] = "Narrow by Category"; $GLOBALS['ResultTitle'] = "Category Details"; if (count($GLOBALS['SearchBrands']) > 0) { $GLOBALS['BrandsList'] = ""; $brandlistingqry = " select brandname , brandimagefile, brandlargefile, brandaltkeyword from [|PREFIX|]brands where brandid in (" . implode($GLOBALS['SearchBrands'], ",") . ")"; $brandlistingresult = $GLOBALS['ISC_CLASS_DB']->Query($brandlistingqry); while ($brandlisting_row = $GLOBALS['ISC_CLASS_DB']->Fetch($brandlistingresult)) { if (isset($params['brand'])) { $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $brandlisting_row['brandlargefile']); if (file_exists($file)) { $attribs = @getimagesize($file); $width = $attribs[0]; $height = $attribs[1]; if ($width > 240) { $width = "240"; } /*if( $height > 240 ) $height = "240";*/ $GLOBALS['BrandsList'] .= "<img alt='" . $brandlisting_row['brandaltkeyword'] . "' src='" . $GLOBALS['ShopPath'] . "/product_images/" . $brandlisting_row['brandlargefile'] . "' width='" . $width . "' /> "; $brandparams = $params; unset($brandparams['brand'], $brandparams['series']); $mmylinks = $this->GetYMMLinks($brandparams); $GLOBALS['BrandsList'] .= "<br><a href='" . $path . $mmylinks . "'>View All Brands</a>"; } } else { if (isset($params['srch_category'])) { $GLOBALS['BrandsList'] .= "<a href='" . $path . $mmy_links . "/brand/" . MakeURLSafe(strtolower($brandlisting_row['brandname'])) . "'>"; } else { $GLOBALS['BrandsList'] .= "<a href='" . $path . "/" . MakeURLSafe(strtolower($brandlisting_row['brandname'])) . $mmy_links . "'>"; } $GLOBALS['BrandsList'] .= "<img alt='" . $brandlisting_row['brandname'] . "' src='" . $GLOBALS['ShopPath'] . "/product_images/" . $brandlisting_row['brandimagefile'] . "'/></a>"; } } } else { $GLOBALS['BrandListStyle'] = "display:none"; } $GLOBALS['ResultCategories'] = ""; foreach ($GLOBALS['SearchCategories'] as $key => $catid) { $parentid = $GLOBALS['categories_all'][$catid]['catparentid']; if ($parentid != 0) { if (isset($params['srch_category'])) { $mmy_links_modified = $mmy_links; } else { if (isset($GLOBALS['categories_all'][$parentid])) { // if parent catg is not visible $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$parentid]['catname'])) . $mmy_links; } else { $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$catid]['catname'])) . $mmy_links; } } } else { $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$catid]['catname'])) . $mmy_links; } /*echo "<br>".$mmy_links; exit;*/ $subcatg_link = $this->LeftCatLink($mmy_links_modified, 'subcategory', $GLOBALS['categories_all'][$catid]['catname']); $GLOBALS['ResultCategories'] .= "<div class='button'><a href='" . $subcatg_link . "'>" . $GLOBALS['categories_all'][$catid]['catname'] . "</a></div>"; } $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("NewSubCategoryListingMain"); } else { $GLOBALS['SearchResults'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoryListingMain"); } } $GLOBALS['SearchResults'] .= "<script type=\"text/javascript\"> \$('.focushiddendiv').css({'position':'absolute', 'margin-top':'-200px', 'display':'block'}); </script>"; if ($GLOBALS['EnableSEOUrls'] == 1) { $back2url = $_SESSION['back2url'] = preg_replace("/^\\//", "", $_SERVER['REQUEST_URI']); } else { $back2url = $_SESSION['back2url'] = "search.php?" . $_SERVER['QUERY_STRING']; } ISC_SetCookie("back2search", $back2url, 0, "/"); // Showing the syndication option? if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) { $GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false); $GLOBALS['SNIPPETS']['SearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultsFeed"); } } else { $this->YMMSelectors($params); $GLOBALS['SearchResults'] = "<div style='float:left'>" . $GLOBALS['YMMTable'] . "</div>"; $GLOBALS['CategoryBrandList'] = "%%Panel.StaticFeaturedCategories%%\n\t\t\t\t%%Panel.StaticFeaturedBrands%%"; // No search results were found // commented below code as need to show the favorite categories and brands as in homepage /*$GLOBALS['HideSearchResults'] = "none"; $GLOBALS['HidePanels'][] = 'SearchPageProducts';*/ } }
/** * Set the panel settings. */ public function SetPanelSettings() { if (GetConfig('HomeFeaturedProducts') <= 0) { $this->DontDisplay = true; return false; } $GLOBALS['SNIPPETS']['VendorFeaturedItems'] = ''; if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $cVendor = GetClass('ISC_VENDORS'); $vendor = $cVendor->GetVendor(); $query = "\n\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\tFROM [|PREFIX|]products p\n\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid AND imageisthumb=1)\n\t\t\tWHERE p.prodvisible='1' AND p.prodvendorid='" . (int) $vendor['vendorid'] . "'\n\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\tORDER BY p.prodvendorfeatured DESC, RAND()\n\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, GetConfig('HomeFeaturedProducts')); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $GLOBALS['AlternateClass'] = ''; while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { 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'] = $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice($row); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; // Workout the product description $desc = strip_tags($row['proddesc']); if (isc_strlen($desc) < 120) { $GLOBALS['ProductSummary'] = $desc; } else { $GLOBALS['ProductSummary'] = isc_substr($desc, 0, 120) . "..."; } $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['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['SNIPPETS']['VendorFeaturedItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("VendorFeaturedItemsItem"); } $GLOBALS['VendorProductsLink'] = VendorProductsLink($vendor); if (!$GLOBALS['SNIPPETS']['VendorFeaturedItems']) { $this->DontDisplay = true; } }