Hi David,
I am looking to show the number of merchants being compared for each product in a modified search results page. You previously helped me with counting the number of merchants and displaying the result in the prices table. Trying to get this to work in searchresults.php and have modified the code below, but no joy.
Any idea on how to get count($prices["products"])
working.
<?php
print translate("Compare Prices from")." ".count($prices["products"])." Merchants Now !!";
?>
Many thanks
Adrian
Hi David,
Thanks for that.
Have inserted the variable in my code
<p><a href='<?php print $product["productHREF"]; ?>' title='<?php print translate("Compare All Prices "); ?>'><?php print translate("Compare Prices from")." ".count($product["numMerchants"])." Merchants Now !!"; ?></a></p>
Obviously it prints out the result as being one, but how do I print the number of prices being compared rather than the product ?
Thanks
Adrian
Hi Adrian,
Close - no need for count() - have a go with:
<p><a href='<?php print $product["productHREF"]; ?>' title='<?php print translate("Compare All Prices "); ?>'><?php print translate("Compare Prices from")." ".$product["numMerchants"]." Merchants Now !!"; ?></a></p>
Cheers,
David.
Hi Adrian,
Within the
foreach($searchresults["products"] as $product)
loop in html/searchresults.php, the number of merchants is present in the variable$product["numMerchants"]
You'll see how this is used on line 24:
<?php if ($product["numMerchants"] > 1): ?>
So that's the variable you need to use - if you're still not sure let me know what code you're trying and I'll check it out for you...
Cheers,
David.