Skip to content

Commit

Permalink
Merge pull request #1 from sergeytolkachyov/dev
Browse files Browse the repository at this point in the history
v.1.0.2
  • Loading branch information
sergeytolkachyov committed Sep 18, 2022
2 parents 68d7752 + aeca3ac commit cc5e87b
Show file tree
Hide file tree
Showing 16 changed files with 363 additions and 197 deletions.
2 changes: 1 addition & 1 deletion language/en-GB/en-GB.mod_wtjshoppingcart.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ MOD_WTJSHOPPINGCART_AFTER_INSTALL = "Thank you for intalling extension"
MOD_WTJSHOPPINGCART_AFTER_DISCOVER_INSTALL = "Thank you for intalling extension"
MOD_WTJSHOPPINGCART_AFTER_UPDATE = "Thank you for updating extension"
MOD_WTJSHOPPINGCART_MAYBE_INTERESTING="<h4>It might be interesting</h4><ul class=\"list-group\"><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/joomshopping-russian-post-shipping-method-api.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">JoomShopping Russian Post Shipping method (via API)</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/en/dev/joomla-plugins/wt-joomshopping-bitrix24-pro.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">WT JoomShopping Bitrix24 PRO, two-way integration plugin for JoomShopping online store and Bitrix24 CRM.</a></li></ul>"
MOD_WTJSHOPPINGCART_WHATS_NEW="<h3>v.1.0.1 What's new?</h3><p>Fixed the error of forming links to products from the basket.</p>"
MOD_WTJSHOPPINGCART_WHATS_NEW="<h3>v.1.0.2 What's new?</h3><ul><li>PHP 8 compatibility patch.</li><li>The module has been rewritten according to the new Joomla 4 module structure. This means that it will work with Joomla 5 as well.</li></ul>"
4 changes: 2 additions & 2 deletions language/ru-RU/ru-RU.mod_wtjshoppingcart.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ MOD_WTJSHOPPINGCART_DESC="<p>Модуль корзины для JoomShopping 5.
MOD_WTJSHOPPINGCART_AFTER_INSTALL = "Спасибо за установку расширения"
MOD_WTJSHOPPINGCART_AFTER_DISCOVER_INSTALL = "Спасибо за установку расширения"
MOD_WTJSHOPPINGCART_AFTER_UPDATE = "Спасибо за обновление расширения"
MOD_WTJSHOPPINGCART_MAYBE_INTERESTING="<h4>Может быть интересно</h4><ul class=\"list-group\"><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/wt-sm-ozon-rocket-dlya-joomshopping.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Расчет доставки и интеграция JoomShopping с Ozon Rocket</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/wt-sm-otpravka-pochta-ru.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Интеграция JoomShopping с Почтой России для Бизнеса</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Favorites, альтернативный список пожеланий (wishlist) для JoomShopping.</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomla-plugins/wt-joomshopping-bitrix24-pro.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Bitrix24 PRO, плагин двухсторонней интеграции интернет-магазина JoomShopping и CRM Битрикс24.</a></li></ul>"
MOD_WTJSHOPPINGCART_WHATS_NEW="<h3>v.1.0.1 Что нового?</h3><p>Исправлена ошибка формирования ссылок на товары из корзины.</p>"
MOD_WTJSHOPPINGCART_MAYBE_INTERESTING="<h4>Может быть интересно</h4><ul class=\"list-group\"><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/wt-sm-otpravka-pochta-ru.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Интеграция JoomShopping с Почтой России для Бизнеса</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Favorites, альтернативный список пожеланий (wishlist) для JoomShopping.</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomla-plugins/wt-joomshopping-bitrix24-pro.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Bitrix24 PRO, плагин двухсторонней интеграции интернет-магазина JoomShopping и CRM Битрикс24.</a></li></ul>"
MOD_WTJSHOPPINGCART_WHATS_NEW="<h3>v.1.0.2 Что нового?</h3><ul><li>Патч совместимости PHP 8.</li><li>Модуль переписан согласно новой структуре модулей Joomla 4. Это означает, что он будет работать и с Joomla 5.</li></ul>"
9 changes: 0 additions & 9 deletions media/css/default.css

This file was deleted.

49 changes: 0 additions & 49 deletions mod_wtjshoppingcart.php

This file was deleted.

