Hi David,
Quick question I hope! I have two fields in my db - price and saleprice. I also compare based on price and I'm fine with the imported results and comparisons. I'm wondering if I can include a function that can display a sale price beside a regular price...only if that db field is populated and not set to 0.00, etc?
Any ideas? I'm sure it's a simple PHP routine. I just want to put it into product.php...search results are not important at the moment.
Thanks for any help! -Joe
That's great David, helps me out a lot - thanks! I will probably just apply it to the table like you suggest, I think that'd be the best idea since I don't want it interfering with the comparison :)
-Joe
Hello Joe,
Sure - on it's own, the code is basically;
<?php
if ($mainProduct["saleprice"])
{
print $config_currencyHTML.$mainProduct["saleprice"];
}
?>
(in other situations the variable would be $product["saleprice"] - just check what is being used by whatever code is displaying the main price)
So, in html/product.php, the main price is displayed by this code on line 23:
<?php print $config_currencyHTML.$mainProduct["price"]; ?> <?php print translate("from"); ?>
...so you could replace that with:
<?php print $config_currencyHTML.$mainProduct["price"]; ?> <?php if ($mainProduct["saleprice"]) print ("Sale Price: ".$config_currencyHTML.$mainProduct["saleprice"].")"; ?> <?php print translate("from"); ?>
...but be careful if your product pages are displaying more than one merchant - in which case it would be better to add the sale price to the prices table...
Hope this helps!
Cheers,
David.