You are here:  » Help. Sitemap

Support Forum



Help. Sitemap

Submitted by esogut on Wed, 2007-12-19 17:54 in

Hello,

I need a some sort of sitemap for my page.

like this.

categoryA
-subcategory
--product
--product
--product
--product
--product

categoryB
-subcategory
--product
--product
--product
--product
--product

pls help needed.

and one more request to make a previous next in productview.
if a person has searched for "A" he gets 30 result this result he can sort this in price etc.
but when he click a product in the product page he would click next and previeos to go thruw his search result. I ask couple of friends of my they pointed me to sessions in php but i really dont now anything about sessions. Pls some help would be appreciated

Submitted by support on Wed, 2007-12-19 17:59

Hi,

A sitemap file similar to the layout you suggested is possible, but could become a very large page very quickly. Are you running a niche site where it would be feasibly to have every product on one page like that?

I can help you with a script to do this tomorrow (although note that Price Tapestry only a single category level unless you have already made changes to support a hierarchy!)

Cheers,
David.

Submitted by esogut on Wed, 2007-12-19 18:34

yes you are right with the product it wil be very big is it possiblle then to do this like this.

CategoryA
-BrandA
-BrandB
-BrandC

CategoryB
-BrandA
-BrandB
-BrandC

and do you have a solution for me for the other problem... thank you.

Submitted by support on Thu, 2007-12-20 08:58

Hi,

Here's a script to display a category and brand sitemap. Remember not to call this file sitemap.php as this already exists to generate the Google XML sitemap! I used catbrand.php

<?php
  
require("includes/common.php");
  require(
"html/header.php");
  require(
"html/menu.php");
  require(
"html/searchform.php");
  
$banner["h2"] = "<strong>Categories &amp; Brands</strong>";
  require(
"html/banner.php");
  
$sql "SELECT DISTINCT(category) FROM ".$config_databaseTablePrefix."products ORDER BY category";
  if (
database_querySelect($sql,$rows1))
  {
    foreach(
$rows1 as $category)
    {
      if (
$config_useRewrite)
      {
        
$href $config_baseHREF."category/".tapestry_hyphenate($category["category"])."/";
      }
      else
      {
        
$href $config_baseHREF."search.php?q=category:".urlencode($category["category"]);
      }
      print 
"<p><a href='".$href."'>".$category["category"]."</a></p>";
      
$sql "SELECT DISTINCT(brand) FROM ".$config_databaseTablePrefix."products WHERE category='".database_safe($category["category"])."' ORDER BY brand";
      if (
database_querySelect($sql,$rows2))
      {
        print 
"<blockquote>";
        foreach(
$rows2 as $brand)
        {
          if (
$config_useRewrite)
          {
            
$href $config_baseHREF."brand/".tapestry_hyphenate($brand["brand"])."/";
          }
          else
          {
            
$href $config_baseHREF."search.php?q=brand:".urlencode($brand["brand"]);
          }
          print 
"<p><a href='".$href."'>".$brand["brand"]."</a></p>";
        }
        print 
"</blockquote>";
      }
    }
  }
  require(
"html/footer.php");
?>

Regarding your second question, i'm afraid that previous and next links on product pages are not practical, as this would be prohibitively slow in terms of SQL and subsequent data processing. Consider a very large result set and that you were viewing a product several hundred pages into the results - in order to pick out the previous and next products for display the script would need to run the same search query using the same paging the same number of times in order to find the adjacent products, and this could have serious performance implications...

Hope this helps,
Cheers,
David.

Submitted by esogut on Thu, 2007-12-20 13:15

Hoi David,

isn't possible to do's without a query to save the query in to a session and then use the session to find the next and prev products in the search result.
Many people at school say it's possible but non of them want to show it how sessions work our how i can get it to work. i just now php basics.

It would be very nice if i can make this function work.

Submitted by support on Thu, 2007-12-20 14:21

Hi,

