You are here:  »  Filter for brand in product name


Filter for brand in product name

Submitted by sirmanu on Mon, 2018-04-09 17:25 in

Hi David.

I have a merchant which has the half feed without the product brand in the field name.
I have tried filter Text Before with "%brandname% " and "%brandname% - ". However, sometimes, the brandname appears and it ends with a double word (example: Acer Acer Aspire E-15)
Also, when the brandname is empty, it ends with a space in the beggining.
Do you know any filter to fix this issue?
Regards

Submitted by support on Tue, 2018-04-10 08:35

Hi,

What you could do is add %fieldname% placeholder support to the Search / Replace values for the Search and Replace filter. To do this, edit includes/filter.php and look for the following code at line 39 or 50 (18/06A)

    return trim(str_replace($filter_data["search"],$filter_data["replace"],$text));

...and REPLACE with:

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

The for the feed where you have added the Text Before filter to the product name using %brandname%, add a Search and Replace filter immediately _after_ the Text Before filter using Search:

%brandname% %brandname%

and Replace:

%brandname%

Hope this helps!

Cheers,
David.
--
PriceTapestry.com