function _webform_csv_data_productfield in Commerce Webform 7
Same name and namespace in other branches
- 8 productfield.inc \_webform_csv_data_productfield()
- 7.2 productfield.inc \_webform_csv_data_productfield()
Implements _webform_csv_data_component().
File
- ./
productfield.inc, line 583
Code
function _webform_csv_data_productfield($component, $export_options, $values) {
$options = $component['extra']['items'];
foreach ($values as $id => $value) {
$values[$id] = json_decode($value);
}
$return = array();
foreach ($options as $key => $item) {
$index = FALSE;
foreach ($values as $value) {
if ($value->product_id == $key) {
$index = $value;
}
}
if ($index !== FALSE) {
if (!empty($index->paid)) {
$return[] = $index->quantity;
$return[] = '0';
}
else {
$return[] = '0';
$return[] = $index->quantity;
}
}
else {
$return[] = '0';
$return[] = '0';
}
}
return $return;
}