Здравствуйте. Помогите разобраться, как сделать расчет в корзине оптовой и розничной цен, то есть, если количество товара меньше 20, то выводим розничную цену, если больше - оптовую. На данный момент две цены подсчитываются в контроллере таким образом:
// Display prices
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$unit_price = $this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'));
$price = $this->currency->format($unit_price, $this->session->data['currency']);
$total = $this->currency->format($unit_price * $product['quantity'], $this->session->data['currency']);
$unit_opt_price = $this->tax->calculate($product['opt_price'], $product['tax_class_id'], $this->config->get('config_tax'));
$opt_price = $this->currency->format($unit_opt_price, $this->session->data['currency']);
$opt_total = $this->currency->format($unit_opt_price * $product['quantity'], $this->session->data['currency']);
} else {
$price = false;
$total = false;
$opt_price = false;
$opt_total = false;
}
Проблем с отображением в шаблоне оптовой и розничной цен нет, только в итоге вся сумма считается либо по опту, либо по рознице.