You are here:  » Filters

Support Forum



Filters

Submitted by scorpionwsm on Sat, 2007-07-07 14:28 in

God help you now :)

I just used the filters for one merchant and may I say brilliant to get rid of the & to replace with & or and.

Saves a hell of a lot of time needing to edit a product feed if there are mistakes but..............

If there anyway that there can be a global filter than will remove every dodgy character from every merchant.

There would be a lot of feeds that do contain the & so having to set filters up for every single merchant, on every single merchant will become tedious.

Apart from that, starting to love this script more and more.

Regards

Mark

Submitted by support on Sat, 2007-07-07 15:46

Hi Mark,

The best (and fastest) way to implement the equivalent of "global filters" is to write the necessary code directly into the import record handler in includes/admin.php.

In that file, look for the following comment on line 156:

    /* apply standard filters */

Immediately after this line, you can process any of the record values in any way you want. For example, to replace the & character with "and", you could add the following code:

$record[$admin_importFeed["field_name"]] = str_replace("&","and",$record[$admin_importFeed["field_name"]]);

You can add as many similar lines as you like, and to modify fields other than name, replace field_name with field_description, field_brand, field_category etc..

Hope this helps!
Cheers,
David.

Submitted by scorpionwsm on Sat, 2007-07-07 16:37

I want your babies, and if I can have them, were be millionaires

Submitted by scorpionwsm on Sat, 2007-07-07 17:09

Ok forget our babies for the moment,

I tried but for some reason I'm getting a whole product site map

http://www.fashion-shopping.co.uk/category/

Might be handy but god knows why lol

Submitted by support on Sat, 2007-07-07 17:12

Hi Mike,

The most likely reason I think is that you have registered a feed with the product name in the category field... that is the only thing that could cause this to happen. If this is the case, you should be able to tell from the product names that are appearing as categories. If you re-register that feed (assuming that only one feed is mis-registered) it should fix itself up...

Cheers,
David.

Submitted by scorpionwsm on Sat, 2007-07-07 18:14

Mike who's Mike? lol

I want your babies and you call me Mike, well Peter

Just to ask, I have one product feed and there are probaly a few dodgy ones where the URL contains &

I have added the following :

$record[$admin_importFeed["field_buy_url"]] = str_replace(";amp","&",$record[$admin_importFeed["field_buy_url"]]);

Would this work or am I always thinking that something is too simple and when I try it, you need to add 100 more lines of code onto it.

Speaking from an affiliates point of view, this thread should be included into the current version of the file, so that you can say that it strips out bad characters.

I am playing with the freemans feed, to which I never noticed any problems until I spent more time looking.

Bad characters that should be stripped are as follows :

&

I did have one which was gt, but that is very rare

I will look for more bad codes in the affiliate feeds, but knowing you can upload and not have to worry adds extra brownie points on for the user.

Regards

Mark or should that be Mike??? I'm confused ;)

Submitted by support on Sat, 2007-07-07 18:19

er, I mean Mark, sorry!

Anyways, regarding your code:

$record[$admin_importFeed["field_buy_url"]] = str_replace(";amp","&",$record[$admin_importFeed["field_buy_url"]]);

The HTML entity for & is
&
... so you may instead need to us:

$record[$admin_importFeed["field_buy_url"]] = str_replace("&","&",$record[$admin_importFeed["field_buy_url"]]);

That should fix it up..

Cheers,
David.