S
S
shad0wcat2017-06-15 18:34:15
PHP
shad0wcat, 2017-06-15 18:34:15

How to display "You save" in Opencart2?

Good afternoon, how to do something in the product / category card with a discounted price, the text "You save x rubles" was displayed?
ea1d8-clip-15kb.png?nocache=1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dim565, 2017-06-16
@shad0wcat

Hello! It works when setting a stock price (not a discount) for a product, I think this is more logical.
Найти:
Найти:

<li>
<h2><?php echo $special; ?></h2>
</li>
Добавить после:
<li class="discount_amount">
<?php echo 'Вы экономите '.$discount_amount; ?>
</li>

Найти:
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
Добавить после:
$discount_amount = $this->currency->format($this->tax->calculate(($result['price'] - $result['special']), $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
Найти:
'price'       => $price,
'special'     => $special,
Добавить после:
Найти:
Tested on pure OpenCart 2.3.0.2. In a good way, it would be necessary to create an ocmod modifier in xml format, and not edit the code directly, but this is already another level.

M
mat26, 2019-05-03
@mat26

Hello!
How to make it not appear "You save" - ​​if not specified?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question