Skip to content

Commit

Permalink
Version 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronef committed Sep 30, 2022
2 parents af89cdd + 7568809 commit abfedce
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# (MODX)EvolutionCMS.snippets.ddGetDocuments changelog


## Version 1.6 (2022-09-30)
* \+ Outputters → Json → Parameters → `outputterParams->templates->{$docFieldName}` → Placeholders: The new placeholders contain any document field name or TV specified in `outputterParams->docFields`.
* \* Outputters → Yandexmarket: Critical error related to missing initialization of an object field has been fixed.


## Version 1.5 (2022-06-03)
* \+ Parameters → `providerParams->groupBy`: The new parameter. Allows to group items that have the same field values into summary item (like SQL `GROUP BY`). See README.
* \* README → Examples: HJSON is used for all examples.
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG_ru.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# (MODX)EvolutionCMS.snippets.ddGetDocuments changelog


## Version 1.5 (2022-06-03)
## Версия 1.6 (2022-09-30)
* \+ Outputters → Json → Параметры → `outputterParams->templates->{$docFieldName}` → Плейсхолдеры: Новые плейсхолдеры. Содержат значения полей документа (и TV), указанных в `outputterParams->docFields`.
* \* Outputters → Yandexmarket: Исправлена критическая ошибка, связанная с отсутствием инициализации поля объекта.


## Версия 1.5 (2022-06-03)
* \+ Параметры → `providerParams->groupBy`: Новый параметр. Позволяет сгруппировать элементы, имеющие одинаковые значения полей, в один сводный элемент (как SQL `GROUP BY`). См. README.
* \* README → Примеры: HJSON используется для всех примеров.

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A snippet for fetching and parsing resources from the document tree or custom DB
#### 1. Elements → Snippets: Create a new snippet with the following data

1. Snippet name: `ddGetDocuments`.
2. Description: `<b>1.5</b> A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.`.
2. Description: `<b>1.6</b> A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddGetDocuments_snippet.php` file from the archive.
Expand Down Expand Up @@ -297,7 +297,8 @@ Get resources from custom DB table.
It is useful for manipulations with doc field values through running snippets.
Available placeholders:
* `[+value+]` — document field value
* `[+value+]` — the field value
* `[+`any document field or tv name`+]` — Any document field name or TV specified in `outputterParams->docFields`
* Valid values:
* `stringChunkName`
* `string` — use inline templates starting with `@CODE:`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dd/evolutioncms-snippets-ddgetdocuments",
"type": "modxevo-snippet",
"version": "1.5.0",
"version": "1.6.0",
"description": "A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.",
"keywords": [
"modx",
Expand Down
2 changes: 1 addition & 1 deletion ddGetDocuments_snippet.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ddGetDocuments
* @version 1.5 (2022-06-03)
* @version 1.6 (2022-09-30)
*
* @see README.md
*
Expand Down
13 changes: 9 additions & 4 deletions src/Outputter/Json/Outputter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Outputter extends \ddGetDocuments\Outputter\Outputter {
/**
* parse
* @version 2.2 (2021-07-12)
* @version 2.3 (2022-09-30)
*
* @param $data {Output}
*
Expand Down Expand Up @@ -39,9 +39,14 @@ public function parse(Output $data){
){
$result_item[$docField] = \ddTools::parseSource(\ddTools::parseText([
'text' => $this->templates->{$docField},
'data' => [
'value' => $result_item[$docField]
]
'data' => \DDTools\ObjectTools::extend([
'objects' => [
$itemData,
[
'value' => $result_item[$docField]
]
]
])
]));
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Outputter/Yandexmarket/Outputter.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,15 @@ function __construct($params = []){

/**
* construct_prepareFields
* @version 1.0.1 (2021-07-09)
* @version 1.0.2 (2022-09-20)
*
* @return {void}
*/
private function construct_prepareFields(){
//Convert fields to objects
$this->shopData = (object) $this->shopData;
$this->offerFields = (object) $this->offerFields;
$this->templates = (object) $this->templates;
foreach (
$this->offerFields as
$offerFieldName =>
Expand Down
2 changes: 1 addition & 1 deletion src/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Snippet extends \DDTools\Snippet {
protected
$version = '1.5.0',
$version = '1.6.0',

$renamedParamsCompliance = [
'outputter' => 'outputFormat',
Expand Down

0 comments on commit abfedce

Please sign in to comment.