Jump to content

Dynamic page title (product description)


mlungisi

Recommended Posts

HI

 

Dynamic page title (product description)

 

I am trying to set my page title to reflect product description when I view the product page. Product info is sourced from MySql database.

 

The website do have pages like (about us, contact us, terms and condition, links etc) but in this case I need change for the products that are pulled from database.

 

The line that pulls description =  <div class="block-yellow"><h5 class="padding-5"><?php echo $Pagedescr?></h5></div>

I’ve tried to but $pagedescr in my code but it doesn’t work.

<title><?php

if (isset($pageTitle)) {

echo $pagedescr;

} else {

echo "Name of the company";

}

?></title>

This is how the page is called: http://company.com/?page=Product&id=77

 

Please help, I’ve got no much experience in PHP.

 

Thanks

 

Link to comment
Share on other sites

variables are case sensitive as the first note, secondly you are checking for pageTitle when you should be checking for the variable you want to echo i am assuming it is $Pagedescr

 

so your code should be more like this

 

<title><?php
if (isset($Pagedescr)) {
  echo $Pagedescr;
} else {
  echo "Name of the company";
}
?></title>

Link to comment
Share on other sites

Sorry, i made a mistake in my initial post, that's what i did

<title><?php

if (isset($Pagedescr)) {

  echo $Pagedescr;

} else {

  echo "Name of the company";

}

?></title>

 

But it doesn't work.

 

The $Pagedescr in only found in the product page.

Link to comment
Share on other sites

are we not talking about the title for the product page each time a product is displayed?

If not how does your page work when you are viewing a product, does the product page get called into another page?

We are going to need more code for how that variable $Pagedescr is set and when and where it is set.

 

Link to comment
Share on other sites

Yes the product page is called into index.php

 

Products page code:

 

 <style type="text/css">
<!--
.Blacktext {
color: #000;
}
-->
</style>
<div id="detailed-wrapper">
<div class="column-310 float-left">
<?php echo $advancedSearch->Display()?>
				<div class="gap-hoz-small"></div>
				<div class="column-310 float-left dealer-menu">
					<div class="block-khaki">
						<a href="javascript:CompareCookie.Display();" class="compare-btn" title="compare"></a>
					</div>
					<div class="gap-hoz-small"></div>
					<div class="block-khaki">
						<a href="?page=Wishlist&view=hto" class="how-to-order"></a>
					</div>
					<div class="gap-hoz-small"></div>
					<div class="block-khaki">
						<a href="javascript:WishlistCookie.Display();" class="wishlist"></a>
					</div>
	<div class="gap-hoz-small"></div><br>
				<div class="block-khaki">
					<div class="padding-10">
						<h1 class="text-white">New Products</h1>
						</div>
						<?php echo $Newproducts->Display()?>
						<div class="gap-hoz-small"></div>
						<br>
				</div></div>
</div>
<div class="gap-vert float-left"></div>
<div class="column-630 float-left">
<h1 class="text-grey"><?php echo $Inventinclgrp?></h1>
<br/>
<div class="breadcrumb">
	<p><?php echo $Inventinclgrp?></p>
	<span> </span>
	<p><?php echo $Prod_Cat?></p>
	<span> </span>
	<p><?php echo $Prod_Subcat?></p>
</div>
<p class="clear"></p>
<br/>
<div class="float-left">
	<div class="column-310 product-detailed">
		<img src="<?php echo $preview_image['href']?>" class="border-khaki float-left" 
			alt="<?php echo htmlentities($data['ItemName'])?>" 
			title="<?php echo htmlentities($data['ItemName'])?>"/>
		<div class="column-310 image-medium-description float-left">
			<div class="border-khaki">
				<p class="float-left padding-5"><?php echo $id?></p>
					<p class="float-right padding-5">
                        <?php $x = @getimagesize($first_image);
						$aw = ($x[0])+30;
						if($aw<330){
							$aw = 360;
						}elseif($aw>650){
							$aw = 650;
						}?>
						<a href="<?php echo $first_image?>" rel="productPics" class="image-enlarge" 
							title="<?php echo $first_description?>">enlarge image</a>
					</p>
					<p style="display:none">
						<?php foreach($image_tags as $img):
							$x = @getimagesize($img['href']);
							if($x[0]>650){
								$aw = 650;
							}elseif($x[0]>$aw){
								$aw = ($x[0]);
							}
							?>
							<a href="<?php echo $img['href']?>" rel="productPics" class="image-enlarge" 
								title="<?php echo $img['title']?>">enlarge image.......</a>
						<?php endforeach?>
					</p>
				<p class="clear"></p>
			</div>
		</div>
		<p class="clear"></p>
		<br/>
	</div>
</div>
<div class="gap-vert float-left"></div>
<div class="float-left column-310">
	<div class="block-yellow"><h5 class="padding-5"><?php echo $Pagedescr?></h5></div>
	<br/>
  <div id="detailed-menu">
            <a href="?page=Product&id=<?php echo urlencode($_GET['id']); ?>&group=<?php echo $_GET['group']; ?>&prnt=YES" class="detailed-btn-print" title="print" target="_new"></a>
            <div class="gap-hoz-small float-left"></div>
            <a href="javascript:mail.Display(<?php echo $to_email; ?>);" class="detailed-btn-email" title="email"></a>
            <div class="gap-hoz-small float-left"></div>
            <a href="javascript:WishlistCookie.Add(this, '<?php echo $_GET['id']; ?>');" class="detailed-btn-wishlist" title="add to wishlist"></a>
            <?php echo $basket?>
            <div class="gap-hoz-small float-left"></div>
            <a href="?page=contact-feedback&enquiry=Product enquiry&item=<?php echo $id;?>" class="detailed-btn-contact" title="contact"></a>
	</div>
	<p class="float-left"><br />
	  <strong class="Blacktext">Note: </strong><span class="error">Products must  be installed by a qualified Electrician.</span><br /> 
	  <br /> </p>
      <p><br/>
      <?php $sw = 350;
	if(count($technical_images) > 0):
		$x = @getimagesize($technical_images[$i]['href']);
		$sw = ($x[0]);
		if($sw<330){
			$sw = 360;
		}elseif($sw>650){
			$sw = 650;
		}?>
      </p>

    <p class="float-left">
           	<a href="<?php echo $technical_images[0]['href']?>" rel="technicalPics" 
			class="image-tech-drawings"	title="<?php echo $technical_images[0]['title']?>">Technical Drawings</a>
</p>
		<?php for($i = 1; $i < count($technical_images); $i++):
			$x = @getimagesize($technical_images[$i]['href']);
			if($x[0]>650){
				$sw = 650;
			}elseif($x[0]>$sw){
				$sw = ($x[0]);
			}?>
			<p class="hide">
				<a href="<?php echo $technical_images[$i]['href']?>" rel="technicalPics" 
					class="image-tech-drawings"	
					title="<?php echo $technical_images[$i]['title']?>">Technical Drawings</a>
			</p>
		<?php endfor?>
	<?php endif?>
	<p class="clear"></p>
        <br />
		<input type="submit" value="Back" class="submit-khaki float-right" onclick="javascript:window.history.back();"/>
             <?php echo $range?><br /><br />
