Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在opencart中仅查看产品页面的折扣价格_Php_Opencart_Opencart 3_Discount_Opencart Module - Fatal编程技术网

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;
            }
        }
    }
}