Доработал. Реализовал для категорий, версия 1.5.
Файл /catalog/controller/product/category.php
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
// Значение цены
$val_price = $this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax') );
$price = $this->currency->format( $val_price );
} else {
$val_price = false;
$price = false;
}
(Изменяем)
т.е. цену товара занёс в переменную $val_price, а $price (была) её переводит её в ныжный форма валюты.
if ((float)$result['special']) {
// Значение специальной цены
$val_special = $this->tax->calculate( $result['special'], $result['tax_class_id'], $this->config->get('config_tax') );
$special = $this->currency->format( $val_special );
} else {
$val_special = false;
$special = false;
}
(Изменяем)
т.е. специальную цену товара занёс в переменную $val_special, а $special (была) её переводит её в ныжный форма валюты.
// Находим скидку
if( $val_special ) {
$discount = ( $val_price - $val_special ) / $val_price * 100;
$discount = round( $discount, 1);
$discount .= '%';
} else {
$discount = false;
}
(Добавляем)
Тут мы находим скидку в процентах, округляем её до одного знака после запятой и прибавляем в конец знак '%'.
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => $descr_plaintext,
'price' => $price,
'special' => $special,
'discount' => $discount,
'tax' => $tax,
'rating' => $result['rating'],
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'])
);
(Изменяем)
Тут просто вписываем в массив данных о продукте строку 'discount' => $discount,
Далее в шаблоне /catalog/view/theme/default/template/product/category.tpl, в нужном месте выводим эту скидку, у меня так:
<div class="image">
<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a>
<?php if ($product['discount']) { ?><div class="special_price"><?php echo $product['discount']; ?></div><?php } ?>
</div>
т.е. просто вписываем <?php if ($product['discount']) { ?><div class="special_price"><?php echo $product['discount']; ?></div><?php } ?>.
Стили на свой вкус делайте. Всё работает.