Exemplo n.º 1
0
	public function SetPanelSettings()
	{
		if (!isset($GLOBALS['ISC_CLASS_PRODUCT'])) {
			$GLOBALS['ISC_CLASS_PRODUCT'] = GetClass('ISC_PRODUCT');
		}

		$relatedProducts = $GLOBALS['ISC_CLASS_PRODUCT']->GetRelatedProducts();

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

		$output = "";

		if(!getProductReviewsEnabled()) {
			$GLOBALS['HideProductRating'] = "display: none";
		}

		$query = $this->getProductQuery('p.productid IN ('.$relatedProducts.')', 'prodsortorder ASC');
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		$GLOBALS['AlternateClass'] = '';
		while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$this->setProductGlobals($row);
			$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideRelatedProducts");
		}

		$GLOBALS['SNIPPETS']['SideProductsRelated'] = $output;

		if(!$output) {
			$this->DontDisplay = true;
		}
	}
	public function SetPanelSettings()
	{
		$output = "";

		// If product ratings aren't enabled then we don't even need to load anything here
		if(!getProductReviewsEnabled()) {
			$this->DontDisplay = true;
			return;
		}

		$categorySql = $GLOBALS['ISC_CLASS_CATEGORY']->GetCategoryAssociationSQL(false);
		$query = $this->getProductQuery('prodratingtotal > 0 AND '.$categorySql, 'p.prodratingtotal DESC', 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)) {
				$this->setProductGlobals($row);
				$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;
	}
Exemplo n.º 3
0
	/**
	 * Set the panel settings.
	 */
	public function SetPanelSettings()
	{
		if(GetConfig('HomeFeaturedProducts') <= 0) {
			$this->DontDisplay = true;
			return false;
		}

		$GLOBALS['SNIPPETS']['VendorFeaturedItems'] = '';

		if(!getProductReviewsEnabled()) {
			$GLOBALS['HideProductRating'] = "display: none";
		}

		$cVendor = GetClass('ISC_VENDORS');
		$vendor = $cVendor->GetVendor();

		$query = $this->getProductQuery(
			'p.prodvendorid='.(int)$vendor['vendorid'],
			'p.prodvendorfeatured DESC, RAND()',
			getConfig('HomeFeaturedProducts')
		);
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		$GLOBALS['AlternateClass'] = '';
		while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$this->setProductGlobals($row);
			$GLOBALS['SNIPPETS']['VendorFeaturedItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("VendorFeaturedItemsItem");
		}

		$GLOBALS['VendorProductsLink'] = VendorProductsLink($vendor);

		if(!$GLOBALS['SNIPPETS']['VendorFeaturedItems']) {
			$this->DontDisplay = true;
		}
	}
Exemplo n.º 4
0
	public function SetPanelSettings()
	{
		$output = "";

		// If product ratings aren't enabled then we don't even need to load anything here
		if(!getProductReviewsEnabled()) {
			$this->DontDisplay = true;
			return;
		}

		$query = $this->getProductQuery('p.prodratingtotal > 0', 'p.prodratingtotal DESC', 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)) {
				$this->setProductGlobals($row);
				$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SidePopularProducts");
			}

			// Showing the syndication option?
			if(GetConfig('RSSPopularProducts') != 0 && GetConfig('RSSSyndicationIcons') != 0) {
				$GLOBALS['SNIPPETS']['SidePopularProductsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SidePopularProductsFeed");
			}
		}
		else {
			$GLOBALS['HideSidePopularProductsPanel'] = "none";
			$this->DontDisplay = true;
		}

		$GLOBALS['SNIPPETS']['SidePopularProducts'] = $output;
	}
Exemplo n.º 5
0
	public function SetPanelSettings()
	{
		$GLOBALS['AlsoBoughtProductListing'] = '';
		$query = "
			SELECT ordprodid
			FROM [|PREFIX|]order_products
			WHERE orderorderid IN (SELECT orderorderid FROM [|PREFIX|]order_products WHERE ordprodid='".$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."') AND ordprodid != ".$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."
			GROUP BY ordprodid
			ORDER BY COUNT(ordprodid) DESC
		";
		$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 10);
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		$productIds = array();
		while($product = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$productIds[] = $product['ordprodid'];
		}

		if(empty($productIds)) {
			$this->DontDisplay = true;
			return;
		}

		if(!getProductReviewsEnabled()) {
			$GLOBALS['HideProductRating'] = "display: none";
		}

		$query = $this->getProductQuery('p.productid IN ('.implode(',', $productIds).')');
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		$GLOBALS['AlternateClass'] = '';
		while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$this->setProductGlobals($row);
			$GLOBALS['AlsoBoughtProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductAlsoBoughtItem");
		}

		if(!$GLOBALS['AlsoBoughtProductListing']) {
			$this->DontDisplay = true;
		}
	}
	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';
		}
	}