</div>
    
    
    <p class="float-left"> <br /> <br />
<span class='st_sharethis_hcount' displayText='ShareThis'></span><br /><br />
<span class='st_facebook_hcount' displayText='Facebook'></span><br /><br />
<span class='st_twitter_hcount' displayText='Tweet'></span><br /><br />
<span class='st_linkedin_hcount' displayText='LinkedIn'></span><br />

    </p>
    
    
    
    
<p class="clear"></p>
<script type="text/javascript">
$(document).ready(function(){
		$("a[rel='productPics']").colorbox({opacity: 0.75, width:<?php echo $aw?>});
		$("a[rel='technicalPics']").colorbox({opacity: 0.75, width:<?php echo $sw?>});
});
</script>
<?php echo $body2?>
</div>
</div> 

Link to comment
Share on other sites

Does the index page get loaded everytime you select a product or does only the section where the product page get loaded?

To change the title of the index page it needs to be reloaded, the code to evaluate the the title will need to be on the index page, when you click on a product you would be able to add the page title to the link and then call that page title on the index page.

The product page itself has no part of this, we wil need to perform the work on the index page, and the index page will need to reload for each product called

Link to comment
Share on other sites

index.php code

 

<?php require_once('src/php/init.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>


<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "a00cacbc-1f81-43c4-8be2-e41d225b4bdf"}); </script>



<title><?php
if (isset($Pagedescr)) {
echo $Pagedescr;
} else {
echo "My Company";
}
?></title>


<meta name="description" content="#######">
<meta name="keywords" content="#########">

<link rel="shortcut icon" type="image/x-icon" href="/Prod_Pics/Icons/Rd.gif">

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16713000-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>


    <title><?php echo $title?> - <?php echo $_GET['page']; ?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <link rel="stylesheet" type="text/css" href="src/css/screen.css"/>
    <link rel="stylesheet" type="text/css" href="src/css/screen-ie.css"/>
    <link rel="stylesheet" type="text/css" href="src/css/print.css" media="print" />
    <link rel="stylesheet" type="text/css" href="src/css/slimbox2.css"/>
    <script src="src/js/jquery-1.3.1.min.js" type="text/javascript"></script>
    <script src="src/js/jookie.js" type="text/javascript"></script>
    <script src="src/js/CookieHandler.js" type="text/javascript"></script>
    <script src="src/js/Time.js" type="text/javascript"></script>
    <script src="src/js/core.js" type="text/javascript"></script>
<!--    /*calls image popup*/-->
    <?php if(isset($_GET['page']) && ($_GET['page'] == 'Product' || $_GET['page'] == 'Compare' || $_GET['page'] == 'Range')):?>
	<script src="src/js/jquery.colorbox-min.js" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" href="src/css/colorbox.css"/>
    <?php endif?>
</head>
<body>
<!--/*Setup for emails*/-->
<?php isset($_GET['page']) && $_GET['page'] == 'Wishlist' || $_GET['page'] == 'Compare' || $_GET['page'] == 'Product' ? require_once('src/php/views/email-form.php') : NULL ?>
    <div id="wrapper">
        <div class="header home-header">
            <?php require_once('src/inc/menu.php')?>
            <div id="logo-rd</div>
            <div id="logo-so<img src="src/img/logo-so.png"/></a></div>
            <?php require_once('src/inc/search.php')?>
            <?php require_once('src/inc/shopping.php')?>
        </div>
        <div id="body" onmouseout="SubMenu();">
            <noscript><p>This site makes extensive use of javascript. Some features will not be available if you do not enable javascript.</p></noscript>
            <?php echo $body ?>
            <p class="clear"></p>
        </div> 
        <p class="clear"> </p>
        <?php require_once('src/inc/footer.php')?>
        <br />
        
        <div align="center">
          <img src="LED_Notice_Banner.jpg" alt="" width="950" height="180" />
          <table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td> </td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
            <tr>
              <td colspan="2"> </td>
              <td width="4%"> </td>
              <td width="4%"> </td>
              <td width="3%"> </td>
              <td width="4%"> </td>
              <td width="3%"> </td>
            </tr>
            <tr>
              <td width="74%" align="left" valign="middle">
              
              
              
           
<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 1,
  interval: 30000,
  width: 'auto',
  height: 100,
  theme: {
    shell: {
      background: '#ffffff',
      color: '#000000'
    },
    tweets: {
      background: '#ffffff',
      color: '#000000',
      links: '#05854b'
    }
  },
  features: {
    scrollbar: false,
    loop: false,
    live: false,
    behavior: 'all'
  }
}).render().setUser('rd').start();
</script>
              
          </table>
      </div>
    </div>


</body>
</html>

 

 

Link to comment
Share on other sites

Links are from products.php and search.php

 

Products.php code:

 

