с Вашим кодом всё работает! ;)
Но в "catalog/controller/product.php" у меня немного другой код, т.к. добавил это: https://opencartforum.com/topic/2004-спецпредложения-скидка-в-процентах/, в итоге, изменив "catalog/model/catalog/product.php", а "catalog/controller/product.php" оставив как есть, вылетает: Fatal error: Unsupported operand types in ***/system/library/currency.php on line 70.
А код следующий, ковыряю уже часа полтора :(
if ($discount) {
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
$this->data['special'] = FALSE;
} else {
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($this->request->get['product_id']);
$GLOBALS["special_clean"] = $special;
if ($special < 1) {$special = (int)($product_info['price'] * $special); $special = round($special,-1);} // наша строка для расчета скидки в процентах
if ($special) {
$this->data['special'] = $this->currency->format($this->tax->calculate($special, $product_info['tax_class_id'], $this->config->get('config_tax')));
//$this->data['price'] = $product_info['price'];
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$this->data['special'] = FALSE;
}
}
В шаблоне вывожу следующую строку:
if (isset($special) and $special !=0)
{
$percent = (1 - $GLOBALS["special_clean"])*100;
echo "</br></br><p class='skidka'>".$text_skidka." ".round($percent)."%</br>до ".$special_date_end."</p>";
}