You are here:  » Displaying Number of Merchants

Support Forum



Displaying Number of Merchants

Submitted by paddyman on Mon, 2009-06-08 12:23 in

Hi David,

Just wondering if it would be possible to display the number of merchants compared beside Stockist in the prices table. So if prices were listed for 10 merchants then prices table would show

Stockists (10)

Adrian

Submitted by support on Mon, 2009-06-08 13:34

Hi Adrian,

Use this code to get the number of merchants on your site:

  $sql = "SELECT COUNT(*) AS numMerchants FROM `".$config_databaseTablePrefix."feeds`";
  database_querySelect($sql,$rows);
  $numMerchants = $rows[0]["numMerchants"];
  print $numMerchants;

Cheers,
David.

Submitted by paddyman on Mon, 2009-06-08 13:49

Hi David,

Thanks for your reply.

Probably wasn't too clear in my first post as usual :)

Am looking to display the number of merchants which are compared for each individual product and have that number displayed alongside "stockists" in the prices table.

Would this be possible ?

Many thanks

Adrian

Submitted by support on Mon, 2009-06-08 14:00

Hi Adrian,

Yes - in fact numMerchants is already included in the comparison queries; so it should be available for display. If you could post the section of code surround where you want the number to be included I'll show you how to add it..

Cheers,
David.

Submitted by paddyman on Mon, 2009-06-08 14:08

Thanks David

From my Prices.php table

<?php
 
print translate("Stockist"); 
?>
(Number of merchants compared goes here)

Cheers

Adrian

Submitted by support on Mon, 2009-06-08 14:26

Hi Adrian,

Ah, in that case, it's probably easier to use count($products), in other words:

<?php
 
print translate("Stockist")." (".count($products).")";
?>

Cheers,
David.

Submitted by paddyman on Mon, 2009-06-08 14:31

Hi David,

Thats returning a value of 0 for each product. Will I send you on my prices.php ?

Cheers

Adrian

Submitted by support on Mon, 2009-06-08 14:38

Hi Adrian,

Sure - email it over and i'll take a look..!

Cheers,
David.