Unfortunately resource variables, which are what are returned by PHP's MySQL library cannot be stored within the session, otherwise I agree that it would be possible to do that way. I will have a think about simple work-arounds that would be quick to implement, but I think however it is done there would have to be a trade-off (i.e. forward / next through a limited number of products only) etc...

Cheers,
David.

Submitted by esogut on Thu, 2007-12-20 20:42

Hi David,

Sorry i keep asking questions but i have one more problem it's with the catbrand.php. my layout is like this.

if i have 6 brands can i put 3 brands on one side and 3 at the other side. i put at the bottom my HTML how i have it now configured in HTML but i cant get it to work in catbrand.php.

-----------------------------------------------------------
CategoryA
-----------------------------------------------------------
- CategoryA_BrandA - CategoryA_BrandD
- CategoryA_BrandB - CategoryA_BrandE
- CategoryA_BrandC - CategoryA_BrandF
-----------------------------------------------------------

  <h4>CategoryA</h4>
  <div class="listCategory">
    <div class="col1_2">
      <ul>
        <li>CategoryA_BrandA</li>
        <li>CategoryA_BrandB</li>
        <li>CategoryA_BrandC</li>
      </ul>
    </div>
    <div class="marge10"></div>
    <div class="col1_2">
      <ul>
        <li>CategoryA_BrandD</li>
        <li>CategoryA_BrandE</li>
        <li>>CategoryA_BrandF</li>
      </ul>
    </div>
    <br class="clearBoth" />
  </div>

Submitted by support on Sat, 2007-12-22 18:50

Hi,

The trick here is to count the items before starting to the display the output, print the header of your containing HTML, print the first half of the items, print the middle section of the containing HTML, print the second half, and finally print the footer section of your containing HTML. Without having your CSS to hand i'm not able to test this easily, but something like the following should do the trick:

<?php
  
require("includes/common.php");
  require(
"html/header.php");
  require(
"html/menu.php");
  require(
"html/searchform.php");
  
$banner["h2"] = "<strong>Categories &amp; Brands</strong>";
  require(
"html/banner.php");
  
$sql "SELECT DISTINCT(category) FROM ".$config_databaseTablePrefix."products ORDER BY category";
  if (
database_querySelect($sql,$rows1))
  {
    foreach(
$rows1 as $category)
    {
      if (
$config_useRewrite)
      {
        
$href $config_baseHREF."category/".tapestry_hyphenate($category["category"])."/";
      }
      else
      {
        
$href $config_baseHREF."search.php?q=category:".urlencode($category["category"]);
      }
      print 
"<p><a href='".$href."'>".$category["category"]."</a></p>";
      
$sql "SELECT DISTINCT(brand) FROM ".$config_databaseTablePrefix."products WHERE category='".database_safe($category["category"])."' ORDER BY brand";
      if (
database_querySelect($sql,$rows2))
      {
        
$half intval(count($rows2) / 2);
        
$count 0;
        print 
"<div class='listCategory'>";
        print 
"<div class='col1_2'>";
        print 
"<ul>";
        foreach(
$rows2 as $brand)
        {
          if (
$config_useRewrite)
          {
            
$href $config_baseHREF."brand/".tapestry_hyphenate($brand["brand"])."/";
          }
          else
          {
            
$href $config_baseHREF."search.php?q=brand:".urlencode($brand["brand"]);
          }
          print 
"<li><a href='".$href."'>".$brand["brand"]."</a></li>";
          
$count++;
          if (
$count == $half)
          {
            print 
"</ul>";
            print 
"</div>";
            print 
"<div class='marge10'></div>";
            print 
"<div class='col1_2'>";
            print 
"<ul>";
          }
        }
        print 
"</ul>";
        print 
"</div>";
        print 
"<br class='clearBoth' />";
        print 
"</div>";
      }
    }
  }
  require(
"html/footer.php");
?>

Cheers,
David.