Skip to content

Commit

Permalink
Merge pull request #692 from modx-pro/3.0.4
Browse files Browse the repository at this point in the history
3.0.4
  • Loading branch information
biz87 committed Jun 8, 2022
2 parents 08c89e4 + 6903901 commit 0d3bfba
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 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.3';
const PKG_VERSION = '3.0.4';
const PKG_RELEASE = 'pl';
const PKG_AUTO_INSTALL = true;

Expand Down
10 changes: 10 additions & 0 deletions core/components/minishop2/docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ 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.4-pl] - 2022-06-09

### Added
Removal of empty directories of images #685

### Changed
Fix escaping rank field for msProductFile #690
Fix first thumbnail generator #691
load minishop2:default lexicon in registerFrontend #688

## [3.0.3-pl] - 2022-05-30

### Changed
Expand Down
2 changes: 2 additions & 0 deletions core/components/minishop2/model/minishop2/minishop2.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public function initialize($ctx = 'web', $scriptProperties = array())
public function registerFrontend($ctx = 'web')
{
if ($ctx != 'mgr' && (!defined('MODX_API_MODE') || !MODX_API_MODE)) {
$this->modx->lexicon->load('minishop2:default');

$config = $this->pdoTools->makePlaceholders($this->config);

// Register CSS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function getFirstThumbnail()
'type' => 'image',
));
$c->limit(1);
$c->sortby('`rank` ASC,`id`', 'ASC');
$c->sortby('`rank`', 'ASC');
$c->select('id,url');

$res = array();
Expand Down
16 changes: 8 additions & 8 deletions core/components/minishop2/processors/mgr/gallery/sort.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ public function process()
}

if ($source->get('rank') < $target->get('rank')) {
$this->modx->exec("UPDATE {$this->modx->getTableName('msProductFile')}
$sql = "UPDATE {$this->modx->getTableName('msProductFile')}
SET `rank` = `rank` - 1 WHERE
`product_id` = " . $product_id . "
`product_id` = {$product_id}
AND `rank` <= {$target->get('rank')}
AND `rank` > {$source->get('rank')}
AND `rank` > 0
");
$newRank = $target->get('rank');
";
} else {
$this->modx->exec("UPDATE {$this->modx->getTableName('msProductFile')}
$sql = "UPDATE {$this->modx->getTableName('msProductFile')}
SET `rank` = `rank` + 1 WHERE
`product_id` = " . $product_id . "
`product_id` = {$product_id}
AND `rank` >= {$target->get('rank')}
AND `rank` < {$source->get('rank')}
");
$newRank = $target->get('rank');
";
}
$this->modx->exec($sql);
$newRank = $target->get('rank');
$source->set('rank', $newRank);
$source->save();

Expand Down

0 comments on commit 0d3bfba

Please sign in to comment.