Skip to content

Commit

Permalink
Fix Class JSFactory not found
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeytolkachyov authored Feb 15, 2024
2 parents fa32fb6 + 4bda9fb commit 39c9762
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 28 deletions.
2 changes: 1 addition & 1 deletion language/en-GB/mod_wtjshoppingswipercarousel.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ MOD_WTJSHOPPINGSWIPERCAROUSEL_AFTER_INSTALL = "Thank you for intalling extension
MOD_WTJSHOPPINGSWIPERCAROUSEL_AFTER_DISCOVER_INSTALL = "Thank you for intalling extension"
MOD_WTJSHOPPINGSWIPERCAROUSEL_AFTER_UPDATE = "Thank you for updating extension"
MOD_WTJSHOPPINGSWIPERCAROUSEL_MAYBE_INTERESTING="<h4>It may be interesting</h4><ul class=\"nav nav-tabs nav-stacked list-group\"><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/en/dev/web-assets\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">Joomla 4 & Joomla 5 Web Assets.</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/en/dev/joomshopping\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">JoomShopping extensions</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/en/dev/joomla-plugins\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">Joomla plugins</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/en/dev/joomla-modules\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">Joomla modules</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/en/dev/components\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">Joomla components</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/en/dev/joomla-libraries\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">Joomla libraries for developers.</a></li></ul>"
MOD_WTJSHOPPINGSWIPERCAROUSEL_WHATS_NEW="<h3>v.1.1.0 What's new?</h3><h4>JoomShopping product link button added</h4><p>If Joomshopping is running in catalog mode, the buy button is unavailable. Therefore, a link to the product has been added.</p>"
MOD_WTJSHOPPINGSWIPERCAROUSEL_WHATS_NEW="<h3>v.1.1.1 What's new?</h3><h4>Bug fix</h4><p>Fixed the error <code>\"class JSFactory not found\"</code>.</p>"
MOD_WTJSHOPPINGSWIPERCAROUSEL_JOOMLARU_TELEGRAM_CHAT="Joomla community in Telegram"
2 changes: 1 addition & 1 deletion language/ru-RU/mod_wtjshoppingswipercarousel.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ MOD_WTJSHOPPINGSWIPERCAROUSEL_AFTER_INSTALL = "Спасибо за устано
MOD_WTJSHOPPINGSWIPERCAROUSEL_AFTER_DISCOVER_INSTALL = "Спасибо за установку расширения"
MOD_WTJSHOPPINGSWIPERCAROUSEL_AFTER_UPDATE = "Спасибо за обновление расширения"
MOD_WTJSHOPPINGSWIPERCAROUSEL_MAYBE_INTERESTING="<h4>Может быть интересно</h4><ul class=\"nav nav-tabs nav-stacked list-group\"><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/web-assets\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Joomla 4 & Joomla 5 Web Assets</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Расширения для JoomShopping</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomla-plugins\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Плагины Joomla</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomla-modules\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Модули Joomla</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/components\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Компоненты Joomla</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/biblioteki\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Библиотеки Joomla для разработчиков</a></li></ul>"
MOD_WTJSHOPPINGSWIPERCAROUSEL_WHATS_NEW="<h3>v.1.1.0 Что нового?</h3><h4>Добавлена ссылка \"Подробнее\" для товара</h4><p>Если Joomshopping работает в режиме каталога - кнопка купить недоступна. Поэтому добавлена ссылка на товар.</p>"
MOD_WTJSHOPPINGSWIPERCAROUSEL_WHATS_NEW="<h3>v.1.1.1 Что нового?</h3><h4>Исправление ошибок</h4><p>Исправлена ошибка <code>\"class JSFactory not found\"</code>.</p>"
MOD_WTJSHOPPINGSWIPERCAROUSEL_JOOMLARU_TELEGRAM_CHAT="Joomla сообщество в Телеграм"
4 changes: 2 additions & 2 deletions mod_wtjshoppingswipercarousel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension type="module" client="site" method="upgrade">
<name>MOD_WTJSHOPPINGSWIPERCAROUSEL</name>
<author>Sergey Tolkachyov</author>
<creationDate>January 2024</creationDate>
<creationDate>February 2024</creationDate>
<copyright>Copyright (C) 2021 Sergey Tolkachyov. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://web-tolk.ru</authorUrl>
<version>1.1.0</version>
<version>1.1.1</version>
<description>MOD_WTJSHOPPINGSWIPERCAROUSEL_DESC</description>
<namespace path="src">Joomla\Module\Wtjshoppingswipercarousel</namespace>
<scriptfile>script.php</scriptfile>
Expand Down
2 changes: 1 addition & 1 deletion script.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* @package Com_blank
* @version 1.1.0
* @version 1.1.1
* @Author Sergey Tolkachyov, https://web-tolk.ru
* @copyright Copyright (C) 2023 Sergey Tolkachyov
* @license GNU/GPL http://www.gnu.org/licenses/gpl-3.0.html
Expand Down
2 changes: 1 addition & 1 deletion services/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/
defined('_JEXEC') or die;
Expand Down
2 changes: 1 addition & 1 deletion src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Fields/JshoppingcategoriesField.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Fields/JshoppinglabelsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Fields/ModuleinfoField.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/
namespace Joomla\Module\Wtjshoppingswipercarousel\Site\Fields;
Expand Down
45 changes: 29 additions & 16 deletions src/Helper/WtjshoppingswipercarouselHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @package WT JShopping Swiper carousel
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @link https://web-tolk.ru
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/

