Skip to content

Commit 85bfa88

Browse files
authored
Merge pull request #680 from modx-pro/ms_301
ms 3.0.1
2 parents a071310 + b92017f commit 85bfa88

File tree

12 files changed

+61
-34
lines changed

12 files changed

+61
-34
lines changed

_build/build.config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const PKG_NAME = 'miniShop2';
55
define('PKG_NAME_LOWER', strtolower(PKG_NAME));
66

7-
const PKG_VERSION = '3.0.0';
7+
const PKG_VERSION = '3.0.1';
88
const PKG_RELEASE = 'pl';
99
const PKG_AUTO_INSTALL = true;
1010

core/components/minishop2/docs/changelog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.0.1-pl] - 2022-05-04
9+
10+
### Changed
11+
- Old controllers msCartHandler, msOrderHandler, msDeliveryHandler, msPaymentHandler are marked as deprecated with usage error logged
12+
- The configuration required for JS controllers no longer depends on the included js files and is always available
13+
- DB storage controllers got additional checks
14+
- Update Copyrights
15+
816
## [3.0.0-pl] - 2022-04-27
917

1018
### Added

core/components/minishop2/docs/readme.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
miniShop2
33
--------------------
44
Author: Vasiliy Naumkin <bezumkin@yandex.ru>
5+
Owner: MODX RSC – Russian Speaking Community https://github.com/modx-pro
6+
Support and development Nikolay Savin https://t.me/biz87
57
--------------------
68

79
Feel free to suggest ideas/improvements/bugs on GitHub:
8-
http://github.com/bezumkin/miniShop2/issues
10+
https://github.com/modx-pro/miniShop2

core/components/minishop2/elements/plugins/plugin.minishop2.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
break;
3434

