Skip to content

Commit

Permalink
Merge pull request #680 from modx-pro/ms_301
Browse files Browse the repository at this point in the history
ms 3.0.1
  • Loading branch information
biz87 committed May 20, 2022
2 parents a071310 + b92017f commit 85bfa88
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 34 deletions.
2 changes: 1 addition & 1 deletion _build/build.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const PKG_NAME = 'miniShop2';
define('PKG_NAME_LOWER', strtolower(PKG_NAME));

const PKG_VERSION = '3.0.0';
const PKG_VERSION = '3.0.1';
const PKG_RELEASE = 'pl';
const PKG_AUTO_INSTALL = true;

Expand Down
8 changes: 8 additions & 0 deletions core/components/minishop2/docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.1-pl] - 2022-05-04

### Changed
- Old controllers msCartHandler, msOrderHandler, msDeliveryHandler, msPaymentHandler are marked as deprecated with usage error logged
- The configuration required for JS controllers no longer depends on the included js files and is always available
- DB storage controllers got additional checks
- Update Copyrights

## [3.0.0-pl] - 2022-04-27

### Added
Expand Down
4 changes: 3 additions & 1 deletion core/components/minishop2/docs/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
miniShop2
--------------------
Author: Vasiliy Naumkin <bezumkin@yandex.ru>
Owner: MODX RSC – Russian Speaking Community https://github.com/modx-pro
Support and development Nikolay Savin https://t.me/biz87
--------------------

Feel free to suggest ideas/improvements/bugs on GitHub:
http://github.com/bezumkin/miniShop2/issues
https://github.com/modx-pro/miniShop2
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
break;

case 'OnLoadWebDocument':
/** @var miniShop2 $miniShop2 */
$miniShop2 = $modx->getService('miniShop2');
$registerFrontend = $modx->getOption('ms2_register_frontend', null, '1');
if ($miniShop2 && $registerFrontend) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public function add($cartItem)

public function change($key, $count)
{
if (empty($this->products)) {
return $this->get();
}

foreach ($this->products as $product) {
$properties = $product->get('properties');
if ($key === $properties['key']) {
Expand All @@ -137,6 +141,9 @@ public function change($key, $count)

public function remove($key)
{
if (empty($this->products)) {
return $this->get();
}
foreach ($this->products as $k => $product) {
$properties = $product->get('properties');
if ($key === $properties['key']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function get()

public function add($key, $value = '')
{
if (empty($this->msOrder)) {
return $this->get();
}
switch ($key) {
case 'delivery':
case 'payment':
Expand All @@ -49,6 +52,9 @@ public function add($key, $value = '')

public function remove($key)
{
if (empty($this->msOrder)) {
return $this->get();
}
switch ($key) {
case 'delivery':
case 'payment':
Expand All @@ -65,6 +71,9 @@ public function remove($key)

public function clean()
{
if (empty($this->msOrder)) {
return [];
}
$fields = $this->get();
foreach ($fields as $key => $value) {
switch ($key) {
Expand Down
2 changes: 1 addition & 1 deletion core/components/minishop2/lexicon/ru/setting.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
По умолчанию к настройкам jgrowl. <br>
Если вы хотите использовать собственную библиотеку - укажите путь к ее настройкам здесь, или очистите параметр и загрузите их вручную через шаблон сайта.";
$_lang['setting_ms2_register_frontend'] = 'Добавлять js и css из комплекта ms2 файлы в DOM дерево';
$_lang['setting_ms2_register_frontend_desc'] = "Разрешить добавление в DOM дерево ссылок на js и css файлы из комплекта ms2";
$_lang['setting_ms2_register_frontend_desc'] = 'Разрешить добавление в DOM дерево ссылок на js и css файлы из комплекта ms2';


$_lang['setting_ms2_payment_paypal_api_url'] = 'Url api запросов PayPal';
Expand Down
54 changes: 27 additions & 27 deletions core/components/minishop2/model/minishop2/minishop2.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class miniShop2
{
public $version = '3.0.0-pl';
public $version = '3.0.1-pl';
/** @var modX $modx */
public $modx;
/** @var pdoFetch $pdoTools */
Expand Down Expand Up @@ -120,34 +120,34 @@ public function registerFrontend($ctx = 'web')
$js .= '?v=' . substr(md5($this->version), 0, 10);
}
$this->modx->regClientScript(str_replace($config['pl'], $config['vl'], $js));
}

$message_setting = array(
'close_all_message' => $this->modx->lexicon('ms2_message_close_all'),
);

$message_setting = array(
'close_all_message' => $this->modx->lexicon('ms2_message_close_all'),
);

$js_setting = array(
'cssUrl' => $this->config['cssUrl'] . 'web/',
'jsUrl' => $this->config['jsUrl'] . 'web/',
'actionUrl' => $this->config['actionUrl'],
'ctx' => $ctx,
'price_format' => json_decode(
$this->modx->getOption('ms2_price_format', null, '[2, ".", " "]'),
true
),
'price_format_no_zeros' => (bool)$this->modx->getOption('ms2_price_format_no_zeros', null, true),
'weight_format' => json_decode(
$this->modx->getOption('ms2_weight_format', null, '[3, ".", " "]'),
true
),
'weight_format_no_zeros' => (bool)$this->modx->getOption('ms2_weight_format_no_zeros', null, true),
);

$data = json_encode(array_merge($message_setting, $js_setting), true);
$this->modx->regClientStartupScript(
'<script>miniShop2Config = ' . $data . ';</script>',
$js_setting = array(
'cssUrl' => $this->config['cssUrl'] . 'web/',
'jsUrl' => $this->config['jsUrl'] . 'web/',
'actionUrl' => $this->config['actionUrl'],
'ctx' => $ctx,
'price_format' => json_decode(
$this->modx->getOption('ms2_price_format', null, '[2, ".", " "]'),
true
);
}
),
'price_format_no_zeros' => (bool)$this->modx->getOption('ms2_price_format_no_zeros', null, true),
'weight_format' => json_decode(
$this->modx->getOption('ms2_weight_format', null, '[3, ".", " "]'),
true
),
'weight_format_no_zeros' => (bool)$this->modx->getOption('ms2_weight_format_no_zeros', null, true),
);

$data = json_encode(array_merge($message_setting, $js_setting), true);
$this->modx->regClientStartupScript(
'<script>miniShop2Config = ' . $data . ';</script>',
true
);

// Register notify plugin JS
$message_js = trim($this->modx->getOption('ms2_frontend_message_js'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

//Deprecated: use handlers from catalog core/components/minishop2/handlers/
$this->modx->log(1, 'Deprecated: use handlers from catalog core/components/minishop2/handlers/');
require_once dirname(__FILE__, 3) . '/handlers/mscarthandler.class.php';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

//Deprecated: use handlers from catalog core/components/minishop2/handlers/
$this->modx->log(1, 'Deprecated: use handlers from catalog core/components/minishop2/handlers/');
require_once dirname(__FILE__, 3) . '/handlers/msdeliveryhandler.class.php';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

//Deprecated: use handlers from catalog core/components/minishop2/handlers/
$this->modx->log(1, 'Deprecated: use handlers from catalog core/components/minishop2/handlers/');
require_once dirname(__FILE__, 3) . '/handlers/msorderhandler.class.php';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

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

0 comments on commit 85bfa88

Please sign in to comment.