You are here:  » Drop Record if Name is equal to desciption text.

Support Forum



Drop Record if Name is equal to desciption text.

Submitted by BobL on Sat, 2012-11-03 14:58 in

Hi David,
I've searched multiple ways trying to find an answer here but keep coming up empty handed..

Is there a way to filter out records where the only thing in the description field is a "exact" repeat of the of the product name field?
By this I mean there is no additional text, just the text of the product name.

Thanks.

Submitted by support on Sat, 2012-11-03 16:08

Hi Bob,

Probably easiest inserted into the validation section of the import record handler function in includes/admin.php. In that file, look for the following comment at line 312:

  /* check product record for minimum required fields */

...and REPLACE with:

  /* check product record for minimum required fields */
  if ($importRecord["description"]==$importRecord["name"]) return;

Cheers,
David.
--
PriceTapestry.com

Submitted by BobL on Sat, 2012-11-03 23:53

Bob L.

For some unknown reason, that didn't work on all of them...??

Submitted by support on Sun, 2012-11-04 09:16

Hi Bob,

Could be a difference in white space before / after the field value - perhaps try:

  if (trim($importRecord["description"])==trim($importRecord["name"])) return;

...or to ignore spaces and case altogether, you could use:

  if (
      str_replace(" ","",strtolower($importRecord["description"]))
      ==
      str_replace(" ","",strtolower($importRecord["name"]))
     ) return;

Hope this helps!

Cheers,
David.
--
PriceTapestry.com