| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 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/maitricfuz/www/saint-martin-lg/plugins/slideshowck/virtuemart/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 SlideshowckHelpersourceVirtuemart {
private static $params;
/**
* Extract from the mod_virtuemart_product
* Get the products list
*/
public static function getProductsListing ($group = FALSE, $nbrReturnProducts = FALSE, $withCalc = TRUE, $onlyPublished = TRUE, $single = FALSE, $filterCategory = TRUE, $category_id = 0, $filterManufacturer = TRUE, $manufacturer_id = 0, $omit = 0) {
$productModel = VmModel::getModel('Product');
VirtueMartModelProduct::$omitLoaded = $omit;
if (! $nbrReturnProducts) $nbrReturnProducts = 10;
$products = $productModel->getProductListing($group, $nbrReturnProducts, $withCalc, $onlyPublished, $single, $filterCategory, $category_id, $filterManufacturer, $manufacturer_id);
$cproducts = array();
foreach($products as $product){
$tmp = get_object_vars($product);
$t = new stdClass();
foreach ($tmp as $k => $v){
// Do not process internal variables
if (strpos ($k, '_') !== 0 and property_exists($product, $k)){
$t->$k = $v;
}
}
$cproducts[] = $t;
}
return $cproducts;
}
/*
* Get the items from the source
*/
public static function getItems($params) {
// does not load if the component is not installed
if (! file_exists(JPATH_SITE . '/administrator/components/com_virtuemart'))
return;
if (empty(self::$params)) {
self:$params = $params;
}
if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
vmLanguage::loadJLang('mod_virtuemart_product', true);
// Setting
$max_items = $params->get( 'limitslides', 0 ); //maximum number of items to display
// not used
$manufacturer_id = $params->get( 'virtuemart_manufacturer_id', null ); // Display products from this manufacturer only
$filter_manufacturer = (bool)$params->get( 'filter_manufacturer', 0 ); // Filter the manufacturer
// from module options
$Product_group = $params->get( 'slideshowckvirtuemart_product_group', 'all'); // Choose which products to display
$category_id = $params->get( 'slideshowckvirtuemart_category', null ); // Display products from this category only
$filter_category = (bool)$params->get( 'slideshowckvirtuemart_filtercategory', 0 ); // Filter the category
$show_price = (bool)$params->get( 'slideshowckvirtuemart_showprice', 0 ); // Display the Product Price?
$show_addtocart = (bool)$params->get( 'slideshowckvirtuemart_showaddtocart', 1 ); // Display the "Add-to-Cart" Link?
$productModel = VmModel::getModel('Product');
$products = self::getProductsListing($Product_group, $max_items, $show_price, true, false,$filter_category, $category_id, $filter_manufacturer, $manufacturer_id);
$productModel->addImages($products);
$items = array();
$currency = CurrencyDisplay::getInstance( );
if ($show_addtocart) {
// add javascript for price and cart, need even for quantity buttons, so we need it almost anywhere
vmJsApi::jPrice();
echo vmJsApi::writeJS();
vmJsApi::cssSite();
}
foreach ($products as $product) {
$slideItem = SlideshowckHelper::initItem();
$slideItem->image = Slideshowck\CKUri::root(true) . '/' . $product->file_url;
$slideItem->link = $product->link;
$slideItem->text = $product->product_desc;
$slideItem->title = $product->product_name;
$price = '';
if (!empty($product->prices['salesPrice']) && (bool)$params->get( 'slideshowckvirtuemart_showprice', 0 )) {
if (!empty($product->prices['salesPrice'])) {
$price .= $currency->createPriceDiv ('salesPrice', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
}
if (!empty($product->prices['salesPriceWithDiscount'])) {
$price .= $currency->createPriceDiv ('salesPriceWithDiscount', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
}
}
if ($price) $slideItem->more[] = '<div class="slideshowck-price">' . $price . '</div>';
if ($show_addtocart) {
$slideItem->more[] = shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product));
}
$items[] = $slideItem;
}
return $items;
}
}