<?php
class ControllerExtensionModuleFeatured extends Controller {
public function index($setting) {
$this->load->language('extension/module/featured');
$this->load->model('catalog/product');
$this->load->model('tool/image');
$data['products'] = array();
if (!$setting['limit']) {
$setting['limit'] = 4;
}
if (!empty($setting['product'])) {
$products = array_slice($setting['product'], 0, (int)$setting['limit']);
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
if ($product_info['image']) {
$image = $this->model_tool_image->resize($product_info['image'], $setting['width'], $setting['height']);
} else {
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
}
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
$price = false;
}
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')), $this->session->data['currency']);
} else {
$special = false;
}
if ($this->config->get('config_tax')) {
$tax = $this->currency->format((float)$product_info['special'] ? $product_info['special'] : $product_info['price'], $this->session->data['currency']);
} else {
$tax = false;
}
if ($this->config->get('config_review_status')) {
$rating = $product_info['rating'];
} else {
$rating = false;
}
$data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'rating' => $rating,
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])
);
}
}
}
<div class="cart-quantity col-8 col-md-9 text-center py-2 mx-0 d-flex align-items-center">
<i onclick="$(this).next().val($(this).next().val()-1);$(this).parents('form').submit();" class="fa fa-minus-circle custBTN" style="margin-right: 10px;color:#22B14C; font-size: 18px;"></i>
<input type="text" class="custQuantity text-center" name="quantity" size="4" value="1" id="quantity_57">
<i onclick="$(this).prev().val(~~$(this).prev().val()+1);$(this).parents('form').submit();" class=" ml-2 fa fa-plus-circle custBTN" style="color:#22B14C; font-size: 18px;"></i>
<input type="hidden" name="product_id" size="2" value="57">
</div>
if ($data['products']) {
return $this->load->view('extension/module/featured', $data);
}
}
} как закрыт