You are here:  » Finding Unmatched Products

Support Forum



Finding Unmatched Products

Submitted by dbfcs on Thu, 2012-03-22 14:15 in

Hi David.

I'm currently working through a dozen data feeds and grouping all the products up into new instances.

Is there a way I can output a list of products that have not been grouped yet, to see if I've missed any or to quickly and easily see new products upon updating the feeds?

Thanks,

Dave

Submitted by support on Thu, 2012-03-22 14:42

Hi Dave,

Sure, have a go with the following, to be run from Price Tapestry installation folder.

unmatched.php:

<?php
  
require("includes/common.php");
  
header("Content-Type: text/plain");
  
$sql "SELECT name, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` GROUP BY name HAVING numMerchants=1";
  
database_querySelect($sql,$rows);
  foreach(
$rows as $row)
  {
    print 
$row["name"]."\n";
  }
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by dbfcs on Thu, 2012-03-22 15:35

David,

That's a cracking bit of code. I've adapted it to filter out any Grouped names that are identical to the original product names and have added the merchant.

<?php
$sql 
"SELECT a.name,a.merchant,COUNT(a.id) AS numMerchants FROM ".$config_databaseTablePrefix."products a LEFT JOIN ".$config_databaseTablePrefix."productsmap b ON a.name=b.name WHERE b.name IS NULL GROUP BY a.name HAVING numMerchants=1 ORDER BY a.merchant ASC, a.name ASC";
?>

I've added a new page in my admin area that then lists the merchants and the offending products underneath each one. It's a huge time saver!

Thanks,

Dave