<?php
class Products{
function Products(){
	$VarSecurity = new VarSecurity();
	if(isset($_GET['view'])){
		$_GET['view'] = $VarSecurity->Security($_GET['view']);
	}
	if(isset($_GET['division'])){
		$_GET['division'] = $VarSecurity->Security($_GET['division']);
	}

	if(isset($_GET['view'])){
		$this->Show();
	}

	if(isset($_GET['division'])){
		$this->Division();
	} else {
		$this->Show();
	}
}

function Division(){
	$advancedSearch = new AdvancedSearch();
	$Newproducts = new NewProducts();

	global $body;
	$body = '<div class="column-310 float-left">
				'.$advancedSearch->Display().'
				<div class="gap-hoz-small"></div>
				<div class="column-310 float-left dealer-menu">
					<div class="block-khaki">
						<a href="javascript:CompareCookie.Display();" class="compare-btn" title="compare"></a>
					</div>
					<div class="gap-hoz-small"></div>
					<div class="block-khaki">
						<a href="?page=Wishlist&view=hto" class="how-to-order"></a>
					</div>
					<div class="gap-hoz-small"></div>
					<div class="block-khaki">
						<a href="javascript:WishlistCookie.Display();" class="wishlist"></a>
					</div>
		</div>
	</div>
			<div class="gap-vert float-left"></div>
			<div class="column-630 float-left">';

$query = @mysql_query('SELECT WEB_admin_options.title, WEB_admin_options.display_price, WEB_admin_options.display_cat_price_no, WEB_InventTable.OLAPProductGroup
							FROM WEB_InventTable, WEB_admin_options
							WHERE WEB_InventTable.OLAPProductGroup='.$_GET['division'].' AND WEB_InventTable.OLAPProductGroup = WEB_admin_options.division_id
							Limit 0,1');
	$data = @mysql_fetch_array($query);

	$body .= '<h1 class="block-khaki padding-5">'.$data['title'].'</h1>
			<br/>
			<div id="products-columns">';

	$price_list = NULL;
	//if($data['display_price']==1){
		//$price_list = 'AND INCLInPriceList=1';
	//}

	$cat_query = @mysql_query('SELECT Dimension3_, CATID, web_olapprodcat.Description AS Description
								FROM WEB_InventTable
								LEFT JOIN web_olapprodcat ON (WEB_InventTable.Dimension3_=web_olapprodcat.CATID)
								WHERE OLAPProductGroup='.$_GET['division'].'
								AND ItemId NOT LIKE "%*%"
								AND ItemId NOT LIKE "%zzz%"
								AND Dimension3_!=""
								'.$price_list.'
								GROUP BY web_olapprodcat.Description
								ORDER BY web_olapprodcat.Description ASC');

	while($cat_data = @mysql_fetch_array($cat_query)){
		$body .= '<h2><a href="?page=Search&division='.$data['OLAPProductGroup'].'&c_id='.$cat_data['CATID'].'">'.$cat_data['Description'].'</a></h2>';
	}

	$body .= '</div>
			<p class="clear"></p>
			<br/><br/>
			<input type="submit" value="Back" class="submit-khaki float-right" onclick="javascript:window.history.back();"/>
		</div>';
}

function Show(){
	$Newproducts = new NewProducts();

	global $body;
	$body = '<div class="column-310 float-left">
				<div class="block-khaki home-highlights">
					<div class="padding-10">
						<h1 class="text-white">Welcome </h1>
						<br/>
						<p>Welcome to our company</p>
					</div>
				</div>
				<div class="gap-hoz-small"></div>
				<div class="block-khaki home-newprod">
					<div class="padding-10">
						<h1 class="text-white">New Products</h1>
						</div>
						'.$Newproducts->Display().'
				</div>
			</div>
			<div class="gap-vert float-left"></div>
			<div class="column-630 float-left">';

$query = @mysql_query('SELECT distinct WEB_admin_options.title, WEB_admin_options.division_id, WEB_admin_options.display_price, WEB_admin_options.display_cat_price_no, WEB_InventTable.OLAPProductGroup
							FROM WEB_InventTable, WEB_admin_options
							WHERE WEB_admin_options.type = "division" AND WEB_InventTable.OLAPProductGroup = WEB_admin_options.division_id');
	while($data = @mysql_fetch_array($query)){
		$body .= '<h1 class="block-khaki padding-5">'.$data['title'].'</h1>
				<br/>
				<div id="products-columns">';

		$price_list = NULL;
		//if($data['display_price']==1){
			//$price_list = 'AND INCLInPriceList=1';
		//}

		$cat_query = @mysql_query('SELECT Dimension3_, CATID, web_olapprodcat.Description AS Description
									FROM WEB_InventTable
									LEFT JOIN web_olapprodcat ON (WEB_InventTable.Dimension3_=web_olapprodcat.CATID)
									WHERE OLAPProductGroup='.$data['division_id'].'
									AND ItemId NOT LIKE "%*%"
									AND ItemId NOT LIKE "%zzz%"
									AND Dimension3_!=""
									'.$price_list.'
									GROUP BY web_olapprodcat.Description
									ORDER BY web_olapprodcat.Description ASC');

		while($cat_data = @mysql_fetch_array($cat_query)){
			$body .= '<h2><a href="?page=Search&division='.$data['OLAPProductGroup'].'&c_id='.$cat_data['CATID'].'">'.$cat_data['Description'].'</a></h2>';
		}
		$body .= '</div>
			<p class="clear"></p>
			<br/>';
	}

	$body .= '<br/>
			<input type="submit" value="Back" class="submit-khaki float-right" onclick="javascript:window.history.back();"/>
		</div>';				
}
}
?>

 

 

Link to comment
Share on other sites

Search.php code

 

<?php
class Search{
function Search(){
	global $body;
	$body = NULL;
	$VarSecurity = new VarSecurity();

	if(isset($_POST['advanced_material'])){
		$_GET['advanced_material'] = $VarSecurity->Security($_POST['advanced_material']);
	}elseif(isset($_GET['advanced_material'])){
		$_GET['advanced_material'] = $VarSecurity->Security($_GET['advanced_material']);
	}

	if(isset($_POST['advanced_lamp'])){
		$_GET['advanced_lamp'] = $VarSecurity->Security($_POST['advanced_lamp']);
	}elseif(isset($_GET['advanced_lamp'])){
		$_GET['advanced_lamp'] = $VarSecurity->Security($_GET['advanced_lamp']);
	}

	if(isset($_POST['advanced_application'])){
		$_GET['advanced_application'] = $VarSecurity->Security($_POST['advanced_application']);
	}elseif(isset($_GET['advanced_application'])){
		$_GET['advanced_application'] = $VarSecurity->Security($_GET['advanced_application']);
	}

	if(isset($_GET['keyword'])){
		$_POST['keyword'] = $VarSecurity->Security($_GET['keyword']);
	}elseif(isset($_POST['keyword'])){
		$_POST['keyword'] = $VarSecurity->Security($_POST['keyword']);
	}

	if(isset($_GET['code'])){
		$_POST['code'] = $VarSecurity->Security($_GET['code']);
	}elseif(isset($_POST['code'])){
		$_POST['code'] = $VarSecurity->Security($_POST['code']);
	}

	if(isset($_GET['division2'])) $_GET['division2'] = $VarSecurity->Security($_GET['division2']);
	if(isset($_GET['division'])) $_GET['division'] = $VarSecurity->Security($_GET['division']);
	if(isset($_GET['c_id'])) $_GET['c_id'] = $VarSecurity->Security($_GET['c_id']);
	if(isset($_GET['sc_id'])) $_GET['sc_id'] = $VarSecurity->Security($_GET['sc_id']);
	if(isset($_GET['p_p'])) $_GET['p_p'] = $VarSecurity->Security($_GET['p_p']);
	if(isset($_GET['type'])) $_GET['type'] = $VarSecurity->Security($_GET['type']);
	if(isset($_POST['adv_search'])) $_POST['adv_search'] = $VarSecurity->Security($_POST['adv_search']);

	if(isset($_POST['keyword']) || isset($_POST['code']) || isset($_GET['advanced_material']) || isset($_GET['advanced_lamp']) || isset($_GET['advanced_application']) || isset($_GET['division']) || isset($_GET['type'])){
		$this->Result();
	}
}

function Result(){
	$rows = 1;
	$link = NULL;
	$title = NULL;
	$division_breadcrumb = NULL;
	$category_breadcrumb = NULL;
	$subcat_breadcrumb = NULL;

//Advanced search is used
	if(isset($_GET['advanced_material']) || isset($_GET['advanced_lamp']) || isset($_GET['advanced_application'])){
		$link = 'page=Search&advanced_material='.$_GET['advanced_material'].'&advanced_lamp='.$_GET['advanced_lamp'].'&advanced_application='.$_GET['advanced_application']; //for pagination
		$x=0;
		$material = '---'; //set non-existing value to search on heading3, where option is NOT selected, for querying
		if(!empty($_GET['advanced_material'])){
			$material = $_GET['advanced_material'];
			$x++;
		}
		$lamp = '---'; //same as above
		if(!empty($_GET['advanced_lamp'])){
			$lamp = $_GET['advanced_lamp'];
			$x++;
		}
		$application = '---';//same as above
		if(!empty($_GET['advanced_application'])){
			$application = $_GET['advanced_application'];
			$x++;
		}

		//for filtering search results by division->category
		$division = '';
		$cat = '';
		$s_cat = '';
		if ((!empty($_GET['division2']))&&(!empty($_GET['c_id']))){
			$division = 'AND OLAPProductGroup = '.$_GET['division2'];
			$cat = 'AND Dimension3_ = "'.$_GET['c_id'].'"';
			$link .= '&division2='.$_GET['division2'].'&c_id='.$_GET['c_id'];
			if (empty($_GET['division'])){
				$_GET['division'] = $_GET['division2'];
			}
		}
		if (!empty($_GET['sc_id'])){
			$link .= '&sc_id='.$_GET['sc_id'];
			$s_cat = 'AND Dimension4_ = "'.$_GET['sc_id'].'"';
		}

		//search result
		$query_string = 'SELECT WEB_InventTable.ItemId, ItemName, OLAPProductGroup, Dimension3_, Dimension4_, WEB_InventTable.Group, GroupView, InventInclusionGroupId, SpecialInventInclusionGroup, Discontinued, web_admin_options.title
						FROM web_admin_options, WEB_InventTable
						LEFT JOIN WEB_Data ON (WEB_Data.ItemId = WEB_InventTable.ItemId AND WEB_InventTable.Webitem=1)
						LEFT JOIN WEB_Heading3 ON (WEB_Data.Heading3 = WEB_Heading3.HeadId
						AND WEB_Data.Heading2 = WEB_Heading3.Heading2)
						WHERE WEB_Data.Heading1 = "Srch" and WEB_InventTable.OLAPProductGroup = web_admin_options.division_id and web_admin_options.type = "division"
						AND WEB_Data.Heading3 IN ("'.$material.'", "'.$lamp.'", "'.$application.'")
						'.$division.'
						'.$cat.'
						'.$s_cat.'
						GROUP BY WEB_InventTable.ItemId, ItemName, OLAPProductGroup, Dimension3_, Dimension4_, WEB_InventTable.Group, GroupView, InventInclusionGroupId, SpecialInventInclusionGroup
						HAVING count(WEB_Data.ItemId)>('.$x.')-1
						ORDER BY OLAPProductGroup, Dimension3_, Dimension4_, ItemId ASC';
					//	echo  
		$query = @mysql_query($query_string);
		$rows = @mysql_num_rows($query);
		$data = @mysql_fetch_array($query);
		$title = 'Search results: (advanced search)';

		//Get Division->category for links (filtering)
		$query_string2 = 'SELECT WEB_InventTable.ItemId, OLAPProductGroup, Dimension3_, InventInclusionGroupId, web_olapprodcat.Description, SpecialInventInclusionGroup, web_admin_options.title
						FROM web_admin_options, web_olapprodcat, WEB_InventTable
						LEFT JOIN WEB_Data ON ( WEB_Data.ItemId = WEB_InventTable.ItemId AND WEB_InventTable.Webitem=1)
						LEFT JOIN WEB_Heading3 ON ( WEB_Data.Heading3 = WEB_Heading3.HeadId
						AND WEB_Data.Heading2 = WEB_Heading3.Heading2 )
						WHERE web_olapprodcat.CATID = WEB_InventTable.Dimension3_ AND WEB_InventTable.OLAPProductGroup = web_admin_options.division_id and web_admin_options.type = "division" AND WEB_Data.Heading1 = "Srch"
						AND WEB_Data.Heading3 IN ("'.$material.'", "'.$lamp.'", "'.$application.'")
						GROUP BY WEB_InventTable.ItemId, OLAPProductGroup, Dimension3_, InventInclusionGroupId, web_olapprodcat.Description, SpecialInventInclusionGroup
						HAVING count(WEB_Data.ItemId)>('.$x.')-1
						ORDER BY OLAPProductGroup, Dimension3_, ItemId ASC';
		$query2 = @mysql_query($query_string2);
		$data2 = @mysql_fetch_array($query2);
		$temp3 = '';
		$check1 = '';
		$check2 = '';
		$link_counter = 1;

		//formating filter links for display
		if (!empty($data2)){
		mysql_data_seek($query2,0);
			$filters=array();
			$counter=1;
			while($data2 = @mysql_fetch_array($query2)){
				if ($check1!=$data2['OLAPProductGroup']){
					$filters[$counter] = array("div"=>'<a href="#">'.$data2['title'].'</a>',"cats"=>NULL);
					$check1=$data2['OLAPProductGroup'];
					$counter++;
					$link_counter=1;
				}
				if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){
					$filters[$counter-1]["cats"] .= '<span></span><a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&advanced_material='.$_GET['advanced_material'].'&advanced_lamp='.$_GET['advanced_lamp'].'&advanced_application='.$_GET['advanced_application'].'">'.$data2['Description'].'</a>';
					$link_counter++;
					$check2=$data2['Dimension3_'];
				} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){
					$filters[$counter-1]["cats"] .= '<span></span><a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&advanced_material='.$_GET['advanced_material'].'&advanced_lamp='.$_GET['advanced_lamp'].'&advanced_application='.$_GET['advanced_application'].'" title="'.$data2['Description'].'">'.$link_counter.'</a>';
					$link_counter++;
					$check2=$data2['Dimension3_'];
				}
			}
		}
		if(isset($counter)){
			for($r=1;$r<$counter;$r++){
					$division_breadcrumb .= $filters[$r]["div"].$filters[$r]["cats"].'<p class="clear"></p>';
			}
		}
		mysql_free_result($query2);
		unset($_GET['division2'],$data2);

//Code or keyword is used	
	} elseif (isset($_POST['keyword']) || isset($_POST['code'])){
		$keyword = NULL;
		if(isset($_POST['keyword'])){
			if($_POST['keyword'] != 'keyword' && $_POST['keyword'] != ''){
				if(strpos($_POST['keyword'],' ')!==false){
					$_POST['keyword'] = str_replace(' ', ' +',$_POST['keyword']);
					if((strpos($_POST['keyword'],'s ')!==false) && (strpos($_POST['keyword'],'ss ')===false)) $_POST['keyword'] = str_replace('s ', ' ',$_POST['keyword']);
					if(substr($_POST['keyword'],strlen($_POST['keyword'])-1)=='s') $_POST['keyword'] = substr($_POST['keyword'],0,(strlen($_POST['keyword'])-1));

					$keyword = 'AND MATCH (WEB_InventTable.ItemName,WEB_InventTable.Description) AGAINST ("+'.$_POST['keyword'].'" IN BOOLEAN MODE)';
				}else{
					if(substr($_POST['keyword'],strlen($_POST['keyword'])-1)=='s') $_POST['keyword'] = substr($_POST['keyword'],0,(strlen($_POST['keyword'])-1));
					$keyword = 'AND (ItemName LIKE "% '.$_POST['keyword'].' %" OR ItemName LIKE "'.$_POST['keyword'].' %" OR ItemName LIKE " %'.$_POST['keyword'].'") ';
				}
			}

			if($_POST['keyword'] == 'keyword'){
				$_POST['keyword'] = NULL;
			}
		}

		$code = NULL;
		if(isset($_POST['code'])){
			if($_POST['code'] != 'code' && $_POST['code'] != '' && $_POST['code'] != 'code'){
				$code = 'AND ItemId LIKE "%'.$_POST['code'].'%"';
			}
			if($_POST['code'] == 'code'){
				$_POST['code'] = NULL;
			}
		}

		$link = 'page=Search&keyword='.$_POST['keyword'].'&code='.$_POST['code'];

		//for filtering search results by division->category
		$division = '';
		$cat = '';
		$s_cat='';
		if ((!empty($_GET['division2']))&&(!empty($_GET['c_id']))){
			$division = 'AND OLAPProductGroup = '.$_GET['division2'];
			$cat = 'AND Dimension3_ = "'.$_GET['c_id'].'"';
			$link = $link.'&division2='.$_GET['division2'].'&c_id='.$_GET['c_id'];
			if (empty($_GET['division'])){
				$_GET['division'] = $_GET['division2'];
			}
		}
		if (!empty($_GET['sc_id'])){
			$link .= '&sc_id='.$_GET['sc_id'];
			$s_cat = 'AND Dimension4_ = "'.$_GET['sc_id'].'"';
		}

		//search results
		$query_string = 'SELECT ItemId, ItemName, OLAPProductGroup, Dimension3_, Dimension4_, WEB_InventTable.Group, GroupView, InventInclusionGroupId, SpecialInventInclusionGroup, Discontinued, web_admin_options.title
							FROM WEB_InventTable, web_admin_options
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id and web_admin_options.type = "division" AND WEB_InventTable.Webitem=1
							AND Dimension3_!=""
							'.$keyword.'
							'.$code.'
							'.$division.'
							'.$cat.'
							'.$s_cat.'
							ORDER BY OLAPProductGroup, Dimension3_, Dimension4_, ItemID ASC';
		$query = @mysql_query($query_string);
		$rows = @mysql_num_rows($query);
		$keyword_title = NULL;
		if(!empty($keyword)){
			$keyword_title = ' (keyword: '.str_replace(' +', ' ', $_POST['keyword']).')';
		}
		$code_title = NULL;
		if(!empty($code)){
			$code_title = ' (code: '.$_POST['code'].')';
		}
		$title = 'Search result'.$keyword_title.$code_title;

		//Get Division->category for links (filtering)
		$query_string2 = 'SELECT WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_, WEB_InventTable.InventInclusionGroupId, WEB_InventTable.SpecialInventInclusionGroup, web_olapprodcat.Description, web_admin_options.title
							FROM WEB_InventTable, web_olapprodcat, web_admin_options
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id and web_admin_options.type = "division" AND WEB_InventTable.Webitem=1
							AND WEB_InventTable.Dimension3_!=""
							'.$keyword.'
							'.$code.'
							AND web_olapprodcat.CATID = WEB_InventTable.Dimension3_
							GROUP BY WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_
							ORDER BY WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_ ASC';

		$query2 = @mysql_query($query_string2);
		$data2 = @mysql_fetch_array($query2);
		$temp3 = '';
		$check1 = '';
		$check2 = '';
		$link_counter = 1;

		//formating filter links for display
		if (!empty($data2)){
		mysql_data_seek($query2,0);
			while($data2 = @mysql_fetch_array($query2)){
				if ($check1!=$data2['OLAPProductGroup']){
					if (empty($check1)) {
						$a = '<a href="#">'.$data2['title'].'</a>';
						$check1=$data2['OLAPProductGroup'];
						if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){//display first 2 category descriptions
							$b = '<span></span><a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'].'">'.$data2['Description'].'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){//display rest of categories as numbers with category names as link title
							$b = '<span></span><a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'].'" title="'.$data2['Description'].'">'.$link_counter.'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						}
					} else {
						$a = '<p class="clear"></p><a href="#">'.$data2['title'].'</a>';
						$link_counter=1;
						if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){//same as above
							$b = '<span></span><a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'].'">'.$data2['Description'].'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){//same as above
							$b = '<span></span><a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'].'" title="'.$data2['Description'].'">'.$link_counter.'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						}
					}
				} else {
					$a = '';
					if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){
						$b = '<a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'].'"> | '.$data2['Description'].'</a>';
						$link_counter++;
						$check2=$data2['Dimension3_'];
					} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){
						$b = '<a href="?page=Search&division2='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'].'" title="'.$data2['Description'].'"> | '.$link_counter.'</a>';
						$link_counter++;
						$check2=$data2['Dimension3_'];
					}
				}
				$check1=$data2['OLAPProductGroup'];
				$check2=$data2['Dimension3_'];
				$temp3 = $temp3.$a.$b;
			}
		}
		$division_breadcrumb = $temp3;
		//mysql_free_result($query2);
		unset($_GET['division2'],$data2);



