Is it possible to create a new page called retailers.php, using the existing atoz.php file to create a list of retailers with direct links to their website.
As we are importing feeds, I understand that there will not be a direct link to the home page.
So, what I was looking for was some mysql to get the URL of the first product listed for each retailer.
thanks,
Dave
That looks 99% there!
I now need to encode the URL using something similar to:
print tapestry_buyURL($product)
The idea is that the link would use the jump.php page and therefore count as a click on the reporting tool.
<?php
require("includes/common.php");
$atoz["items"] = array();
$sql = "SELECT id,merchant,buy_url FROM `".$config_databaseTablePrefix."products` GROUP BY merchant";
if (database_querySelect($sql,$rows))
{
foreach($rows as $retailer)
{
$item = array();
$item["name"] = $retailer["merchant"];
$item["href"] = tapestry_buyURL($retailer);
$atoz["items"][] = $item;
}
}
$banner["h2"] = "<strong>Retailers</strong>";
require("html/header.php");
require("html/menu.php");
require("html/searchform.php");
require("html/banner.php");
require("html/atoz.php");
require("html/footer.php");
?>
Cheers,
David.
Decided to post the whole thing again (see previous post!) as you need to add the id field to the SQL in order to use the jump.php script...
Cheers,
David.
Perhaps a page that should be included with the distro. It works a treat at UK Price Comparison Search
Hi Dave,
Have a go with this:
retailers.php:
<?php
require("includes/common.php");
$atoz["items"] = array();
$sql = "SELECT merchant,buy_url FROM `".$config_databaseTablePrefix."products` GROUP BY merchant";
if (database_querySelect($sql,$rows))
{
foreach($rows as $retailer)
{
$item = array();
$item["name"] = $retailer["merchant"];
$item["href"] = $retailer["buy_url"];
$atoz["items"][] = $item;
}
}
$banner["h2"] = "<strong>Retailers</strong>";
require("html/header.php");
require("html/menu.php");
require("html/searchform.php");
require("html/banner.php");
require("html/atoz.php");
require("html/footer.php");
?>
This works because of the "GROUP BY" clause in the SQL, which restricts it to selecting one record from the products table per merchant...
Cheers!
David.