Hi David ,
on the products page i want to list any promotions or special offers from the retailer whos product im viewing.
now all the promotions and offes are kept in a separate database , any idea how i can display by matching the reatiler name then retrieving the offer from the other database??
cheers
ok will try this , the other database though has a different username and different password but is on the same server.
Hi Jonny,
If the other database is on the same server, with the same username and password then you could use Price Tapestry's database library to do this. All you would need to do is change $config_databaseName before the query.
As you're aware, the product page features all merchants that stock the product, so I would imagine that you would want to add this to the price comparison table, in a new cell displayed by html/prices.php. To do this, you would simply add a new column heading - for example by inserting the following code in the header section (somewhere between lines 3 and 8:
<th align='left'>Special Offers</th>
...and then in the corresponding row section below:
<?php
print "<td>";
$config_databaseName = "OtherDatabase";
$sql = "SELECT * FROM offers WHERE merchant='".database_safe($product["merchant"])."'";
if (database_querySelect($sql,$offers))
{
foreach($offers as $offer)
{
//database row in $offer array at this point, for example:
print $offer["coupon_code"];
}
}
else
{
print " ";
}
print "<td>";
?>
Cheers,
David.