3535
case 'OnLoadWebDocument':
36+
/** @var miniShop2 $miniShop2 */
3637
$miniShop2 = $modx->getService('miniShop2');
3738
$registerFrontend = $modx->getOption('ms2_register_frontend', null, '1');
3839
if ($miniShop2 && $registerFrontend) {

core/components/minishop2/handlers/storage/db/cartdbhandler.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public function add($cartItem)
119119

120120
public function change($key, $count)
121121
{
122+
if (empty($this->products)) {
123+
return $this->get();
124+
}
125+
122126
foreach ($this->products as $product) {
123127
$properties = $product->get('properties');
124128
if ($key === $properties['key']) {
@@ -137,6 +141,9 @@ public function change($key, $count)
137141

138142
public function remove($key)
139143
{
144+
if (empty($this->products)) {
145+
return $this->get();
146+
}
140147
foreach ($this->products as $k => $product) {
141148
$properties = $product->get('properties');
142149
if ($key === $properties['key']) {

core/components/minishop2/handlers/storage/db/orderdbhandler.class.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public function get()
3232

3333
public function add($key, $value = '')
3434
{
35+
if (empty($this->msOrder)) {
36+
return $this->get();
37+
}
3538
switch ($key) {
3639
case 'delivery':
3740
case 'payment':
@@ -49,6 +52,9 @@ public function add($key, $value = '')
4952

5053
public function remove($key)
5154
{
55+
if (empty($this->msOrder)) {
56+
return $this->get();
57+
}
5258
switch ($key) {
5359
case 'delivery':
5460
case 'payment':
@@ -65,6 +71,9 @@ public function remove($key)
6571

6672
public function clean()
6773
{
74+
if (empty($this->msOrder)) {
75+
return [];
76+
}
6877
$fields = $this->get();
6978
foreach ($fields as $key => $value) {
7079
switch ($key) {

core/components/minishop2/lexicon/ru/setting.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
По умолчанию к настройкам jgrowl. <br>
131131
Если вы хотите использовать собственную библиотеку - укажите путь к ее настройкам здесь, или очистите параметр и загрузите их вручную через шаблон сайта.";
132132
$_lang['setting_ms2_register_frontend'] = 'Добавлять js и css из комплекта ms2 файлы в DOM дерево';
133-
$_lang['setting_ms2_register_frontend_desc'] = "Разрешить добавление в DOM дерево ссылок на js и css файлы из комплекта ms2";
133+
$_lang['setting_ms2_register_frontend_desc'] = 'Разрешить добавление в DOM дерево ссылок на js и css файлы из комплекта ms2';
134134

135135

136136
$_lang['setting_ms2_payment_paypal_api_url'] = 'Url api запросов PayPal';

core/components/minishop2/model/minishop2/minishop2.class.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class miniShop2
44
{
5-
public $version = '3.0.0-pl';
5+
public $version = '3.0.1-pl';
66
/** @var modX $modx */
77
public $modx;
88
/** @var pdoFetch $pdoTools */
@@ -120,34 +120,34 @@ public function registerFrontend($ctx = 'web')
120120
$js .= '?v=' . substr(md5($this->version), 0, 10);
121121
}
122122
$this->modx->regClientScript(str_replace($config['pl'], $config['vl'], $js));
123+
}
124+
125+
$message_setting = array(
126+
'close_all_message' => $this->modx->lexicon('ms2_message_close_all'),
127+
);
123128

124-
$message_setting = array(
125-
'close_all_message' => $this->modx->lexicon('ms2_message_close_all'),
126-
);
127-
128-
$js_setting = array(
129-
'cssUrl' => $this->config['cssUrl'] . 'web/',
130-
'jsUrl' => $this->config['jsUrl'] . 'web/',
131-
'actionUrl' => $this->config['actionUrl'],
132-
'ctx' => $ctx,
133-
'price_format' => json_decode(
134-
$this->modx->getOption('ms2_price_format', null, '[2, ".", " "]'),
135-
true
136-
),
137-
'price_format_no_zeros' => (bool)$this->modx->getOption('ms2_price_format_no_zeros', null, true),
138-
'weight_format' => json_decode(
139-
$this->modx->getOption('ms2_weight_format', null, '[3, ".", " "]'),
140-
true
141-
),
142-
'weight_format_no_zeros' => (bool)$this->modx->getOption('ms2_weight_format_no_zeros', null, true),
143-
);
144-
145-
$data = json_encode(array_merge($message_setting, $js_setting), true);
146-
$this->modx->regClientStartupScript(
147-
'<script>miniShop2Config = ' . $data . ';</script>',
129+
$js_setting = array(
130+
'cssUrl' => $this->config['cssUrl'] . 'web/',
131+
'jsUrl' => $this->config['jsUrl'] . 'web/',
132+
'actionUrl' => $this->config['actionUrl'],
133+
'ctx' => $ctx,
134+
'price_format' => json_decode(
135+
$this->modx->getOption('ms2_price_format', null, '[2, ".", " "]'),
148136
true
149-
);
150-
}
137+
),
138+
'price_format_no_zeros' => (bool)$this->modx->getOption('ms2_price_format_no_zeros', null, true),
139+
'weight_format' => json_decode(
140+
$this->modx->getOption('ms2_weight_format', null, '[3, ".", " "]'),
141+
true
142+
),
143+
'weight_format_no_zeros' => (bool)$this->modx->getOption('ms2_weight_format_no_zeros', null, true),
144+
);
145+
146+
$data = json_encode(array_merge($message_setting, $js_setting), true);
147+
$this->modx->regClientStartupScript(
148+
'<script>miniShop2Config = ' . $data . ';</script>',
149+
true
150+
);
151151

152152
// Register notify plugin JS
153153
$message_js = trim($this->modx->getOption('ms2_frontend_message_js'));
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22

3-
//Deprecated: use handlers from catalog core/components/minishop2/handlers/
3+
$this->modx->log(1, 'Deprecated: use handlers from catalog core/components/minishop2/handlers/');
44
require_once dirname(__FILE__, 3) . '/handlers/mscarthandler.class.php';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22

3-
//Deprecated: use handlers from catalog core/components/minishop2/handlers/
3+
$this->modx->log(1, 'Deprecated: use handlers from catalog core/components/minishop2/handlers/');
44
require_once dirname(__FILE__, 3) . '/handlers/msdeliveryhandler.class.php';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22

3-
//Deprecated: use handlers from catalog core/components/minishop2/handlers/
3+
$this->modx->log(1, 'Deprecated: use handlers from catalog core/components/minishop2/handlers/');
44
require_once dirname(__FILE__, 3) . '/handlers/msorderhandler.class.php';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22

3-
//Deprecated: use handlers from catalog core/components/minishop2/handlers/
3+
$this->modx->log(1, 'Deprecated: use handlers from catalog core/components/minishop2/handlers/');
44
require_once dirname(__FILE__, 3) . '/handlers/mspaymenthandler.class.php';

0 commit comments

Comments
 (0)