You are here:  » Some products showing 'More information' button instead of 'Compare ... prices'


Some products showing 'More information' button instead of 'Compare ... prices'

Submitted by Kees on Wed, 2017-08-30 08:11 in

Hi,

I want to thank you for your time, love your script.

I'm having an issue with some items on my site. Some items will only show the 'More information' button even though there are multiple suppliers.

Plugins: "Automatic Product Mapping by Unique ID" and "Redirect Old Pages to Mapped Product"

{link saved}

It shows the 'More information' button even though there are multiple suppliers. On other pages it is showing correctly (search for Samsung or go to the homepage for example).

Submitted by Kees on Wed, 2017-08-30 08:16

Aditional information: The issue seems to be only with the Category page.

On the homepage or on other search pages it is displayed with the "Compare ... prices" button.

Submitted by support on Wed, 2017-08-30 08:37

Hello Kees,

Thank you for your comments and welcome to the forum!

What's happening here is that not all merchants will be using the same category name - the search results will only show as compared where numMerchants has returned greater than one, and in the case of a search by category that would require that all merchants use the same category name for a given product.

This is where Category Mapping would come in, enabling you to map other merchants category names for "Barbecue" to "Barbecue" (in this example, it is quite possible that other merchants use "BBQ" so this would be an ideal case for Category Mapping).

In the case of a search by merchant, category or brand it's actually no problem to re-query the result set to get the actual number of compared products and I will include this in the next distribution. To apply to 16/09A, edit search.php and look for the following code beginning at line 501:

      foreach($searchresults["products"] as $k => $product)
      {
        $searchresults["products"][$k] = array_merge($searchresults["products"][$k],$rows3[$product["id"]]);
        $searchresults["products"][$k]["productHREF"] = tapestry_productHREF($searchresults["products"][$k]);
      }

...and REPLACE with:

      foreach($searchresults["products"] as $k => $product)
      {
        $searchresults["products"][$k] = array_merge($searchresults["products"][$k],$rows3[$product["id"]]);
        $searchresults["products"][$k]["productHREF"] = tapestry_productHREF($searchresults["products"][$k]);
      }
      if (isset($parts[1]))
      {
        $ins = array();
        foreach($searchresults["products"] as $k => $product)
        {
          $ins[] = "'".database_safe($product["name"])."'";
        }
        $in = implode(",",$ins);
        $sql4 = "SELECT name,COUNT(*) AS numMerchants FROM `".$config_databaseTablePrefix."products`
                   WHERE name IN (".$in.") GROUP BY name";
        database_querySelect($sql4,$rows4);
        $numMerchants = array();
        foreach($rows4 as $row)
        {
          $numMerchants[$row["name"]] = $row["numMerchants"];
        }
        foreach($searchresults["products"] as $k => $product)
        {
          $searchresults["products"][$k]["numMerchants"] = $numMerchants[$product["name"]];
        }
      }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Kees on Wed, 2017-08-30 08:48

Hi David,

Thanks! This fixed my issue. Great response time by the way.

Greetings,
Kees