[v3.0.2.0 - Extension] - Additional images in features module
Posted: Tue Jan 02, 2018 4:00 am
Tested for default template. In catalog/controller/extension/module/featured.php file,
find:
add below:
Then, find:
add below:
Then, find:
add right below:
Then, in catalog/view/theme/default/template/extension/module/featured.twig file,
find:
add right below:
Then, at the bottom of the file, if the following line already exists:
add the following right below:
However, if no JS code can be found at the bottom of the file, add the entire code:
This should resolve the problem.
find:
Code: Select all
if ((float)$product['special']) {
$special = $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
$special = false;
}
Code: Select all
$images = array();
$results = $this->model_catalog_product->getProductImages($product['product_id']);
foreach ($results as $result) {
$images[] = array(
'popup' => $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')),
'thumb' => $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_height'))
);
}
$heading_title = html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8');
Code: Select all
'tax' => $tax,
Code: Select all
'images' => $images,
'heading_title' => $heading_title,
Code: Select all
if ($data['products']) {
Code: Select all
$this->document->addScript('catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js');
$this->document->addStyle('catalog/view/javascript/jquery/magnific/magnific-popup.css');
find:
Code: Select all
<div class="product-layout col-lg-3 col-md-3 col-sm-6 col-xs-12">
Code: Select all
{% if product.thumb or product.images %}
<ul class="thumbnails">
{% if product.thumb %}
<li><a class="thumbnail" href="{{ popup }}" title="{{ product.heading_title }}"><img src="{{ product.thumb }}" title="{{ product.heading_title }}" alt="{{ product.heading_title }}"/></a></li>
{% endif %}
{% if product.images %}
{% for image in product.images %}
<li class="image-additional"><a class="thumbnail" href="{{ image.popup }}" title="{{ product.heading_title }}"> <img src="{{ image.thumb }}" title="{{ product.heading_title }}" alt="{{ product.heading_title }}"/></a></li>
{% endfor %}
{% endif %}
</ul>
{% endif %}
Code: Select all
$(document).ready(function() {
Code: Select all
$('.thumbnails').magnificPopup({
type: 'image',
delegate: 'a',
gallery: {
enabled: true
}
});
Code: Select all
<script type="text/javascript"><!--
$(document).ready(function() {
$('.thumbnails').magnificPopup({
type: 'image',
delegate: 'a',
gallery: {
enabled: true
}
});
});
//--></script>