Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
$data['text_discount'] = '%s or more %s';
$discount_query = $this->model_catalog_product->getProductDiscounts($result['product_id']);
$discounts = array();
foreach ($discount_query as $discount) {
$discounts[] = array(
'quantity' => $discount['quantity'],
'price' => $this->currency->format($this->tax->calculate($discount['price'], $result['tax_class_id'], $this->config->get('config_tax')))
);
}
ну 2.1.0.1 я себе еще не ставил, но по сути тут логика такая:
попробовать сделать все согласно этим советам Для просмотра ссылки Войдиили Зарегистрируйся
с той разницей, что в 1.5 переменные в контроллере формируются
$this->data
а в 2.Х
$data
чего-то не работает(((
вот кусок кода контроллера
Код://category discounts $discount_query = $this->model_catalog_product->getProductDiscounts($result['product_id']); $discounts = array(); foreach ($discount_query as $discount) { $discounts[] = array( 'quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $result['tax_class_id'], $this->config->get('config_tax'))) ); } //category discounts $data['products'][] = array( 'product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'discounts' => $discount, 'tax' => $tax, 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) ); }
и кусок кода в category.tpl
Код:<?php if ($product['price']) { ?> <p class="price custom-style-price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-new pull-left">ОПТ(от 50шт)<br><?php echo $product['special']; ?></span> <span class="price-old pull-right">Розн<br><?php echo $product['price']; ?></span> <?php } ?> <?php if ($product['tax']) { ?> <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span> <?php } ?> <?php if ($discounts) { ?> <li> <hr> </li> <?php foreach ($discounts as $discount) { ?> <li><?php echo $discounts['quantity']; ?><?php echo $text_discount; ?><?php echo $discount['price']; ?></li> <?php } ?> <?php } ?> </p> <?php } ?>
//category discounts
$data['text_discount'] = '%s or more %s';
$discount_query = $this->model_catalog_product->getProductDiscounts($result['product_id']);
$discounts = array();
foreach ($discount_query as $discount) {
$discounts[] = array(
'quantity' => $discount['quantity'],
'price' => $this->currency->format($this->tax->calculate($discount['price'], $result['tax_class_id'], $this->config->get('config_tax')))
);
}
//category discounts
$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'discounts' => $discounts,
'tax' => $tax,
'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating' => $result['rating'],
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);
}