I read about integrating coupon codes into the product.php and price.php page. I can get coupon codes/text/promotions from the Avantlink network that are available as rss, javascripts or php. What I'd like to do is add a link either near the merchant name in product.php or in the table on prices.php that links to a file that I'll show using a lightbox script. This link would contain the php script that generates the list of current promotions.
Each merchant would have it's own page.
Any ideas how I can get started?
Hi Don,
If there is consistency between the merchant names that you have registered within Price Tapestry, and those that you need to pass to your lightbox script; then within the prices table (html/prices.php), in the merchant column (line 11), the merchant name is in the $product["merchant"] variable. That line in the distribution is:
<td><a href='<?php print $product["merchantHREF"]; ?>'><?php print $product["merchant"]; ?></a></td>
...so to add a JavaScript link alongside the merchant name, here's a rough idea of what you could do (i'm afraid i'm not familiar with lightbox so I don't know exactly how it is called)...
<td><a href='<?php print $product["merchantHREF"]; ?>'><?php print $product["merchant"]; ?></a> [<a onclick='javascript:someFunction('<?php print $product["merchant"]; ?>');' />vouchers</a>]</td>
If however you need to cross-reference the Price Tapestry registered merchant name with some other index (e.g. a merchant ID); a simple lookup table, also within html/prices.php should be all that's needed, for example - right at the very top of the script:
<?php
$lookup["Merchant 1"] = "1234";
$lookup["Merchant 2"] = "5678";
$lookup["Merchant 3"] = "9101";
?>
...and then where the merchant is displayed, in place of the above:
<td><a href='<?php print $product["merchantHREF"]; ?>'><?php print $product["merchant"]; ?></a> [<a onclick='javascript:someFunction('<?php print $lookup[$product["merchant"]]; ?>');' />vouchers</a>]</td>
Hope this helps!
Cheers,
David.