You are here:  » Kelkoo Feeds


Kelkoo Feeds

Submitted by macland on Sun, 2017-08-27 04:38 in

Hi David

I don't know if you have time to help me or if I need to hire a programmer but I have a question about Kelkoo which I've just started working with :-)

Kelkoo provides 2 feedtypes:

- A feed with information about all the merchants (example at {link savd}
- A feed with information about all the products ({link saved})

There are hundreds of product feeds and one merchant feed.

I have modified and used the bulk.php that you have made for me before to be able to load and register all the feeds.
The problem is that the product feed don't use the merchants name, only their UID, which can then be translated to the name in the merchant feed.
Since there are hundreds of merchants, changing all the time and I'm in several languages adding filters manually is not an option.

What I imagine I need to do is to
- make a new table with the merchant info
- copy and modify the automation-tool code to be able to load the merchant feed
- during import in the bulk php, have a UID lookup in this table and inserting the merchant name instead of the UID
- modify my cronjob so I first import the merchant feed to get the latest updates here, then run the rest as usuall

Or maybe it's another way - as I said I don't know if you are able to help me with this, but if you can let me know if I'm in the right lane of thinking that would be very helpfull :-)

Thank you

Submitted by support on Tue, 2017-08-29 09:23

Hi,

A new filter can be created to convert the merchant ID to the merchant name. First, download the merchant meta data feed to the feeds folder as kelkoo_merchants.xml. Of course, you can create an Automation Tool job to do this just as you will be having the main feed downloaded.

By default filters cannot be added to the Merchant field however this can be changed easily. To do this, edit admin/feeds_filters.php and look for the following code at line 10:

  require("../includes/filter.php");

...and REPLACE with:

  require("../includes/filter.php");
  $config_fieldSet["merchant"] = "Merchant";

And similarly edit admin/feeds_filters_configure.php and look for the following code at line 10:

  require("../includes/filter.php");

...and REPLACE with:

  require("../includes/filter.php");
  $config_fieldSet["merchant"] = "Merchant";

With that in place, add the following new code to includes/filter.php to add the "Kelkoo Merchant" filter:

  /*************************************************/
  /* kelkooMerchant */
  /*************************************************/
  $filter_names["kelkooMerchant"] = "Kelkoo Merchant";
  function filter_kelkooMerchantConfigure($filter_data)
  {
    print "<p>There are no additional configuration parameters for this filter.</p>";
  }
  function filter_kelkooMerchantValidate($filter_data)
  {
  }
  function filter_kelkooMerchantExec($filter_data,$text)
  {
    global $config_feedDirectory;
    global $filter_kelkooMerchantByID;
    if (!isset($filter_kelkooMerchantByID))
    {
      $merchants = simplexml_load_string(file_get_contents($config_feedDirectory."kelkoo_merchants.xml"));
      foreach($merchants as $merchant)
      {
        $attributes = $merchant->attributes();
        $id = (int)$attributes["id"];
        $name = (string)$merchant->name;
        $filter_kelkooMerchantByID[$id] = $name;
      }
    }
    return $filter_kelkooMerchantByID[$text];
  }

You will then be able to register the Kelkoo feed with the merchant ID field selected as the Merchant Name, and then add a new "Kelkoo Merchant" filter to the Merchant field to apply the ID to name translation at import time...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com