Done ! Heres the code for those who interested :
in templates/[GANTRY_TEMPLATE]/custom/includes/Last_Products.php
<?php
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; }
class Last_Products
{
public $ids = NULL;
public $products = NULL;
public function __construct() {
}
public function getProducts ($nombre_produits = 3) {
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName('product_id'));
$query->from($db->quoteName('#__hikashop_product'));
$query->where($db->quoteName('product_published') . ' = '. $db->quote('1'));
$query->order($db->quoteName('product_created') . ' DESC');
$query->setLimit( $nombre_produits );
//instancie la classe hikashop
$productClass = hikashop_get('class.product');
//recupere les ids des n derniers produits dans un tableau
$db->setQuery($query);
$this->ids= $db->loadColumn();
foreach( $this->ids as $id ) {
$this->products[$id]['object'] = $productClass->getProduct($id);
$config = hikashop_config();
$image = reset($this->products[$id]['object']->images);
$path = '/'.$config->get('uploadfolder').$image->file_path;
$this->products[$id]['image'] = $path;
$productClass->addAlias($this->products[$id]['object']);
$this->products[$id]['link'] = hikashop_contentLink('product&task=show&cid=' . $this->products[$id]['object']->product_id . '&name=' . $this->products[$id]['object']->alias . '&Itemid=XXX',
$this->products[$id]['object']);
}
return $this->products;
}
}
in templates/[GANTRY_TEMPLATE]/custom/particles/last-products.html.twig
{% extends '@nucleus/partials/particle.html.twig' %}
{% block particle %}
<div class="g-content-pro-slideset style1 gutter-enabled">
{% if particle.mainheading or particle.introtext %}
<div class="g-particle-intro">
{% if particle.mainheading %}
<h3 class="g-title g-main-title">{{ particle.mainheading|raw }}</h3>
<div class="g-title-separator {% if particle.introtext == false %}no-intro-text{% endif %}"></div>
{% endif %}
{% if particle.introtext %}<p class="g-introtext">{{ particle.introtext|raw }}</p>{% endif %}
</div>
{% endif %}
<div class="uk-slidenav-position" data-uk-slideset="{small: 1, medium: {{ particle.columns|default('3')|e }}, large: {{ particle.columns|default('3')|e }}, duration:200, animation: 'fade'}">
<div class="uk-slider-container">
<ul class="uk-slideset uk-grid">
{% for slide in gantry.last_products.getProducts(particle.products|default('3')|e)|batch(particle.columns|default('3')|e) %}
{% for item in slide %}
<li>
<div class="g-content-pro-item">
<div class="g-content-pro-image">
<a href="{{ item['link'] }}" class="uk-overlay uk-overlay-hover">
<span class="uk-overlay-panel uk-overlay-background uk-overlay-icon uk-overlay-fade"></span>
<img alt="{{ item['object'].product_name }}" src="{{ item['image'] }}" {{ item[image]|imagesize|raw }}>
</a>
</div>
<div class="g-info-container">
<h4 class="g-content-pro-title">
<a target="_parent" href="{{ item['object'].product_alias|e }}">
{{ item['object'].product_name|raw }}
</a>
</h4>
<p class="g-content-pro-desc">{{ item['object'].product_description|raw }}</p>
</div>
</div>
</li>
{% endfor %}
{% endfor %}
</ul>
</div>
<ul class="uk-slideset-nav uk-dotnav uk-flex-center">
{% set counter = 0 %}
{% for item in gantry.last_products.getProducts() %}
<li data-uk-slideset-item="{{ counter }}"><a href=""></a></li>
{% set counter = counter + 1 %}
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
in templates/[GANTRY_TEMPLATE]/custom/particles/last-products.yaml
name: Last Products
description: Affiche les derniers produits
type: particle
form:
fields:
mainheading:
type: input.text
label: Titre
description: Entrer le titre
placeholder: 'Entrer le titre'
default: ''
introtext:
type: textarea.textarea
label: Intro Text
description: Texte d introduction.
placeholder: 'Entrer le texte d introduction'
default: ''
columns:
type: select.select
label: Produits par slide
description: Sélectionner le nombre d articles par slide.
placeholder: 'Selectionner...'
default: 3
options:
3: 3
4: 4
5: 5
6: 6
products:
type: select.select
label: Nombre de produits
description: Sélectionner le nombre d articles au total.
placeholder: 'Selectionner...'
default: 3
options:
3: 3
4: 4
5: 5
6: 6
Finally, override the main templates/[GANTRY_TEMPLATE]/includes/theme.php with
// Require the Best Products library
include_once dirname(__FILE__).'/../custom/includes/Last_Products.php';
// Dependency Injection of Best Products
$gantry['last_products'] = new \Last_Products();
at the end.
I didnt put the scss....it depends of what you wants to see