Hi David
I have created an additional field "old price", which I managed to show in Featured Products.
In addition, I would like to show the savings (price - old price) in absolute terms.
For example: (price = 100 usd) (old price = 150 usd)
How can I show the savings of 50 usd in Featured products?
Cheers, IG
Works perfectly. Thank you very much.
Is there a way to see in the backend, which products have the biggest savings?
Hi,
Sure - in the backend / Price Tapestry installation ( e.g. /pt/ ) edit search.php and look for the following code at line 83:
$orderByDefault["rating"] = "rating DESC";
...and REPLACE with:
$orderByDefault["saving"] = "(old_price - price) DESC";
$orderByDefault["rating"] = "rating DESC";
(as above, if old_price isn't exactly what you have used modify as required)
Then browse to
/pt/search.php?q=bw:&sort=saving
(bw: is the "begins with" search operator, and without anything after the ":" it returns all products...)
Cheers,
David.
--
PriceTapestry.com
Hi David
How can I show the savings on this page: /pt/search.php?q=bw:&sort=saving
Cheers, IG
Hi,
If you edit search.php and first change the replacement above to add the sort so that instead of:
$orderByDefault["saving"] = "(old_price - price) DESC";
...you now have:
$orderByDefault["saving"] = "saving DESC";
Then look for the following code at line 234:
$sql = "SELECT SQL_CALC_FOUND_ROWS id,COUNT(id) AS numMerchants,MIN(price) as minPrice FROM `".$config_databaseTablePrefix."products` WHERE ".$where.$priceWhere." GROUP BY search_name";
...and REPLACE with:
$sql = "SELECT SQL_CALC_FOUND_ROWS id,COUNT(id) AS numMerchants,MIN(price) as minPrice,(MAX(old_price)-MIN(price)) AS saving FROM `".$config_databaseTablePrefix."products` WHERE ".$where.$priceWhere." GROUP BY search_name";
Finally, in html/searchresults.php look for the following code at line 59:
<span class='pt_sr_price'><?php print tapestry_price($product["minPrice"]); ?></span>
...and REPLACE with:
<span class='pt_sr_price'><?php print tapestry_price($product["minPrice"]); ?></span>
<?php
if (isset($product["saving"]))
{
print "<br />Saving ".tapestry_price(tapestry_decimalise($product["saving"]));
}
?>
The saving will then be displayed below the price in search results...
Cheers,
David.
--
PriceTapestry.com
What can I say? I am speechless as usual. Your support is second to none!
Hi,
In your Featured Products / Each template, use %SAVINGS% as the placeholder and then edit pto_featured.php and look for the following code at line 145:
$each = str_replace("%PRICE%",$pto_config_currencyHTML.$row->minPrice,$each);
...and REPLACE with:
if ($row->old_price > $row->minPrice)
{
$savings = "SAVE ".$pto_config_currencyHTML.pto_common_decimalise($row->old_price - $row->minPrice);
}
else
{
$savings = "";
}
$each = str_replace("%SAVINGS%",$savings,$each);
$each = str_replace("%PRICE%",$pto_config_currencyHTML.$row->minPrice,$each);
(if old_price isn't exactly what you have used for the old price field name, modify the two instances in the above replacement as required...)
Hope this helps!
Cheers,
David.
--
PriceTapestry.com