На форуме 9558 тем, 76452 сообщений, 44664 участников
тема · 695 просмотров · 1 ответ

Вывести в карточки товаров отображаемых в категориях цену discount. Opencart 2.3.0.2.

Общие вопросы
читают: 0 участников и 1 гость
порядок
4 мая 2018 20:04#1
Добрый вечер! Полазил сегодня по форумах, в надежде решить данный вопрос. И потерпел неудачу. Единственное решение которое нашел неподходит данной версии опенкарта. Можете подсказать как это все реализовать?
Вот то решение которое есть на форумах (для версии 1.5):

в feature.php после

if ((float)$product_info['special']) {
$special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax'😉));
} else {
$special = false;
}
пишем

$discounts = $this->model_catalog_product->getProductDiscounts($product_info['product_id']);

$this->data['discounts'] = array();


foreach ($discounts as $discount) {
$this->data['discounts'][] = array(
'quantity' => $discount['quantity'],
'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax'😉))
);
}

В category.php после

if ((float)$result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'😉));
} else {
$special = false;}
пишем

$discounts = $this->model_catalog_product->getProductDiscounts($result['product_id']);

$this->data['discounts'] = array();


foreach ($discounts as $discount) {
$this->data['discounts'][] = array(
'quantity' => $discount['quantity'],
'price' => $this->currency->format($this->tax->calculate($discount['price'], $result['tax_class_id'], $this->config->get('config_tax'😉))
);
}
И в соответствующих .tpl где надо

<div class="discount">
<?php foreach ($discounts as $discount) { ?>
<?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
<?php } ?>
</div>
сообщения 1–2 из 2
Чтобы ответить, войдите или зарегистрируйтесь.

Похожие темы