Skip to content

Commit

Permalink
Merge pull request #3 from sergeytolkachyov/dev
Browse files Browse the repository at this point in the history
- Changing links in layouts: `view` param to `controller`
  • Loading branch information
sergeytolkachyov committed Aug 10, 2023
2 parents 801f1cb + f5c3c23 commit 93f0ec7
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 74 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.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>"
MOD_WTJSHOPPINGCART_WHATS_NEW="<h3>v.1.0.3 What's new?</h3><h4>Changing links in module layouts</h4><p>In the module layouts (located in the <code>tmpl</code> folder), the links to checkout and shopping cart have been changed. The <code>view</code> parameter has been replaced with <code>controller</code>. I recommend making menu items for ordering and shopping cart and hiding them in the menu item settings.</p>"
2 changes: 1 addition & 1 deletion language/ru-RU/ru-RU.mod_wtjshoppingcart.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ 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-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>"
MOD_WTJSHOPPINGCART_WHATS_NEW="<h3>v.1.0.3 Что нового?</h3><h4>Изменение ссылок в макетах</h4><p>В макетах модуля (находятся в папке <code>tmpl</code>) изменены ссылки на оформление заказа и корзину. Параметр <code>view</code> заменён на <code>controller</code>. Рекомендую сделать пункты меню для оформления заказа и корзины и скрыть их в настройках пункта меню.</p>"
4 changes: 2 additions & 2 deletions mod_wtjshoppingcart.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" client="site" method="upgrade">
<name>MOD_WTJSHOPPINGCART</name>
<creationDate>18/09/2022</creationDate>
<creationDate>August 2023</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.2</version>
<version>1.0.3</version>
<description>Displays a JoomShopping cart</description>
<namespace path="src">Joomla\Module\Wtjshoppingcart</namespace>
<scriptfile>script.php</scriptfile>
Expand Down
20 changes: 0 additions & 20 deletions script.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Version;

/**
* Script file of HelloWorld component.
*
* The name of this class is dependent on the component being installed.
* The class name should have the component's name, directly followed by
* the text InstallerScript (ex:. com_helloWorldInstallerScript).
*
* This class will be called by Joomla!'s installer, if specified in your component's
* manifest file, and is used for custom automation actions in its installation process.
*
* In order to use this automation script, you should reference it in your component's
* manifest file as follows:
* <scriptfile>script.php</scriptfile>
*
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
class mod_wtjshoppingcartInstallerScript
{
/**
Expand Down
11 changes: 6 additions & 5 deletions services/provider.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT JShopping Cart
*
* @copyright (C) 2022 Sergey Tolkachyov
* @link https://web-tolk.ru
* @license GNU General Public License version 2 or later
* @package WT JShopping Cart
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/

defined('_JEXEC') or die;
Expand Down
11 changes: 7 additions & 4 deletions src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT Yandex Map items
*
* @copyright (C) 2022 Sergey Tolkachyov
* @package WT JShopping Cart
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
* @license GNU General Public License version 2 or later
*/

namespace Joomla\Module\Wtjshoppingcart\Site\Dispatcher;
Expand Down Expand Up @@ -66,6 +67,8 @@ protected function getLayoutData() : array

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

return $data;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Fields/ModuleinfoField.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* @package WebTolk plugin info field
* @version 1.0.0
* @Author Sergey Tolkachyov, https://web-tolk.ru
* @copyright Copyright (C) 2020 Sergey Tolkachyov
* @license GNU/GPL http://www.gnu.org/licenses/gpl-2.0.html
* @since 1.0.0
* @package WT JShopping Cart
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/
namespace Joomla\Module\Wtjshoppingcart\Site\Fields;
defined('_JEXEC') or die;
Expand Down
28 changes: 24 additions & 4 deletions src/Helper/WtjshoppingcartHelper.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php
/**
* @package WT JoomShopping cart
* @author Sergey Tolkachyov, info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2022 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @package WT JShopping Cart
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/

namespace Joomla\Module\Wtjshoppingcart\Site\Helper;
Expand Down Expand Up @@ -53,6 +55,24 @@ public static function getCart(Registry &$params, CMSApplicationInterface $app)

return $cart;
}

/**
* Get a JoomShopping checkout url
*
* @param Registry &$params object holding the models parameters
*
* @return object jshopCart
*/
public static function getCheckoutUrl (Registry &$params, CMSApplicationInterface $app)
{
$cart = self::getCart($params, $app);
$cartpreview = \JSFactory::getModel('cartPreview', 'jshop');
$cartpreview->setCart($cart);
$cartpreview->setCheckoutStep(0);
$checkout_url = $cartpreview->getUrlCheckout();
var_dump($checkout_url);
return $checkout_url;
}
}

?>
11 changes: 6 additions & 5 deletions tmpl/bootstrap5-icon-and-text.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT JShopping Cart
* @author Sergey Tolkachyov, info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2022 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @link https://web-tolk.ru/en/dev/joomla-modules/wt-jshopping-cart-modul-bootstrap-5-korziny-dlya-joomshopping-5-i-joomla-4.html
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/
defined('_JEXEC') or die('Restricted access');

Expand Down Expand Up @@ -45,7 +46,7 @@
*/
?>

