Hi,
I'd like to drop record when importing if:
1. Retail Price and Price field are blank, 0 or 0.00
2. Retail Price = Price
I just want to import a record when Retail Price greater than Price.
I already created the Retail Price field on my database.
Thank you
Hi David,
I put this to show the saving on my website:
<?php
$saving = $product["retailprice"] - $product["price"];
print "Save: ".$config_currencyHTML.$saving;
?>
If the saving is $1, $2, $3 ... or $2.50 ..., it displays ok.
When the saving is $0.01, it displays like this:
Save: $0.010000000000218
Both "retailprice and "price" are decimal(10,2) in my SQL
Thank you
That's interesting, especially since the fields are being deciamlised(), but if you use:
<?php
$saving = $product["retailprice"] - $product["price"];
print "Save: ".$config_currencyHTML.tapestry_decimalise($saving);
?>
...that should do the trick...
Cheers,
David.
--
PriceTapestry.com
Hello senaite and welcome to the forum!
This is probably best implemented as a simple mod to the import process. In includes/admin.php, look for the following code at line 326:
/* decimalise price */
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
...and REPLACE with:
/* decimalise price */
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
$importRecord["retailprice"] = tapestry_decimalise($importRecord["retailprice"]);
if (($importRecord["price"]=="0.00") || ($importRecord["retailprice"]=="0.00")) return;
if ($importRecord["price"] == $importRecord["retailprice"]) return;
Using the tapestry_decimalise() function on your `retailprice` field will ensure that any currency characters, letters or superfluous white space are removed.
Hope this helps!
Cheers,
David.
--
PriceTapestry.com