Hi,
The code I have right now is looking for a special price, and if it exists, it will stripe the "normal" price and show the discount price in the next column.
In price.php :
<?php
if (isset($product["specialprice"]) && $product["specialprice"]!="") {
print "<td>";
print "<span class='line-through'>".$product["price"].$config_currencyHTML"</span>";
print "</td>";
print "<td>";
print "<strong>".$product["specialprice"].$config_currencyHTML"</strong>";
print "</td>";
} else {
print "<td>";
print "<strong>".$product["price"].$config_currencyHTML;"</strong>";
print "</td>";
print "<td>";
print "-";
print "</td>";
//}
?>
<td>
<?php
if (isset($product["shipping"]) && $product["shipping"]!="") {
print $product["shipping"].$config_currencyHTML;
} else {
print translate("Check Website");
}
?>
It's ok in many cases, but I have also many feeds that are built this way :
PRICE 84.64
CURRENCY euros
...
PROMO 1
PRICENOREBATE 92
PERCENTAGEPROMO 8
As you can see, here the "normal" price is now the PRICENOREBATE (since Promo = 1), while PRICE is the discount price. Both have been inverted.
Did anybody already find a way to manage such issue ?
Thanks !
Hi David,
Thanks for your answer
No the problem is that all feeds are not the same : some of them will keep PRICE as the original price, and if a promo exists, they will put the discount price in another field (PROMOPRICE).
But in this case, the merchant is doing the opposite : if PROMO=1, then PRICE is the discount price...and the original price is PRICENOREBATE (or sometimes another field, like PRIXORI or what ever...)
Hi,
This could be done with some hard coded logic at import time. In includes/admin.php look for where the main price field is deciamlised using the following code at line 325:
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
...and REPLACE with:
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
$importRecord["specialprice"] = tapestry_decimalise($importRecord["specialprice"]);
// desired outcome:
// if both set, price is the dearer of the two, specialprice the cheaper
// elseif only one is set, that value becomes price and specialprice is empty
if ($importRecord["price"]!="0.00" && $importRecord["specialprice"]!="0.00")
{
if($importRecord["specialprice"] > $importRecord["price"])
{
$swaptemp = $importRecord["specialprice"];
$importRecord["specialprice"] = $importRecord["price"];
$importRecord["price"] = $swaptemp;
}
}
elseif($importRecord["price"]!="0.00")
{
$importRecord["specialprice"] = "";
}
else
{
$importRecord["price"] = $importRecord["specialprice"];
$importRecord["specialprice"] = "";
}
That way, it doesn't matter which order price and a discounted price fields are registered; price will always contain the dearer of the two values; or if only one is set, then price is set to that value.
Cheers,
David.
--
PriceTapestry.com
Thanks David !
As far as I understand, this code only show one price (the cheapest one) and so doesn't hightlight the difference between price and special price. It's ok for me, I take it !
Best regards
Hi,
If all records are like that you could register PRICENOREBATE as Price, and PRICE as specialprice. Would that be an option; or is the problem that _not_ all records have a value in PRICENOREBATE?
Cheers,
David.
--
PriceTapestry.com