I have an importer which works well when I start the import from browser. It has a tamper plugin to put a default value to a field.

But when I start the import from code, everything works except the tamper plugin. Here is the code I am usinng to start importer:

$feedSource = feeds_source('my_importer');
while (FEEDS_BATCH_COMPLETE != $feedSource->import());

Do I need to specify the config of the importer from the code, to include tamper settings?

Comments

Sinan Erdem created an issue. See original summary.

Sinan Erdem’s picture

Status: Active » Closed (works as designed)

It looks like the problem is originating from another module "Feeds Extensible Parsers". I created an issue here: #2709401: When running importer from code, only one field is updated properly

dimexz’s picture

Status: Closed (works as designed) » Active

Got same problem with common CSV parser.

Undefined index: NNN in feeds_tamper_load_by_importer()

dimexz’s picture

An alternative way to run import from CLI is using Drush Feeds Import sandbox module (need 'Process in Background' configured):

drush vset feeds_process_limit 50000
drush feeds-import --feed-id=importer_id
drush vset feeds_process_limit 50

In this case tamper works fine.

dimexz’s picture

UPD: Since 7.53 Drupal and 8.1 drush (logic & syntax changed):

drush vset feeds_process_limit 100
drush -y feeds-import importer_id
MegaChriz’s picture

@dimexz
Since 7.x-2.0-beta3 you also no longer need to use the Drush Feeds Import sandbox module. Drush support is now built-in!
For more information about the command 'feeds-import', see also https://drushcommands.com/drush-7x/feeds/feeds-import or type drush help feeds-import.