You are here:  » Selective import


Selective import

Submitted by dflsports on Fri, 2006-02-03 16:45 in

Just when I think I have done enough, I hurt my brain by thinking of new sites to build.

My question is:

Can I parse the data using MagicParser to only include records with a keyword or maybe if the datafeed has a category field, I only want certain categories?

Thanks you, again and again and again :)

Don

[mod: title edited for clarity]

Submitted by support on Fri, 2006-02-03 19:19

Hi Don,

Absolutely, there's no problem studying the data in $record before deciding whether or not to continue processing it; such as importing the record into a database.

For example, let's say you're looking to import only product records where the description field contains the keyword "DVD". You could do this as follows:

<?php
  
function myRecordHandler($record)
  {
    if (
strpos($record["DESCRIPTION"],"DVD")!==FALSE)
    {
      
// process record as normal
    
}
  }
?>

Hope this helps!