function fn_exim_orders_get_extra($data) { if (!empty($data)) { $data = @unserialize($data); return YAML_Parser::serialize($data); } return ''; }
function fn_exim_get_extra_fields($user_id, $lang_code = CART_LANGUAGE) { $fields = array(); $_user = db_get_hash_single_array("SELECT d.description, f.value FROM ?:profile_fields_data as f LEFT JOIN ?:profile_field_descriptions as d ON d.object_id = f.field_id AND d.object_type = 'F' AND d.lang_code = ?s WHERE f.object_id = ?i AND f.object_type = 'U'", array('description', 'value'), $lang_code, $user_id); $_profile = db_get_hash_single_array("SELECT d.description, f.value FROM ?:profile_fields_data as f LEFT JOIN ?:profile_field_descriptions as d ON d.object_id = f.field_id AND d.object_type = 'F' AND d.lang_code = ?s LEFT JOIN ?:user_profiles as p ON f.object_id = p.profile_id AND f.object_type = 'P' WHERE p.user_id = ?i", array('description', 'value'), $lang_code, $user_id); if (!empty($_user)) { $fields['user'] = $_user; } if (!empty($_profile)) { $fields['profile'] = $_profile; } if (!empty($fields)) { return YAML_Parser::serialize($fields); } return ''; }
function fn_exim_orders_get_extra_fields($order_id, $lang_code = CART_LANGUAGE) { $fields = array(); $_user = db_get_array("SELECT d.description, f.value, a.section FROM ?:profile_fields_data as f LEFT JOIN ?:profile_field_descriptions as d ON d.object_id = f.field_id AND d.object_type = 'F' AND d.lang_code = ?s LEFT JOIN ?:profile_fields as a ON a.field_id = f.field_id WHERE f.object_id = ?i AND f.object_type = 'O'", $lang_code, $order_id); if (!empty($_user)) { foreach ($_user as $field) { if ($field['section'] == 'B') { $type = 'billing'; } elseif ($field['section'] == 'S') { $type = 'shipping'; } else { $type = 'user'; } $fields[$type][$field['description']] = $field['value']; } } if (!empty($fields)) { return YAML_Parser::serialize($fields); } return ''; }