public function SetPanelSettings() { $GLOBALS['ISC_CLASS_CATEGORY'] = GetClass('ISC_CATEGORY'); // Should we hide the comparison button? if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() < 2) { $GLOBALS['HideCompareItems'] = "none"; } // Load the products into the reference array $GLOBALS['ISC_CLASS_CATEGORY']->GetProducts($products); $GLOBALS['CategoryProductListing'] = ""; if (GetConfig('ShowProductRating') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $display_mode = ucfirst(GetConfig("CategoryDisplayMode")); if ($display_mode == "Grid") { $display_mode = ""; } $GLOBALS['DisplayMode'] = $display_mode; if ($display_mode == "List") { if (GetConfig('ShowAddToCartLink') && $GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() > 0) { $GLOBALS['HideAddButton'] = ''; } else { $GLOBALS['HideAddButton'] = 'none'; } $GLOBALS['ListJS'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ListCheckForm"); } $GLOBALS['CompareButton'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton" . $display_mode); if ($display_mode == "List" && $GLOBALS['ISC_CLASS_CATEGORY']->GetNumPages() > 1) { $GLOBALS['CompareButtonTop'] = $GLOBALS['CompareButton']; } $GLOBALS['AlternateClass'] = ''; foreach ($products as $row) { if ($GLOBALS['AlternateClass'] == 'Odd') { $GLOBALS['AlternateClass'] = 'Even'; } else { $GLOBALS['AlternateClass'] = 'Odd'; } $GLOBALS['ProductCartQuantity'] = ''; if (isset($GLOBALS['CartQuantity' . $row['productid']])) { $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']]; } $GLOBALS['ProductId'] = (int) $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { $GLOBALS['ProductURL'] = ProdLink($row['prodname']); $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); $GLOBALS['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //blessen 1734.06 //$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'] = ''; } } // for list style if ($display_mode == "List") { // get a small chunk of the product description $desc = isc_substr(strip_tags($row['proddesc']), 0, 250); if (isc_strlen($row['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($row) && GetConfig('ShowAddToCartLink')) { if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['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"); } } } } else { $GLOBALS["CompareOnSubmit"] = "onsubmit=\"return compareProducts(config.CompareLink)\""; } $GLOBALS['CategoryProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryProductsItem" . $display_mode); } if ($GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() == 0) { // There are no products in this category $GLOBALS['CategoryProductListing'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryNoProductsMessage"); $GLOBALS['HideOtherProductsIn'] = 'none'; $GLOBALS['ExtraCategoryClass'] = "Wide WideWithLeft"; if ($GLOBALS['SNIPPETS']['SubCategories'] != '') { $GLOBALS['CategoryProductListing'] = ''; } $GLOBALS['HideRightColumn'] = "none"; } else { $GLOBALS['HideOtherProductsIn'] = 'block'; $GLOBALS['OtherProductsIn'] = sprintf(GetLang('OtherProductsIn'), $GLOBALS['ISC_CLASS_CATEGORY']->GetName()); } }
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 (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $query = "\n\t\t\tSELECT p.*, FLOOR(p.prodratingtotal/p.prodnumratings) AS prodavgrating, i.imagefile, i.imageisthumb, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\tFROM [|PREFIX|]products p\n\t\t\tLEFT JOIN [|PREFIX|]product_images i ON (p.productid = i.imageprodid AND i.imageisthumb=1)\n\t\t\tWHERE p.prodvisible='1' AND p.prodvendorid='" . (int) $vendor['vendorid'] . "' AND p.productid!='" . (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "'\n\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\tORDER BY p.prodvendorfeatured DESC, RAND() DESC\n\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 9); $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'] = CalculateProductPrice_retail($row); $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { $GLOBALS['ProductURL'] = ProdLink($row['prodname']); $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); $GLOBALS['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //blessen //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['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'; } }
function DoAjaxSearch() { if (isset($_GET['search_query']) && isc_strlen($_GET['search_query']) >= 3) { $searchterms = BuildProductSearchTerms($_REQUEST); // Build the search query using our terms & the fields we want $searchQueries = BuildProductSearchQuery($searchterms); $Search_Count = $GLOBALS['ISC_CLASS_DB']->FetchOne($searchQueries['countQuery']); // No results? if ($Search_Count == 0) { exit; } // Add the limit $searchQueries['query'] .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 5); $Search_Result = $GLOBALS['ISC_CLASS_DB']->Query($searchQueries['query']); while ($product = $GLOBALS['ISC_CLASS_DB']->Fetch($Search_Result)) { $product['imagefile'] = ''; $products[$product['productid']] = $product; } // Fetch product images $productids = implode(",", array_keys($products)); $query = sprintf("select imageprodid, imagefile from [|PREFIX|]product_images where imageprodid in (%s) and imageisthumb=2", $GLOBALS['ISC_CLASS_DB']->Quote($productids)); $Result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($productimage = $GLOBALS['ISC_CLASS_DB']->Fetch($Result)) { $products[$productimage['imageprodid']]['imagefile'] = $productimage['imagefile']; } $view_all = ''; if ($Search_Count > 5) { $view_all = sprintf(' view_all="%s"', $this->EscapeEntity(sprintf('<a href="%s/search.php?search_query=%s">%s »</a>', $GLOBALS['ShopPathNormal'], $_REQUEST['search_query'], GetLang('QuickSearchViewAll')))); } echo '<?xml version="1.0"?>' . "\n"; echo sprintf('<results type="%s" result_count="%s"%s>' . "\n", GetLang('QuickSearchProducts'), $Search_Count, $view_all); foreach ($products as $product) { if ($product['imagefile']) { $image = sprintf("%s/%s/%s", $GLOBALS['ShopPathNormal'], GetConfig('ImageDirectory'), $product['imagefile']); } else { $image = GetLang('QuickSearchNoImage'); } if (GetConfig('EnableProductReviews')) { $ratingimg = sprintf("%s/images/IcoRating%s.gif", $GLOBALS['TPL_PATH'], (int) $product['prodavgrating']); } else { $ratingimg = ''; } echo sprintf('<result title="%s" price="%s" url="%s" image="%s" ratingimg="%s" />' . "\n", $this->EscapeEntity($product['prodname']), $this->EscapeEntity(CalculateProductPrice_retail($product)), ProdLink($product['prodname']), $this->EscapeEntity($image), $this->EscapeEntity($ratingimg)); } echo "</results>\n"; } }
public function SetPanelSettings() { $output = ""; // If product ratings aren't enabled then we don't even need to load anything here if (GetConfig('EnableProductReviews') == 0) { $this->DontDisplay = true; return; } if (isset($GLOBALS['ISC_CLASS_CATEGORY'])) { $categorySql = $GLOBALS['ISC_CLASS_CATEGORY']->GetCategoryAssociationSQL(); } else { if (isset($GLOBALS['ISC_CLASS_PRICE'])) { $categorySql = $GLOBALS['ISC_CLASS_PRICE']->GetCategoryAssociationSQL(); } } $query = "\n\t\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\tWHERE p.prodvisible='1' AND prodratingtotal > '0' " . $categorySql . "\n\t\t\t\tORDER BY prodavgrating DESC\n\t\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 5); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) { $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']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { $GLOBALS['ProductURL'] = ProdLink($row['prodname']); $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); $GLOBALS['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //blessen //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCategoryPopularProducts"); } // Showing the syndication option? if (GetConfig('RSSPopularProducts') != 0 && GetConfig('RSSCategories') != 0 && GetConfig('RSSSyndicationIcons') != 0) { $GLOBALS['ISC_LANG']['CategoryPopularProductsFeed'] = sprintf(GetLang('CategoryPopularProductsFeed'), isc_html_escape($GLOBALS['CatName'])); $GLOBALS['SNIPPETS']['SideCategoryPopularProductsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCategoryPopularProductsFeed"); } } else { $GLOBALS['HideSideCategoryPopularProductsPanel'] = "none"; $this->DontDisplay = true; } $GLOBALS['SNIPPETS']['SideCategoryPopularProducts'] = $output; }
public function SetPanelSettings() { $count = 0; $output = ""; $GLOBALS['SNIPPETS']['HomeNewProducts'] = ''; if (GetConfig('HomeNewProducts') > 0) { if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $query = "\n\t\t\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)\n\t\t\t\t\tWHERE p.prodvisible='1' AND (imageisthumb=1 OR ISNULL(imageisthumb))\n\t\t\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\t\t\tORDER BY proddateadded DESC\n\t\t\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, GetConfig('HomeNewProducts')); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) { $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']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); // Workout the product description $desc = strip_tags($row['proddesc']); if (strlen($desc) < 120) { $GLOBALS['ProductSummary'] = $desc; } else { $GLOBALS['ProductSummary'] = 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['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //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['SNIPPETS']['HomeNewProducts'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("HomeNewProductsItem"); } // Showing the syndication option? if (GetConfig('RSSNewProducts') != 0 && GetConfig('RSSSyndicationIcons') != 0) { $GLOBALS['SNIPPETS']['HomeNewProductsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("HomeNewProductsFeed"); } } else { $this->DontDisplay = true; $GLOBALS['HideHomeNewProductsPanel'] = "none"; } } else { $this->DontDisplay = true; $GLOBALS['HideHomeNewProductsPanel'] = "none"; } }
public function SetPanelSettings() { $count = 0; $output = ""; $products = array(); $GLOBALS['BrandsMessage'] = ''; // If we're showing the "All brands" page then we to display a list of all the brands if ($GLOBALS['ISC_CLASS_BRANDS']->ShowingAllBrands()) { // Output sub-categories $GLOBALS['SNIPPETS']['SubBrands'] = ""; $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]brands ORDER BY brandname ASC"); if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) { // Check to see if we need to add in place holder images or if we are just displaying text if (!($rtn = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['ISC_CLASS_DB']->Query("SELECT COUNT(*) AS Total FROM [|PREFIX|]brands WHERE brandimagefile != ''"))) || !$rtn['Total']) { $useImages = false; } else { $useImages = true; if (GetConfig('BrandDefaultImage') !== '') { $defaultImage = GetConfig('ShopPath') . '/' . GetConfig('BrandDefaultImage'); } else { $defaultImage = GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/BrandDefault.gif'; } } for ($i = 1; $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $i++) { $GLOBALS['SubBrandName'] = isc_html_escape($row['brandname']); $GLOBALS['SubBrandLink'] = BrandLink($row['brandname']); if ($useImages) { if ($row['brandimagefile'] !== '') { $GLOBALS['SubBrandImage'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $row['brandimagefile']; } else { $GLOBALS['SubBrandImage'] = $defaultImage; } $GLOBALS['SNIPPETS']['SubBrands'] .= '<li style="width: ' . GetConfig('BrandImageWidth') . 'px; height: ' . (GetConfig('BrandImageHeight') + 50) . 'px">' . $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandItemImage") . '</li>'; if ($i % GetConfig('BrandPerRow') === 0) { $GLOBALS['SNIPPETS']['SubBrands'] .= '<li style="float:none; clear:both;"></li>'; } } else { $GLOBALS['SNIPPETS']['SubBrands'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandItem"); } } if ($useImages) { $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrandsGrid"); } else { $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubBrands"); } $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']); $GLOBALS['BrandsMessage'] = $output; } else { $GLOBALS['BrandsMessage'] = GetLang('ViewAllBrandsInstructions'); } $GLOBALS['BrandProductListing'] = "<li> </li>"; $GLOBALS['HideBrandProductListing'] = "none"; return; } // Load the products into the reference array $GLOBALS['ISC_CLASS_BRANDS']->GetProducts($products); $GLOBALS['BrandProductListing'] = ""; if ($GLOBALS['BrandName'] == "") { // We're on the 'All Brands' page and the brands list is on the right $GLOBALS['ChooseBrandFromList'] = sprintf(GetLang('ChooseBrandFromList'), GetLang('Right')); $GLOBALS['BrandProductListing'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BrandMainPageMessage"); } else { // Show products for a specific brand if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $GLOBALS['AlternateClass'] = ''; foreach ($products as $row) { if ($GLOBALS['AlternateClass'] == 'Odd') { $GLOBALS['AlternateClass'] = 'Even'; } else { $GLOBALS['AlternateClass'] = 'Odd'; } $GLOBALS['ProductCartQuantity'] = ''; if (isset($GLOBALS['CartQuantity' . $row['productid']])) { $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']]; } $GLOBALS['ProductId'] = (int) $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { $GLOBALS['ProductURL'] = ProdLink($row['prodname']); $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); $GLOBALS['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //blessen //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $GLOBALS['BrandProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BrandProductsItem"); } if ($GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() == 0) { // There are no products in this category $GLOBALS['BrandsMessage'] = GetLang('NoProductsInBrand'); $GLOBALS['BrandProductListing'] = "<li> </li>"; $GLOBALS['HideBrandProductListing'] = "none"; } } }
public function SetPanelSettings() { $viewed = ""; if (isset($_COOKIE['RECENTLY_VIEWED_PRODUCTS'])) { $viewed = $_COOKIE['RECENTLY_VIEWED_PRODUCTS']; } else { if (isset($_SESSION['RECENTLY_VIEWED_PRODUCTS'])) { $viewed = $_SESSION['RECENTLY_VIEWED_PRODUCTS']; } } $GLOBALS['CompareLink'] = CompareLink(); if ($viewed != "") { // Hide the top selling products panel from the cart page $GLOBALS['HideSideTopSellersPanel'] = "none"; $output = ""; $viewed_products = array(); $viewed_products = explode(",", $viewed); foreach ($viewed_products as $k => $p) { $viewed_products[$k] = (int) $p; } // Reverse the array so recently viewed products appear up top $viewed_products = array_reverse($viewed_products); // Hide the compare button if there's less than 2 products if (GetConfig('EnableProductComparisons') == 0 || count($viewed_products) < 2) { $GLOBALS['HideSideProductRecentlyViewedCompare'] = "none"; } if (!empty($viewed_products)) { if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $query = "\n\t\t\t\t\t\tSELECT p.*, prodratingtotal/prodnumratings AS prodavgrating, i.imagefile, i.imageisthumb, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\t\t\tLEFT JOIN [|PREFIX|]product_images i ON (p.productid = i.imageprodid AND i.imageisthumb=1)\n\t\t\t\t\t\tWHERE prodvisible='1' AND productid IN ('" . implode("','", $viewed_products) . "')\n\t\t\t\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) { while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $recently_viewed_products[] = $row; } $GLOBALS['AlternateClass'] = ''; foreach ($viewed_products as $product_id) { foreach ($recently_viewed_products as $row) { if ($product_id == $row['productid']) { if ($GLOBALS['AlternateClass'] == 'Odd') { $GLOBALS['AlternateClass'] = 'Even'; } else { $GLOBALS['AlternateClass'] = 'Odd'; } $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); $GLOBALS['ProductCartQuantity'] = ''; if (isset($GLOBALS['CartQuantity' . $row['productid']])) { $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']]; } $GLOBALS['ProductId'] = (int) $row['productid']; //temp script to shortern the product name if ($row['prodbrandid'] == 37) { $query = "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 = '" . $row['productid'] . "' "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if ($cat['catcombine'] != "") { $GLOBALS['ProductName'] = $cat['catcombine'] . " Part Number " . isc_html_escape($row['prodcode']); } else { $GLOBALS['ProductName'] = $cat['catname'] . " Part Number " . isc_html_escape($row['prodcode']); } } else { $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); } //temp script to shortern the product name //$GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { $GLOBALS['ProductURL'] = ProdLink($row['prodname']); $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); $GLOBALS['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //blessen //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $GLOBALS['ProductRating'] = $this->getRoundValue((double) $row['prodavgrating']); $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideRecentlyViewedProducts"); } } } } else { $GLOBALS['HideRecentlyViewedProductsPanel'] = "none"; $this->DontDisplay = true; } } else { $GLOBALS['HideRecentlyViewedProductsPanel'] = "none"; $this->DontDisplay = true; } $GLOBALS['SNIPPETS']['SideProductRecentlyViewed'] = $output; } else { // Cookies aren't working, hide the panel $GLOBALS['HideRecentlyViewedProductsPanel'] = "none"; $this->DontDisplay = true; } }
public function SetPanelSettings() { $count = 0; $prod_ids = array(); $output = ""; $GLOBALS['SuggestedProductListing'] = ""; // Hide the "compare" checkbox for each product $GLOBALS['HideCompareItems'] = "none"; // Make sure the query doesn't return the product we're adding to // the cart or any other products in the cart for that matter $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART'); $ignore_prod_list = $GLOBALS['ISC_CLASS_CART']->api->GetProductsInCartCSV(); if ($ignore_prod_list == "") { $ignore_prod_list = 0; } $query = "\n\t\t\t\tSELECT ordprodid\n\t\t\t\tFROM [|PREFIX|]order_products\n\t\t\t\tWHERE orderorderid IN (\n\t\t\t\t\tSELECT orderorderid FROM [|PREFIX|]order_products WHERE ordprodid='" . (int) $GLOBALS['ProductJustAdded'] . "'\n\t\t\t\t) AND ordprodid NOT IN (" . $ignore_prod_list . ")\n\t\t\t\tGROUP BY ordprodid\n\t\t\t\tORDER BY COUNT(ordprodid) DESC\n\t\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 9); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); // Get the list of suggested product id's while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $prod_ids[] = $row['ordprodid']; } $suggest_prod_ids = implode(",", $prod_ids); $remaining_places = 9 - count($prod_ids); // If there aren't enough products to suggest, we will get // the popular products (based on reviews) instead // If there aren't enough suggested products, fetch related products for this item if ($remaining_places > 0) { require_once APP_ROOT . "/includes/classes/class.product.php"; $related = GetRelatedProducts($GLOBALS['Product']['productid'], $GLOBALS['Product']['prodname'], $GLOBALS['Product']['prodrelatedproducts']); // Any returned products? add them to the list $relatedProducts = explode(",", $related); // Limit the number of products to the # of empty spaces we have for ($i = 0; $i <= $remaining_places; ++$i) { if (!isset($relatedProducts[$i]) || $relatedProducts[$i] == "") { break; } if (!in_array($relatedProducts[$i], $prod_ids) && !@in_array($relatedProducts[$i], $ignore_prod_list)) { $prod_ids[] = $relatedProducts[$i]; } } $remaining_places = 9 - count($prod_ids); $suggest_prod_ids = implode(",", $prod_ids); } // Still don't have enough? Fetch popular products if ($remaining_places > 0) { if (!$suggest_prod_ids) { $suggest_prod_ids = 0; } $query = sprintf("select productid, floor(prodratingtotal/prodnumratings) as prodavgrating from [|PREFIX|]products where productid not in (%s) and productid not in (%s) and prodvisible='1' order by prodavgrating desc", $suggest_prod_ids, $ignore_prod_list); $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, $remaining_places); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); // Is there at least one product to suggest? while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $prod_ids[] = $row['productid']; } $suggest_prod_ids = implode(",", $prod_ids); } // If there are *still* no products to suggest, just show them // the normal shopping cart view instead if (!empty($prod_ids)) { // Get a list of products that were ordered at the // same time as the product that was just added to the cart if (!$suggest_prod_ids) { $suggest_prod_ids = 0; } if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } $query = "\n\t\t\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)\n\t\t\t\t\tWHERE p.productid IN (" . $suggest_prod_ids . ") AND p.prodvisible='1' AND (imageisthumb=1 OR ISNULL(imageisthumb))\n\t\t\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\t\t\tORDER BY prodnumsold DESC, prodratingtotal DESC\n\t\t\t\t"; $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'] = (int) $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { $GLOBALS['ProductURL'] = ProdLink($row['prodname']); $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); $GLOBALS['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //blessen //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $GLOBALS['SuggestedProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryProductsItem"); } } if (!$GLOBALS['SuggestedProductListing']) { ob_end_clean(); header("Location:cart.php"); die; } }
public function LoadProductsToCompare() { $count = 0; $output = ""; $tOutput = ""; $products = array(); // First row - the "Remove" link $GLOBALS['SNIPPETS']['TD1'] = ""; $GLOBALS['SNIPPETS']['TD2'] = ""; $GLOBALS['SNIPPETS']['TD3'] = ""; $GLOBALS['SNIPPETS']['TD4'] = ""; $GLOBALS['SNIPPETS']['TD5'] = ""; $GLOBALS['SNIPPETS']['TD6'] = ""; $GLOBALS['SNIPPETS']['TD7'] = ""; $GLOBALS['SNIPPETS']['TD8'] = ""; $GLOBALS['SNIPPETS']['TD9'] = ""; $GLOBALS['SNIPPETS']['TD10'] = ""; $GLOBALS['SNIPPETS']['TD11'] = ""; // Do we need to sort? if ($this->_comparesort != "") { $sort = sprintf("order by %s", $this->_comparesort); } else { $sort = ""; } $product_ids = $this->GetProductIds(); if (empty($product_ids)) { return; } $productids_array = explode('/', $this->GetIds()); if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['BaseCompareLink'] = CompareLink($productids_array) . '?'; } else { $GLOBALS['BaseCompareLink'] = CompareLink($productids_array) . '&'; } $compareWidth = 100 - 20; $compareWidth = floor($compareWidth / count($this->_compareproducts)); $GLOBALS['CompareWidth'] = $compareWidth . "%"; $GLOBALS['CompareHeadWidth'] = 100 - $compareWidth * count($this->_compareproducts) . "%"; $query = "\n\t\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . ",\n\t\t\t\t(SELECT brandname FROM [|PREFIX|]brands WHERE brandid=prodbrandid) AS brand,\n\t\t\t\t(select count(fieldid) from [|PREFIX|]product_customfields where fieldprodid=p.productid) as numcustomfields,\n\t\t\t\t(select count(reviewid) from [|PREFIX|]reviews where revproductid=p.productid and revstatus='1') AS numreviews\n\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)\n\t\t\t\tWHERE p.prodvisible='1' AND p.productid IN (" . $product_ids . ") AND (pi.imageisthumb=1 OR ISNULL(pi.imageisthumb))\n\t\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\t" . $sort; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $GLOBALS['ProductNumber'] = $count++; if ($row['brand'] != "") { $GLOBALS['ProductBrand'] = sprintf("<a href='%s'>%s</a>", BrandLink($row['brand']), isc_html_escape($row['brand'])); } else { $GLOBALS['ProductBrand'] = GetLang('NA'); } // Build the page title $this->_comparetitle .= sprintf("%s %s ", isc_html_escape($row['prodname']), GetLang('VS')); $GLOBALS['ProductId'] = $row['productid']; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); $GLOBALS['NumReviews'] = $row['numreviews']; if ($row['numreviews'] == 0) { $GLOBALS['HideComparisonReviewLink'] = "none"; } else { $GLOBALS['HideComparisonReviewLink'] = ""; } $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); if ($row['prodavailability'] != "") { $GLOBALS['ProductAvailability'] = isc_html_escape($row['prodavailability']); } else { $GLOBALS['ProductAvailability'] = GetLang('NA'); } $compare_ids = array_diff($this->_compareproducts, array($row['productid'])); if (count($compare_ids) == 1) { $GLOBALS['RemoveCompareLink'] = "javascript:alert('%%LNG_CompareTwoProducts%%');"; } else { $GLOBALS['RemoveCompareLink'] = CompareLink($compare_ids); if (!empty($this->_comparesort)) { $GLOBALS['RemoveCompareLink'] .= '?sort=' . $_GET['sort']; } } $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; if ($row['proddesc'] != "") { // Strip out HTML from the description first $row['proddesc'] = strip_tags($row['proddesc']); if (isc_strlen($row['proddesc']) > 200) { $GLOBALS['ProductSummary'] = isc_substr($row['proddesc'], 0, 200) . "..."; } else { $GLOBALS['ProductSummary'] = $row['proddesc']; } } else { $GLOBALS['ProductSummary'] = GetLang('NA'); } // Are there any custom fields? if ($row['numcustomfields'] > 0) { $GLOBALS['CustomFields'] = ""; // Get the custom fields for this product $query = sprintf("select * from [|PREFIX|]product_customfields where fieldprodid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($row['productid'])); $cResult = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($cRow = $GLOBALS['ISC_CLASS_DB']->Fetch($cResult)) { $GLOBALS['CustomFieldName'] = isc_html_escape($cRow['fieldname']); $GLOBALS['CustomFieldValue'] = $cRow['fieldvalue']; $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductCustomField"); } } else { $GLOBALS['CustomFields'] = GetLang('NA'); } $GLOBALS['SNIPPETS']['TD1'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD1"); $GLOBALS['SNIPPETS']['TD2'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD2"); $GLOBALS['SNIPPETS']['TD3'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD3"); $GLOBALS['SNIPPETS']['TD4'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD4"); $GLOBALS['SNIPPETS']['TD5'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD5"); $GLOBALS['SNIPPETS']['TD6'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD6"); $GLOBALS['SNIPPETS']['TD7'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD7"); $GLOBALS['SNIPPETS']['TD8'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD8"); $GLOBALS['SNIPPETS']['TD9'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTD9"); } if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none;"; } $output1 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR1"); $output2 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR2"); $output3 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR3"); $output4 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR4"); $output5 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR5"); $output6 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR6"); $output7 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR7"); $output8 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR8"); $output9 = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareProductTR9"); $output = $output1 . $output2 . $output3 . $output4 . $output9 . $output5 . $output6 . $output7 . $output8; $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']); $GLOBALS['SNIPPETS']['ComparisonList'] = $output; }
public function SetPanelSettings() { $count = 1; $output = ""; if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideProductRating'] = "display: none"; } if (isset($GLOBALS['ISC_CLASS_CATEGORY'])) { $categorySql = $GLOBALS['ISC_CLASS_CATEGORY']->GetCategoryAssociationSQL(); } else { if (isset($GLOBALS['ISC_CLASS_PRICE'])) { $categorySql = $GLOBALS['ISC_CLASS_PRICE']->GetCategoryAssociationSQL(); } } $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)\n\t\t\t\tWHERE p.prodnumsold > '0' AND p.prodvisible='1' AND (imageisthumb=1 OR ISNULL(imageisthumb)) " . $categorySql . "\n\t\t\t\tORDER BY p.prodnumsold DESC\n\t\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 5); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) { $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']]; } if ($count == 1) { $snippet = "SideTopSellersFirst"; } else { $snippet = "SideTopSellers"; } $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname'])); $GLOBALS['ProductId'] = $row['productid']; $GLOBALS['ProductNumber'] = $count++; $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['ProductLink'] = ProdLink($row['prodname']); // Determine the price of this product $GLOBALS['ProductPrice'] = CalculateProductPrice_retail($row); if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) { $GLOBALS['ProductURL'] = ProdLink($row['prodname']); $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink'); } else { //$GLOBALS['ProductURL'] = CartLink($row['productid']); $GLOBALS['ProductURL'] = ProdLink($row['prodname']); //blessen if (intval($row['prodretailprice']) <= 0) { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } else { $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink1'); } //blessen //$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink'); } if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) { $GLOBALS['HideActionAdd'] = ''; } else { $GLOBALS['HideActionAdd'] = 'none'; } $GLOBALS['HideProductVendorName'] = 'display: none'; $GLOBALS['ProductVendor'] = ''; if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) { $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors'); if (isset($vendorCache[$row['prodvendorid']])) { $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>'; $GLOBALS['HideProductVendorName'] = ''; } } $GLOBALS['ProductRating'] = (int) $row['prodavgrating']; $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet); } } else { $GLOBALS['HideSideCategoryTopSellersPanel'] = "none"; $this->DontDisplay = true; } $GLOBALS['SNIPPETS']['SideTopSellers'] = $output; }