public function SetPanelSettings() { $count = 0; $output = ""; $GLOBALS['SNIPPETS']['WishListItems'] = ""; $GLOBALS['HideCompareItems'] = "none"; if(!GetConfig('ShowProductRating')) { $GLOBALS['HideProductRating'] = "display: none"; } if (!isset($GLOBALS['WishListItems'])) { return false; } $GLOBALS['AlternateClass'] = ''; foreach($GLOBALS['WishListItems'] 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['ItemId'] = (int) $row['wishlistitemid']; $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); } $GLOBALS['ProductThumb'] = ImageThumb($row, ProdLink($row['prodname'])); $GLOBALS['SNIPPETS']['WishListItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("WishListItem"); } }
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'; } }
/** * Show a list of items that the customer has recently viewed by browsing our site */ private function ShowRecentItems() { $viewed = ""; if (isset($_COOKIE['RECENTLY_VIEWED_PRODUCTS'])) { $viewed = $_COOKIE['RECENTLY_VIEWED_PRODUCTS']; } else if (isset($_SESSION['RECENTLY_VIEWED_PRODUCTS'])) { $viewed = $_SESSION['RECENTLY_VIEWED_PRODUCTS']; } if ($viewed != "") { $GLOBALS['HideNoRecentItemsMessage'] = "none"; $GLOBALS['SNIPPETS']['AccountRecentItems'] = ""; $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['HideCompareItems'] = "none"; } if (!empty($viewed_products)) { if(!getProductReviewsEnabled()) { $GLOBALS['HideProductRating'] = "display: none"; } $query = " SELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, pi.*, ".GetProdCustomerGroupPriceSQL()." FROM [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images pi ON (productid=pi.imageprodid AND imageisthumb=1) WHERE prodvisible='1' AND productid in ('".implode("','", $viewed_products)."') ".GetProdCustomerGroupPermissionsSQL()." "; $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['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); } $GLOBALS['ProductThumb'] = ImageThumb($row, ProdLink($row['prodname'])); $GLOBALS['SNIPPETS']['AccountRecentItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountRecentlyViewedProducts"); } } } else { $GLOBALS['HideRecentItemList'] = "none"; } } else { $GLOBALS['HideRecentItemList'] = "none"; } $GLOBALS['CompareLink'] = CompareLink(); // Show the list of available shipping addresses $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(GetConfig('StoreName') . " - " . GetLang('RecentlyViewedItems')); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("account_recentitems"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); }
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'] = ''; } } }
/** * Build the array of searched item results for the AJAX request * * Method will build an array of searched item results for the AJAX request. Method will work with the ISC_SEARCH * class to get the results so make sure that the object is initialised and the DoSearch executed. * * Each key in the array will be the 'score' value (as a string) so it can be merged in with other results and can * then be further sorted using any PHP array sorting functions, so output would be something like this: * * EG: return = array(10, // result count * array( * "12.345" => array( * 0 => [product HTML] * 1 => [product HTML] * 2 => [product HTML] * ), * "2.784" => array( * 0 => [product HTML] * ), * "6.242" => array( * 0 => [product HTML] * 1 => [product HTML] * ) * ) * ); * * @access public * @return array An array with two values, first is total number of search results. Other is the search item results AJAX array on success, empty array on error */ static public function buildSearchResultsAJAX() { if (!isset($GLOBALS["ISC_CLASS_SEARCH"]) || !is_object($GLOBALS["ISC_CLASS_SEARCH"])) { return array(0, array()); } $totalRecords = $GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product"); if ($totalRecords == 0) { return array(0, array()); } $results = $GLOBALS["ISC_CLASS_SEARCH"]->GetResults("product"); $ajaxArray = array(); if (!array_key_exists("results", $results) || !is_array($results["results"])) { return array(); } $products = $results["results"]; foreach ($products as $product) { if (!isset($product["score"])) { $product["score"] = 0; } $GLOBALS["ProductName"] = $product["prodname"]; $GLOBALS["ProductURL"] = ProdLink($product["prodname"]); $GLOBALS['ProductPrice'] = ''; if (GetConfig('ShowProductPrice') && !$product['prodhideprice']) { $GLOBALS['ProductPrice'] = formatProductCatalogPrice($product); } if(getProductReviewsEnabled()) { $ratingURL = $GLOBALS["IMG_PATH"] . "/IcoRating" . (int)$product["prodavgrating"] . ".gif"; $GLOBALS["ProductRatingImage"] = "<img src=\"" . $ratingURL . "\" class=\"RatingIMG\" />"; } else { $GLOBALS["ProductRatingImage"] = ""; } $GLOBALS["ProductNoImageClassName"] = ""; if (isset($product["imageid"]) && $product["imageid"] !== "") { $image = new ISC_PRODUCT_IMAGE(); $image->populateFromDatabaseRow($product); $productImageSize = $image->getResizedFileDimensions(ISC_PRODUCT_IMAGE_SIZE_TINY, true); if ($productImageSize[0] > 70) { // ISCFIVEFIVEBETA-89 - cap to 70px wide // note: will need to adjust height by proper ratio if we want the height output to html $productImageSize[0] = 70; } $GLOBALS["ProductImage"] = "<img src=\"" . isc_html_escape($image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_TINY, true)) . "\" alt=\"" . isc_html_escape($product["prodname"]) . "\" title=\"" . isc_html_escape($product["prodname"]) . "\" width=\"" . $productImageSize[0] . "\" />"; } else { $GLOBALS["ProductNoImageClassName"] = "QuickSearchResultNoImage"; $GLOBALS["ProductImage"] = "<span>" . GetLang("QuickSearchNoImage") . "</span>"; } $sortKey = (string)$product["score"]; if (!array_key_exists($sortKey, $ajaxArray) || !is_array($ajaxArray[$sortKey])) { $ajaxArray[$sortKey] = array(); } $ajaxArray[$sortKey][] = $GLOBALS["ISC_CLASS_TEMPLATE"]->GetSnippet("SearchResultAJAXProduct"); } return array($totalRecords, $ajaxArray); }
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 = " SELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, pi.*, ".GetProdCustomerGroupPriceSQL().", (SELECT brandname FROM [|PREFIX|]brands WHERE brandid=prodbrandid) AS brand, (select count(fieldid) from [|PREFIX|]product_customfields where fieldprodid=p.productid) as numcustomfields, (select count(reviewid) from [|PREFIX|]reviews where revproductid=p.productid and revstatus='1') AS numreviews FROM [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid AND pi.imageisthumb=1) WHERE p.prodvisible='1' AND p.productid IN (".$product_ids.") ".GetProdCustomerGroupPermissionsSQL()." ".$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, ProdLink($row['prodname'])); // Determine the price of this product $GLOBALS['HideProductPrice'] = ''; $GLOBALS['ProductPrice'] = ''; if (GetConfig('ShowProductPrice') && !$row['prodhideprice']) { $GLOBALS['ProductPrice'] = formatProductCatalogPrice($row); } else { $GLOBALS['HideProductPrice'] = 'display:none;'; } 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 = "SELECT * FROM [|PREFIX|]product_customfields WHERE fieldprodid='" . $GLOBALS['ISC_CLASS_DB']->Quote($row['productid']) . "' ORDER BY fieldid"; $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(!getProductReviewsEnabled()) { $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; }