//New products	
	}elseif(!empty($_GET['type']) && $_GET['type']=='newproducts'){
		$link = 'page=Search&type=newproducts';

		//for filtering search results by division->category
		$division = '';
		$cat = '';
		$s_cat='';
		if ((!empty($_GET['division']))&&(!empty($_GET['c_id']))){
			$division = 'AND OLAPProductGroup = '.$_GET['division'];
			$cat = 'AND Dimension3_ = "'.$_GET['c_id'].'"';
			$link .= '&division='.$_GET['division'].'&c_id='.$_GET['c_id'];
			if (empty($_GET['division'])){
				$_GET['division'] = $_GET['division2'];
			}
		}
		if (!empty($_GET['sc_id'])){
			$link .= '&sc_id='.$_GET['sc_id'];
			$s_cat = 'AND Dimension4_ = "'.$_GET['sc_id'].'"';
		}

		//search results
		$query_string = 'SELECT WEB_InventTable.ItemId, WEB_InventTable.ItemName, WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_, WEB_InventTable.Dimension4_, WEB_InventTable.Group, WEB_InventTable.GroupView, WEB_InventTable.InventInclusionGroupId, WEB_InventTable.SpecialInventInclusionGroup, WEB_InventTable.Discontinued,web_admin_options.title
							FROM web_admin_options, WEB_InventTable INNER JOIN web_newproduct ON WEB_InventTable.ItemId = web_newproduct.ItemId
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id AND web_admin_options.type = "division" AND WEB_InventTable.Webitem=1
							AND Dimension3_!=""
							'.$division.'
							'.$cat.'
							'.$s_cat.'
							ORDER BY OLAPProductGroup, Dimension3_, Dimension4_, ItemID ASC';
		$query = @mysql_query($query_string);
		$rows = @mysql_num_rows($query);
		$title = 'Search result (new products)';

		//Get Division->category for links (filtering)
		$query_string2 = 'SELECT DISTINCT WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_, WEB_InventTable.InventInclusionGroupId, web_olapprodcat.Description,web_admin_options.title
							FROM web_admin_options, web_olapprodcat, WEB_InventTable INNER JOIN web_newproduct ON WEB_InventTable.ItemId = web_newproduct.ItemId
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id AND web_admin_options.type = "division" AND WEB_InventTable.Webitem=1
							AND Dimension3_!=""
							AND web_olapprodcat.CATID = WEB_InventTable.Dimension3_
							GROUP BY WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_
							ORDER BY WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_ ASC';
		$query2 = @mysql_query($query_string2);
		$data2 = @mysql_fetch_array($query2);
		$temp3 = '';
		$check1 = '';
		$check2 = '';
		$link_counter = 1;

		//formating filter links for display
		if (!empty($data2)){
		mysql_data_seek($query2,0);
			while($data2 = @mysql_fetch_array($query2)){
				if ($check1!=$data2['OLAPProductGroup']){
					if (empty($check1)) {
						$a = '<a href="#">'.$data2['title'].'</a>';
						$check1=$data2['OLAPProductGroup'];
						if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){//display first 2 category descriptions
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=newproducts">'.$data2['Description'].'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){//display rest of categories as numbers with category names as link title
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=newproducts" title="'.$data2['Description'].'">'.$link_counter.'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						}
					} else {
						$a = '<p class="clear"></p><a href="#">'.$data2['title'].'</a>';
						$link_counter=1;
						if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){//same as above
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=newproducts">'.$data2['Description'].'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){//same as above
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=newproducts" title="'.$data2['Description'].'">'.$link_counter.'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						}
					}
				} else {
					$a = '';
					if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){
						$b = '<a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=newproducts"> | '.$data2['Description'].'</a>';
						$link_counter++;
						$check2=$data2['Dimension3_'];
					} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){
						$b = '<a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=newproducts" title="'.$data2['Description'].'"> | '.$link_counter.'</a>';
						$link_counter++;
						$check2=$data2['Dimension3_'];
					}
				}
				$check1=$data2['OLAPProductGroup'];
				$check2=$data2['Dimension3_'];
				$temp3 = $temp3.$a.$b;
			}
		}
		$division_breadcrumb = $temp3;
		mysql_free_result($query2);
		unset($_GET['division2'],$data2);