Expand Down Expand Up @@ -57,6 +57,11 @@ public function getList($params, $app): array
*/
public function getJshopConfig(): object
{
if (!class_exists('JSFactory') && file_exists(JPATH_SITE . '/components/com_jshopping/bootstrap.php'))
{
require_once(JPATH_SITE . '/components/com_jshopping/bootstrap.php');
}

$jshopConfig = \JSFactory::getConfig();

return $jshopConfig;
Expand Down Expand Up @@ -130,7 +135,7 @@ public function getSwiperParams($data, $app): void
$breakpoints[$breakpoint->breakpoint] = [
'slidesPerView' => $breakpoint->slidesPerView,
'spaceBetween' => $breakpoint->spaceBetween,
'direction' => (!empty($breakpoint->direction) ? $breakpoint->direction : 'horizontal'),
'direction' => (!empty($breakpoint->direction) ? $breakpoint->direction : 'horizontal'),
];
}

Expand Down Expand Up @@ -232,6 +237,7 @@ private function getImagesFromModuleParams($params): array

/**
* Return JoomShopping product list
*
* @param $params
* @param $app
*
Expand All @@ -246,12 +252,13 @@ private function getJshoppingProducts($params, $app): array
$noimage = $jshopConfig->image_product_live_path . "/noimage.gif";
$filters = [];
$count = $params->get('joomshopping_products_count_products', 4);
$list = [];
$list = [];
if ($params->get('joomshopping_products_type') == 'last_products')
{
$productlist = \JSFactory::getModel('last', 'Site\\Productlist');
$categories = $params->get('catids', []);
if(is_array($categories) && count($categories) > 0){
$categories = $params->get('catids', []);
if (is_array($categories) && count($categories) > 0)
{
$categories = array_map('intval', $categories);
}
$filters['categorys'] = $categories;
Expand All @@ -277,10 +284,12 @@ private function getJshoppingProducts($params, $app): array
if (strpos($product_ids, ',') !== false)
{
$product_ids = explode(',', $product_ids);
$product_ids = array_map('trim',$product_ids);
$product_ids = array_map('trim', $product_ids);

} else {
$product_ids = (array)trim($product_ids);
}
else
{
$product_ids = (array) trim($product_ids);
}

if (is_array($product_ids) && count($product_ids) > 0)
Expand All @@ -304,9 +313,10 @@ private function getJshoppingProducts($params, $app): array

if ($params->get('joomshopping_products_type') == 'toprating_products')
{
$product = \JSFactory::getModel('toprating', 'Site\\Productlist');
$product = \JSFactory::getModel('toprating', 'Site\\Productlist');
$categories = $params->get('catids', []);
if(is_array($categories) && count($categories) > 0){
if (is_array($categories) && count($categories) > 0)
{
$categories = array_map('intval', $categories);
}
$filters['categorys'] = $categories;
Expand All @@ -321,9 +331,10 @@ private function getJshoppingProducts($params, $app): array
}
if ($params->get('joomshopping_products_type') == 'tophits_products')
{
$product = \JSFactory::getModel('tophits', 'Site\\Productlist');
$product = \JSFactory::getModel('tophits', 'Site\\Productlist');
$categories = $params->get('catids', []);
if(is_array($categories) && count($categories) > 0){
if (is_array($categories) && count($categories) > 0)
{
$categories = array_map('intval', $categories);
}
$filters['categorys'] = $categories;
Expand All @@ -340,7 +351,8 @@ private function getJshoppingProducts($params, $app): array
if ($params->get('joomshopping_products_type') == 'bestseller_products')
{
$categories = $params->get('catids', []);
if(is_array($categories) && count($categories) > 0){
if (is_array($categories) && count($categories) > 0)
{
$categories = array_map('intval', $categories);
}

Expand All @@ -357,7 +369,7 @@ private function getJshoppingProducts($params, $app): array
if ($params->get('joomshopping_products_type') == 'label_products')
{

$product = \JSFactory::getModel('label', 'Site\\Productlist');
$product = \JSFactory::getModel('label', 'Site\\Productlist');
$label_ids = (array) $params->get('label_id');

if ($label_ids)
Expand All @@ -366,7 +378,8 @@ private function getJshoppingProducts($params, $app): array
}

$categories = $params->get('catids', []);
if(is_array($categories) && count($categories) > 0){
if (is_array($categories) && count($categories) > 0)
{
$categories = array_map('intval', $categories);
}

Expand Down
2 changes: 1 addition & 1 deletion tmpl/bs-5-card-joomshopping-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/
use Joomla\CMS\Factory;
Expand Down
2 changes: 1 addition & 1 deletion tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright (C) 2022-2023 Sergey Tolkachyov. All rights reserved.
* @author Sergey Tolkachyov - https://web-tolk.ru
* @link https://web-tolk.ru
* @version 1.1.0
* @version 1.1.1
* @license GNU General Public License version 3 or later
*/
use Joomla\CMS\HTML\HTMLHelper;
Expand Down

0 comments on commit 39c9762

Please sign in to comment.