You are here:  » new filter, removed brand contents from product name

Support Forum



new filter, removed brand contents from product name

Submitted by mally on Thu, 2009-02-05 23:21 in

Hello David

Would it be possible to create a filter that would remove the contents of brand from the contents for the product name?

Thanks Mally

Submitted by support on Fri, 2009-02-06 09:42

Hi Mally,

This would be quite easily done as a modification to the Search and Replace to make the "Search" string support the same placeholder format, e.g. %fieldname% as the Text Before / After filters. To do this, look for the existing version of the filter_searchReplaceExec function (starting at around line 52 of includes/filter.php):

  function filter_searchReplaceExec($filter_data,$text)
  {
    return trim(str_replace($filter_data["search"],$filter_data["replace"],$text));
  }

...and REPLACE this with:

  function filter_searchReplaceExec($filter_data,$text)
  {
    $filter_data["search"] = filter_recordPlaceholders($filter_data["search"]);
    return trim(str_replace($filter_data["search"],$filter_data["replace"],$text));
  }

Then, add a Search and Replace filter to the Product Name field, and as your Search string, just use:

%BRAND%

(where BRAND is the actual name of the brand field as shown on the Feed Registration (Step 2) page)...and the Replace field blank. That should do the trick!

Cheers,
David.

Submitted by mally on Fri, 2009-02-06 22:21

Hello David

Thanks worked well thanks.

A problem I've also come accross is one a book site I'm trying to setup.

They have the name of the book and the words by Author Name.

Would it be possible to develop some thing that strips everthing in after and including " by" in the product name?

thanks Mally

Submitted by support on Sat, 2009-02-07 14:49

Hi Mally,

I think you may already have the "Explode" filter - if not, the code is in this thread:

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

If you then add the Explode filter, with an "Explode Character or String" value of " by" and return index of 0 (zero) that will return everything in-front of the " by"...

Cheers,
David.