Hi David,
Is it possible to show the number of merchants on the product page, next to the title. Right now I'm displaying the cheapest Merchant, but I would like to add the number of merchants that has been compared (combined with a html-anchor which clicks to the comparisson table)... So I would like to see: Product X Best Deal at Merchant Y, (Z merchants compared)
Can you help me on this one? Thanks!
Koen
Thanks David!
But how do I get this into the plugin (shortcode?) :-$
Thanks!
Koen
Hi Koen,
The shortcodes are invoked separately from the PriceTapestry.org virtual pages, so there's no concept of a plugin generated title / meta tags.
To add the above to the plugin generated product pages, you would edit pto.php and look for the following code at line 251:
$title = str_replace("%PRODUCT_NAME%",htmlspecialchars($pto_productResults[0]->name),$title);
...and REPLACE with:
$title = str_replace("%PRODUCT_NAME%",htmlspecialchars($pto_productResults[0]->name),$title);
if (count($pto_productResults)>1)
{
$title .= ", (".count($pto_productResults)." merchants compared)";
}
If you could copy the code that you have in place to display "Product X Best Deal at Merchant Y" from your shortcode, I'll show how to modify that to do the same...
Cheers,
David.
--
PriceTapestry.com
Thanks David,
This is my code for the best deal:
<p class='pto_product_price'>
<h2>Beste deal:
<strong>%PRICE%</strong> bij %PRICE_LINKS%</h2>
<em><span style="color: #ff6600;">(voor € %DB_totalprice% bij je thuisbezorgd) </span></em>
<p>
Thanks,
Koen
Hello Koen,
My apologies I mis-read your original question - no problem, it's straight forward to add a new placeholder to return the number of compared merchants.
If you edit pto_product.php and look for the following code at line 476:
$html_product = str_replace("%PRICE_LINKS%",implode(", ",$price_links),$html_product);
...and REPLACE with:
$html_product = str_replace("%PRICE_LINKS%",implode(", ",$price_links),$html_product);
$html_product = str_replace("%NUM_MERCHANTS%",count($pto_productResults),$html_product);
You can then use the placeholder %NUM_MERCHANTS% within your Product / Main template as required!
Cheers,
David.
--
PriceTapestry.com
Hi David,
Thanks for this one! Is it possible to only show the number of merchants when there are multiple merchants (NUM_MERCHANTS > 1)?
Thanks,
Koen
Hi Koen,
Sure - in your modified pto_product.php where you now have this code:
$html_product = str_replace("%NUM_MERCHANTS%",count($pto_productResults),$html_product);
...REPLACE that with:
if (count($pto_productResults) > 1)
{
$html_product = str_replace("%NUM_MERCHANTS%",count($pto_productResults),$html_product);
$html_product = str_replace("%IF_COMPARED%","",$html_product);
$html_product = str_replace("%ENDIF_COMPARED%","",$html_product);
}
else
{
$html_product = preg_replace('/%IF_COMPARED%(.*)%ENDIF_COMPARED%/','',$html_product);
}
And then in your template, use something like:
%IF_COMPARED%
Comparing %NUM_MERCHANTS% Prices
%ENDIF_COMPARED%
Cheers,
David.
--
PriceTapestry.com
Hi David,
In addition to this one... Is it also possible to state the highest price (like best price, but then the higest one....) in the product section? Like a %highest_price% placeholder?
So I will got: "product available at X merchants, best price Y, highest price Z"...
Thanks in advance,
Koen
Hello Koen,
Sure - in pto_product.php look for the following code at line 461:
$html_product = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$html_product);
...and REPLACE with:
$html_product = str_replace("%HIGHEST_PRICE%",$pto_config_currencyHTML.$pto_productResults[count($pto_productResults)-1]->price,$html_product);
$html_product = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$html_product);
...and that will add support for %HIGHEST_PRICE% placeholder.
Cheers,
David.
--
PriceTapestry.com
Hi Koen,
Sure - on the line after your current $title construction, have a go with:
if (count($pto_productResults)>1)
{
$title .= ", (".count($pto_productResults)." merchants compared)";
}
Cheers,
David.
--
PriceTapestry.com