Hi David, I was thinking of way to display sale price vs regular price... and wondered what method you would recommend. New column, or Text After...
I can easily add a new column (thanks to your excellent previous posts!).. and to be honest, my site is less about price comparison that accessibility. Do you think the 2nd column method is preferable? I would like to apply visual css format to the sale price field, which seems doable in both cases.
Just wondering what you think?
Thanks again for all your terrific help!
T.
I took your advice, and so far so good, sale price is now imported successfully...
One minor item .. despite my new field having no default value (as far as I can tell, that is!), if there is no sale price, it returns 0.00 on my product page (for sale price). I'm trying to place both on the page, ie. sale price & regular price.
Should there be an additional IF statement? I just added this, found in an earlier post:
<?php
if ($product["saleprice"]):
?>
<?php
print $config_currencyHTML.number_format($product["saleprice"],2);
?>
<?php
endif;
?>
And I'm so impressed by this app, you've included things that are just so important to price comparison sites! And made it easy to use :)
Thanks!
Hi,
You probably need to use a comparison operator in this instance, for example:
<?php
if (floatval($product["saleprice"]) > 0.0):
?>
That should do the trick!
Cheers,
David.
Thank you David, it works perfectly!
May I please ask you to look at this code - I'm trying to learn & it's a little cranky somewhere :)
One of my merchants populates the Sale Price field with the Regular Price, even if the item is not on sale, so my goal is to indicate this is "Regular Price" when the two fields match.
<?php
if (floatval($product["saleprice"]) > 0.0) {
print $config_currencyHTML.number_format($product["saleprice"],2);
print "Sale Price";
} elseif ((floatval($product["saleprice"])) == (floatval($product["price"]))) {
print "Regular Price";
}
?>
Thanks again
T.
Hi David, I posted too soon.. worked on it a little longer, and believe I fixed my own problem (just needed to simplify things!)
<?php
if (floatval($product["saleprice"]) == 0.0) {
print " ";
} if ($mainProduct["saleprice"] == $mainProduct["price"]) {
print "Regular Price";
} if (floatval($product["saleprice"]) > 0.0) {
print $config_currencyHTML.number_format($product["saleprice"],2);
print "Sale Price";
}
?>
If there is a better way, I would appreciate any feedback, but so far this seems to work :)
T.
OK.. one more tweak to *really* make it work..
(pls feel free to delete previous posts, sorry!)
<?php
if (floatval($product["saleprice"]) == 0.0) {
print " ";
} if ($product["saleprice"] == $product["price"]) {
print "Regular Price";
} elseif (floatval($product["saleprice"]) > 0.0) {
print "<div><font color='#0006eb'><b>";
print $config_currencyHTML.number_format($product["saleprice"],2);
print "</b></font>";
print "<b><a href='";
print tapestry_buyURL($product);
print "' target='_blank'> Sale Price</a></b> </font></div>";
}
?>
Hi,
I'd definitely go with a new field / column if you're happy with the database / code modifications involved. This should make visual customisation easier (styling of that cell), and if you really wanted to you could do some maths based on the different between the 2 fields.
In some cases where people use feeds containing a sale price; it is the sale price that is registered as the "price" field, so you might want to consider this, and actually making it "regular_price" as the new field. You can only do this of course if your feeds always have the sale price populated even if it is the same as the regular price.
You could then also, if you wished, do some maths on the 2 fields and show something like "Save £10.00", using something like this:
<?php
if ($product["regular_price"] > $product["price"])
{
$saving = sprintf("%.2f",($product["regular_price"] - $product["price"]));
print "Save ".$config_currencyHTML.$saving;
}
?>
Hope this helps!
Cheers,
David.