You are here:  » Global Filters

Support Forum



Global Filters

Submitted by wdekreij on Thu, 2007-02-22 22:03 in

Is it possible to use a "search and replace" filter automaticly for each feed?

In fact, I want to have the possibility to "hotlink" keywords in descriptions (for SEO), and this would be the best option I guess..

Thanks in advance,

Wilco

Submitted by support on Fri, 2007-02-23 08:07

Hi Wilco,

There is no global filter feature as such, but it is straight forward to embed global search and replace code on every field into the import record handler function in includes/admin.php.

Find the following function, beginning on line 124:

function admin__importRecordHandler($record)

Then scroll down to find the following comment:

/* create product record */

Immediately after this line, and before the SQL statement is generated is the place to make any global changes to the field values. In the case of the description; a search and replace might be done as follows, here creating a link from the word example to a website - which sounds like it is the sort of thing you want to do:

$record[$admin_importFeed["field_description"]] = str_replace("example","<a href='http://www.example.com/'>example</a>",$record[$admin_importFeed["field_description"]]);

Hope this helps!
Cheers,
David.