public function CommerceSmartImporerService::exportPrice in Commerce Smart Importer 8
Helper function for exportField.
Exports price.
1 call to CommerceSmartImporerService::exportPrice()
- CommerceSmartImporerService::exportField in src/
Plugin/ CommerceSmartImporerService.php - Force different types of fields to string.
File
- src/
Plugin/ CommerceSmartImporerService.php, line 1643 - Main Commerce Smart Importer Service.
Class
- CommerceSmartImporerService
- This is main Commerce Smart Importer Service.
Namespace
Drupal\commerce_smart_importer\PluginCode
public function exportPrice($entity, $field_definition) {
$values = [];
foreach ($entity
->get($field_definition['machine_names'])
->getValue() as $item) {
$field = $item;
$values[] = number_format($field['number'], 2, '.', '');
}
$values = implode('|', $values);
return $values;
}