我正在创建一个本地运输的自定义运输模块。我创建了一个自定义字段,可以对每个客户进行检查以启用/禁用该模块。我需要能够提取自定义字段和自定义字段的值。另一个问题是该字段被禁用,因此它仅显示在管理员端,而不显示在客户端。
我尝试使用以下内容,但它仅捕获活动字段,而不显示值。
// Custom Fields
$data['custom_fields'] = array();
$this->load->model('account/custom_field');
$custom_fields = $this->model_account_custom_field->getCustomFields($this->config->get('config_customer_group_id'));
foreach ($custom_fields as $custom_field) {
if ($custom_field['location'] == 'account') {
$data['custom_fields'][] = $custom_field;
}
}
print_r($data['custom_fields']);
我还尝试了以下查询,该查询将返回所有字段,但不返回值。
$custom_field_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "custom_field_customer_group` cfcg LEFT JOIN `" . DB_PREFIX . "custom_field` cf ON (cfcg.custom_field_id = cf.custom_field_id) LEFT JOIN `" . DB_PREFIX . "custom_field_description` cfd ON (cf.custom_field_id = cfd.custom_field_id) WHERE cf.status = '1' AND cfd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cfcg.customer_group_id = '" . (int)$customer_group_id . "' ORDER BY cf.sort_order ASC");