Exemplo n.º 1
0
 /**
  * Set the settings for this panel.
  */
 public function SetPanelSettings()
 {
     // How many tags do we have?
     $query = "\n\t\t\tSELECT COUNT(tagid) AS tagcount\n\t\t\tFROM [|PREFIX|]product_tags\n\t\t";
     $tagCount = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
     // How many products does the most popular tag contain?
     $query = "\n\t\t\tSELECT MAX(tagcount) AS popularcount, MIN(tagcount) AS leastcount\n\t\t\tFROM [|PREFIX|]product_tags\n\t\t";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $tagCounts = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     // Get a list of all of the tags
     $query = "\n\t\t\tSELECT *\n\t\t\tFROM [|PREFIX|]product_tags\n\t\t\tORDER BY tagname ASC\n\t\t";
     $min = GetConfig('TagCloudMinSize');
     $max = GetConfig('TagCloudMaxSize');
     $GLOBALS['SNIPPETS']['TagList'] = '';
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     while ($tag = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         $weight = ceil($tag['tagcount'] / $tagCount * 100);
         if ($max > $min) {
             $fontSize = $weight / 100 * ($max - $min) + $min;
         } else {
             $fontSize = (100 - $weight) / 100 * ($max - $min) + $max;
         }
         $fontSize = (int) $fontSize;
         $GLOBALS['FontSize'] = $fontSize . '%';
         $GLOBALS['TagName'] = isc_html_escape($tag['tagname']);
         $GLOBALS['TagLink'] = TagLink($tag['tagfriendlyname'], $tag['tagid']);
         $GLOBALS['TagProductCount'] = sprintf(GetLang('XProductsTaggedWith'), $tag['tagcount'], isc_html_escape($tag['tagname']));
         $GLOBALS['SNIPPETS']['TagList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductTagCloudItem');
     }
 }
