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_blabla = array(
'filter_category_id' => $category['category_id'],
'sort' => 'p.price',
'order' => 'asc',
'start' => '1',
'limit' => '0, 1'
);
$results_blabla = $this->model_catalog_product->getProducts($data_blabla);
foreach ($results_blabla as $result) {
$price_min = $result['price'];
}
$discounts = $this->model_catalog_product->getProductDiscounts($result['product_id']);
if (count($discounts) > 0) {
$discount_min = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
foreach ($discounts as $discount) {
if (floatval($discount['price']) < floatval($discount_min)) $discount_min = $discount['price'];
}
$discount_min = $this->currency->format($this->tax->calculate($discount_min, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$discount_min = false;
}
<div class="discount">от
<?php echo $product['discounts']; ?>
</div>
попробуйте в контроллер category.php добавить
и передать $price_min в шаблон вместе с остальными даннымиPHP:$data_blabla = array( 'filter_category_id' => $category['category_id'], 'sort' => 'p.price', 'order' => 'asc', 'start' => '1', 'limit' => '0, 1' ); $results_blabla = $this->model_catalog_product->getProducts($data_blabla); foreach ($results_blabla as $result) { $price_min = $result['price']; }
Какая версия опенкарта? на самом там все просто делается, через tpl ку можно вроде.Подскажите, в какое конкретно место размещать функцию?
Но учтите это без учета скидок, дисконта и таксов. Т.е. "голая цена".Подскажите, в какое конкретно место размещать функцию?