You are here:  » Add Brand to Product Name

Support Forum



Add Brand to Product Name

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

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.

Submitted by lisbali12 on Mon, 2013-02-04 18:36

Hi David,

Sorry to hijack this one. I'm trying to do the same as Jon did - to add the brand name onto the product name using a add text before filter where merchants don't put brand in their product titles. It works great, except that I also get \""\ showing with the brand on my results pages (i.e. \"brand name \" product name). The brand field for this particular merchant is BRAND/BRANDNAME so I'm wondering whether the slash is causing problems but am otherwise clueless! Also, when there is no brand for a paricular product, I get the full \"%BRAND/BRANDNAME% \" showing instead. Any ideas how I can get rid of this?

Many thanks,

Lis

Submitted by lisbali12 on Tue, 2013-02-05 09:06

Hi again,

Sorry to be a pain - I've found out what the issue is (PHP's Magic Quotes)and implemented the includes/widget.php change as per http://www.pricetapestry.com/node/4440

That has taken care of the extra slashes. I still get the quotation marks showing around the brand name though - is there some way of removing these too?

Many thanks,

Lis

Submitted by support on Tue, 2013-02-05 09:17

Hi Lis,

If you're seeing quotation-marks around a value that would indicate that the feed is possibly quoted-text but has not been auto-detected. On Feed Registration Step 1, rather than use the auto-detected format string, select the correct format from the drop-down box, for example "Quoted Text - Header Row - Comma Separated" - that should be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by lisbali12 on Tue, 2013-02-05 09:25

I'm sorry, I'm having one of those days (all too common unfortunately!) - it's all fine now - fixed as per my last message. All I needed to do was remove the quotes still in the filter.

Another cup of coffee methinks!