You are here:  » Exclude specific merchants from comparison.


Exclude specific merchants from comparison.

Submitted by stonecold111 on Fri, 2013-08-23 08:22 in

Hi David,
is it possible to exclude specific merchants from price comparison? I want them on the site for visitors to browse on their merchant pages but I don't want them being compared with other merchants because their reputations aren't good. Thank you.

Submitted by support on Fri, 2013-08-23 12:17

Hi,

It's straight forward to exclude specific merchants from /product/ pages. I know you're using the WordPress plugin, so in this case look for the following code at line 17 of pto_product.php:

  $sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' ORDER BY price";

...and REPLACE with:

  $sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' AND merchant NOT IN ('Merchant 1','Merchant 2') ORDER BY price";

However, I think you would want to combine this with linking direct to merchant on search result pages for that merchant, and you could do this by looking for the following code at line 58 of pto_common.php:

  if (isset($product->api))

...and REPLACE with:

  $directToMerchant = array('Merchant 1','Merchant 2');
  if (
     isset($product->api)
     ||
     (
       isset($product->numMerchants)
       &&
       ($product->numMerchants == 1)
       &&
       in_array($product->merchant,$directToMerchant)
     )
  )

Cheers,
David.
--
PriceTapestry.com

Submitted by stonecold111 on Fri, 2013-08-23 15:08

Do I need to put something like %directToMerchant% in the search page settings to get its links to show up?

Submitted by support on Fri, 2013-08-23 18:19

Hello Lau,

I know your search code has been modified already so `merchant` will need to be added to the select for this to work. In your modified pto_search.php (based on the last version I sent to you by email) look for the following code at line 35:

  $pto_searchSelect = "SQL_CALC_FOUND_ROWS id,COUNT(id) AS
  numMerchants,MIN(price) as minPrice,MIN(retailprice) as
  minRetailPrice,discount";

...and REPLACE with;

  $pto_searchSelect = "SQL_CALC_FOUND_ROWS id,COUNT(id) AS
  numMerchants,MIN(price) as minPrice,MIN(retailprice) as
  minRetailPrice,discount,merchant";

This will add `merchant` to the selected fields, for use by the above mod.

Cheers,
David.
--
PriceTapestry.com

Submitted by stonecold111 on Sat, 2013-08-24 20:39

Hi,
I've added the code, but no direct links are shown on the excluded merchant page. Do I need to add a placeholder? Adding %DB_MERCHANT% or %MERCHANT% to the table doesn't change anything.