Схема
public mixed
getTotal (
&$total_data, &$total, &$taxes )
Аргументы
Аргумент |
Возможный тип |
Описание |
&$total_data |
— |
— |
&$total |
— |
— |
&$taxes |
— |
— |
Описание
Метод пока еще не документирован.
Исходный код
if (isset($this->session->data['reward'])) {
$this->language->load('total/reward');
$points = $this->customer->getRewardPoints();
if ($this->session->data['reward'] <= $points) {
$discount_total = 0;
$points_total = 0;
foreach ($this->cart->getProducts() as $product) {
if ($product['points']) {
$points_total += $product['points'];
}
}
$points = min($points, $points_total);
foreach ($this->cart->getProducts() as $product) {
$discount = 0;
if ($product['points']) {
$discount = $product['total'] * ($this->session->data['reward'] / $points_total);
if ($product['tax_class_id']) {
$tax_rates = $this->tax->getRates($product['total'] - ($product['total'] - $discount), $product['tax_class_id']);
foreach ($tax_rates as $tax_rate) {
if ($tax_rate['type'] == 'P') {
$taxes[$tax_rate['tax_rate_id']] -= $tax_rate['amount'];
}
}
}
}
$discount_total += $discount;
}
$total_data[] = array(
'code' => 'reward',
'title' => sprintf($this->language->get('text_reward'), $this->session->data['reward']),
'text' => $this->currency->format(-$discount_total),
'value' => -$discount_total,
'sort_order' => $this->config->get('reward_sort_order')
);
$total -= $discount_total;
}
}