diff --git a/CHANGELOG.md b/CHANGELOG.md index 20727ee..0ab4bf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/CHANGELOG_ru.md b/CHANGELOG_ru.md index 708470a..08481a3 100644 --- a/CHANGELOG_ru.md +++ b/CHANGELOG_ru.md @@ -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 используется для всех примеров. diff --git a/README.md b/README.md index 1fe8224..f4776b7 100644 --- a/README.md +++ b/README.md @@ -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: `1.5 A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.`. +2. Description: `1.6 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. @@ -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:` diff --git a/composer.json b/composer.json index b4d95b3..e000a47 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/ddGetDocuments_snippet.php b/ddGetDocuments_snippet.php index 806834f..87efa10 100644 --- a/ddGetDocuments_snippet.php +++ b/ddGetDocuments_snippet.php @@ -1,7 +1,7 @@ $this->templates->{$docField}, - 'data' => [ - 'value' => $result_item[$docField] - ] + 'data' => \DDTools\ObjectTools::extend([ + 'objects' => [ + $itemData, + [ + 'value' => $result_item[$docField] + ] + ] + ]) ])); } } diff --git a/src/Outputter/Yandexmarket/Outputter.php b/src/Outputter/Yandexmarket/Outputter.php index 1a29e8c..125b8f8 100644 --- a/src/Outputter/Yandexmarket/Outputter.php +++ b/src/Outputter/Yandexmarket/Outputter.php @@ -305,7 +305,7 @@ function __construct($params = []){ /** * construct_prepareFields - * @version 1.0.1 (2021-07-09) + * @version 1.0.2 (2022-09-20) * * @return {void} */ @@ -313,6 +313,7 @@ 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 => diff --git a/src/Snippet.php b/src/Snippet.php index 4d12352..238febc 100644 --- a/src/Snippet.php +++ b/src/Snippet.php @@ -3,7 +3,7 @@ class Snippet extends \DDTools\Snippet { protected - $version = '1.5.0', + $version = '1.6.0', $renamedParamsCompliance = [ 'outputter' => 'outputFormat',