You are here:  » Related Products Refinement


Related Products Refinement

Submitted by lunen on Wed, 2012-05-30 16:50 in

Hi David,

I have lots of products that are really the same, but the merchants named them different. I was hoping I could capture some of these in the related products, so basically show a very similar result to the search results based on the name of the product, but in the related products field.. Right now my related products don't have much relevancy to the product displayed on the page.

Here's and example: brand name ski jacket, brand name ski jacket men's large, brand name ski jacket black mens -- for this example this is referring to the same product, so when someone is looking at the page for brand name ski jacket -- the brand name ski jacket mens' large & brand name ski jacket black mens will show up in the relevant products.

Thanks!

Submitted by support on Wed, 2012-05-30 18:30

Hi Lunen,

Don't forget of course that Product Mapping can be used to match together the same product where merchants use slightly different names; but of course I appreciate this isn't necessarily practical except for very niche sites.

It may be worth removing the same category clause from the related products selection. To do this look for the following code at line 84 of products.php:

      if ($product["products"][0]["category"])

...and REPLACE with:

      if (FALSE)

With that in place; if merchants are not using identical category names then this should yield better results; however keep an eye on performance as this clause was introduced in order to keep database loading for related products in-check for very large sites; but shouldn't cause any problem for niche / medium sized installations...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by lunen on Thu, 2012-05-31 00:15

David, Below is the code for my related products.. I'm not sure what's gone wrong but the results I'm getting are not relevant to the product on the page. I looked at an older version of PT I had, and it looks like this code has changed considerably. Any ideas with this code? I'm not sure what the database_safe($word) is is that the same as the old database_safe($q)?

 if ($config_useRelated && isset($product))
  {
    $wheres = array();
    $words = explode(" ",$product["products"][0]["name"]);
    foreach($words as $word)
    {
      $where = "search_name LIKE '%".database_safe($word)."%'";
      $wheres[] = $where;
    }
    $where = "(".implode(" OR ",$wheres).")";
    $ids = array();
    foreach($product["products"] as $p)
    {
      $ids[] = $p["id"];
    }
    $where .= " AND id NOT IN (".implode(",",$ids).")";
    $sql = "SELECT id,COUNT(id) AS numMerchants,MIN(price) as minPrice FROM `".$config_databaseTablePrefix."products` WHERE ".$where." GROUP BY search_name LIMIT 6";
    $searchresults["numRows"] = database_querySelect($sql,$rows);
    $ids = array();
    foreach($rows as $row)

Submitted by support on Thu, 2012-05-31 07:58

Hi Lunen,

Ah - that was experimental new index strategy code that I forwarded, and yes it is considerably different to the distribution version. Since this is not returning relevant results in this instance (it is the inclusion of category that could potentially cause performance issues) if this part of the script did not cause performance issues on your site then I would recommend re-instating the distribution version of the Featured Products code; and check that product page performance is OK; If you're not sure which code to replace email me your current version and I'll revert the code for you.

Either way; I will continue to look at the featured products code using the new index strategy in order to improve relevancy...

Cheers,
David.
--
PriceTapestry.com