<a id="jshop_module_cart<?php echo $module->id;?>" role="button" class="btn btn-light btn-sm position-relative d-inline-flex flex-column p-1 wt_jshop_module_cart wt-jshopping-cart-module-icon <?php echo $params->get('moduleclass_sfx');?>" href="<?php print \JSHelper::SEFLink('index.php?option=com_jshopping&view=cart', 1);?>" rel="nofollow" title="<?php print Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART');?>">
<a id="jshop_module_cart<?php echo $module->id;?>" role="button" class="btn btn-light btn-sm position-relative d-inline-flex flex-column p-1 wt_jshop_module_cart wt-jshopping-cart-module-icon <?php echo $params->get('moduleclass_sfx');?>" href="<?php print \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart', 1);?>" rel="nofollow" title="<?php print Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART');?>">
<i class="<?php echo $params->get('icon_css_class', 'fas fa-shopping-cart');?>"></i> <?php print Text::_('MOD_WTJSHOPPINGCART_CART');?>
<span class="position-absolute top-0 start-100 translate-middle badge border-light rounded-pill bg-danger digit">
<?php echo $cart->count_product;?>
Expand Down
9 changes: 5 additions & 4 deletions tmpl/bootstrap5-icon-btn.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT JShopping Cart
* @author Sergey Tolkachyov, info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2022 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @link https://web-tolk.ru/en/dev/joomla-modules/wt-jshopping-cart-modul-bootstrap-5-korziny-dlya-joomshopping-5-i-joomla-4.html
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/
defined('_JEXEC') or die('Restricted access');

Expand Down
11 changes: 6 additions & 5 deletions tmpl/bootstrap5-icon.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT JShopping Cart
* @author Sergey Tolkachyov, info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2022 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @link https://web-tolk.ru/en/dev/joomla-modules/wt-jshopping-cart-modul-bootstrap-5-korziny-dlya-joomshopping-5-i-joomla-4.html
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/
defined('_JEXEC') or die('Restricted access');

Expand Down Expand Up @@ -47,7 +48,7 @@

<a id="jshop_module_cart<?php echo $module->id; ?>" role="button"
class="btn position-relative wt_jshop_module_cart wt-jshopping-cart-module-icon <?php echo $params->get('moduleclass_sfx'); ?>"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&view=cart', 1); ?>" rel="nofollow"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart', 1); ?>" rel="nofollow"
title="<?php print Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART'); ?>">
<i class="<?php echo $params->get('icon_css_class', 'fas fa-shopping-cart'); ?>"></i>
<span class="position-absolute top-0 start-100 translate-middle badge border-light rounded-pill bg-danger digit">
Expand Down
13 changes: 7 additions & 6 deletions tmpl/bootstrap5-list-group.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT JShopping Cart
* @author Sergey Tolkachyov, info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2022 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @link https://web-tolk.ru/en/dev/joomla-modules/wt-jshopping-cart-modul-bootstrap-5-korziny-dlya-joomshopping-5-i-joomla-4.html
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/
defined('_JEXEC') or die('Restricted access');

Expand Down Expand Up @@ -89,11 +90,11 @@
</div>
<div class="btn-group">
<a class="wt_jshop_module_cart btn btn-outline-primary btn-sm"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&view=cart', 1); ?>"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart'); ?>"
rel="nofollow"
title="<?php echo Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART'); ?>"><?php echo Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART'); ?></a>
<a class="wt_jshop_module_cart btn btn-primary btn-sm"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&view=checkout',1); ?>"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&controller=checkout'); ?>"
rel="nofollow"
title="<?php echo Text::_('MOD_WTJSHOPPINGCART_CHECKOUT'); ?>"><?php echo Text::_('MOD_WTJSHOPPINGCART_CHECKOUT'); ?></a>
</div>
Expand Down
13 changes: 7 additions & 6 deletions tmpl/bootstrap5-offcanvas.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT JShopping Cart
* @author Sergey Tolkachyov, info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2022 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @link https://web-tolk.ru/en/dev/joomla-modules/wt-jshopping-cart-modul-bootstrap-5-korziny-dlya-joomshopping-5-i-joomla-4.html
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/
defined('_JEXEC') or die('Restricted access');

Expand Down Expand Up @@ -107,11 +108,11 @@
</div>
<div class="btn-group">
<a class="wt_jshop_module_cart btn btn-outline-primary btn-sm"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&view=cart', 1); ?>"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart', 1); ?>"
rel="nofollow"
title="<?php echo Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART'); ?>"><?php echo Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART'); ?></a>
<a class="wt_jshop_module_cart btn btn-primary btn-sm"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&view=checkout'); ?>"
href="<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&controller=checkout'); ?>"
rel="nofollow"
title="<?php echo Text::_('MOD_WTJSHOPPINGCART_CHECKOUT'); ?>"><?php echo Text::_('MOD_WTJSHOPPINGCART_CHECKOUT'); ?></a>
</div>
Expand Down
11 changes: 6 additions & 5 deletions tmpl/default.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package WT JShopping Cart
* @author Sergey Tolkachyov, info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2022 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @link https://web-tolk.ru/en/dev/joomla-modules/wt-jshopping-cart-modul-bootstrap-5-korziny-dlya-joomshopping-5-i-joomla-4.html
* @version 1.0.3
* @author Sergey Tolkachyov <https://web-tolk.ru>
* @сopyright (c) 2022 - August 2023 Sergey Tolkachyov. All rights reserved.
* @license GNU/GPL license: https://www.gnu.org/copyleft/gpl.html
* @link https://web-tolk.ru
*/
defined('_JEXEC') or die('Restricted access');

Expand Down Expand Up @@ -58,7 +59,7 @@
</tr>
<tr>
<td colspan="3" align="right">
<a href = "<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1)?>"><?php print Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART')?></a>
<a href = "<?php echo \JSHelper::SEFLink('index.php?option=com_jshopping&controller=cart', 1)?>"><?php print Text::_('MOD_WTJSHOPPINGCART_GO_TO_CART')?></a>
</td>
</tr>
</table>
Expand Down

0 comments on commit 93f0ec7

Please sign in to comment.