You are here:  » Display Number of seller on searchresult page

Support Forum



Display Number of seller on searchresult page

Submitted by technoarenasol on Mon, 2012-10-22 06:50 in

Hi David

How to display number of merchant like this :

Nokia 302
(image)
(3 seller)
(price)

Thank you
amin

Submitted by support on Mon, 2012-10-22 08:10

Hello Amin,

In html/featured.php within the loop to display each featured product you can use the following code wherever required:

<br /><?php ?> Seller

So for example to show the number of sellers after the image; look for the following code at line 12:

          <?php endif; ?>

...and REPLACE with:

          <br /><?php print $product["numMerchants"]; ?> Seller
          <?php endif; ?>

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Mon, 2012-10-22 08:42

technoarenasol

Thank you David

Submitted by technoarenasol on Wed, 2012-10-24 09:30

technoarenasol

Hi David...Its working but also count variant products means count 3 If three variant products in one seller ..

1st seller : 1 variant
2nd seller : 3 variants
3rd Seller : 1 variant

So its display (5 seller)

Submitted by support on Wed, 2012-10-24 09:57

Hi, technoarenasol

This would require a re-query since the search results are generated from a summary query. It will be fast so shouldn't cause any problems but keep an eye on page load time. Firstly, add the following code at the top of html/searchresults.php

<?php
  
function numSellers($name)
  {
    global 
$config_databaseTablePrefix;
    
$sql "SELECT DISTINCT(merchant) FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($name)."'";
    return 
database_querySelect($sql,$result);
  }
?>

Then as an alternative to the original replacement; use:

          <br /><?php print numSellers($product["name"]); ?> Seller
          <?php endif; ?>

Cheers,
David.
--
PriceTapestry.com