| Server IP : 46.105.57.169 / Your IP : 216.73.216.84 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/m/a/i/maitricfuz/www/new-saint-martin/plugins/slideshowck/hikashop/helper/ |
Upload File : |
<?php
/**
* @name Slideshow CK
* @package com_slideshow
* @copyright Copyright (C) 2016. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
*/
// No direct access
defined('_JEXEC') or die;
/**
* Helper Class.
*/
class SlideshowckHelpersourceHikashop {
private static $params;
/*
* Get the items from the source
*/
public static function getItems($params) {
if (empty(self::$params)) {
self:$params = $params;
}
// load the items
$products = self::loadItems($params);
global $Itemid;
if (!$products) return false;
// load the hikashop config class
$configClass = hikashop_get('class.config');
$uploadfoler = $configClass->get('uploadfolder', 'media/com_hikashop/upload/');
// load the hikashop product class
$productClass = hikashop_get('class.product');
$items = array();
global $Itemid;
foreach ($products as $i => $product) {
if (!empty($product->file_path)) {
$slideItem = SlideshowckHelper::initItem();
// $item->path = \Joomla\CMS\Uri\Uri::root(true) . '/' . trim($uploadfoler, '/') . '/' . $product->file_path;
$slideItem->image = \Joomla\CMS\Uri\Uri::root(true) . '/' . trim($uploadfoler, '/') . '/' . $product->file_path;
} else {
unset($items[$i]);
continue;
}
$productClass->addAlias($product);
$url_itemid = $params->get( 'hikashopitemid', 0 ) ? $params->get( 'hikashopitemid', 0 ) : $Itemid;
$url_itemid = empty($url_itemid) ? '' : '&Itemid=' . $url_itemid;
$slideItem->link = hikashop_contentLink('&ctrl=product&task=show&cid=' . $product->product_id . '&name=' . $product->alias . $url_itemid, $product);
$price = '';
if (!empty($product->price_value) && (bool)$params->get( 'slideshowhikashop_showprice', 0 )) {
$currency = hikashop_get('class.currency');
$price = $currency->format($product->price_value, hikashop_getCurrency());
}
// $description = modSlideshowckHelper::truncate($item->product_description, '150');
$slideItem->text = $product->product_description;
$slideItem->title = $product->product_name;
if ($price) $slideItem->more[] = '<div class="slideshowck-price">' . $price . '</div>';
$items[] = $slideItem;
}
return $items;
}
private static function loadItems($params) {
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){
echo 'This module can not work without the Hikashop Component';
return;
}
// Setting
$max_items = $params->get( 'limitslides', 0 ); //maximum number of items to display
$category_id = $params->get( 'slideshowckhikashop_category', null ); // Display products from this category only
$filter_category = (bool)$params->get( 'slideshowckhikashop_filtercategory', 0 ); // Filter the category
$show_price = (bool)$params->get( 'slideshowckhikashop_showprice', 0 ); // Display the Product Price?
$product_group = $params->get( 'slideshowckhikashop_product_group', 'featured'); // Choose which products to display
$db = \Joomla\CMS\Factory::getDBO();
if ($filter_category) {
$querycategory = " AND #__hikashop_product_category.category_id = ' " . $category_id . "'";
} else {
$querycategory = "";
}
if ($show_price) {
$selectprice = ", price_value, currency_symbol";
$queryprice = " LEFT OUTER JOIN #__hikashop_price"
. " ON #__hikashop_price.price_product_id = #__hikashop_product.product_id"
. " RIGHT OUTER JOIN #__hikashop_currency"
. " ON #__hikashop_price.price_currency_id = #__hikashop_currency.currency_id";
} else {
$selectprice = "";
$queryprice = "";
}
if ($product_group == 'latest') {
$queryorder = " ORDER BY product_created DESC";
} else if ($product_group == 'random') {
$queryorder = " ORDER BY RAND()";
} else if ($product_group == 'topten') {
$queryorder = " ORDER BY product_sales DESC";
} else if ($product_group == 'mostviewed') {
$queryorder = " ORDER BY product_hit DESC";
} else {
$queryorder = " ORDER BY ordering ASC";
}
$querylimit = $max_items > 0 ? " LIMIT 0, " . $max_items : "";
$query = "SELECT ordering, product_published, #__hikashop_product.product_id, category_id, product_hit, product_created, product_sales, product_sale_start, product_sale_end, product_name, product_description, file_path" . $selectprice
. " FROM #__hikashop_product_category"
. " RIGHT OUTER JOIN #__hikashop_product"
. " ON #__hikashop_product_category.product_id = #__hikashop_product.product_id"
. " RIGHT OUTER JOIN #__hikashop_file"
. " ON #__hikashop_file.file_ref_id = #__hikashop_product.product_id"
. $queryprice
. " WHERE #__hikashop_product.product_published = 1"
. " AND #__hikashop_product.product_type = 'main'"
. $querycategory
. " AND ( ('" . time() . "' >= #__hikashop_product.product_sale_start OR #__hikashop_product.product_sale_start = '0' )"
. " AND (#__hikashop_product.product_sale_end > '" . time() . "' OR #__hikashop_product.product_sale_end = '0') )"
. " GROUP BY product_id"
. $queryorder
. $querylimit;
$db->setQuery($query);
if ($db->execute()) {
$products = $db->loadObjectList();
} else {
echo '<p style="color:red;font-weight:bold;">Error loading SQL data : loading the hikashop products in Slideshow CK</p>';
return false;
}
// var_dump($products);
if(empty($products)) return false;
return $products;
}
}