admin/model/customer/custom_field.php
(开头部分) 11KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
class ModelCustomerCustomField extends Model {
public function addCustomField($data) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "custom_field` SET type = '" . $this->db->escape((string)$data['type']) . "', value = '" . $this->db->escape((string)$data['value']) . "', validation = '" . $this->db->escape((string)$data['validation']) . "', location = '" . $this->db->escape((string)$data['location']) . "', status = '" . (int)$data['status'] . "', sort_order = '" . (int)$data['sort_order'] . "'");
$custom_field_id = $this->db->getLastId();
foreach ($data['custom_field_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_description SET custom_field_id = '" . (int)$custom_field_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
}
if (isset($data['custom_field_customer_group'])) {
foreach ($data['custom_field_customer_group'] as $custom_field_customer_group) {
if (isset($custom_field_customer_group['customer_group_id'])) {
$this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_customer_group SET custom_field_id = '" . (int)$custom_field_id . "', customer_group_id = '" . (int)$custom_field_customer_group['customer_group_id'] . "', required = '" . (int)(isset($custom_field_customer_group['required']) ? 1 : 0) . "'");
}
}
}
if (isset($data['custom_field_value'])) {
foreach ($data['custom_field_value'] as $custom_field_value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value SET custom_field_id = '" . (int)$custom_field_id . "', sort_order = '" . (int)$custom_field_value['sort_order'] . "'");
$custom_field_value_id = $this->db->getLastId();
foreach ($custom_field_value['custom_field_value_description'] as $language_id => $custom_field_value_description) {
$this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value_description SET custom_field_value_id = '" . (int)$custom_field_value_id . "', language_id = '" . (int)$language_id . "', custom_field_id = '" . (int)$custom_field_id . "', name = '" . $this->db->escape($custom_field_value_description['name']) . "'");
}
}
}
return $custom_field_id;
}
public function editCustomField($custom_field_id, $data) {
$this->db->query("UPDATE `" . DB_PREFIX . "custom_field` SET type = '" . $this->db->escape((string)$data['type']) . "', value = '" . $this->db->escape((string)$data['value']) . "', validation = '" . $this->db->escape((string)$data['validation']) . "', location = '" . $this->db->escape((string)$data['location']) . "', status = '" . (int)$data['status'] . "', sort_order = '" . (int)$data['sort_order'] . "' WHERE custom_field_id = '" . (int)$custom_field_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_description WHERE custom_field_id = '" . (int)$custom_field_id . "'");
foreach ($data['custom_field_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_description SET custom_field_id = '" . (int)$custom_field_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "'");
}
$this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_customer_group WHERE custom_field_id = '" . (int)$custom_field_id . "'");
if (isset($data['custom_field_customer_group'])) {
foreach ($data['custom_field_customer_group'] as $custom_field_customer_group) {
if (isset($custom_field_customer_group['customer_group_id'])) {
$this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_customer_group SET custom_field_id = '" . (int)$custom_field_id . "', customer_group_id = '" . (int)$custom_field_customer_group['customer_group_id'] . "', required = '" . (int)(isset($custom_field_customer_group['required']) ? 1 : 0) . "'");
}
}
}
$this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_value WHERE custom_field_id = '" . (int)$custom_field_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "custom_field_value_description WHERE custom_field_id = '" . (int)$custom_field_id . "'");
if (isset($data['custom_field_value'])) {
foreach ($data['custom_field_value'] as $custom_field_value) {
if ($custom_field_value['custom_field_value_id']) {
$this->db->query("INSERT INTO " . DB_PREFIX . "custom_field_value SET custom_field_value_id = '" . (int)$custom_field_value['custom_field_value_id'] . "', custom_field_id = '" . (int)$custom_field_id . "', sort_order = '" . (int)$custom_field_value['sort_order'] . "'");
后面还有 152 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
