admin/model/localisation/tax_class.php
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
class ModelLocalisationTaxClass extends Model {
public function addTaxClass($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "tax_class SET title = '" . $this->db->escape((string)$data['title']) . "', description = '" . $this->db->escape((string)$data['description']) . "', date_added = NOW()");
$tax_class_id = $this->db->getLastId();
if (isset($data['tax_rule'])) {
foreach ($data['tax_rule'] as $tax_rule) {
$this->db->query("INSERT INTO " . DB_PREFIX . "tax_rule SET tax_class_id = '" . (int)$tax_class_id . "', tax_rate_id = '" . (int)$tax_rule['tax_rate_id'] . "', based = '" . $this->db->escape($tax_rule['based']) . "', priority = '" . (int)$tax_rule['priority'] . "'");
}
}
$this->cache->delete('tax_class');
return $tax_class_id;
}
public function editTaxClass($tax_class_id, $data) {
$this->db->query("UPDATE " . DB_PREFIX . "tax_class SET title = '" . $this->db->escape((string)$data['title']) . "', description = '" . $this->db->escape((string)$data['description']) . "', date_modified = NOW() WHERE tax_class_id = '" . (int)$tax_class_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "'");
if (isset($data['tax_rule'])) {
foreach ($data['tax_rule'] as $tax_rule) {
$this->db->query("INSERT INTO " . DB_PREFIX . "tax_rule SET tax_class_id = '" . (int)$tax_class_id . "', tax_rate_id = '" . (int)$tax_rule['tax_rate_id'] . "', based = '" . $this->db->escape($tax_rule['based']) . "', priority = '" . (int)$tax_rule['priority'] . "'");
}
}
$this->cache->delete('tax_class');
}
public function deleteTaxClass($tax_class_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "tax_class WHERE tax_class_id = '" . (int)$tax_class_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "'");
$this->cache->delete('tax_class');
}
public function getTaxClass($tax_class_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_class WHERE tax_class_id = '" . (int)$tax_class_id . "'");
return $query->row;
}
public function getTaxClasses($data = array()) {
if ($data) {
$sql = "SELECT * FROM " . DB_PREFIX . "tax_class";
$sql .= " ORDER BY title";
if (isset($data['order']) && ($data['order'] == 'DESC')) {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
后面还有 45 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
