Hello David,
I'm trying to implement alternate shading within the rows of the price comparison table. I've found a few scripts from various sites along with modifying the mysql database, but it's getting a bit above my head when trying to combine them into PT. Is it easily possible to do this?
Also, is it possible to merge the Amazon table with the main price comparison table?
Many thanks for your help,
Matt
Hi Matt,
A common way to style alternative rows is to set-up separate classes for odd and even rows, and then add PHP code to the loop to select the correct class. So first of all in your default.css you could add the two classes:
.odd {
background-color: #cccccc;
}
.even {
background-color: #fafafa;
}
(or whatever shading you require of course!)
Then, in html/prices.php, look for where each price row is currently started by the following code at line 10:
<?php foreach($prices["products"] as $product): ?>
<tr bgcolor='#ffffcc'>
...and REPLACE that with:
<?php $r = 0; ?>
<?php foreach($prices["products"] as $product): ?>
<tr class='<?php $r++;print (($r & 1)?"odd":"even");?>'>
(don't forget to do a hard refresh (CTRL+F5) after editing CSS to make sure the browser reloads all resources)
Regarding merging Amazon results, this is possible bit I would normally only recommend this when using ItemLookup (with a known ASIN, ISBN or EAN value) rather than ItemSearch, which can't be guaranteed to return the same product(s) as the focus of the page - so keeping them separate make sure this isn't a problem.
If ItemLookup would be an option for your site / niche, or it would be manageable to manually manage a lookup table of ASIN (Amazon's unique product identifiers) for the products on your site let me know and I'll take you through the steps to implement that...
Cheers,
David.
--
PriceTapestry.com