You are here:  » Showing number of merchants being compared in search results page

Support Forum



Showing number of merchants being compared in search results page

Submitted by paddyman on Tue, 2009-11-17 17:50 in

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.

Many thanks

Adrian

Submitted by support on Tue, 2009-11-17 17:58

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.

Submitted by paddyman on Tue, 2009-11-17 18:08

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

Submitted by support on Tue, 2009-11-17 18:54

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.

Submitted by paddyman on Tue, 2009-11-17 19:02

Excellent

Thanks

Adrian