You are here:  » Drop product and categories before during Import

Support Forum



Drop product and categories before during Import

Submitted by webie on Fri, 2012-09-28 14:58 in

HI is there a way of hard coding this if keywords are found then drop product.

Regards

Darren

Submitted by support on Fri, 2012-09-28 15:50

Hello Darren,

Sure - it sounds like the Drop Record / Drop Record RegExp filters are what you need.

The "Drop Record" filter takes a single keyword parameter and if the field to which it has been applied (so in your case you would want to add the filter to both Category and Product Name fields) contains the keyword at any position then the product is dropped (so in the case of using the "Drop Record" filter against the Category field after import there would be no category on your site containing that text).

The "Drop Record RegExp" allows you to specify multiple keywords to match using a regular expression. The format is as follows:

(Keyword1|Keyword2|Keyword3)

...which is a RegExp (Regular Expression) that will match any of Keyword1, Keyword2 or Keyword3, and if so the product will not be imported.

Don't forget to re-import all feeds after adding or changing filters as they are applied at import time.

Cheers,
David.
--
PriceTapestry.com

Submitted by webie on Fri, 2012-09-28 17:49

HI David,

Is it possible to add this to the admin.php instead of the db table.

Regards

Darren

Submitted by support on Fri, 2012-09-28 18:06

Hi Darren,

Sure - common to all distributions of Price Tapestry is this comment in includes/admin.php

    /* create product record */

I assume that a common list of keywords to drop records can be applied to both the product name and category fields, so have a go with the folloing code, inserted immediately before the above comment:

  $dropIfContains = array("keyword1","keyword2","keyword3","etc");
  foreach($dropIfContains as $v)
  {
    if (
       (stripos($importRecord["name"],$v)!==FALSE)
       ||
       (stripos($importRecord["category"],$v)!==FALSE)
       )
       return;
  }

Cheers,
David.
--
PriceTapestry.com