Support forum login

©2006-2012 IAAI Software

Contact Us Privacy Policy

Add Brand to Product Name

Submitted by cascadeclimbers on Mon, 2010-06-21 02:51.

Hi David,

I've got a few new feeds where the merchant does not put the brand name into the product name. Considering my options here I see two options. 1) I could setup a custom scripts as a cron job after that concatenates the two fields into the product name field before import, or 2) Modify the PT import script to add a option when registering the feed to concatenate the field. I'm sure someone else has run into this problem but I haven't found a solution searching the forum.

Cheers, Jon

Submitted by support on Mon, 2010-06-21 07:37.

Hi Jon,

The Text Before filter with an appropriate placeholder should be all you need to do - especially as it's only relevant to a few feeds.

To add the filter to a feed, first, go to Feed Registration (Step 2) and make a note of the exact name of the brand field (for example BRAND, BrandName, brand_name etc.) as it is displayed in the sample data. Then go back to the Admin home page and click Filters alongside the feed. Add a new "Text Before" filter to the Product Name field, and then in the text box on the configuration page, enter:

"%BRAND% "

- without quotes, but note the SPACE on the end - that's important otherwise there would be no space between the brand and the product name after import! Replace BRAND with whatever the feed uses as the actual brand field name of course, and after the next import your product names should include the brand name!

Hope this helps!

Cheers,
David.

Submitted by cascadeclimbers on Tue, 2010-06-22 03:54.

Hi David,

That worked great! Now, my next issue is that there are some affiliates who only include the brand name part of the time in the product name. So, I tried to do a find and replace filter with %Brand and then a text before filter with %Brand and that didn't appear to work. Thoughts?

Thanks, Jon

$> cd /pub
$> more beer

Submitted by support on Tue, 2010-06-22 08:16.

Hi Jon,

The Search and Replace filter doesn't apply placeholders to either the search string, or the replaced string - but it's an easy modification to make it do so.

In includes/filter.php, look for the following code beginning at line 47:

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

...and REPLACE that with:

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

With that in place, you'll be able to include, for example, %Brand% in the search string. The modification will also apply place-holders to the resulting value (e.g. from the replace string), but I think logically you would normally use one or the other.

Cheers,
David.