Submitted by mattwalker on Mon, 2010-07-12 02:57 in Price Tapestry
Hi David,
I'm trying to get the product description to show/hide within the comparison table but how's it done? I thought it was purely CSS at first, but I think there's a bit more to it than that!
I think it's a case of generating a DIV that starts off with the CSS display style of "none", and on clicking the link to show that description toggles between "table-row" and back to "none". Based on the distribution version of html/price.php, and to create a "More Info" link below the product name, first look for the following code at line 12:
Hi Matt,
I think it's a case of generating a DIV that starts off with the CSS display style of "none", and on clicking the link to show that description toggles between "table-row" and back to "none". Based on the distribution version of html/price.php, and to create a "More Info" link below the product name, first look for the following code at line 12:
<td><?php print $product["name"]; ?></td>
...and REPLACE with:
<td>
<?php print $product["name"]; ?>
<?php if ($product["description"]): ?>
<br />
<small><a href='JavaScript:
if (document.getElementById("<?php print "desc".$product["id"]; ?>").style.display == "none")
{
document.getElementById("<?php print "desc".$product["id"]; ?>").style.display == "table-row"
}
else
{
document.getElementById("<?php print "desc".$product["id"]; ?>").style.display == "none"
}
'>Toggle Description</a><small>
<?php endif; ?>
</td>
...and then add the region for the description to be displayed in a new row below the price result row by looking for the following code at line 15:
</tr>
...and REPLACE with:
</tr>
<tr id='desc".$product["id"]."' style='display:none;'>
<td colspan='4'>
<?php print $product["description"]; ?>
</td>
</tr>
Hope this helps!
Cheers,
David.