You are here

protected function FeedsCommercePricelistItemProcessor::map in Commerce Pricelist 7

Parameters

FeedsSource $source:

FeedsParserResult $result:

null $target_item:

Return value

array|null

File

commerce_pricelist_feeds/plugins/FeedsCommercePricelistItemProcessor.inc, line 197
FeedsUserProcessor class.

Class

FeedsCommercePricelistItemProcessor
Feeds processor plugin. Create users from feed items.

Code

protected function map(FeedsSource $source, FeedsParserResult $result, $target_item = NULL) {
  $target_item = parent::map($source, $result, $target_item);
  if ($source->importer->processor->config['convert_price'] == 1) {

    // Convert price to minor currency
    $target_item->price_amount = $target_item->price_amount * 100;
  }
  if ($source->importer->processor->config['convert_dates'] == 1) {

    // convert date strings to unix timestamp
    $target_item->valid_from = strtotime($target_item->valid_from);
    $target_item->valid_to = strtotime($target_item->valid_to);
  }
  return $target_item;
}