You are here:  » Feed field priority


Feed field priority

Submitted by fabio on Sun, 2017-04-23 15:32 in

Hi David,

question time ;)

Let's say I have 3 feeds.

Feed A
Feed B
Feed C

I import them all and then I would like to :

use namne from feed A, description from feed B, and image of feed C in my product pages.

Is it possible ?

Fabio

Submitted by support on Mon, 2017-04-24 09:48

Hello Fabio;

Sure - in html/product.php look for the following code at line 2:

  $product_main = $product["products"][0];

...and REPLACE with:

  $product_main = $product["products"][0];
  $product_priority["original_name"] = "Merchant A";
  $product_priority["description"] = "Merchant B";
  $product_priority["image_url"] = "Merchant C";
  foreach($product_priority as $field => $merchant)
  {
    foreach($product["products"] as $p)
    {
      if (($p["merchant"] == $merchant) && $p[$field])
      {
        $product_main[$field] = $p[$field];
      }
    }
  }
  $product_main["name"] = $product_main["original_name"];

Edit the $product_priority array with the merchant names as required. The last line of the replacement sets the main name to the original_name field of the preferred merchant for that field (since for compared products name will be the same for all records)...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com