Php 如何在opencart中仅查看产品页面的折扣价格
我有分机。顾客折扣。我想看看购物车和账单上的折扣产品价格。我该怎么做?Php 如何在opencart中仅查看产品页面的折扣价格,php,opencart,opencart-3,discount,opencart-module,Php,Opencart,Opencart 3,Discount,Opencart Module,我有分机。顾客折扣。我想看看购物车和账单上的折扣产品价格。我该怎么做? 您正在上传购物车页面截图?opencart已经为产品页面上显示的折扣价格提供了功能。 <?php class ModelExtensionTotalCustomerDiscount extends Model { public function getTotal($total) { if ($this->cart->getSubTotal() > 0) {
您正在上传购物车页面截图?opencart已经为产品页面上显示的折扣价格提供了功能。
<?php
class ModelExtensionTotalCustomerDiscount extends Model {
public function getTotal($total) {
if ($this->cart->getSubTotal() > 0) {
$this->load->language('extension/total/customer_discount');
$price = 0;
$special->row['discount'] = 0;
if(isset($this->session->data['customer_id']) && $this->session->data['customer_id'] > 0) {
$special = $this->db->query("SELECT discount FROM " . DB_PREFIX . "customer WHERE customer_id = '".(int)$this->session->data['customer_id']."'");
if(isset($special->row['discount']) && $special->row['discount'] > 0) {
$price = ($special->row['discount'] / 100) * $this->cart->getSubTotal();
}
}
if ($price > 0) {
$total['totals'][] = array(
'code' => 'customer_discount',
'title' => sprintf($this->language->get('text_discount'),$special->row['discount'].'%'),
'value' => - $price,
'sort_order' => $this->config->get('total_customer_discount_sort_order')
);
$total['total'] -= $price;
}
}
}
}