17 changes: 7 additions & 10 deletions mod_wtjshoppingcart.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" client="site" method="upgrade">
<name>MOD_WTJSHOPPINGCART</name>
<creationDate>09.07.2022</creationDate>
<creationDate>18/09/2022</creationDate>
<author>Sergey Tolkachyov</author>
<authorEmail>infop@web-tolk.ru</authorEmail>
<authorUrl>https://web-tolk.ru</authorUrl>
<copyright>Sergey Tokachyov</copyright>
<license>Open Source License, GNU GPL</license>
<version>1.0.1</version>
<version>1.0.2</version>
<description>Displays a JoomShopping cart</description>
<namespace path="src">Joomla\Module\Wtjshoppingcart</namespace>
<scriptfile>script.php</scriptfile>
<media folder="media" destination="mod_wtjshoppingcart">
<folder>css</folder>
</media>
<files>
<filename module="mod_wtjshoppingcart">mod_wtjshoppingcart.php</filename>
<folder>tmpl</folder>
<folder>src</folder>
<folder>fields</folder>
<folder module="mod_wtjshoppingcart">src</folder>
<folder>tmpl</folder>
<folder>language</folder>
<folder>services</folder>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_wtjshoppingcart.ini</language>
Expand All @@ -29,7 +26,7 @@
<config>
<fields name="params">
<fieldset name="basic">
<field addfieldpath="modules/mod_wtjshoppingcart/fields" type="moduleinfo" name="moduleinfo"/>
<field addfieldprefix="Joomla\Module\Wtjshoppingcart\Site\Fields" type="moduleinfo" name="moduleinfo"/>
<field
name="moduleclass_sfx"
type="text"
Expand Down
1 change: 1 addition & 0 deletions script.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function postflight($type, $installer)
<a class='btn btn-sm btn-outline-primary' href='https://web-tolk.ru' target='_blank'>https://web-tolk.ru</a>
<a class='btn btn-sm btn-outline-primary' href='mailto:info@web-tolk.ru'><i class='icon-envelope'></i> info@web-tolk.ru</a>
</p>
<p><a class='btn btn-info' href='https://t.me/joomlaru' target='_blank'>Joomla Russian Community in Telegram</a></p>
".Text::_($element."_MAYBE_INTERESTING")."
</div>
Expand Down
43 changes: 43 additions & 0 deletions services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* @package WT JShopping Cart
*
* @copyright (C) 2022 Sergey Tolkachyov
* @link https://web-tolk.ru
* @license GNU General Public License version 2 or later
*/

defined('_JEXEC') or die;

use Joomla\CMS\Extension\Service\Provider\HelperFactory;
use Joomla\CMS\Extension\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
* The WT JShopping Cart module service provider.
*
* @since 1.0.0
*/
return new class implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.0.0
*/
public function register(Container $container)
{
// Основной namespace модуля
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Wtjshoppingcart'));
// Namespace модуля для хелпера
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Wtjshoppingcart\\Site\\Helper'));
// Namespace модуля для своих типов полей
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Wtjshoppingcart\\Site\\Fields'));
$container->registerServiceProvider(new Module);
}
};
72 changes: 72 additions & 0 deletions src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* @package WT Yandex Map items
*
* @copyright (C) 2022 Sergey Tolkachyov
* @link https://web-tolk.ru
* @license GNU General Public License version 2 or later
*/

namespace Joomla\Module\Wtjshoppingcart\Site\Dispatcher;

\defined('JPATH_PLATFORM') or die;

use Exception;
use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Extension\ModuleInterface;
use Joomla\Input\Input;
use Joomla\Module\Wtjshoppingcart\Site\Helper\WtjshoppingcartHelper;

/**
* Dispatcher class for mod_wtyandexmapitems
*
* @since 1.1.0
*/
class Dispatcher extends AbstractModuleDispatcher
{

/**
* The module extension. Used to fetch the module helper.
*
* @var ModuleInterface|null
* @since 1.1.0
*/
private $moduleExtension;


public function __construct(\stdClass $module, CMSApplicationInterface $app, Input $input)
{
parent::__construct($module, $app, $input);

$this->moduleExtension = $this->app->bootModule('mod_wtjshoppingcart', 'site');
}

/**
* Returns the layout data.
*
* @return array
*
* @since 1.1.0
*/
protected function getLayoutData() : array
{
if (!file_exists(JPATH_SITE . '/administrator/components/com_jshopping/jshopping.xml'))
{
throw new Exception('Please install JoomShopping', 500);
}
if(!class_exists('JSHelper')){
require_once(JPATH_SITE . '/components/com_jshopping/bootstrap.php');
}

$data = parent::getLayoutData();

\JSFactory::loadCssFiles();
\JSFactory::loadLanguageFile();

$data['jshopConfig'] = \JSFactory::getConfig();
$data['cart'] = WtjshoppingcartHelper::getCart($data['params'], $this->getApplication());

return $data;
}
}
Loading

0 comments on commit cc5e87b

Please sign in to comment.