Exemplo n.º 7
0
		/**
		*	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();
		}
Exemplo n.º 8
0
	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) {
			$this->DontDisplay = true;
			return;
		}

		// Hide the top selling products panel from the cart page
		$GLOBALS['HideSideTopSellersPanel'] = "none";

		$output = "";
		$viewed_products = explode(",", $viewed);
		$viewed_products = array_map('intval', $viewed_products);

		// 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(!getProductReviewsEnabled()) {
			$GLOBALS['HideProductRating'] = "display: none";
		}

		$query = $this->getProductQuery('p.productid IN ('.implode(',', $viewed_products).')');
		$result = $GLOBALS['ISC_CLASS_DB']->query($query);
		$productData = array();
		while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$productData[$row['productid']] = $row;
		}

		if(empty($productData)) {
			$this->DontDisplay = true;
			return;
		}

		$GLOBALS['AlternateClass'] = '';
		foreach($viewed_products as $productId) {
			if(empty($productData[$productId])) {
				continue;
			}

			$this->setProductGlobals($productData[$productId]);
			$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideRecentlyViewedProducts");
		}

		$GLOBALS['SNIPPETS']['SideProductRecentlyViewed'] = $output;
	}
Exemplo n.º 9
0
		private function ManageSettings($messages=array())
		{
			if(!gzte11(ISC_HUGEPRINT)) {
				$GLOBALS['HideVendorOptions'] = 'display: none';
			}

			$GLOBALS['Message'] = GetFlashMessageBoxes();

			// Get the getting started box if we need to
			$GLOBALS['GettingStartedStep'] = '';
			if(empty($GLOBALS['Message']) && (isset($_GET['wizard']) && $_GET['wizard']==1) && !in_array('settings', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) {
				$GLOBALS['GettingStartedTitle'] = GetLang('ConfigureStoreSettings');
				$GLOBALS['GettingStartedContent'] = GetLang('ConfigureStoreSettingsDesc');
				$GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html');
			}

			if (GetConfig('UseWYSIWYG')) {
				$GLOBALS['IsWYSIWYGEnabled'] = 'checked="checked"';
			}

			if (GetConfig('ShowThumbsInControlPanel')) {
				$GLOBALS['IsProductThumbnailsEnabled'] = 'checked="checked"';
			}

			if (GetConfig('DesignMode')) {
				$GLOBALS['IsDesignMode'] = 'checked="checked"';
			}

			if (GetConfig('ForceControlPanelSSL')) {
				$GLOBALS['IsControlPanelSSLEnabled'] = 'checked="checked"';
			}

			if (GetConfig('DownForMaintenance')) {
				$GLOBALS['IsDownForMaintenance'] = 'checked="checked"';
			}

			$GLOBALS["CharacterSet"] = GetConfig('CharacterSet');

			if(in_array(GetConfig('CharacterSet'), $this->validCharacterSets)) {
				$selectedCharset = GetConfig('CharacterSet');
				$selectedCharset = isc_strtolower($selectedCharset);
				$selectedCharset = str_replace(array("-", "_"), "", $selectedCharset);
				$GLOBALS["CharacterSet_Selected_" . $selectedCharset] = 'selected="selected"';
			} else {
				$GLOBALS["CharacterSet_Selected_utf8"] = 'selected="selected"';
			}

			/*
			if (GetConfig('UseSSL')) {
				$GLOBALS['IsSSLEnabled'] = 'checked="checked"';
			}
			*/
			switch (GetConfig('UseSSL')) {
				case SSL_NORMAL:
					$SSLOption = "UseNormalSSL";
					break;
				case SSL_SHARED:
					$SSLOption = "UseSharedSSL";
					break;
				case SSL_SUBDOMAIN:
					$SSLOption = "UseSubdomainSSL";
					break;
				default:
					$SSLOption = "NoSSL";
			}

			$GLOBALS[$SSLOption . 'Checked'] = 'checked="checked"';

			if(GetConfig('AllowPurchasing')) {
				$GLOBALS['IsPurchasingEnabled'] = 'checked="checked"';
			}

			switch(GetConfig('WeightMeasurement')) {
				case 'LBS':
					$GLOBALS['IsPounds'] = 'selected="selected"';
					break;
				case 'Ounces':
					$GLOBALS['IsOunces'] = 'selected="selected"';
					break;
				case 'KGS':
					$GLOBALS['IsKilos'] = 'selected="selected"';
					break;
				case 'Grams':
					$GLOBALS['IsGrams'] = 'selected="selected"';
					break;
				case 'Tonnes':
					$GLOBLAS['IsTonnes'] = 'selected="selected"';
			}

			if (GetConfig('LengthMeasurement') == "Inches") {
				$GLOBALS['IsInches'] = 'selected="selected"';
			} else {
				$GLOBALS['IsCentimeters'] = 'selected="selected"';
			}

			$GLOBALS['ShippingFactoringDimensionDepthSelected'] = '';
			$GLOBALS['ShippingFactoringDimensionHeightSelected'] = '';
			$GLOBALS['ShippingFactoringDimensionWidthSelected'] = '';

			switch (GetConfig('ShippingFactoringDimension')) {
				case 'height':
					$GLOBALS['ShippingFactoringDimensionHeightSelected'] = 'selected="selected"';
					break;
				case 'width':
					$GLOBALS['ShippingFactoringDimensionWidthSelected'] = 'selected="selected"';
					break;
				case 'depth':
				default:
					$GLOBALS['ShippingFactoringDimensionDepthSelected'] = 'selected="selected"';
					break;
			}

			if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
				$GLOBALS['IsDropdown'] = 'selected="selected"';
			} else {
				$GLOBALS['IsTextbox'] = 'selected="selected"';
			}

			// Product breadcrumbs dropdown
			$GLOBALS['ProductBreadcrumbs'] = GetConfig('ProductBreadcrumbs');
			$GLOBALS['ProductBreadcrumbOptions'] = array(
				"showall" => GetLang('ShowAll'),
				"showone" => GetLang('ShowOneOnly'),
				"shownone" => GetLang('DontShow'),
			);

			if (GetConfig('FastCartAction') == 'popup') {
				$GLOBALS['IsShowPopWindow'] = 'selected="selected"';
			} else {
				$GLOBALS['IsShowCartPage'] = 'selected="selected"';
			}

			if (GetConfig('TagCloudsEnabled')) {
				$GLOBALS['IsTagCloudsEnabled'] = 'checked="checked"';
			}

			if (GetConfig('BulkDiscountEnabled')) {
				$GLOBALS['IsBulkDiscountEnabled'] = 'checked="checked"';
			}

			if (GetConfig('EnableProductTabs')) {
				$GLOBALS['IsProductTabsEnabled'] = 'checked="checked"';
			}

			if (GetConfig('ShowAddToCartQtyBox')) {
				$GLOBALS['IsShownAddToCartQtyBox'] = 'checked="checked"';
			}

			if (GetConfig('CaptchaEnabled')) {
				$GLOBALS['IsCaptchaEnabled'] = 'checked="checked"';
			}

			if(GetConfig('StoreDSTCorrection')) {
				$GLOBALS['IsDSTCorrectionEnabled'] = "checked=\"checked\"";
			}

			if (GetConfig('ShowCartSuggestions')) {
				$GLOBALS['IsShowCartSuggestions'] = 'checked="checked"';
			}

			if (GetConfig('ShowThumbsInCart')) {
				$GLOBALS['IsShowThumbsInCart'] = 'checked="checked"';
			}

			if (GetConfig('TagCloudsEnabled')) {
				$GLOBALS['IsTagCloudsEnabled'] = 'checked="checked"';
			}

			if (GetConfig('ShowAddToCartQtyBox')) {
				$GLOBALS['IsShownAddToCartQtyBox'] = 'checked="checked"';
			}

			if (GetConfig('AutoApproveReviews')) {
				$GLOBALS['IsAutoApproveReviews'] = 'checked="checked"';
			}

			if (GetConfig('SearchSuggest')) {
				$GLOBALS['IsSearchSuggest'] = 'checked="checked"';
			}

			if (GetConfig('QuickSearch')) {
				$GLOBALS['IsQuickSearch'] = 'checked="checked"';
			}

			if (GetConfig('ShowInventory')) {
				$GLOBALS['IsShowInventory'] = 'checked="checked"';
			}

			if (GetConfig('ShowPreOrderInventory')) {
				$GLOBALS['IsShowPreOrderInventory'] = 'checked="checked"';
			}

			// Bulk Discount Settings
			if (GetConfig('BulkDiscountEnabled')) {
				$GLOBALS['IsBulkDiscountEnabled'] = 'checked="checked"';
			}

			if (GetConfig('EnableProductTabs')) {
				$GLOBALS['IsProductTabsEnabled'] = 'checked="checked"';
			}

			// RSS Settings
			if (GetConfig('RSSNewProducts')) {
				$GLOBALS['IsRSSNewProductsEnabled'] = 'checked="checked"';
			}

			if (GetConfig('RSSPopularProducts')) {
				$GLOBALS['IsRSSPopularProductsEnabled'] = 'checked="checked"';
			}

			if (GetConfig('RSSFeaturedProducts')) {
				$GLOBALS['IsRSSFeaturedProductsEnabled'] = 'checked="checked"';
			}

			if (GetConfig('RSSCategories')) {
				$GLOBALS['IsRSSCategoriesEnabled'] = 'checked="checked"';
			}

			if (GetConfig('RSSProductSearches')) {
				$GLOBALS['IsRSSProductSearchesEnabled'] = 'checked="checked"';
			}

			if (GetConfig('RSSLatestBlogEntries')) {
				$GLOBALS['IsRSSLatestBlogEntriesEnabled'] = 'checked="checked"';
			}

			if (GetConfig('RSSSyndicationIcons')) {
				$GLOBALS['IsRSSSyndicationIconsEnabled'] = 'checked="checked"';
			}

			if(GetConfig('EnableCustomersAlsoViewed')) {
				$GLOBALS['IsCustomersAlsoViewedEnabled'] = 'checked="checked"';
			}

			// Product Images
			if (GetConfig('ProductImagesTinyThumbnailsEnabled')) {
				$GLOBALS['IsProductImagesTinyThumbnailsEnabled'] = 'checked="checked"';
			}

			if(GetConfig('ProductImagesImageZoomEnabled')) {
				$GLOBALS['IsProductImagesImageZoomEnabled'] = 'checked="checked"';
			}

			if((int)GetConfig('ProductImagesStorewideThumbnail_width') < 1) {
				$GLOBALS['ISC_CFG']['ProductImagesStorewideThumbnail_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_THUMBNAIL;
			}

			if((int)GetConfig('ProductImagesStorewideThumbnail_height') < 1) {
				$GLOBALS['ISC_CFG']['ProductImagesStorewideThumbnail_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_THUMBNAIL;
			}

			if((int)GetConfig('ProductImagesProductPageImage_width') < 1) {
				$GLOBALS['ISC_CFG']['ProductImagesProductPageImage_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_STANDARD;
			}

			if((int)GetConfig('ProductImagesProductPageImage_height') < 1) {
				$GLOBALS['ISC_CFG']['ProductImagesProductPageImage_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_STANDARD;
			}

			if((int)GetConfig('ProductImagesGalleryThumbnail_width') < 1) {
				$GLOBALS['ISC_CFG']['ProductImagesGalleryThumbnail_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_TINY;
			}

			if((int)GetConfig('ProductImagesGalleryThumbnail_height') < 1) {
				$GLOBALS['ISC_CFG']['ProductImagesGalleryThumbnail_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_TINY;
			}

			// Backup Settings
			if (GetConfig('BackupsLocal')) {
				$GLOBALS['IsBackupsLocalEnabled'] = 'checked="checked"';
			}

			if (GetConfig('BackupsRemoteFTP')) {
				$GLOBALS['IsBackupsRemoteFTPEnabled'] = 'checked="checked"';
			}

			if (GetConfig('BackupsAutomatic')) {
				$GLOBALS['IsBackupsAutomaticEnabled'] = 'checked="checked"';
			}

			if (GetConfig('HTTPSSLVerifyPeer')) {
				$GLOBALS['IsHTTPSSLVerifyPeerEnabled'] = 'checked="checked"';
			}

			if (strpos(strtolower(PHP_OS), 'win') === 0) {
				$binary = 'php.exe';
				$path_to_php = Which($binary);
			} else {
				// Check if there is a separate PHP 5 binary first
				foreach(array('php5', 'php') as $phpBin) {
					$path_to_php = Which($phpBin);
					if($path_to_php !== '') {
						break;
					}
				}
			}

			if ($path_to_php === '' && strpos(strtolower(PHP_OS), 'win') === 0) {
				$path_to_php = 'php.exe';
			} elseif ($path_to_php === '') {
				$path_to_php = 'php';
			}

			$GLOBALS['BackupsAutomaticPath'] = $path_to_php.' -f ' . realpath(ISC_BASE_PATH . "/admin")."/cron-backup.php";

			if (GetConfig('BackupsAutomaticMethod') == "ftp") {
				$GLOBALS['IsBackupsAutomaticMethodFTP'] = 'selected="selected"';
			} else {
				$GLOBALS['IsBackupsAutomaticMethodLocal'] = 'selected="selected"';
			}

			if (GetConfig('BackupsAutomaticDatabase')) {
				$GLOBALS['IsBackupsAutomaticDatabaseEnabled'] = 'checked="checked"';
			}

			if (GetConfig('BackupsAutomaticImages')) {
				$GLOBALS['IsBackupsAutomaticImagesEnabled'] = 'checked="checked"';
			}

			if (GetConfig('BackupsAutomaticDownloads')) {
				$GLOBALS['IsBackupsAutomaticDownloadsEnabled'] = 'checked="checked"';
			}

			$GLOBALS['LanguageOptions'] = $this->GetLanguageOptions(GetConfig('Language'));

			if (!function_exists('ftp_connect')) {
				$GLOBALS['FTPBackupsHide'] = "none";
			}

			$GLOBALS['TimeZoneOptions'] = $this->GetTimeZoneOptions(GetConfig('StoreTimeZone'));

			$query = sprintf("select version() as version");
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
			$GLOBALS['dbVersion'] = $row['version'];

			// Logging Settings
			if (GetConfig('SystemLogging')) {
				$GLOBALS['IsSystemLoggingEnabled'] = "checked=\"checked\"";
			}

			if(GetConfig('DebugMode')) {
				$GLOBALS['IsDebugModeEnabled'] = "checked=\"checked\"";
			}

			if (GetConfig('SystemLogTypes')) {
				$types = explode(",", GetConfig('SystemLogTypes'));
				if (in_array('general', $types)) {
					$GLOBALS['IsGeneralLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('payment', $types)) {
					$GLOBALS['IsPaymentLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('shipping', $types)) {
					$GLOBALS['IsShippingLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('notification', $types)) {
					$GLOBALS['IsNotificationLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('sql', $types)) {
					$GLOBALS['IsSQLLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('php', $types)) {
					$GLOBALS['IsPHPLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('accounting', $types)) {
					$GLOBALS['IsAccountingLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('emailintegration', $types)) {
					$GLOBALS['IsEmailIntegrationLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('ebay', $types)) {
					$GLOBALS['IsEbayLoggingEnabled'] = "selected=\"selected\"";
				}
				if (in_array('shoppingcomparison', $types)) {
					$GLOBALS['IsShoppingComparisonLoggingEnabled'] = "selected=\"selected\"";
				}
			}

			if (GetConfig('SystemLogSeverity')) {
				$severities = explode(",", GetConfig('SystemLogSeverity'));
				if (in_array('errors', $severities)) {
					$GLOBALS['IsLoggingSeverityErrors'] = "selected=\"selected\"";
				}
				if (in_array('warnings', $severities)) {
					$GLOBALS['IsLoggingSeverityWarnings'] = "selected=\"selected\"";
				}
				if (in_array('notices', $severities)) {
					$GLOBALS['IsLoggingSeverityNotices'] = "selected=\"selected\"";
				}
				if (in_array('success', $severities)) {
					$GLOBALS['IsLoggingSeveritySuccesses'] = "selected=\"selected\"";
				}
				if (in_array('debug', $severities)) {
					$GLOBALS['IsLoggingSeverityDebug'] = "selected=\"selected\"";
				}
			}


			if (GetConfig('EnableSEOUrls') == 2) {
				$GLOBALS['IsEnableSEOUrlsAuto'] = "selected=\"selected\"";
			}
			else if (GetConfig('EnableSEOUrls') == 1) {
				$GLOBALS['IsEnableSEOUrlsEnabled'] = "selected=\"selected\"";
			}
			else {
				$GLOBALS['IsEnableSEOUrlsDisabled'] = "selected=\"selected\"";
			}

			if (!gzte11(ISC_MEDIUMPRINT)) {
				$GLOBALS['HideBackupSettings'] = "none";
			}

			if (GetConfig('AdministratorLogging')) {
				$GLOBALS['IsAdministratorLoggingEnabled'] = "checked=\"checked\"";
			}

			if(GetConfig('HidePHPErrors')) {
				$GLOBALS['IsHidePHPErrorsEnabled'] = "checked=\"checked\"";
			}

			if(GetConfig('EnableWishlist')) {
				$GLOBALS['IsWishlistEnabled'] = "checked=\"checked\"";
			}

			if(GetConfig('EnableAccountCreation')) {
				$GLOBALS['IsEnableAccountCreation'] = "checked=\"checked\"";
			}

			if (!getProductReviewsEnabled()) {
				 $GLOBALS['HideIfReviewsDisabled'] = 'display: none;';
			}

			if(GetConfig('EnableProductComparisons')) {
				$GLOBALS['IsEnableProductComparisons'] = "checked=\"checked\"";
			}

			// Product display settings
			if(GetConfig('ShowProductPrice')) {
				$GLOBALS['IsProductPriceShown'] = 'CHECKED';
			}

			if(GetConfig('ShowProductSKU')) {
				$GLOBALS['IsProductSKUShown'] = 'CHECKED';
			}

			if(GetConfig('ShowProductWeight')) {
				$GLOBALS['IsProductWeightShown'] = 'CHECKED';
			}

			if(GetConfig('ShowProductBrand')) {
				$GLOBALS['IsProductBrandShown'] = 'CHECKED';
			}

			if(GetConfig('ShowProductShipping')) {
				$GLOBALS['IsProductShippingShown'] = 'CHECKED';
			}

			if(GetConfig('ShowProductRating')) {
				$GLOBALS['IsProductRatingShown'] = 'CHECKED';
			}

			if(GetConfig('ShowAddToCartLink')) {
				$GLOBALS['IsAddToCartLinkShown'] = 'CHECKED';
			}

			if (GetConfig('ShowAddThisLink')) {
				$GLOBALS['IsAddThisLinkShown'] = 'checked="checked"';
			}

			if(GetConfig('LowInventoryNotificationAddress') != '') {
				$GLOBALS['LowInventoryEmailsEnabledCheck'] = "checked=\"checked\"";
			}
			else {
				$GLOBALS['HideLowInventoryNotification'] = "none";
			}

			if(GetConfig('ForwardInvoiceEmails') != '') {
				$GLOBALS['ForwardInvoiceEmailsCheck'] = "checked=\"checked\"";
			}
			else {
				$GLOBALS['HideForwardInvoiceEmails'] = 'none';
			}

			if(GetConfig('MailUseSMTP')) {
				$GLOBALS['HideMailSMTPSettings'] = '';
				$GLOBALS['MailUseSMTPChecked'] = "checked=\"checked\"";
			}
			else {
				$GLOBALS['HideMailSMTPSettings'] = 'none';
				$GLOBALS['MailUsePHPChecked'] = "checked=\"checked\"";
			}

			if (GetConfig('ProductImageMode') == "lightbox") {
				$GLOBALS['ProductImageModeLightbox'] = 'selected="selected"';
			} else {
				$GLOBALS['ProductImageModePopup'] = 'selected="selected"';
			}

			if (GetConfig('CategoryDisplayMode') == "grid") {
				$GLOBALS['CategoryDisplayModeGrid'] = 'selected="selected"';
			}
			else {
				$GLOBALS['CategoryDisplayModeList'] = 'selected="selected"';
			}

			if (GetConfig('CategoryDefaultImage') !== '') {
				$GLOBALS['CatImageDefaultSettingMessage'] = sprintf(GetLang('CatImageDefaultSettingDesc'), GetConfig('ShopPath') . '/' . GetConfig('CategoryDefaultImage'), GetConfig('CategoryDefaultImage'));
			} else {
				$GLOBALS['CatImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingNoDeleteDesc'), $GLOBALS['IMG_PATH'].'/CategoryDefault.gif', $GLOBALS['IMG_PATH'].'CategoryDefault.gif');
			}

			if (GetConfig('BrandDefaultImage') !== '') {
				$GLOBALS['BrandImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingDesc'), GetConfig('ShopPath') . '/' . GetConfig('BrandDefaultImage'), GetConfig('BrandDefaultImage'));
			} else {
				$GLOBALS['BrandImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingNoDeleteDesc'), $GLOBALS['IMG_PATH'].'/BrandDefault.gif', $GLOBALS['IMG_PATH'].'/BrandDefault.gif');
			}

			$GLOBALS['HideCurrentDefaultProductImage'] = 'display: none';
			switch(GetConfig('DefaultProductImage')) {
				case 'template':
					$GLOBALS['DefaultProductImageTemplateChecked'] = 'checked="checked"';
					break;
				case '':
					$GLOBALS['DefaultProductImageNoneChecked'] = 'checked="checked"';
					break;
				default:
					$GLOBALS['DefaultProductImageCustomChecked'] = 'checked="checked"';
					$GLOBALS['HideCurrentDefaultProductImage'] = '';
					$GLOBALS['DefaultProductImage'] = GetConfig('DefaultProductImage');
			}

			if (GetConfig('CategoryListingMode') == 'children') {
				$GLOBALS['CategoryListModeChildren'] = "checked=\"checked\"";
			}
			else if (GetConfig('CategoryListingMode') == 'emptychildren') {
				$GLOBALS['CategoryListModeEmptyChildren'] = "checked=\"checked\"";
			}
			else {
				$GLOBALS['CategoryListModeSingle'] = "checked=\"checked\"";
			}

			// check if the images need to be resized automatically
			$GLOBALS['RunImageResize'] = '0';
			if(isset($_SESSION['RunImageResize']) && $_SESSION['RunImageResize'] == 'yes') {
				$GLOBALS['RunImageResize'] = '1';
				unset($_SESSION['RunImageResize']);
			}

			// Get a list of the customer groups
			$query = 'SELECT * FROM [|PREFIX|]customer_groups ORDER BY groupname ASC';
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$GLOBALS['CustomerGroupOptions'] = '';
			while($group = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				if(GetConfig('GuestCustomerGroup') == $group['customergroupid']) {
					$sel = 'selected="selected"';
				}
				else {
					$sel = '';
				}
				$GLOBALS['CustomerGroupOptions'] .= "<option value=\"".$group['customergroupid']."\" ".$sel.">".isc_html_escape($group['groupname'])."</option>";
			}

			// Workout the HTTPS URL
			$GLOBALS['CompleteStorePath'] = fix_url($_SERVER['PHP_SELF']);
			$GLOBALS['HTTPSUrl'] = str_replace("http://", "https://", isc_strtolower($GLOBALS['ShopPath']));

			$GLOBALS['HideVendorSettings'] = 'display: none';
			if(gzte11(ISC_HUGEPRINT)) {
				$GLOBALS['HideVendorSettings'] = '';
			}

			if(GetConfig('VendorLogoSize')) {
				$logoDimensions = explode('x', GetConfig('VendorLogoSize'));
				$GLOBALS['VendorLogoSizeW'] = (int)$logoDimensions[0];
				$GLOBALS['VendorLogoSizeH'] = (int)$logoDimensions[1];
				$GLOBALS['HideVendorLogoUploading'] = '';
				$GLOBALS['VendorLogoUploadingChecked'] = 'checked="checked"';
			}
			else {
				$GLOBALS['HideVendorLogoUploading'] = 'display: none';
			}

			if(GetConfig('VendorPhotoSize')) {
				$photoDimensions = explode('x', GetConfig('VendorPhotoSize'));
				$GLOBALS['VendorPhotoSizeW'] = (int)$photoDimensions[0];
				$GLOBALS['VendorPhotoSizeH'] = (int)$photoDimensions[1];
				$GLOBALS['HideVendorPhotoUploading'] = '';
				$GLOBALS['VendorPhotoUploadingChecked'] = 'checked="checked"';
			}
			else {
				$GLOBALS['HideVendorPhotoUploading'] = 'display: none';
			}

			foreach ($this->all_vars as $var) {
				if (is_string(GetConfig($var)) || is_numeric(GetConfig($var))) {
					$GLOBALS[$var] = isc_html_escape(GetConfig($var));
				}
			}

			// the current value of auto_increment for the orders table
			$GLOBALS['StartingOrderNumber'] = ResetStartingOrderNumber();

			if(GetConfig('DisableDatabaseDetailFields')) {
				$GLOBALS['dbType'] = '';
				$GLOBALS['dbServer'] = '';
				$GLOBALS['dbUser'] = '';
				$GLOBALS['dbPass'] = '';
				$GLOBALS['dbDatabase'] = '';
				$GLOBALS['tablePrefix'] = '';
				$GLOBALS['HideDatabaseDetails'] = 'display: none';
			}

			if(GetConfig('DisableLicenseKeyField')) {
				$GLOBALS['serverStamp'] = 'N/A';
				$GLOBALS['HideLicenseKey'] = 'display: none';
			}

			if(GetConfig('DisablePathFields')) {
				$GLOBALS['HidePathFields'] = 'display: none';
			}

			if(GetConfig('DisableStoreUrlField')) {
				$GLOBALS['HideStoreUrlField'] = 'display: none';
			}

			if(GetConfig('DisableLoggingSettingsTab')) {
				$GLOBALS['HideLoggingSettingsTab'] = 'display: none';
			}

			if(GetConfig('DisableProxyFields')) {
				$GLOBALS['HideProxyFields'] = 'display: none';
			}

			if(GetConfig('DisableBackupSettings')) {
				$GLOBALS['HideBackupSettings'] = 'none';
			}


			// Advance Search settings\
			$GLOBALS['SearchDefaultProductSortOptions'] = getAdvanceSearchSortOptions("product");
			$GLOBALS['SearchDefaultContentSortOptions'] = getAdvanceSearchSortOptions("content");

			$GLOBALS['SearchProductDisplayModeOptions'] = '';

			foreach (array('grid', 'list') as $type) {
				$GLOBALS['SearchProductDisplayModeOptions'] .= '<option value="' . $type . '"';

				if (GetConfig('SearchProductDisplayMode') == $type) {
					$GLOBALS['SearchProductDisplayModeOptions'] .= ' selected';
				}

				$GLOBALS['SearchProductDisplayModeOptions'] .= '>' . GetLang('SearchProductDisplayMode' . ucfirst($type)) . '</option>';
			}

			$GLOBALS['SearchResultsPerPageOptions'] = '';

			foreach (array('5', '10', '20', '50', '100') as $perpage) {
				$GLOBALS['SearchResultsPerPageOptions'] .= '<option value="' . $perpage . '"';

				if (GetConfig('SearchResultsPerPage') == $perpage) {
					$GLOBALS['SearchResultsPerPageOptions'] .= ' selected';
				}

				$GLOBALS['SearchResultsPerPageOptions'] .= '>' . $perpage . '</option>';
			}

			$GLOBALS['SearchOptimisationOptions'] = '';

			foreach (array('fulltext', 'like', 'both') as $mode) {
				$GLOBALS['SearchOptimisationOptions'] .= '<option value="' . $mode . '"';

				if (GetConfig('SearchOptimisation') == $mode) {
					$GLOBALS['SearchOptimisationOptions'] .= ' selected';
				}

				$GLOBALS['SearchOptimisationOptions'] .= '>' . GetLang('SearchOptimisation' . ucfirst(isc_strtolower($mode))) . '</option>';
			}

			$GLOBALS["AbandonOrderLifetimeOptions"] = "";

			foreach (array(1, 7, 14, 21, 30, 60, 90, 120, 150, 180) as $lifetimeType) {
				$GLOBALS["AbandonOrderLifetimeOptions"] .= "<option value=\"" . $lifetimeType . "\"";

				if ((int)GetConfig("AbandonOrderLifetime") == $lifetimeType) {
					$GLOBALS["AbandonOrderLifetimeOptions"] .= " selected=\"selected\"";
				}

				$GLOBALS["AbandonOrderLifetimeOptions"] .= ">" . GetLang("AbandonOrderLifetimeOption" . $lifetimeType . "Days") . "</option>\n";
			}

			$GLOBALS['ShopPath'] = GetConfig('ShopPathNormal');

			// get the maintenance message
			$GLOBALS['DownForMaintenanceMessage'] = Store_DownForMaintenance::getDownForMaintenanceMessage();

			switch (GetConfig('RedirectWWW')) {
				case REDIRECT_TO_WWW:
					$redirectOption = 'RedirectToWWW';
					break;
				case REDIRECT_TO_NO_WWW:
					$redirectOption = 'RedirectToNoWWW';
					break;
				default:
					$redirectOption = 'RedirectNoPreference';
			}

			$GLOBALS[$redirectOption . 'Selected'] = 'selected="selected"';
			$GLOBALS['ShowPCISettings'] = !GetConfig('HidePCISettings');

			$GLOBALS['FacebookLikeButtonEnabled'] = GetConfig('FacebookLikeButtonEnabled');
			$GLOBALS['FacebookLikeButtonStyle' . GetConfig('FacebookLikeButtonStyle')] = 'selected="selected"';
			$GLOBALS['FacebookLikeButtonPosition' . GetConfig('FacebookLikeButtonPosition')] = 'selected="selected"';
			$GLOBALS['FacebookLikeButtonVerb' . GetConfig('FacebookLikeButtonVerb')] = 'selected="selected"';
			$GLOBALS['FacebookLikeButtonShowFacesEnabled'] = GetConfig('FacebookLikeButtonShowFaces');

			if (!isset($GLOBALS['TPL_CFG']['EnableFlyoutMenuSupport']) || !$GLOBALS['TPL_CFG']['EnableFlyoutMenuSupport']) {
				// force selection if template does not support flyout
				$GLOBALS['CategoryListStyle'] = 'static';
			}

			$this->template->display('settings.manage.tpl');
		}
Exemplo n.º 10
0
		public function SetPanelSettings()
		{
			if (!$GLOBALS["ISC_CLASS_SEARCH"]->searchIsLoaded()) {
				return;
			}

			// Do we have any categories
			$GLOBALS["SearchResultsCategory"] = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("category") > 0) {
				$GLOBALS["SearchResultsCategory"] = ISC_CATEGORY::buildSearchResultsHTML();
			}

			if (trim($GLOBALS["SearchResultsCategory"]) !== "") {
				$GLOBALS["HideSearchResultsCategory"] = "";
			} else {
				$GLOBALS["HideSearchResultsCategory"] = "none";
			}

			// Do we have any brands
			$GLOBALS["SearchResultsBrand"] = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("brand") > 0) {
				$GLOBALS["SearchResultsBrand"] = ISC_BRANDS::buildSearchResultsHTML();
			}

			if (trim($GLOBALS["SearchResultsBrand"]) !== "") {
				$GLOBALS["HideSearchResultsBrand"] = "";
			} else {
				$GLOBALS["HideSearchResultsBrand"] = "none";
			}

			// Now for the products
			$GLOBALS["SearchResultsProduct"] = "";
			$productSearchResults = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product") > 0) {
				$productSearchResults = ISC_PRODUCT::buildSearchResultsHTML();
			}

			if (GetConfig("SearchProductDisplayMode") == "list") {
				$displayMode = "List";
			} else {
				$displayMode = "Grid";
			}

			if (trim($productSearchResults) !== "") {
				$GLOBALS["SectionResults"] = $productSearchResults;
				$GLOBALS["SectionType"] = "ProductList";
				$GLOBALS["SectionExtraClass"] = "";
				$GLOBALS["HideAddButton"] = "none";
				$GLOBALS["CompareButton"] = "";
				$GLOBALS["CompareButtonTop"] = "";

				$totalPages = $GLOBALS['ISC_CLASS_SEARCH']->GetNumPages("product");
				$totalRecords = $GLOBALS['ISC_CLASS_SEARCH']->GetNumResults("product");

				$page = (int)@$_REQUEST['page'];
				if ($page < 1) {
					$page = 1;
				} else if ($page > $totalPages) {
					$page = $totalPages;
				}

				if (GetConfig("SearchProductDisplayMode") == "list") {
					$GLOBALS["SectionExtraClass"] = "List";
					$GLOBALS["HideAddButton"] = "";
					$GLOBALS["ListJS"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ListCheckForm");
					$GLOBALS["CompareButton"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton" . $displayMode);

					if ($totalPages > 1) {
						$GLOBALS["CompareButtonTop"] = $GLOBALS["CompareButton"];
					}
				} else {
					$GLOBALS["CompareButton"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton");
				}

				// generate url with all current GET params except page, ajax and section
				$url = array();
				foreach ($_GET as $key => $value) {
					if ($key == 'page' || $key == 'ajax' || $key == 'section') {
						continue;
					}
					if (is_array($value)) {
						foreach ($value as $subvalue) {
							$url[] = urlencode($key . '[]') . '=' . urlencode($subvalue);
						}
					} else {
						$url[] = urlencode($key) . '=' . urlencode($value);
					}
				}
				$url[] = "page={page}";
				$url[] = "section=product";
				$url = 'search.php?' . implode('&', $url) . '#results';

				$GLOBALS['SectionPaging'] = '';

				$maxPagingLinks = 5;
				if($GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
					$maxPagingLinks = 3;
				}

				$start = max($page - $maxPagingLinks, 1);
				$end = min($page + $maxPagingLinks, $totalPages);

				for ($i = $start; $i <= $end; $i++) {
					if($i == $page) {
						$snippet = "CategoryPagingItemCurrent";
					}
					else {
						$snippet = "CategoryPagingItem";
					}

					$GLOBALS['PageLink'] = str_replace('{page}', $i, $url);
					$GLOBALS['PageNumber'] = $i;
					$GLOBALS['SectionPaging'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
				}

				// Parse the paging snippet
				if($page > 1) {
					$prevPage = $page - 1;
					$GLOBALS['PrevLink'] = str_replace('{page}', $prevPage, $url);
					$GLOBALS['SectionPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious");
				}

				if($page < $totalPages) {
					$prevPage = $page + 1;
					$GLOBALS['NextLink'] = str_replace('{page}', $prevPage, $url);
					$GLOBALS['SectionPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingNext");
				}

				if ($totalPages > 1) {
					$GLOBALS["HideSectionPaging"] = "";
				} else {
					$GLOBALS["HideSectionPaging"] = "none";
				}

				if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product") <= 1) {
					$GLOBALS["HideSectionSorting"] = "none";
				} else {
					$GLOBALS["HideSectionSorting"] = "";
				}

				$GLOBALS["SectionSortingOptions"] = getAdvanceSearchSortOptions("product");
				$GLOBALS["SectionSearchResults"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultGrid");
				$GLOBALS["SearchResultsProduct"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultSectionProduct");
				$GLOBALS["HideSearchResultsProduct"] = "none";

				if(!getProductReviewsEnabled()) {
					$GLOBALS["HideProductRating"] = "display: none";
				}

			} else {
				$GLOBALS["HideSearchResultsProduct"] = "";
			}

			// If no results then show the 'no results found' div
			if (trim($GLOBALS["SearchResultsBrand"]) == "" && trim($GLOBALS["SearchResultsCategory"]) == "" && trim($GLOBALS["SearchResultsProduct"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "none";
				$GLOBALS["HideSearchResultsProduct"] = "none";
				$GLOBALS["HideSearchResultsNoResult"] = "";

			// Else if we just have no categories or brands then do not show the top containing div
			} else if (trim($GLOBALS["SearchResultsBrand"]) == "" && trim($GLOBALS["SearchResultsCategory"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "none";
				$GLOBALS["HideSearchResultsProduct"] = "";
				$GLOBALS["HideSearchResultsNoResult"] = "none";

			// Else if we have categories or brands BUT no products then display the 'no results found' div
			} else if ((trim($GLOBALS["SearchResultsBrand"]) == "" || trim($GLOBALS["SearchResultsCategory"]) !== "") && trim($GLOBALS["SearchResultsProduct"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "";
				$GLOBALS["HideSearchResultsProduct"] = "none";
				$GLOBALS["HideSearchResultsNoResult"] = "";
			} else {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "";
				$GLOBALS["HideSearchResultsProduct"] = "";
				$GLOBALS["HideSearchResultsNoResult"] = "none";
			}

			/*
			 * if the "Enable Product Search Feeds?" is ticked in Store
			 * Settings -> Display and we are searching add the link
			 */
			if (isset($GLOBALS['ISC_CLASS_SEARCH']) && GetConfig('RSSProductSearches')) {
				$GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);
				$GLOBALS['SnippetSearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SearchResultsFeed');
			}
		}
Exemplo n.º 11
0
	public function PostReview()
	{
		$product_id = (int)$_POST['product_id'];

		$query = "SELECT * FROM [|PREFIX|]products WHERE productid='".(int)$product_id."'";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		$product = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
		$prodLink = ProdLink($product['prodname']);

		if(GetConfig('EnableProductTabs') == 0) {
			$prodReviewsLink = $prodLink.'#reviews';
		}
		else {
			$prodReviewsLink = Interspire_Url::modifyParams($prodLink, array('tab' => 'ProductReviews'));
		}

		if(!$product['prodname']) {
			// Abandon ship!
			ob_end_clean();
			header("Location:" . $GLOBALS['ShopPath']);
			die();
		}

		// Check that the customer has permisison to view this product
		$canView = false;
		$productCategories = explode(',', $product['prodcatids']);
		foreach($productCategories as $categoryId) {
			// Do we have permission to access this category?
			if(CustomerGroupHasAccessToCategory($categoryId)) {
				$canView = true;
			}
		}
		if($canView == false) {
			$noPermissionsPage = GetClass('ISC_403');
			$noPermissionsPage->HandlePage();
			exit;
		}

		// Are reviews disabled? Just send the customer back to the product page
		if(!getProductReviewsEnabled()) {
			header("Location: ".$prodReviewsLink);
			exit;
		}

		// Setup an array containing all of the fields from the POST that we care about for reviews.
		// We'll use this below, and in the case that we need to redirect back to the product page.
		$reviewPostData = array();
		$reviewFields = array(
			'revrating',
			'revtitle',
			'revtext',
			'revfromname',
			'product_id'
		);
		foreach($reviewFields as $field) {
			if(!isset($_POST[$field])) {
				$reviewPostData[$field] = '';
				continue;
			}
			$reviewPostData[$field] = $_POST[$field];
		}

		// Check all required fields have been supplied
		$requiredFields = array(
			'revrating',
			'revtitle',
			'revtext'
		);
		foreach($requiredFields as $field) {
			if(!isset($_POST[$field]) || !trim($_POST[$field])) {
				$_SESSION['productReviewData'] = $reviewPostData;
				FlashMessage(GetLang('InvalidReviewFormInput'), MSG_ERROR, $prodReviewsLink, 'reviews');
				exit;
			}
		}

		$captcha = '';
		if(isset($_POST['captcha'])) {
			$captcha = $_POST['captcha'];
		}
		$captcha_check = true;

		// Should reviews be approved automatically?
		if(GetConfig('AutoApproveReviews')) {
			$status = 1;
		}
		else {
			$status = 0;
		}

		// Do we need to check captcha?
		if(GetConfig('CaptchaEnabled') && isc_strtolower($captcha) != isc_strtolower($GLOBALS['ISC_CLASS_CAPTCHA']->LoadSecret())) {
			$_SESSION['productReviewData'] = $reviewPostData;
			FlashMessage(GetLang('ReviewBadCaptcha'), MSG_ERROR, $prodReviewsLink, 'reviews');
			exit;
		}

		// Save the review in the database
		$newReview = array(
			"revproductid" => (int)$reviewPostData['product_id'],
			"revfromname" => $reviewPostData['revfromname'],
			"revdate" => time(),
			"revrating" => max(1, min(5, $reviewPostData['revrating'])),
			"revtext" => $reviewPostData['revtext'],
			"revtitle" => $reviewPostData['revtitle'],
			"revstatus" => $status
		);

		if(!$GLOBALS['ISC_CLASS_DB']->InsertQuery("reviews", $newReview)) {
			$_SESSION['productReviewData'] = $reviewPostData;
			FlashMessage(GetLang('ReviewBadCaptcha'), MSG_ERROR, $prodReviewsLink, 'reviews');
			exit;
			}

		// Determine what the success message should be - is the review live
		// or is it pending approval from the site owner?

		// If this is an automagically approved review, we need to show that & update the average rating
		if($status == 1) {
			$query = "
				UPDATE [|PREFIX|]products
				SET prodnumratings=prodnumratings+1, prodratingtotal=prodratingtotal+'".(int)$reviewPostData['revrating']."'
				WHERE productid='".$product['productid']."'
			";
			$GLOBALS['ISC_CLASS_DB']->Query($query);
			$flashMessage = GetLang('ReviewSavedApproved');
		}
		else {
			$flashMessage = GetLang('ReviewSavedPending');
		}

		FlashMessage($flashMessage, MSG_SUCCESS, $prodReviewsLink, 'reviews');
		exit;
	}
Exemplo n.º 12
0
	/**
	 * Setup the number of product reviews etc if this product has any.
	 */
	private function SetProductReviews()
	{
		if(!GetConfig('ShowProductRating')) {
			$GLOBALS['HideRating'] = "none";
		}

		$GLOBALS['Rating'] = $this->productClass->GetRating();
		if($GLOBALS['Rating'] == 0) {
			$GLOBALS['HideRating'] = 'none';
		}
		$GLOBALS['ProductNumReviews'] = (int) $this->productClass->GetNumReviews();

		// Are reviews disabled? Then don't show anything related to reviews
		if(!getProductReviewsEnabled()) {
			$GLOBALS['HideReviewLink'] = "none";
			$GLOBALS['HideRating'] = "none";
			$GLOBALS['HideReviews'] = "none";
		}
		else {
			// How many reviews are there?
			if ($this->productClass->GetNumReviews() == 0) {
				$GLOBALS['HideReviewLink'] = "none";
			}
			else {
				$GLOBALS['HideNoReviewsMessage'] = "none";
				if ($this->productClass->GetNumReviews() == 1) {
					$GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1');
				} else {
					$GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $this->productClass->GetNumReviews());
				}
				if (GetConfig('EnableProductTabs')) {
					$GLOBALS['ReviewLinkOnClick'] = "ActiveProductTab('ProductReviews_Tab'); return false;";
				}
			}
		}

	}
Exemplo n.º 13
0
		/**
		 * 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);
		}
Exemplo n.º 14
0
	public function SetPanelSettings()
	{
		if (!isset($GLOBALS['ProductJustAdded']) || !$GLOBALS['ProductJustAdded']) {
			$this->DontDisplay = true;
			return;
		}

		$limit = 8;
		if (isset($GLOBALS['SuggestiveCartContentLimit'])) {
			$limit = (int)$GLOBALS['SuggestiveCartContentLimit'];
		}

		$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
		$ignore_prod_list = getCustomerQuote()->getUniqueProductIds();
		$ignore_prod_list = implode(',', $ignore_prod_list);
		if($ignore_prod_list == "") {
			$ignore_prod_list = 0;
		}
		$query = "
			SELECT ordprodid
			FROM [|PREFIX|]order_products
			WHERE orderorderid IN (
				SELECT orderorderid FROM [|PREFIX|]order_products WHERE ordprodid='".(int)$GLOBALS['ProductJustAdded']."'
			) AND ordprodid NOT IN (".$ignore_prod_list.")
			GROUP BY ordprodid
			ORDER BY COUNT(ordprodid) DESC
		";
		$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, $limit);
		$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 = $limit -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 = $limit -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(!getProductReviewsEnabled()) {
				$GLOBALS['HideProductRating'] = "display: none";
			}

			$query = $this->getProductQuery(
				'p.productid IN ('.$suggest_prod_ids.')',
				'p.prodnumsold DESC, p.prodratingtotal DESC'
			);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

			$GLOBALS['AlternateClass'] = '';
			while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$this->setProductGlobals($row);
				$GLOBALS['SuggestedProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryProductsItem");
			}
		}

		if(!$GLOBALS['SuggestedProductListing']) {
			ob_end_clean();
			header("Location:cart.php");
			die();
		}
	}
Exemplo n.º 15
0
	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;
			if($GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
				$numEitherSide = 3;
			}

			$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(!getProductReviewsEnabled()) {
			$GLOBALS['HideProductRating'] = "display: none";
		}

		$GLOBALS['AlternateClass'] = '';
		foreach($products as $row) {
			$this->setProductGlobals($row);
			$GLOBALS['TagProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("TagProductsItem");
		}
	}
Exemplo n.º 16
0
		public function LoadProductsToCompare()
		{

			$count = 0;
			$output = "";
			$tOutput = "";
			$products = array();

			// First row - the "Remove" link
			$GLOBALS['SNIPPETS']['TD1'] = "";
			$GLOBALS['SNIPPETS']['TD2'] = "";
			$GLOBALS['SNIPPETS']['TD3'] = "";
			$GLOBALS['SNIPPETS']['TD4'] = "";
			$GLOBALS['SNIPPETS']['TD5'] = "";
			$GLOBALS['SNIPPETS']['TD6'] = "";
			$GLOBALS['SNIPPETS']['TD7'] = "";
			$GLOBALS['SNIPPETS']['TD8'] = "";
			$GLOBALS['SNIPPETS']['TD9'] = "";
			$GLOBALS['SNIPPETS']['TD10'] = "";
			$GLOBALS['SNIPPETS']['TD11'] = "";

			// Do we need to sort?
			if ($this->_comparesort != "") {
				$sort = sprintf("order by %s", $this->_comparesort);
			} else {
				$sort = "";
			}

			$product_ids = $this->GetProductIds();

			if (empty($product_ids)) {
				return;
			}

			$productids_array = explode('/', $this->GetIds());

			if ($GLOBALS['EnableSEOUrls'] == 1) {
				$GLOBALS['BaseCompareLink'] = CompareLink($productids_array).'?';
			} else {
				$GLOBALS['BaseCompareLink'] = CompareLink($productids_array).'&amp;';
			}



			$compareWidth = 100 - 20;
			$compareWidth = floor($compareWidth / count($this->_compareproducts));
			$GLOBALS['CompareWidth'] = $compareWidth."%";
			$GLOBALS['CompareHeadWidth'] = 100-($compareWidth*count($this->_compareproducts))."%";

			$query = "
				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;
		}