You are here:  » Import Linkshare RSS feeds to Pricetapestry

Active Forum Topics


Import Linkshare RSS feeds to Pricetapestry

Submitted by senaite on Fri, 2014-02-21 16:50 in

Hi David,
How do I import Linkshare RSS feeds to Pricetapestry?

Thank you

Submitted by support on Fri, 2014-02-21 16:59

Hello Senaite,

Do you have an example URL (I'll remove before publishing your reply) of a particular RSS feed that you're wanting to working with?

Otherwise, Linkshare provide full datafeeds which aren't limited to the standard RSS fieldset and work fine with Price Tapestry.

The only thing to bear in mind is that when automating Linkshare feeds using the Automation Tool in some circumstances (depending on PHP and hosting configuration) you may need to use CURL as the automation handler. To change this, edit your config.advanced.php and change line 43 as follows:

  $config_automationHandler = "curl";

Hope this helps! If you've not yet started using the Automation Tool and you have a feed that you are trying to use at any time if you're not sure how to import it just let me know the feed URL (I'll remove the link before publishing or you can always email me) and I'll check it out on my test server for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by senaite on Fri, 2014-02-21 19:50

Hi David,
Here is the rss feed:

{link saved}

This merchant only offers RSS feed.

Thanks

Submitted by support on Sat, 2014-02-22 11:07

Hello Senaite,

Thanks for the link. As you'll have discovered, this format doesn't have a specific price field (the only required field that is missing) however it does appear in a consistent (e.g. predictable) format within the description, so it can be extracted easily using a new filter.

First of all, edit your includes/filter.php and add the following new code to the end of the file, inserted before the closing PHP tag:

  /*************************************************/
  /* RegExp Extract */
  /*************************************************/
  $filter_names["regExpExtract"] = "RegExp Extract";
  function filter_regExpExtractConfigure($filter_data)
  {
    print "Regular Expression:<br />";
    print "<input type='text' name='match' value='".widget_safe($filter_data["match"])."' />";
    widget_errorGet("match");
    print "<br /><br />";
    print "Return Index: (zero based)<br />";
    print "<input type='text' size='3' name='index' value='".widget_safe($filter_data["index"])."' />";
    widget_errorGet("index");
  }
  function filter_regExpExtractValidate($filter_data)
  {
    if (!$filter_data["match"])
    {
      widget_errorSet("match","required field");
    }
    if (!$filter_data["index"])
    {
      widget_errorSet("index","required field");
    }
  }
  function filter_regExpExtractExec($filter_data,$text)
  {
    if (preg_match($filter_data["match"],$text,$matches))
    {
      return $matches[$filter_data["index"]];
    }
    else
    {
      return "";
    }
  }

Next, register your Linkshare RSS feed as normal, and on Feed Registration Step 2 enter the merchant name and select the following field mappings:

Product Name: TITLE
Description: DESCRIPTION
Image URL:
Buy URL: LINK
Price: DESCRIPTION
Category: CATEGORY
Brand:

...and then Save and Trial Import.

(at this point, it will show as 0 products)

Now from the /admin/ homepage, click Filters alongside the feed, and add a new "RegExp Extract" filter to the Price (DESCRIPTION) field. Configure the filter as follows:

Regular Expression:

/Price: <b>(.*)<\/b>/U

Return Index:

1

Save the filter, and finally re-import. On my test server this results in 423 products.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com