//Discontinued items	
	}elseif(!empty($_GET['type']) && $_GET['type']=='endrange'){
		$link = 'page=Search&type=endrange';

		//for filtering search results by division->category
		$division = '';
		$cat = '';
		$s_cat='';
		if ((!empty($_GET['division']))&&(!empty($_GET['c_id']))){
			$division = 'AND OLAPProductGroup = '.$_GET['division'];
			$cat = 'AND Dimension3_ = "'.$_GET['c_id'].'"';
			$link .= '&division='.$_GET['division'].'&c_id='.$_GET['c_id'];
			if (empty($_GET['division'])){
				$_GET['division'] = $_GET['division2'];
			}
		}
		if (!empty($_GET['sc_id'])){
			$link .= '&sc_id='.$_GET['sc_id'];
			$s_cat = 'AND Dimension4_ = "'.$_GET['sc_id'].'"';
		}

		//search results
		$query_string = 'SELECT WEB_InventTable.ItemId, WEB_InventTable.ItemName, WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_, WEB_InventTable.Dimension4_, WEB_InventTable.Group, WEB_InventTable.GroupView, WEB_InventTable.InventInclusionGroupId, WEB_InventTable.SpecialInventInclusionGroup, WEB_InventTable.Discontinued,web_admin_options.title
							FROM web_admin_options, WEB_InventTable
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id AND web_admin_options.type = "division" AND WEB_InventTable.Webitem=1 AND Discontinued=1
							AND Dimension3_!=""
							'.$division.'
							'.$cat.'
							'.$s_cat.'
							ORDER BY OLAPProductGroup, Dimension3_, Dimension4_, ItemID ASC';
		$query = @mysql_query($query_string);
		$rows = @mysql_num_rows($query);
		$title = 'Search result (end of range products)';

		//Get Division->category for links (filtering)
		$query_string2 = 'SELECT DISTINCT WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_, WEB_InventTable.InventInclusionGroupId, web_olapprodcat.Description,web_admin_options.title
							FROM web_olapprodcat, WEB_InventTable,web_admin_options
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id AND web_admin_options.type = "division" AND WEB_InventTable.Webitem=1 AND Discontinued=1
							AND Dimension3_!=""
							AND web_olapprodcat.CATID = WEB_InventTable.Dimension3_
							GROUP BY WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_
							ORDER BY WEB_InventTable.OLAPProductGroup, WEB_InventTable.Dimension3_ ASC';
		$query2 = @mysql_query($query_string2);
		$data2 = @mysql_fetch_array($query2);
		$temp3 = '';
		$check1 = '';
		$check2 = '';
		$link_counter = 1;

		//formating filter links for display
		if (!empty($data2)){
		mysql_data_seek($query2,0);
			while($data2 = @mysql_fetch_array($query2)){
				if ($check1!=$data2['OLAPProductGroup']){
					if (empty($check1)) {
						$a = '<a href="#">'.$data2['title'].'</a>';
						$check1=$data2['OLAPProductGroup'];
						if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){//display first 2 category descriptions
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=endrange">'.$data2['Description'].'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){//display rest of categories as numbers with category names as link title
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=endrange" title="'.$data2['Description'].'">'.$link_counter.'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						}
					} else {
						$a = '<p class="clear"></p><a href="#">'.$data2['title'].'</a>';
						$link_counter=1;
						if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){//same as above
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=endrange">'.$data2['Description'].'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){//same as above
							$b = '<span></span><a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=endrange" title="'.$data2['Description'].'">'.$link_counter.'</a>';
							$link_counter++;
							$check2=$data2['Dimension3_'];
						}
					}
				} else {
					$a = '';
					if (($check2!=$data2['Dimension3_'])&&($link_counter<=2)){
						$b = '<a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=endrange"> | '.$data2['Description'].'</a>';
						$link_counter++;
						$check2=$data2['Dimension3_'];
					} elseif (($check2!=$data2['Dimension3_'])&&($link_counter>2)){
						$b = '<a href="?page=Search&division='.$data2['OLAPProductGroup'].'&c_id='.$data2['Dimension3_'].'&type=endrange" title="'.$data2['Description'].'"> | '.$link_counter.'</a>';
						$link_counter++;
						$check2=$data2['Dimension3_'];
					}
				}
				$check1=$data2['OLAPProductGroup'];
				$check2=$data2['Dimension3_'];
				$temp3 = $temp3.$a.$b;
			}
		}
		$division_breadcrumb = $temp3;
		mysql_free_result($query2);
		unset($_GET['division2'],$data2);

