Hi,
I want to include a list of the brands on a page that is outside the price tapestry folder.
I have tried putting the php from brands.php into the external page, but get errors.
I have tried to make the urls referred to in the files associated with that php absolute so they can be referenced.
Should this work, I may have missed some url as I get the error that there is a..
Call to undefined function: database_queryselect()
Which is from the brands.php. In brands php it says required, common.php and I think that is where the functions aret being got from, even of I make all the urls in common.ph absolute, it doesnt seem to recognise that function which i think is in database.php.
Is there a way to do this, something I may have missed to be able to put a list of brands on a page outside the price tapestry folder.
Hi,
Is a similar thing possible for the price range search boxes.
Again I want to put the price range search box on a page outside the folder that it is installed in and wondered if this is possible?
Hi Clare,
That shouldn't be a problem because there is no reference to the database on the search form. All you need to do is make sure that the action attribute of the form is a fully qualified URL (i.e. relative to the top level directory of your website) to search.php in your Price Tapestry folder as the value for $config_baseHREF will not be valid. For example, in html/searchform.php instead of:
print "<form name='search' action='".$config_baseHREF."search.php'>";
use...
print "<form name='search' action='/pricetapestry/search.php'>";
...where "/pricetapestry/" is the path to your Price Tapestry folder.
Cheers,
David.
Oh great, thats nice and simple, thankyou very much.
Hi Clare,
Several components of Price Tapestry use relative URLs so it maybe quite tricky to make this work - to the extent I think that it would be easier just to write a separate standalone script (only linking to your config.php file) to query the database directly and display a list of brands with links into the Price Tapestry site.
There's not much code required, something like this should do the trick:
brandlist.php
<?php
require("../pricetapestry/config.php");
$link = mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);
mysql_select_db($config_databaseName,$link);
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` ORDER BY brand";
$result = mysql_query($sql,$link);
if ($result)
{
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
if ($config_useRewrite)
{
$href = $config_baseHREF."brand/".str_replace(" ","-",$row["brand"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=brand:".urlencode($row["brand"]).":";
}
print "<p><a href='".$href."'>".$row["brand"]."</a></p>";
}
}
?>
The only thing you should need to change is:
require("../pricetapestry/config.php");
...where "../pricetapestry/" is the relative path from where you've created this script to your Price Tapestry installation directory.
Hope this helps!
Cheers,
David.