'How to see discount price only the product page in opencart
I have an extension. Customer discount. I want to see the discounted product price at the cart and at the bill. How can I do it?
see what I want
<?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;
}
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|