You are here:  » Remove text before filter

Support Forum



Remove text before filter

Submitted by paddyman on Sat, 2008-08-09 12:27 in

Hi David,

Think I remember this mentioned on the forum before but can't find it in the forum search.

Looking to remove some text before http://www.merchant.com as follows

http://webgains.com/click.html?wgcampaignid=12345&wgprogramid=123&product=45678wgtarget=http://www.merchant.com/product

Could do a search and replace but the text before http://www.merchant.com will sometimes be different.

Is there any filter I could use when importing?

Thanks

Adrian

Submitted by support on Sat, 2008-08-09 14:01

Hi Adrian,

The "Explode" filter should do the trick; use the version in this thread:

http://www.pricetapestry.com/node/2017

Then, if you add a new Explode filter to the field containing the above text; and use "wgtarget=" (without the quotes) as the explode character or string; a return index of "1" will return the text after that point (provided it doesn't appear again, which doesn't look like it would be a problem!)...

Cheers,
David.

Submitted by paddyman on Sat, 2008-08-09 15:37

Thanks David,

That works great :)

Submitted by paddyman on Sat, 2008-08-09 15:48

Hi David,

One more thing on this, kind of related.

Have the following link in my buy_url field which comes from the merchant feed "deeplink" field

http://webgains.com/click.html?wgcampaignid=12345&wgprogramid=123&product=45678wgtarget=http://www.merchant.com/product

Was hoping to also register this link in another field in my database (merchanturl). Have done this but when selecting the explode filter, the field drop down list contains only one reference to deeplink "Merchanturl(deelplink)", which has replaced buy_url(deeplink). This means that when I run the explode filter, both fields in the database get filtered.

Any ideas on how to register the field twice ?

Hope this makes sense.

Adrian

Submitted by support on Sat, 2008-08-09 15:52

Hi,

One trick you can use here, particularly with XML feeds, is if there is a field in the feed that is always blank; you can register that as one of the fields that you want to have a copy of a value from another field in.

Then, add a "Text After" filter and use the placeholder mechanism to copy in the value of the other field, using %FIELDNAME%, for example %DEEPLINK%. Note that this filter must come first in order for this to work.

This will give you two fields with the same value which you can then go on to filter separately. If this isn't an option, let me know and it should be straight forward enough to work out a PHP solution within the import record handler function.

Cheers,
David.

Submitted by paddyman on Sat, 2008-08-09 20:18

Hi David,

Have a problem with the filters for my merchanturl field and I can't figure out whats wrong. I've registered a blank field (description) in the feed against Merchanturl. When I go to the setup the textafter filter, on the feeds_filters_configure page the field value is just empty and doesn't show the descrption field. I've tried registering an RRP field I setup against the same description field in the feed and it works fine. Have looked at all instances of merchanturl in my code and all looks similar to the code for the RRP field.

In feeds_filters_configure I have

if ($feed["field_merchanturl"]) $fields[$feed["field_merchanturl"]] = "Merchanturl (".$feed["field_merchanturl"].")";

Any idea what could be going wrong. Can send you on some files if you have time to take a look.

Thanks

Adrian

Submitted by support on Sun, 2008-08-10 10:15

Hi Adrian,

Have you made a similar change in admin/feeds_filters.php. Just like in the file you have modified, look for the following code (line 69):

if ($feed["field_price"]) $fields[$feed["field_price"]] = "Price (".$feed["field_price"].")";

...and on the next line, duplicate that line exactly but for the field you have added, for example:

if ($feed["field_merchanturl"]) $fields[$feed["field_merchanturl"]] = "Merchant URL (".$feed["field_merchanturl"].")";

If that's not the cause; feel free to email me your modified files and i'll check them over for you...

Cheers,
David.

Submitted by paddyman on Sun, 2008-08-10 12:51

Hi David,

It all looked ok but re-added the code again and it works perfectly.

Thanks

Adrian