I want to add category list to the left area of index, search and product pages? how can I do this?
yes thank you.. my site is www.queenofcheap.com
How can I fix the search box to either center it more or make it a little bit longer?
Hi,
To balance it out I would suggest putting in a right column that is the same width as the left column. You could do it by changing your user_footer_before file something like this:
html/user_footer_before.php
</td>
<td width='130'></td>
</tr>
</table>
Simply adjust the width of the 3rd column as necessary; or alternatively you could also add a width attribute to the left hand colum in user_header_after of the same amount...
Cheers!
David.
The code sample you provided for categories works beautifully.
Could you provide a sample for brands?
Thanks
Michele
Hi Michele,
Sure - here's the PHP section to do a brand list - just paste it into the various HTML sections created above at the location you want it to be displayed...
<?php
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` ORDER BY brand";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."brand/".tapestry_hyphenate($row["brand"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=brand:".urlencode($row["brand"]).":";
}
print "<a href='".$href."'>".$row["brand"]."</a><br />";
}
}
?>
Cheers,
David.
Perfect - thank you! :)
The site I'm using it on lends itself more to brands than to categories, so that is the ideal solution
Is it possible to display custom categories that are made in admin instead of all the categories?
Sure; the following code will create an index of categories that have been set-up in Category Mapping in /admin/
<?php
$sql = "SELECT name as category FROM `".$config_databaseTablePrefix."categories` ORDER BY category";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."category/".tapestry_hyphenate($row["category"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=category:".urlencode($row["category"]).":";
}
print "<a href='".$href."'>".$row["category"]."</a><br />";
}
}
?>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi,
Firstly, you need to make changes to the page structure in order to acommodate your left hand content area. This can be done by creating some additional files in your html/ directory that Price Tapestry looks for and includes on your page if they exist. They are:
html/user_header_after.php
and
html/user_footer_before.php
As you can see from their names, the first file is included at the top of the page; and the second file included at the bottom. Therefore, if you want to put content into a left hand column beside the main content you need to use these files to display the appropriate HTML TABLE code. It can be done as follows:
html/user_header_after.php
<table width='100%'>
<tr>
<td valign='top'>
<!-- insert your left column code here, you can use PHP tags -->
</td>
<td valign='top'>
html/user_footer_before.php
</td>
<td valign='top'>
<!-- insert your right column code here, you can use PHP tags -->
</td>
</tr>
</table>
(if you don't want any right column content just leave out the TD element in the footer_before file)
The more complex part of this is creating the category list without corrupting the display variables that have been setup for display by the other html/* files. Therefore, I would suggest that you code it up independantly. Something like this should work:
html/user_header_after.php
<table width='100%'>
<tr>
<td valign='top'>
<?php
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category";
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."category/".tapestry_hyphenate($row["category"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=category:".urlencode($row["category"]).":";
}
print "<a href='".$href."'>".$row["category"]."</a><br />";
}
}
?>
</td>
<td valign='top'>
html/user_footer_before.php
</td>
</tr>
</table>
It's going to take a bit of work to create a nice layout, but that should give you something to get started with...!
Hope this helps,
Cheers,
David.