//search generated by clicking on product links (product search link)

	} else {
		//sub category is specified
		if((isset($_GET['sc_id']))&&(isset($_GET['c_id']))){
			$query_string = 'SELECT ItemId, ItemName, OLAPProductGroup, Dimension3_, Dimension4_, WEB_InventTable.Group, GroupView, InventInclusionGroupId, SpecialInventInclusionGroup, Discontinued, web_admin_options.title
							FROM WEB_InventTable, web_admin_options
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id
							AND OLAPProductGroup="'.$_GET['division'].'" AND WEB_InventTable.Webitem=1
							AND ItemId NOT LIKE "%ZZZ%"
							AND Dimension3_="'.$_GET['c_id'].'"
							AND Dimension4_="'.$_GET['sc_id'].'"
							ORDER BY OLAPProductGroup, Dimension3_, Dimension4_, ItemId ASC';

			$link = 'page=Search&division='.$_GET['division'].'&c_id='.$_GET['c_id'].'&sc_id='.$_GET['sc_id'];

			$subcat_query = @mysql_query('SELECT Description FROM web_olapprodsubcat WHERE SUBCATID="'.$_GET['sc_id'].'"');
			$subcat_data = @mysql_fetch_array($subcat_query);
			$subcat_breadcrumb = '<span></span><a href="?page=Search&division='.$_GET['division'].'&c_id='.$_GET['c_id'].'&sc_id='.$_GET['sc_id'].'">'.$subcat_data['Description'].'</a>';

		//category is specified
		} else if(isset($_GET['c_id'])&&(!isset($_GET['sc_id']))){
			$query_string = 'SELECT ItemId, ItemName, OLAPProductGroup, Dimension3_, Dimension4_, WEB_InventTable.Group, GroupView, InventInclusionGroupId, SpecialInventInclusionGroup, Discontinued, web_admin_options.title
							FROM WEB_InventTable, web_admin_options
							WHERE WEB_InventTable.OLAPProductGroup = web_admin_options.division_id
							AND OLAPProductGroup="'.$_GET['division'].'" AND WEB_InventTable.Webitem=1
							AND WEB_InventTable.ItemId NOT LIKE "%ZZZ%"
							AND Dimension3_="'.$_GET['c_id'].'"
							ORDER BY OLAPProductGroup, Dimension3_, Dimension4_, ItemId ASC';

			$link = 'page=Search&division='.$_GET['division'].'&c_id='.$_GET['c_id'];
		}

		$query = @mysql_query($query_string);
		$rows = @mysql_num_rows($query);
		$data = @mysql_fetch_array($query);
		$title = $data['title'];
		$division_breadcrumb = '<a href="?page=Products&division='.$_GET['division'].'">'.$data['title'].'</a>';

		//get Category names to display
		$category_query = @mysql_query('SELECT Description FROM web_olapprodcat WHERE CATID="'.$_GET['c_id'].'"');
		$category_data = @mysql_fetch_array($category_query);
		$category_breadcrumb = '<span></span><a href="?page=Search&division='.$_GET['division'].'&c_id='.$_GET['c_id'].'">'.$category_data['Description'].'</a>';

		//get Sub-category names to display
		if(!isset($_GET['sc_id'])){
			$subcategory_query = @mysql_query('SELECT SUBCATID, Description FROM web_olapprodsubcat WHERE SUBCATID like "'.$_GET['c_id'].'%"');
			$subcategory_data = @mysql_fetch_array($subcategory_query);
			$subcat_breadcrumb .= '<span></span><a href="?page=Search&division='.$_GET['division'].'&c_id='.$_GET['c_id'].'&sc_id='.$subcategory_data['SUBCATID'].'">'.$subcategory_data['Description'].'</a>';
			$link_count = 1;
			mysql_field_seek($subcategory_query,1);
			while($subcategory_data = @mysql_fetch_array($subcategory_query)){
				if ($link_count<3) {
					$subcat_breadcrumb .= '<a href="?page=Search&division='.$_GET['division'].'&c_id='.$_GET['c_id'].'&sc_id='.$subcategory_data['SUBCATID'].'"> | '.$subcategory_data['Description'].'</a>';
					$link_count++;
				} else {
					$subcat_breadcrumb .= '<a href="?page=Search&division='.$_GET['division'].'&c_id='.$_GET['c_id'].'&sc_id='.$subcategory_data['SUBCATID'].'" title="'.$subcategory_data['Description'].'"> | '.$link_count.'</a>';
					$link_count++;
				}
			}
		}
	}

	$page = 1;
	if(isset($_GET['p_p'])){
		$page = $_GET['p_p'];
	}

