You are here:  » Merchant Count and Product Count

Support Forum



Merchant Count and Product Count

Submitted by scorpionwsm on Fri, 2007-07-06 15:01 in

Hi David,

Certainly going to make you work for my money thats for sure ;)

I have seen a couple of websites that have something like the following :

We are currently listing [b]100[/b] merchants offering over [b]100[/b] products

Is there a simple way of doing this?

Regards

Mark

Submitted by support on Fri, 2007-07-06 16:09

Hi Mark,

Here's the code for that text:

  $sql = "SELECT count(*) as productCount from ".$config_databaseTablePrefix."products";
  database_querySelect($sql,$rows);
  $productCount = $rows[0]["productCount"];
  $sql = "SELECT count(*) as merchantCount from ".$config_databaseTablePrefix."feeds";
  database_querySelect($sql,$rows);
  $merchantCount = $rows[0]["merchantCount"];
  print "<p>We are currently listing <strong>".$merchantCount."</strong> merchants offering over <strong>".$productCount."</strong> products</p>";

Cheers!
David.

Submitted by scorpionwsm on Fri, 2007-07-06 16:29

Your a usefull chappy.

Any chance of it being able to bring me a beer when I can't be bothered to goto the fridge? ;)

Now that I would pay double for

Regards

Mark

Submitted by support on Fri, 2007-07-06 16:32

No probs.

I'm trying to get exclusive UK distribution rights for this:

http://www.youtube.com/watch?v=9oUWCLBKK3E

Hope this helps!
Cheers,
David

;)

Submitted by scorpionwsm on Sat, 2007-07-07 13:38

Looks good, but knowing me I'll probaly be so drunk I'll end up with black eyes falling to catch them :)

I'm trying to display the brands now as well, and before it was reasonably easy as both were main cats

$sql = "SELECT count(*) as productCount from ".$config_databaseTablePrefix."products";
database_querySelect($sql,$rows);
$productCount = $rows[0]["productCount"];

With the brands though, it is products, then brands

How would I go about doing this?

Cheers David, total star.

Regards

Mark

Submitted by support on Sat, 2007-07-07 15:40

Hi Mark,

Brands is a little trickier because you have to count unique (DISTINCT) brands. This code should do the trick:

$sql = "SELECT count(DISTINCT brand) as brandCount from ".$config_databaseTablePrefix."products";
database_querySelect($sql,$rows);
$brandCount = $rows[0]["brandCount"];

Hope this helps,
Cheers,
David.

Submitted by scorpionwsm on Sat, 2007-07-07 16:30

Perfect

Submitted by kempo on Sun, 2007-09-02 11:00

I put this code into the "index.php" and it did not work. After that IE shows a white blank page. Where should I put it?

Submitted by support on Sun, 2007-09-02 13:31

Hi,

Could you email your modified index.php as an attachment and i'll take a look for you...

Cheers,
David.