Exemplo n.º 2
0
 /**
  * Show a listing of all of the available tags sorted by weight.
  */
 public function ShowTagCloud()
 {
     $GLOBALS['HidePanels'][] = 'TagProducts';
     $GLOBALS['BreadCrumbs'] = array(array('name' => GetLang('ProductTagCloud'), 'link' => TagLink()));
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(GetConfig('StoreName') . ' - ' . GetLang('ProductTagCloud'));
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("tags");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
Exemplo n.º 3
0
 public function SetPanelSettings()
 {
     if ($GLOBALS['ISC_CLASS_PRODUCT']->ProductHasTags() == false) {
         $this->DontDisplay = true;
         return false;
     }
     // Get the tags associated with this product
     $tags = array();
     $query = "\n\t\t\tSELECT t.*\n\t\t\tFROM [|PREFIX|]product_tags t\n\t\t\tINNER JOIN [|PREFIX|]product_tagassociations ta ON (ta.productid='" . (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' AND ta.tagid=t.tagid)\n\t\t\tWHERE t.tagcount > 1\n\t\t\tORDER BY t.tagname ASC\n\t\t";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     while ($tag = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         $tags[] = $tag;
     }
     if (empty($tags)) {
         $this->DontDisplay = true;
         return false;
     }
     $tagCount = count($tags);
     $min = GetConfig('TagCloudMinSize');
     $max = GetConfig('TagCloudMaxSize');
     $GLOBALS['SNIPPETS']['TagList'] = '';
     foreach ($tags as $tag) {
         $weight = ceil($tag['tagcount'] / $tagCount * 100);
         if ($max > $min) {
             $fontSize = $weight / 100 * ($max - $min) + $min;
         } else {
             $fontSize = (100 - $weight) / 100 * ($max - $min) + $max;
         }
         $fontSize = (int) $fontSize;
         $GLOBALS['FontSize'] = $fontSize . '%';
         $GLOBALS['TagName'] = isc_html_escape($tag['tagname']);
         $GLOBALS['TagLink'] = TagLink($tag['tagfriendlyname'], $tag['tagid']);
         $GLOBALS['TagProductCount'] = sprintf(GetLang('XProductsTaggedWith'), $tag['tagcount'], isc_html_escape($tag['tagname']));
         $GLOBALS['SNIPPETS']['TagList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SimilarProductsByTagTag');
     }
 }
Exemplo n.º 4
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;
         $start = max($GLOBALS['ISC_CLASS_TAGS']->GetPage() - $numEitherSide, 1);
         $end = min($GLOBALS['ISC_CLASS_TAGS']->GetPage() + $numEitherSide, $GLOBALS['ISC_CLASS_TAGS']->GetNumPages());
         for ($page = $start; $page <= $end; $page++) {
             if ($page == $GLOBALS['ISC_CLASS_TAGS']->GetPage()) {
                 $snippet = "CategoryPagingItemCurrent";
             } else {
                 $snippet = "CategoryPagingItem";
             }
             $pageData = array('page' => $page, 'sort' => $GLOBALS['ISC_CLASS_TAGS']->GetSort());
             $GLOBALS['PageLink'] = TagLink($tagFriendlyName, $tagId, $pageData);
             $GLOBALS['PageNumber'] = $page;
             $GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
         }
         // Do we need to output a "Previous" link?
         if ($GLOBALS['ISC_CLASS_TAGS']->GetPage() > 1) {
             $pageData = array('page' => $GLOBALS['ISC_CLASS_TAGS']->GetPage() - 1, 'sort' => $GLOBALS['ISC_CLASS_TAGS']->GetSort());
             $GLOBALS['PrevLink'] = TagLink($tagFriendlyName, $tagId, $pageData);
             $GLOBALS['SNIPPETS']['CategoryPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious");
         }
         // Do we need to output a "Next" link?
         if ($GLOBALS['ISC_CLASS_TAGS']->GetPage() < $GLOBALS['ISC_CLASS_TAGS']->GetNumPages()) {
             $pageData = array('page' => $GLOBALS['ISC_CLASS_TAGS']->GetPage() + 1, 'sort' => $GLOBALS['ISC_CLASS_TAGS']->GetSort());
             $GLOBALS['NextLink'] = TagLink($tagFriendlyName, $tagId, $pageData);
             $GLOBALS['SNIPPETS']['CategoryPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingNext");
         }
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPaging");
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
         $GLOBALS['SNIPPETS']['TagPaging'] = $output;
     }
     // Should we show the compare button?
     if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_TAGS']->GetNumProducts() < 2) {
         $GLOBALS['HideCompareItems'] = "display: none";
     } else {
         $GLOBALS['CompareLink'] = CompareLink();
     }
     // Parse the sort select box snippet
     if ($GLOBALS['ISC_CLASS_TAGS']->GetNumProducts() > 1) {
         // Parse the sort select box snippet
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $GLOBALS['URL'] = TagLink($tagFriendlyName, $tagId);
         } else {
             $GLOBALS['URL'] = $GLOBALS['ShopPath'] . "/tags.php";
             $GLOBALS['HiddenSortField'] = "<input type=\"hidden\" name=\"tagid\" value=\"" . (int) $tagId . "\" />";
         }
         $GLOBALS['SNIPPETS']['CategorySortBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategorySortBox");
     }
     // Actually load the products
     $products = $GLOBALS['ISC_CLASS_TAGS']->GetProducts();
     $GLOBALS['TagProductListing'] = '';
     // Show products for a specific tag
     if (GetConfig('EnableProductReviews') == 0) {
         $GLOBALS['HideProductRating'] = "display: none";
     }
     $GLOBALS['AlternateClass'] = '';
     foreach ($products as $row) {
         if ($GLOBALS['AlternateClass'] == 'Odd') {
             $GLOBALS['AlternateClass'] = 'Even';
         } else {
             $GLOBALS['AlternateClass'] = 'Odd';
         }
         $GLOBALS['ProductCartQuantity'] = '';
         if (isset($GLOBALS['CartQuantity' . $row['productid']])) {
             $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']];
         }
         $GLOBALS['ProductId'] = (int) $row['productid'];
         $GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
         $GLOBALS['ProductLink'] = ProdLink($row['prodname']);
         $GLOBALS['ProductRating'] = (int) $row['prodavgrating'];
         // Determine the price of this product
         $GLOBALS['ProductPrice'] = CalculateProductPrice($row);
         $GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname']));
         if (isId($row['prodvariationid']) || trim($row['prodconfigfields']) != '' || $row['prodeventdaterequired'] == 1) {
             $GLOBALS['ProductURL'] = ProdLink($row['prodname']);
             $GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
         } else {
             $GLOBALS['ProductURL'] = CartLink($row['productid']);
             $GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink');
         }
         if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {
             $GLOBALS['HideActionAdd'] = '';
         } else {
             $GLOBALS['HideActionAdd'] = 'none';
         }
         $GLOBALS['HideProductVendorName'] = 'display: none';
         $GLOBALS['ProductVendor'] = '';
         if (GetConfig('ShowProductVendorNames') && $row['prodvendorid'] > 0) {
             $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors');
             if (isset($vendorCache[$row['prodvendorid']])) {
                 $GLOBALS['ProductVendor'] = '<a href="' . VendorLink($vendorCache[$row['prodvendorid']]) . '">' . isc_html_escape($vendorCache[$row['prodvendorid']]['vendorname']) . '</a>';
                 $GLOBALS['HideProductVendorName'] = '';
             }
         }
         $GLOBALS['TagProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("TagProductsItem");
     }
 }
Exemplo n.º 5
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.º 6
0
	public function SetPanelSettings()
	{
		if($GLOBALS['ISC_CLASS_PRODUCT']->ProductHasTags() == false) {
			$this->DontDisplay = true;
			return false;
		}

		// Get the correct tag count associated with this product
		$tags = array();
		$query = "
			SELECT
				tt.tagid, tt.tagname, tt.tagfriendlyname, validtag.tagcount
			FROM (
				SELECT
					t.tagid, COUNT(*) AS tagcount
				FROM
					[|PREFIX|]product_tags t
				INNER JOIN
					[|PREFIX|]product_tagassociations ta
					ON
					ta.tagid = t.tagid
				GROUP BY
					t.tagid
				HAVING COUNT(*) > 1
			) validtag
			INNER JOIN
				[|PREFIX|]product_tagassociations tta
				ON
				tta.tagid = validtag.tagid
			INNER JOIN
				[|PREFIX|]product_tags tt ON
				tt.tagid = tta.tagid
			WHERE
				tta.productid = '".(int)$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."'";

		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		while($tag = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$tags[] = $tag;
		}

		if(empty($tags)) {
			$this->DontDisplay = true;
			return false;
		}
		$tagCount = count($tags);

		$min = GetConfig('TagCloudMinSize');
		$max = GetConfig('TagCloudMaxSize');
		$GLOBALS['SNIPPETS']['TagList'] = '';
		foreach($tags as $tag) {
			$weight = ceil(($tag['tagcount']/$tagCount)*100);
			if ($weight > 100) {
				$weight = 100;
			}

			if($max > $min) {
				$fontSize = (($weight/100) * ($max - $min)) + $min;
			}
			else {
				$fontSize = (((100-$weight)/100) * ($max - $min)) + $max;
			}
			$fontSize = (int)$fontSize;
			$GLOBALS['FontSize'] = $fontSize.'%';
			$GLOBALS['TagName'] = isc_html_escape($tag['tagname']);
			$GLOBALS['TagLink'] = TagLink($tag['tagfriendlyname'], $tag['tagid']);
			$GLOBALS['TagProductCount'] = sprintf(GetLang('XProductsTaggedWith'), $tag['tagcount'], isc_html_escape($tag['tagname']));
			$GLOBALS['SNIPPETS']['TagList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SimilarProductsByTagTag');
		}
	}