?> <?php if (is_object($field)) { ?> <dt><?php echo JText::_($field->label); ?> :</dt> <dd> <?php if (is_array($field->value)) { echo '<br />'; foreach ($field->value as $value) { echo '- ' . JText::_($value) . '<br/>'; } } elseif (J2StoreOrdersHelper::isJson(stripslashes($field->value))) { $json_values = json_decode(stripslashes($field->value)); if (is_array($json_values)) { foreach ($json_values as $value) { echo '- ' . JText::_($value) . '<br/>'; } } else { echo JText::_($field->value); } } else { echo JText::_($field->value); } ?> </dd> <?php }
private function processCustomFields($row, $type, $text) { if ($type == 'billing') { $field = 'all_billing'; } elseif ($type == 'shipping') { $field = 'all_shipping'; } elseif ($type == 'payment') { $field = 'all_payment'; } $fields = array(); if (!empty($row->{$field}) && JString::strlen($row->{$field}) > 0) { $custom_fields = $this->getDecodedFields($row->{$field}); if (isset($custom_fields) && count($custom_fields)) { foreach ($custom_fields as $namekey => $field) { if (!property_exists($row, $type . '_' . $namekey) && !property_exists($row, 'user_' . $namekey) && $namekey != 'country_id' && $namekey != 'zone_id' && $namekey != 'option' && $namekey != 'task' && $namekey != 'view') { $fields[$namekey] = $field; } } } } if (isset($fields) && count($fields)) { foreach ($fields as $namekey => $field) { //label /* $tag_label = '[CUSTOM_'.strtoupper($type).'_LABEL:'.strtoupper($namekey).']'; $text = str_replace($tag_label, $field['label'], $text); //value $tag_value = '[CUSTOM_'.strtoupper($type).'_VALUE:'.strtoupper($namekey).']'; if(is_array($field['value'])) { $v = ''; foreach($field['value'] as $value) { $v .= '-'.JText::_($value).'\n'; } $value = $v; } else { $value = JText::_($field['value']); } $text = str_replace($tag_value, $field['value'], $text); */ $string = ''; if (is_array($field['value'])) { foreach ($field['value'] as $value) { $string .= '-' . JText::_($value) . '\\n'; } } elseif (J2StoreOrdersHelper::isJson(stripslashes($field['value']))) { $json_values = json_decode(stripslashes($field['value'])); foreach ($json_values as $value) { $string .= '-' . JText::_($value) . '\\n'; } } else { $string = JText::_($field['value']); } $value = $field['label'] . ' : ' . $string; $tag_value = '[CUSTOM_' . strtoupper($type) . '_FIELD:' . strtoupper($namekey) . ']'; $text = str_replace($tag_value, $value, $text); } } return $text; }