//Display of search results --- body parts
	global $pagination;
	$Pagination = new Pagination($rows, $pagination['items_per_page'], $link, $page);

	$AdvancedSearch = new AdvancedSearch();
	$NewProducts = new NewProducts();

	global $body;
	$body = '<div class="column-310 float-left">
				'.$AdvancedSearch->Display().'
				<div class="gap-hoz-small"></div>
				<div class="column-310 float-left dealer-menu">
					<div class="block-khaki">
						<a href="javascript:CompareCookie.Display();" class="compare-btn" title="compare"></a>
					</div>
					<div class="gap-hoz-small"></div>
					<div class="block-khaki">
						<a href="?page=Wishlist&view=hto" class="how-to-order"></a>
					</div>
					<div class="gap-hoz-small"></div>
					<div class="block-khaki">
						<a href="javascript:WishlistCookie.Display();" class="wishlist"></a>
					</div>
	<div class="gap-hoz-small"></div><br>
				<div class="block-khaki">
					<div class="padding-10">
						<h1 class="text-white">New Products</h1>
						</div>
						'.$NewProducts->Display().'
						<div class="gap-hoz-small"></div>
						<br>
				</div></div>
	</div>
			<div class="gap-vert float-left"></div>
			<div class="column-630 float-left">
			<h1 class="text-grey">'.$title.'</h1>
			<div class="breadcrumb">
				'.$division_breadcrumb.'
				'.$category_breadcrumb.'
				'.$subcat_breadcrumb.'
			<p class="clear"></p></div>
			<div class="pagination"><p class="clear"></p>'.$Pagination->Display().'</div>
			<br/>';

	$body .= '<div id="search-result-wrapper">';

	$limit = ' LIMIT 0,'.$pagination['items_per_page'];
	if(isset($_GET['p_p'])){
		$limit = ' LIMIT '.(($_GET['p_p'] - 1) * $pagination['items_per_page']).','.$pagination['items_per_page'];
	}

	$sub_category = NULL;
	$query = @mysql_query($query_string.$limit);

	if($rows > 0){
		$division = NULL;
		$cat_check = NULL;
		$cat_txt = NULL;
		$discontinued=FALSE;

		mysql_data_seek($query,0);
		while($data = @mysql_fetch_array($query)){
			if(substr($data['ItemName'],0,1)=="*" || $data['Discontinued']==1){
				$discontinued=TRUE;
			}

			$division_changed = NULL;
			if ($cat_check!=$data['Dimension3_']) {
				$cat_query = @mysql_query('SELECT Description FROM web_olapprodcat WHERE CATID="'.$data['Dimension3_'].'"');
				$cat_data = @mysql_fetch_array($cat_query);
				$link = NULL;
				if(!empty($_GET['advanced_material']) || !empty($_GET['advanced_lamp']) || !empty($_GET['advanced_application'])){
					$link = '&division2='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&advanced_material='.$_GET['advanced_material'].'&advanced_lamp='.$_GET['advanced_lamp'].'&advanced_application='.$_GET['advanced_application']; 
				} elseif (isset($_POST['keyword']) || isset($_POST['code'])){
					$link = '&division2='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'];
				} elseif (isset($_GET['division'])){
					$link = '&division='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'];
				} elseif (isset($_GET['type']) && $_GET['type']=='newproducts'){
					$link = '&division='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&type=newproducts';
				} elseif (isset($_GET['type']) && $_GET['type']=='endrange'){
					$link = '&division='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&type=endrange';
				}

				$body .= '<p class="clear"></p>
							<h2 class="block-khaki padding-5">'.$data['title'].' | <a href="?page=Search'.$link.'">'.$cat_data['Description'].'</a></h2>
							<br>';
				$division = $data['InventInclusionGroupId'];
				$division_changed = true;
				$cat_check = $data['Dimension3_'];
				$cat_txt = $cat_data['Description'];
				mysql_free_result($cat_query);
			}

			if(($data['Dimension4_'] != $sub_category) || $division_changed){
				$subcat_query = @mysql_query('SELECT Description FROM web_olapprodsubcat WHERE SUBCATID="'.$data['Dimension4_'].'"');
				$subcat_data = @mysql_fetch_array($subcat_query);
				if(!empty($_GET['advanced_material']) || !empty($_GET['advanced_lamp']) || !empty($_GET['advanced_application'])){
					$body .= '<p class="clear"></p>
							<h5 class="block-yellow subcat"><a href="?page=Search&division2='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&sc_id='.$data['Dimension4_'].'&advanced_material='.$_GET['advanced_material'].'&advanced_lamp='.$_GET['advanced_lamp'].'&advanced_application='.$_GET['advanced_application'].'" class="padding-5 subcat">'.$subcat_data['Description'].'</a></h5>
							<br/>';
				} elseif(isset($_POST['keyword'])||isset($_POST['code'])){
					$body .= '<p class="clear"></p>
							<h5 class="block-yellow subcat"><a href="?page=Search&division2='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&sc_id='.$data['Dimension4_'].'&keyword='.$_POST['keyword'].'&code='.$_POST['code'].'" class="padding-5 subcat">'.$subcat_data['Description'].'</a></h5>
							<br/>';			
				} elseif(isset($_GET['division'])){
					$body .= '<p class="clear"></p>
							<h5 class="block-yellow subcat"><a href="?page=Search&division='.$_GET['division'].'&c_id='.$data['Dimension3_'].'&sc_id='.$data['Dimension4_'].'" class="padding-5 subcat">'.$subcat_data['Description'].'</a></h5>
							<br/>';	
				} elseif(isset($_GET['type']) && $_GET['type']=='newproducts'){
					$body .= '<p class="clear"></p>
							<h5 class="block-yellow subcat"><a href="?page=Search&division='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&sc_id='.$data['Dimension4_'].'&type=newproducts" class="padding-5 subcat">'.$subcat_data['Description'].'</a></h5>
							<br/>';	
				} elseif(isset($_GET['type']) && $_GET['type']=='endrange'){
					$body .= '<p class="clear"></p>
							<h5 class="block-yellow subcat"><a href="?page=Search&division='.$data['OLAPProductGroup'].'&c_id='.$data['Dimension3_'].'&sc_id='.$data['Dimension4_'].'&type=endrange" class="padding-5 subcat">'.$subcat_data['Description'].'</a></h5>
							<br/>';	
				}	
				$sub_category = $data['Dimension4_'];
				if($discontinued==TRUE){
					$body .= '<p class="error">End of range items are marked with <strong>*</strong></p>';
				}
				$discontinued=FALSE;
			}

			$in_compare_cookie = NULL;
			if($this->Compared($data['ItemId'], 'rd_compare')){
				$in_compare_cookie = ' checked="checked"';
			}

			$in_wishlist_cookie = NULL;
			if($this->Compared($data['ItemId'], 'rd_wishlist')){
				$in_wishlist_cookie = ' checked="checked"';
			}

			$basket = NULL;

			$pic_query = @mysql_query('SELECT * FROM WEB_Pic WHERE ItemId="'.$data['ItemId'].'" AND Type="4"');
			$pic_data = @mysql_fetch_array($pic_query);
			global $Session;

			$wishlist = '<p><input type="checkbox" class="checkbox" onclick="WishlistCookie.Add(this, \''.$data['ItemId'].'\');"'.$in_wishlist_cookie.'/>Add to wishlist</p>';
			if($Session->ID() != NULL){
				if($Session->Privilege() != NULL){
					$allow = explode(",: ", $Session->Privilege());
					foreach($allow as $key=>$val){
						if ($val=='ALL' || ($val==$data['InventInclusionGroupId'] && $data['InventInclusionGroupId']!=NULL) || ($val==$data['SpecialInventInclusionGroup'] && $data['SpecialInventInclusionGroup']!=NULL)){
							$basket = '<p> <a href="?page=Basket&pre_add='.urlencode($data['ItemId']).'" class="basket-link">» Add to basket</a></p>';
						}
					}
				}
			}
			$body .= '<div>
						<p class="border-khaki image-wrapper"><a href="?page=Product&id='.urlencode($data['ItemId']).'&group='.($data['Group']).'"><img src="'.$pic_data['Href'].'" alt="'.htmlentities($data['ItemName']).'" title="'.htmlentities($data['ItemName']).'"/></a></p>
						<p class="item_name">('.$data['ItemId'].') '.$data['ItemName'].'</p>
						<p><input type="checkbox" class="checkbox" onclick="CompareCookie.Add(this, \''.$data['ItemId'].'\');"'.$in_compare_cookie.'/>Compare</p>
						'.$wishlist.'
						'.$basket.'
					</div>';
		}
	} else {
		$body .= '<p class="error">Your search returned no results</p>';
	}

	$body .= '</div></div>
			<br><p><input type="submit" value="Back" class="submit-khaki float-right" onclick="javascript:window.history.back();"/></p>';
}

