You are here:  » Replace Merchant Names?


Replace Merchant Names?

Submitted by ItsDavid on Wed, 2017-01-25 17:53 in

Hello David,

Hope you had a very happy and relaxing New Year.

I am trying to setup a search and replace filter for my merchant names
as per this forum post

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

I have gotten everything setup however when i go to register a filter or global filter the option to select merchant or merchant name is not an option that is available.

The only options i have available in the drop down is as follows.

Product Name

Description

Image URL

Buy URL

Price

Category

Brand

Can you advise on how i can setup a search and replace for my merchant names?

The reason i ask is because some of my merchant names have the word "Affiliate Program" in them and i would like to clean the names up.

Thank you in advance for all your help.

Submitted by support on Thu, 2017-01-26 09:04

Hi David,

To do this, first edit includes/admin.php and look for the following code beginning at line 233:

    /* construct merchant value */
    if ($admin_importFeed["field_merchant"])
    {
      $importRecord["merchant"] = $record[$admin_importFeed["field_merchant"]];
      $importRecord["merchant"] = tapestry_normalise($importRecord["merchant"],"\.");
    }
    else
    {
      $importRecord["merchant"] = $admin_importFeed["merchant"];
    }

DELETE the code from this point, and then look for the following code at line 157:

    $importRecord = array();

...and REPLACE with:

    $importRecord = array();
    /* construct merchant value */
    if ($admin_importFeed["field_merchant"])
    {
      $importRecord["merchant"] = $record[$admin_importFeed["field_merchant"]];
      $importRecord["merchant"] = tapestry_normalise($importRecord["merchant"],"\.");
    }
    else
    {
      $importRecord["merchant"] = $admin_importFeed["merchant"];
    }

Finally, edit admin/feeds_filters.php and look for the following code at line 80:

  require("admin_header.php");

...and REPLACE with:

  require("admin_header.php");
  $config_fieldSet["merchant"] = "Merchant";

You'll then be able to apply filters to the Merchant field just as any other field...

Cheers,
David.
--
PriceTapestry.com

Submitted by tobyhage on Wed, 2017-07-12 15:00

David,

Is it possible to add code

$config_fieldSet["merchant"] = "Merchant";

in config_advanced.php or will this break other code?!

Submitted by support on Thu, 2017-07-13 06:39

Hi Toby,

It would since $config_fieldSet is used by both Feed Registration Step 2 and the import process where in both cases `merchant` is handled slightly differently to the normal fields, so it's best just to override in this case for the purposes of applying filters...

Cheers,
David.
--
PriceTapestry.com