You are here:  » Group Offers per EAN in Search Results


Group Offers per EAN in Search Results

Submitted by marco.saiu on Wed, 2017-12-27 19:37 in

Dear David,

i try to group results in search page per ean (if possible).

I apply group per ean in product.php with apply this code:

https://www.pricetapestry.com/node/3217

But in search.php not work!

I use latest PT version.

Thanks,
Marco Saiu

Submitted by support on Thu, 2017-12-28 09:23

Hello Marco,

The equivalent REPLACEment for additional grouping by `ean` (product page only) to the modification described in node 3217 would be;

    $sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' ORDER BY price";
    $numRows = database_querySelect($sql,$rows);
    $ean = "";
    foreach($rows as $row)
    {
      if ($row["ean"])
      {
        $ean = $row["ean"];
        break;
      }
    }
    if ($ean)
    {
      $sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' OR ean='".database_safe($ean)."' ORDER BY price";
      $numRows = database_querySelect($sql,$rows);
    }

However, this would still leave search results ungrouped. What would be a much better approach as you have ean available would be Automatic Product Mapping by Unique ID ...

Cheers,
David.
--
PriceTapestry.com

Submitted by marco.saiu on Thu, 2017-12-28 09:53

Thanks!