function Compared($value, $cookie_name){
	if(isset($_COOKIE[$cookie_name])){
		$CookieHandler = new CookieHandler();
		$cookie = $CookieHandler->Parse($cookie_name);

		$compares = explode(':', $_COOKIE[$cookie_name]);
		foreach($cookie as $key){
			$pieces = explode(':', $key);

			if($value == $pieces[0]){
				return true;
			}
		}
	}

	return false;
}
}
?>

Link to comment
Share on other sites

I have had a bit of a trawl through that code, I can so far only find 2 spots that refer to the page=Product in what you have given so far

and that is on your search page

I cant find anywhere where that $Pagedescr gets set, so you need to find out what table has the product description and which column name, The easiest thing to do on the index page would be to query the database for the product id that gets sent and then get the associated product description, once you have that you can set the title.

 

Remove that title query you had as title already gets set a bit further down your index page so we will need to modify that if a product has been selected.

Link to comment
Share on other sites

  • 2 weeks later...

HI, i'm back from Easter holiday and hope you had a safe break.

 

The website is http://www.radiant.co.za

Product view: http://www.radiant.co.za/?page=Product&id=JH108&group=

 

I want to show the name of the product on title. Product name = JH108: Chandelier 240v - Tellus 3-light bar

 

Also this will help when users share the product page on social network, the product name will be automatically posted.

 

The product name/description is pulled from MySQL by <?php echo $Pagedescr?> and that's what i want to put in the site title.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.