Commit 6a003656 authored by Gorodkov Denis's avatar Gorodkov Denis

commerce

parent 049aace8
This diff is collapsed.
uuid: fcf6028d-a796-4ad6-83f3-59e025ba449d
langcode: en
status: true
dependencies:
module:
- tour
id: tour.token
label: Token
targetEntityType: tour
cache: true
......@@ -55,7 +55,6 @@ module:
file: 0
filter: 0
help: 0
history: 0
image: 0
inline_entity_form: 0
jquery_ui: 0
......@@ -98,7 +97,6 @@ module:
text: 0
token: 0
toolbar: 0
tour: 0
ultimate_cron: 0
update: 0
user: 0
......
label: 'Block Layout Page'
tips:
block-layout:
label: 'Block Layout'
body: 'Blocks are boxes of content rendered into an area, or region, of a web page that can be displayed in regions (such as footer or sidebar) on your page.'
place-block:
label: 'Place Blocks'
body: 'Any custom or contributed block can be added to a particular region by clicking on a button Place block. A new block can also be created by clicking on Place Block'
block-region:
label: 'Block Region'
body: 'Assign or change the region of a block by clicking here. A dropdown list with all the regions will appear.You can place one block in multiple regions.'
configure-block:
label: 'Configure Block'
body: 'By Clicking on "Configure" you can go ahead and edit the contents of the block, deal with the visibility settings and even change the placement of where it is on your theme.'
custom-block-library:
label: 'Custom Block Library'
body: 'The block management screen also has an another tab on the top which is used to add Custom blocks. The name of the tab is "Custom block library". This tab ultimately provides a link to add custom blocks.'
label: 'Adding languages'
tips:
language-add-overview:
label: 'Adding languages'
body: '<p>This page provides the ability to add common languages to your site.</p><p>If the desired language is not available, you can add a custom language.</p>'
language-add-choose:
label: 'Select language'
body: '<p>Choose a language from the list, or choose "Custom language..." at the end of the list.</p><p>Click the "Add language" button when you are done choosing your language.</p><p>When adding a custom language, you will get an additional form where you can provide the name, code, and direction of the language.</p>'
language-add-continue:
label: 'Continuing on'
body: '<p>Now that you have an overview of the "Add languages" feature, you can continue by:<ul><li>Adding a language</li><li>Adding a custom language</li><li><a href="[site:url]admin/config/regional/language">Viewing configured languages</a></li></ul></p>'
label: 'Editing languages'
tips:
language-edit-overview:
label: 'Editing languages'
body: '<p>This page provides the ability to edit a language on your site, including custom languages.</p>'
language-edit-langcode:
label: 'Language code'
body: '<p>You cannot change the code of a language on the site, since it is used by the system to keep track of the language.</p>'
language-edit-label:
label: 'Language name'
body: '<p>The language name is used throughout the site for all users and is written in English. Names of built-in languages can be translated using the Interface Translation module, and names of both built-in and custom languages can be translated using the Configuration Translation module.</p>'
language-edit-direction:
label: 'Language direction'
body: '<p>Choose if the language is a "Left to right" or "Right to left" language.</p><p>Note that not all themes support "Right to left" layouts, so test your theme if you are using "Right to left".</p>'
language-edit-continue:
label: 'Continuing on'
body: '<p>Now that you have an overview of the "Edit language" feature, you can continue by:<ul><li>Editing a language</li><li><a href="[site:url]admin/config/regional/language">Viewing configured languages</a></li></ul></p>'
label: Language
tips:
language-overview:
label: Languages
body: '<p>The "Languages" page allows you to add, edit, delete, and reorder languages for the site.</p>'
language-add:
label: 'Adding languages'
body: '<p>To add more languages to your site, click the "Add language" button.</p><p>Added languages will be displayed in the language list and can then be edited or deleted.</p>'
language-reorder:
label: 'Reordering languages'
body: '<p>To reorder the languages on your site, use the drag icons next to each language.</p><p>The order shown here is the display order for language lists on the site such as in the language switcher blocks provided by the Interface Translation and Content Translation modules.</p><p>When you are done with reordering the languages, click the "Save configuration" button for the changes to take effect.</p>'
language-default:
label: 'Set a language as default'
body: '<p>You can change the default language of the site by choosing one of your configured languages as default. The site will use the default language in situations where no choice is made but a language should be set, for example as the language of the displayed interface.</p>'
language-operations:
label: 'Modifying languages'
body: '<p>Operations are provided for editing and deleting your languages.</p><p>You can edit the name and the direction of the language.</p><p>Deleted languages can be added back at a later time. Deleting a language will remove all interface translations associated with it, and content in this language will be set to be language neutral. Note that you cannot delete the default language of the site.</p>'
language-continue:
label: 'Continuing on'
body: '<p>Now that you have an overview of the "Languages" page, you can continue by:<ul><li><a href="[site:url]admin/config/regional/language/add">Adding a language</a></li><li>Reordering languages</li><li>Editing a language</li><li>Deleting a language</li></ul></p>'
label: Translation
tips:
locale-overview:
label: 'User interface translation'
body: 'This page allows you to translate the user interface or modify existing translations. If you have installed your site initially in English, you must first add another language on the <a href="[site:url]admin/config/regional/language">Languages page</a>, in order to use this page.'
locale-language:
label: 'Translation language'
body: 'Choose the language you want to translate.'
locale-search:
label: Search
body: 'Enter the specific word or sentence you want to translate, you can also write just a part of a word.'
locale-filter:
label: 'Filter the search'
body: 'You can search for untranslated strings if you want to translate something that isn''t translated yet. If you want to modify an existing translation, you might want to search only for translated strings.'
locale-submit:
label: 'Apply your search criteria'
body: 'To apply your search criteria, click on the <em>Filter</em> button.'
locale-translate:
label: Translate
body: 'You can write your own translation in the text fields of the right column. Try to figure out in which context the text will be used in order to translate it in the appropriate way.'
locale-validate:
label: 'Validate the translation'
body: 'When you have finished your translations, click on the <em>Save translations</em> button. You must save your translations, each time before changing the page or making a new search.'
locale-continue:
label: 'Continuing on'
body: 'The translations you have made here will be used on your site''s user interface. If you want to use them on another site or modify them on an external translation editor, you can <a href="[site:url]admin/config/regional/translate/export">export them</a> to a .po file and <a href="[site:url]admin/config/regional/translate/import">import them</a> later.'
label: 'Fields indexed in this index'
tips:
search-api-index-fields-introduction:
label: 'Fields indexed in this index'
body: 'This page lists which fields are indexed in this index, grouped by datasource. (Datasource-independent fields are listed under "General".) Indexed fields can be used to add filters or sorting to views or other search displays based on the index. Fields with type "Fulltext" can also be used for fulltext searching.'
search-api-index-fields-add:
label: 'Add fields'
body: 'With the "Add fields" button you can add additional fields to this index.'
search-api-index-fields-label:
label: Label
body: 'A label for the field that will be used to refer to the field in most places in the user interface.'
search-api-index-fields-machine-name:
label: 'Machine name'
body: 'The internal ID to use for this field. Can safely be ignored by inexperienced users in most cases. Changing a field''s machine name requires reindexing of the index.'
search-api-index-fields-property-path:
label: 'Property path'
body: 'The internal relationship linking the indexed item to the field, with links being separated by colons (:). This can be useful information for advanced users, but can otherwise be ignored.'
search-api-index-fields-type:
label: Type
body: 'The data type to use when indexing the field. Determines how a field can be used in searches. For information on the available types, see the <a href="#search-api-data-types-table">"Data types" box</a> at the bottom of the page.'
search-api-index-fields-boost:
label: Boost
body: 'Only applicable for fulltext fields. Determines how "important" the field is compared to other fulltext fields, to influence scoring of fulltext searches.'
search-api-index-fields-edit:
label: 'Edit field'
body: 'Some fields have additional configuration available, in which case an "Edit" link is displayed in the "Operations" column.'
search-api-index-fields-remove:
label: 'Remove field'
body: 'Removes a field from the index again. (Note: Sometimes, a field is required (for example, by a processor) and cannot be removed.)'
search-api-index-fields-submit:
label: 'Save changes'
body: 'This saves all changes made to the fields for this index. Until this button is pressed, all added, changed or removed fields will only be stored temporarily and not effect the actual index used in the rest of the site.'
search-api-index-fields-cancel:
label: 'Cancel changes'
body: 'If you have made changes to the index''s fields but not yet saved them, the "Cancel" link lets you discard those changes.'
label: 'Add or edit a Search API index'
tips:
search-api-index-form-introduction:
label: 'Adding or editing an index'
body: 'This form can be used to edit an existing index or add a new index to your site. Indexes define a set of data that will be indexed and can then be searched.'
search-api-index-form-name:
label: 'Index name'
body: 'Enter a name to identify this index. For example, "Content index". This will only be displayed in the admin user interface.'
search-api-index-form-datasources:
label: Datasources
body: 'Datasources define the types of items that will be indexed in this index. By default, all content entities (like content, comments and taxonomy terms) will be available here, but modules can also add their own.'
search-api-index-form-tracker:
label: Tracker
body: 'An index''s tracker is the system that keeps track of which items there are available for the index, and which of them still need to be indexed. Changing the tracker of an existing index will lead to reindexing of all items.'
search-api-index-form-server:
label: Server
body: 'The search server that the index should use for indexing and searching. If no server is selected here, the index cannot be enabled. An index can only have one server, but a server can have any number of indexes.'
search-api-index-form-description:
label: 'Index description'
body: 'Optionally, enter a description to explain the function of the index in more detail. This will only be displayed in the admin user interface.'
search-api-index-form-options:
label: 'Advanced options'
body: 'These options allow more detailed configuration of index behavior, but can usually safely be ignored by inexperienced users.'
label: 'Processors used for this index'
tips:
search-api-index-processors-introduction:
label: 'Processors used for this index'
body: 'Processors customize different aspects of an index''s functionality. They can keep items from being indexed, change how certain fields are indexed and influence searches.'
search-api-index-processors-enable:
label: 'Enable processors'
body: 'This lists all processors available for this index and lets you choose the ones that should be active. (Note: Some processors cannot be disabled.)'
search-api-index-processors-weights:
label: 'Processor order'
body: 'This shows you which enabled processors will be active in the different parts of the indexing/searching workflow, and lets you re-arrange them. This should usually not be necessary, and only be used by advanced users as some processors will lead to unexpected results when used in the wrong order.'
search-api-index-processors-settings:
label: 'Processor settings'
body: 'Some processors have additional configuration available, which you are able to change here.'
label: 'Information about an index'
tips:
search-api-index-introduction:
label: 'Information about an index'
body: 'This page shows a summary of a search index and its status.'
search-api-index-index-status:
label: 'Index status'
body: 'This gives a summary about how many items are known for this index, and how many have been indexed in their latest version. Items that are not indexed yet cannot be found by searches.'
search-api-index-status:
label: Status
body: 'Shows whether the index is currently enabled or disabled.'
search-api-index-datasources:
label: Datasources
body: 'Lists all datasources that are enabled for this index.'
search-api-index-tracker:
label: Tracker
body: 'The tracker used by the index. Only one ("Default") is available by default.'
search-api-index-server:
label: Server
body: 'If the index is attached to a server, this server is listed here.'
search-api-index-server-index-status:
label: 'Server index status'
body: 'For enabled indexes, the number of items that can actually be retrieved from the server is listed here. For reasons why this number might differ from the number under "Index status", <a href="https://www.drupal.org/docs/8/modules/search-api/getting-started/frequently-asked-questions#server-index-status">see the module''s documentation</a>.'
search-api-index-cron-batch-size:
label: 'Cron batch size'
body: 'The number of items that will be indexed at once during cron runs.'
search-api-index-index-now:
label: 'Start indexing now'
body: 'The "Start indexing now" form allows indexing items manually right away, with a batch process. Otherwise, items are only indexed during cron runs. The form might be disabled if indexing is currently not possible for some reason, or not necessary.'
search-api-index-tracking:
label: 'Track items for index'
body: 'In certain situations, the index''s tracker doesn''t have the latest state of the items available for indexing. This will be automatically rectified during cron runs, but can also be manually triggered here, with the "Track now" button.'
search-api-index-reindex:
label: 'Queue all items for reindexing'
body: 'This will queue all items on this index for reindexing. Previously indexed data will remain on the search server, so searches on this index will continue to yield results.'
search-api-index-clear:
label: 'Clear all indexed data'
body: 'This will remove all indexed content for this index from the search server and queue it for reindexing. Searches on this index will not return any results until items are reindexed.'
label: 'Add or edit a Search API server'
tips:
search-api-server-form-introduction:
label: 'Adding or editing a Server'
body: 'This form can be used to edit an existing server or add a new server to your site. Servers will hold your indexed data.'
search-api-server-form-name:
label: 'Server name'
body: 'Enter a name to identify this server. For example, "Solr server". This will only be displayed in the admin user interface.'
search-api-server-form-description:
label: 'Server description'
body: 'Optionally, enter a description to explain the function of the server in more detail. This will only be displayed in the admin user interface.'
search-api-server-form-backend:
label: 'Server backend'
body: 'Servers can be based on different technologies. These are called "backends". A server uses exactly one backend and cannot change it later. You can make the "Database" backend available by enabling the "Database Search" module. Another very common backend is <a href="https://www.drupal.org/project/search_api_solr">"Solr"</a>, which requires to be set up separately.'
label: 'Information about a server'
tips:
search-api-server-introduction:
label: 'Information about a server'
body: 'This page shows a summary of a search server.'
search-api-server-status:
label: Status
body: 'Shows whether the server is currently enabled or disabled.'
search-api-server-backend:
label: 'Backend class'
body: 'The backend plugin used for this server. The backend plugin determines how items are indexed and searched for example, using the database or an Apache Solr server.'
search-api-server-indexes:
label: 'Search indexes'
body: 'Lists all search indexes that are attached to this server.'
search-api-server-clear:
label: 'Delete all indexed data'
body: 'This will permanently remove all data currently indexed on this server for indexes that aren''t read-only. Items are queued for reindexing. Until reindexing occurs, searches for the affected indexes will not return any results.'
label: 'View edit page'
tips:
views-main:
label: 'Manage view settings'
body: 'View or edit the configuration.'
views-ui-displays:
label: 'Displays in this view'
body: 'A display is a way of outputting the results, e.g., as a page or a block. A view can contain multiple displays, which are listed here. The active display is highlighted.'
views-ui-view-admin:
label: 'View administration'
body: 'Perform administrative tasks, including adding a description and creating a clone. Click the drop-down button to view the available options.'
views-ui-format:
label: 'Output format'
body: 'Choose how to output results. E.g., choose <em>Content</em> to output each item completely, using your configured display settings. Or choose <em>Fields</em>, which allows you to output only specific fields for each result. Additional formats can be added by installing modules to <em>extend</em> Drupal''s base functionality.'
views-ui-fields:
label: Fields
body: 'If this view uses fields, they are listed here. You can click on a field to configure it.'
views-ui-filter:
label: 'Filter your view'
body: 'Add filters to limit the results in the output. E.g., to only show content that is <em>published</em>, you would add a filter for <em>Published</em> and select <em>Yes</em>.'
views-ui-filter-operations:
label: 'Filter actions'
body: 'Add, rearrange or remove filters.'
views-ui-sorts:
label: 'Sort Criteria'
body: 'Control the order in which the results are output. Click on an active sort rule to configure it.'
views-ui-sorts-operations:
label: 'Sort actions'
body: 'Add, rearrange or remove sorting rules.'
views-ui-preview:
label: Preview
body: 'Show a preview of the view output.'
uuid: 684a45e2-1f48-4fe6-a3f1-fc2aad0713ac
langcode: ru
status: true
dependencies:
module:
- block
_core:
default_config_hash: DI2aQ7IbaYrwUfiwSn-3g-ANh_t7LzQ1JkRqd1ujgFs
id: block-layout
label: 'Страница схемы блоков'
module: block
routes:
-
route_name: block.admin_display
tips:
block-layout:
id: block-layout
plugin: text
label: 'Макет блоков'
weight: 1
body: 'Блоки - это блоки содержимого, отображаемые в области или области веб-страницы, которые могут отображаться в областях (например, нижнем колонтитуле или боковой панели) на вашей странице.'
place-block:
id: place-block
plugin: text
label: 'Разместить блоки'
weight: 2
selector: .button--small
body: 'Любой пользовательский или добавленный блок можно добавить в конкретный регион, нажав кнопку «Поместить блок». Новый блок также можно создать, нажав кнопку «Поместить блок».'
block-region:
id: block-region
plugin: text
label: 'Регион Блока'
weight: 3
selector: .block-region-select
body: 'Назначьте или измените регион блока, щелкнув здесь. Появится выпадающий список со всеми регионами. Вы можете разместить один блок в нескольких регионах.'
configure-block:
id: configure-block
plugin: text
label: 'Настроить блок'
weight: 4
selector: .dropbutton-widget
body: 'Нажав «Настроить», вы можете продолжить и редактировать содержимое блока, работать с настройками видимости и даже изменять его расположение в вашей теме.'
custom-block-library:
id: custom-block-library
plugin: text
label: 'Библиотека Пользовательских блоков'
weight: 5
body: 'На экране управления блоками также есть еще одна вкладка вверху, которая используется для добавления пользовательских блоков. Название вкладки - «Библиотека пользовательских блоков». Эта вкладка в конечном итоге предоставляет ссылку для добавления пользовательских блоков.'
uuid: 8dc495b8-31a4-4fd4-9715-a634f88803e0
langcode: ru
status: true
dependencies:
module:
- language
_core:
default_config_hash: vcDd9H0uIlyOQGoVAJuD3ADMnQeRR_X3B-ojyb8Cbnc
id: language-add
label: 'Добавление языков'
module: language
routes:
-
route_name: language.add
tips:
language-add-overview:
id: language-add-overview
plugin: text
label: 'Добавление языков'
weight: 1
body: '<p>Эта страница предоставляет возможность добавить на сайт общеизвестные языки.</p><p>Если необходимый язык отсутствует, можно добавить собственный язык.</p>'
language-add-choose:
id: language-add-choose
plugin: text
label: 'Выберите язык'
weight: 2
selector: '#edit-predefined-langcode'
body: '<p>Выберите язык из списка, или выберите пункт "Собственный язык...", который находится в конце списка.</p><p>После выбора языка, нажмите кнопку "Добавить язык" .</p><p>При добавлении собственного языка, появится дополнительная форма, где будет необходимо ввести название, код и направление языка.</p>'
language-add-continue:
id: language-add-continue
plugin: text
label: Продолжение
weight: 3
body: '<p>Теперь, когда у вас есть обзор функции «Добавить языки», вы можете продолжить: <ul><li>Добавление языка</li><li>Добавление пользовательского языка</li><li><a href="[site:url]admin/config/regional/language">Просмотр настроенных языков</a></li></ul></p>'
uuid: 96fb3403-153a-46b3-9fe0-185ae3969502
langcode: ru
status: true
dependencies:
module:
- language
_core:
default_config_hash: gjYvYwMqulNsq7VmScWKOqEUxar9AX0TvG8vfCCguUQ
id: language-edit
label: 'Редактирование языков'
module: language
routes:
-
route_name: entity.configurable_language.edit_form
tips:
language-edit-overview:
id: language-edit-overview
plugin: text
label: 'Редактирование языков'
weight: 1
body: '<p>Эта страница предоставляет возможность редактировать язык на вашем сайте, включая собственные языки.</p>'
language-edit-langcode:
id: language-edit-langcode
plugin: text
label: 'Код языка'
weight: 2
selector: '#edit-langcode-view'
body: '<p>Невозможно изменить код языка сайта, так как он используется системой для отслеживания языка.</p>'
language-edit-label:
id: language-edit-label
plugin: text
label: 'Название языка'
weight: 3
selector: '#edit-label'
body: 'Название языка используется по всему сайту для всех пользователей и пишется на английском языке. Названия встроенных языков могут быть переведены с помощью модуля Interface Translation, а названия встроенных и собственных языков могут быть переведены с помощью модуля Configuration Translation.'
language-edit-direction:
id: language-edit-direction
plugin: text
label: 'Направление языка'
weight: 4
selector: '#edit-direction--wrapper--description'
body: '<p>Выберите направление языка - "Слева-направо" или "Справа-налево".</p><p>Обратите внимание, что не все темы поддерживают направление "Справа-налево", поэтому проверьте свою тему перед использованием направления "Справа-налево".</p>'
language-edit-continue:
id: language-edit-continue
plugin: text
label: Продолжение
weight: 5
body: '<p>Теперь, когда у вас есть обзор функции «Изменить язык», вы можете продолжить: <ul><li>Редактирование языка</li><li><a href="[site:url]admin/config/region/language">Просмотр настроенных языков</a></li></ul></p>'
uuid: e36d912c-2ed1-4824-8900-4e1ba4d8b0a3
langcode: ru
status: true
dependencies:
module:
- language
_core:
default_config_hash: Okz8QMYRGvq95nqLGYjp8gLiy93DKoMEzEVZVwEeg4M
id: language
label: Language
module: language
routes:
-
route_name: entity.configurable_language.collection
tips:
language-overview:
id: language-overview
plugin: text
label: Языки
weight: 1
body: '<p>Страница "Языки" позволяет вам добавлять, редактировать, удалять, и упорядочивать языки для сайта.</p>'
language-add:
id: language-add
plugin: text
label: 'Добавление языков'
weight: 2
selector: .button-action
body: '<p>Для добавления языков на ваш сайт, нажмите кнопку "Добавить язык".</p><p>Добавленные языки будут отображаться в списке языков и потом могут быть отредактированы или удалены.</p>'
language-reorder:
id: language-reorder
plugin: text
label: 'Переупорядочивание языков'
weight: 3
selector: .draggable
body: '<p>Чтобы изменить порядок языков на сайте, используйте иконки перемещения рядом с каждым языком.</p><p>В указанной здесь последовательности языки будут отображаться в списках языков на сайте, например в блоках переключения языков, которые предоставляются модулями Перевод Интерфейса и Перевод Материалов.</p><p>После окончания изменения порядка языков, нажмите на кнопку "Сохранить конфигурацию" чтобы изменения вступили в силу.</p>'
language-default:
id: language-default
plugin: text
label: 'Установить языком по умолчанию'
weight: 4
selector: .js-form-item-site-default-language
body: '<p>Вы можете выбрать язык сайта по умолчанию, выбрав один из настроенных языков языком по умолчанию. Сайт будет использовать язык по умолчанию в ситуациях, когда выбор не сделан, но язык должен быть установлен, например язык отображаемого интерфейса.</p>'
language-operations:
id: language-operations
plugin: text
label: 'Изменение языков'
weight: 5
selector: .dropbutton-wrapper
body: '<p>Операции предназначенные для редактирования и удаления ваших языков.</p><p>Вы можете отредактировать имя и направление языка.</p><p>Удалённые языки можно вернуть обратно позже. Удаление языка удалит все переводы интерфейса связанные с ним, и для всех материалов на этом языке будет установлен нейтральный язык. Обратите внимание, что вы не можете удалить язык установленный по умолчанию для сайта.</p>'
language-continue:
id: language-continue
plugin: text
label: Продолжение
weight: 6
body: '<p>Теперь, когда у вас есть обзор страницы «Языки», вы можете продолжить: <ul><li><a href="[site:url]admin/config/regional/language/add">Добавление язык</a> </li><li>Изменение порядка языков</li><li>Редактирование языка</li><li>Удаление языка</li></ul></p>'
uuid: 63b753f4-a907-45d8-94bc-becfed856303
langcode: ru
status: true
dependencies:
module:
- locale
_core:
default_config_hash: Kcx1PIw-KgGbTo5_tOkbI6TWJiP_0Sr7t5T9SuMV2hA
id: locale
label: Перевод
module: locale
routes:
-
route_name: locale.translate_page
tips:
locale-overview:
id: locale-overview
plugin: text
label: 'Перевод пользовательского интерфейса'
weight: 1
body: 'На данной странице вы можете перевести пользовательский интерфейс или изменить существующий перевод. Если вы изначально установили сайт на Английском, перед началом использования этой страницы, вам необходимо добавить другой язык на странице <a href="[site:url]admin/config/regional/language">Языки</a>.'
locale-language:
id: locale-language
plugin: text
label: 'Язык перевода'
weight: 2
selector: '#edit-langcode'
body: 'Выберите язык, который вы хотите перевести.'
locale-search:
id: locale-search
plugin: text
label: Search
weight: 3
selector: '#edit-string'
body: 'Введите опредёленное слово или предложение, которое необходимо перевести. Можно ввести только часть слова.'
locale-filter:
id: locale-filter
plugin: text
label: 'Фильтрация результатов поиска'
weight: 4
selector: '#edit-translation'
body: 'Вы можете искать непереведённые строки, если вы хотите перевести что-нибудь ещё непереведённое. Если вы хотите изменить существующий перевод, вы можете искать только переведённые строки.'
locale-submit:
id: locale-submit
plugin: text
label: 'Применить критерий поиска'
weight: 5
selector: '#edit-submit'
body: 'Для применения выбранного критерия поиска, нажмите кнопку <em>Фильтр</em>.'
locale-translate:
id: locale-translate
plugin: text
label: Переводы
weight: 6
selector: .js-form-type-textarea
body: 'Вы можете написать свой собственный вариант перевода в текстовых полях правой колонки. Попробуйте выяснить, в каком контексте будет использоваться текст для того, чтобы перевести его как можно точнее.'
locale-validate:
id: locale-validate
plugin: text
label: 'Подтверждение перевода'
weight: 7
selector: '#edit-submit--2'
body: 'После завершения ваших переводов нажмите кнопку <em>Сохранить переводы</em>. Необходимо сохранять переводы каждый раз перед изменением страницы или выполнением нового поиска.'
locale-continue:
id: locale-continue
plugin: text
label: Продолжение
weight: 8
body: 'Выполненные здесь переводы будут использоваться в пользовательском интерфейсе сайта. Если их необходимо использовать на другом сайте или отредактировать во внешнем редакторе переводов, <a href="[site:url]admin/config/regional/translate/export">экспортируйте их</a> в po-файл, а затем <a href="[site:url]admin/config/regional/translate/import">импортируйте их</a>.'
uuid: f3d9b77b-c5af-4fc1-b518-2139083a0e76
langcode: ru
status: true
dependencies:
module:
- search_api
_core:
default_config_hash: mP2RtTYiDo6dp1q8hXxx2Wgr_1ZvtN7AijjXrwFQV_k
id: search-api-index-fields
label: 'Fields indexed in this index'
module: search_api
routes:
-
route_name: entity.search_api_index.fields
tips:
search-api-index-fields-introduction:
id: search-api-index-fields-introduction
plugin: text
label: 'Fields indexed in this index'
weight: 1
body: 'This page lists which fields are indexed in this index, grouped by datasource. (Datasource-independent fields are listed under "General".) Indexed fields can be used to add filters or sorting to views or other search displays based on the index. Fields with type "Fulltext" can also be used for fulltext searching.'
search-api-index-fields-add:
id: search-api-index-fields-add
plugin: text
label: 'Add fields'
weight: 2
selector: '.button-action[data-drupal-selector="edit-add-field"]'
body: 'With the "Add fields" button you can add additional fields to this index.'
search-api-index-fields-label:
id: search-api-index-fields-label
plugin: text
label: Label
weight: 3
selector: '.details-wrapper:nth(0) table thead th:nth(0)'
body: 'A label for the field that will be used to refer to the field in most places in the user interface.'
search-api-index-fields-machine-name:
id: search-api-index-fields-machine-name
plugin: text
label: 'Machine name'
weight: 4
selector: '.details-wrapper:nth(0) table thead th:nth(1)'
body: 'The internal ID to use for this field. Can safely be ignored by inexperienced users in most cases. Changing a field''s machine name requires reindexing of the index.'
search-api-index-fields-property-path:
id: search-api-index-fields-property-path
plugin: text
label: 'Property path'
weight: 5
selector: '.details-wrapper:nth(0) table thead th:nth(2)'
body: 'The internal relationship linking the indexed item to the field, with links being separated by colons (:). This can be useful information for advanced users, but can otherwise be ignored.'
search-api-index-fields-type:
id: search-api-index-fields-type
plugin: text
label: Type
weight: 6
selector: '.details-wrapper:nth(0) table thead th:nth(3)'
body: 'The data type to use when indexing the field. Determines how a field can be used in searches. For information on the available types, see the <a href="#search-api-data-types-table">"Data types" box</a> at the bottom of the page.'
search-api-index-fields-boost:
id: search-api-index-fields-boost
plugin: text
label: Boost
weight: 7
selector: '.details-wrapper:nth(0) table thead th:nth(4)'
body: 'Only applicable for fulltext fields. Determines how "important" the field is compared to other fulltext fields, to influence scoring of fulltext searches.'
search-api-index-fields-edit:
id: search-api-index-fields-edit
plugin: text
label: 'Edit field'
weight: 8
selector: '.details-wrapper:nth(0) table tbody td:nth(5) a'
body: 'Some fields have additional configuration available, in which case an "Edit" link is displayed in the "Operations" column.'
search-api-index-fields-remove:
id: search-api-index-fields-remove
plugin: text
label: 'Remove field'
weight: 9
selector: '.details-wrapper:nth(0) table tbody td:nth(6) a'
body: 'Removes a field from the index again. (Note: Sometimes, a field is required (for example, by a processor) and cannot be removed.)'
search-api-index-fields-submit:
id: search-api-index-fields-submit
plugin: text
label: 'Save changes'
weight: 10
selector: '#edit-actions-submit'
body: 'This saves all changes made to the fields for this index. Until this button is pressed, all added, changed or removed fields will only be stored temporarily and not effect the actual index used in the rest of the site.'
search-api-index-fields-cancel:
id: search-api-index-fields-cancel
plugin: text
label: 'Cancel changes'
weight: 10
selector: '#edit-actions-cancel'
body: 'If you have made changes to the index''s fields but not yet saved them, the "Cancel" link lets you discard those changes.'
uuid: f8b81004-8bf1-42fe-a257-0e68687d4025
langcode: ru
status: true
dependencies:
module:
- search_api
_core:
default_config_hash: TK3PjpP4I6WFh5JDY_L_c5XCiTyAZBBA9z0M9pcGjzo
id: search-api-index-form
label: 'Add or edit a Search API index'
module: search_api
routes:
-
route_name: entity.search_api_index.add_form
-
route_name: entity.search_api_index.edit_form
tips:
search-api-index-form-introduction:
id: search-api-index-form-introduction
plugin: text
label: 'Adding or editing an index'
weight: 1
body: 'This form can be used to edit an existing index or add a new index to your site. Indexes define a set of data that will be indexed and can then be searched.'
search-api-index-form-name:
id: search-api-index-form-name
plugin: text
label: 'Index name'
weight: 2
selector: '#edit-name'
body: 'Enter a name to identify this index. For example, "Content index". This will only be displayed in the admin user interface.'
search-api-index-form-datasources:
id: search-api-index-form-datasources
plugin: text
label: Datasources
weight: 3
selector: '#edit-datasources'
body: 'Datasources define the types of items that will be indexed in this index. By default, all content entities (like content, comments and taxonomy terms) will be available here, but modules can also add their own.'
search-api-index-form-tracker:
id: search-api-index-form-tracker
plugin: text
label: Tracker
weight: 4
selector: '#edit-tracker'
body: 'An index''s tracker is the system that keeps track of which items there are available for the index, and which of them still need to be indexed. Changing the tracker of an existing index will lead to reindexing of all items.'
search-api-index-form-server:
id: search-api-index-form-server
plugin: text
label: Server
weight: 5
selector: '#edit-server'
body: 'The search server that the index should use for indexing and searching. If no server is selected here, the index cannot be enabled. An index can only have one server, but a server can have any number of indexes.'
search-api-index-form-description:
id: search-api-index-form-description
plugin: text
label: 'Index description'
weight: 6
selector: '#edit-description'
body: 'Optionally, enter a description to explain the function of the index in more detail. This will only be displayed in the admin user interface.'
search-api-index-form-options:
id: search-api-index-form-options
plugin: text
label: 'Advanced options'
weight: 7
selector: '#edit-options'
body: 'These options allow more detailed configuration of index behavior, but can usually safely be ignored by inexperienced users.'
uuid: d7626e8e-ef8a-436a-83e0-67c8741da284
langcode: ru
status: true
dependencies:
module:
- search_api
_core:
default_config_hash: LqXAZO_yZPho3Pueh85e-NzQ3DmI5rNBf6_q8McKUqc
id: search-api-index-processors
label: 'Processors used for this index'
module: search_api
routes:
-
route_name: entity.search_api_index.processors
tips:
search-api-index-processors-introduction:
id: search-api-index-processors-introduction
plugin: text
label: 'Processors used for this index'
weight: 1
body: 'Processors customize different aspects of an index''s functionality. They can keep items from being indexed, change how certain fields are indexed and influence searches.'
search-api-index-processors-enable:
id: search-api-index-processors-enable
plugin: text
label: 'Enable processors'
weight: 2
selector: '#edit-status'
body: 'This lists all processors available for this index and lets you choose the ones that should be active. (Note: Some processors cannot be disabled.)'
search-api-index-processors-weights:
id: search-api-index-processors-weights
plugin: text
label: 'Processor order'
weight: 3
selector: '#edit-weights'
body: 'This shows you which enabled processors will be active in the different parts of the indexing/searching workflow, and lets you re-arrange them. This should usually not be necessary, and only be used by advanced users as some processors will lead to unexpected results when used in the wrong order.'
search-api-index-processors-settings:
id: search-api-index-processors-settings
plugin: text
label: 'Processor settings'
weight: 4
selector: .form-type-vertical-tabs
body: 'Some processors have additional configuration available, which you are able to change here.'
uuid: d801c45b-0a0a-4f12-8e91-47da1ffc4bb3
langcode: ru
status: true
dependencies:
module:
- search_api
_core:
default_config_hash: vrJLX_BEpVcWa6OU7FvRAUfErBOxQBhPtzuKeNo4M2M
id: search-api-index
label: 'Information about an index'
module: search_api
routes:
-
route_name: entity.search_api_index.canonical
tips:
search-api-index-introduction:
id: search-api-index-introduction
plugin: text
label: 'Information about an index'
weight: 1
body: 'This page shows a summary of a search index and its status.'
search-api-index-index-status:
id: search-api-index-index-status
plugin: text
label: 'Index status'
weight: 2
selector: .search-api-index-status
body: 'This gives a summary about how many items are known for this index, and how many have been indexed in their latest version. Items that are not indexed yet cannot be found by searches.'
search-api-index-status:
id: search-api-index-status
plugin: text
label: Status
weight: 3
selector: .search-api-index-summary--status
body: 'Shows whether the index is currently enabled or disabled.'
search-api-index-datasources:
id: search-api-index-datasources
plugin: text
label: Datasources
weight: 4
selector: .search-api-index-summary--datasource
body: 'Lists all datasources that are enabled for this index.'
search-api-index-tracker:
id: search-api-index-tracker
plugin: text
label: Tracker
weight: 5
selector: .search-api-index-summary--tracker
body: 'The tracker used by the index. Only one ("Default") is available by default.'
search-api-index-server:
id: search-api-index-server
plugin: text
label: Server
weight: 6
selector: .search-api-index-summary--server
body: 'If the index is attached to a server, this server is listed here.'
search-api-index-server-index-status:
id: search-api-index-server-index-status
plugin: text
label: 'Server index status'
weight: 7
selector: .search-api-index-summary--server-index-status
body: 'For enabled indexes, the number of items that can actually be retrieved from the server is listed here. For reasons why this number might differ from the number under "Index status", <a href="https://www.drupal.org/docs/8/modules/search-api/getting-started/frequently-asked-questions#server-index-status">see the module''s documentation</a>.'
search-api-index-cron-batch-size:
id: search-api-index-cron-batch-size
plugin: text
label: 'Cron batch size'
weight: 8
selector: .search-api-index-summary--cron-batch-size
body: 'The number of items that will be indexed at once during cron runs.'
search-api-index-index-now:
id: search-api-index-remove
plugin: text
label: 'Start indexing now'
weight: 9
selector: '#edit-index'
body: 'The "Start indexing now" form allows indexing items manually right away, with a batch process. Otherwise, items are only indexed during cron runs. The form might be disabled if indexing is currently not possible for some reason, or not necessary.'
search-api-index-tracking:
id: search-api-index-tracking
plugin: text
label: 'Track items for index'
weight: 10
selector: '#edit-tracking'
body: 'In certain situations, the index''s tracker doesn''t have the latest state of the items available for indexing. This will be automatically rectified during cron runs, but can also be manually triggered here, with the "Track now" button.'
search-api-index-reindex:
id: search-api-index-reindex
plugin: text
label: 'Queue all items for reindexing'
weight: 11
selector: '#edit-reindex'
body: 'This will queue all items on this index for reindexing. Previously indexed data will remain on the search server, so searches on this index will continue to yield results.'
search-api-index-clear:
id: search-api-index-clear
plugin: text
label: 'Clear all indexed data'
weight: 12
selector: '#edit-clear'
body: 'This will remove all indexed content for this index from the search server and queue it for reindexing. Searches on this index will not return any results until items are reindexed.'
uuid: 176cac35-9d00-4ea1-ab33-724bed6b5a13
langcode: ru
status: true
dependencies:
module:
- search_api
_core:
default_config_hash: wiTKND8Vi_2guGPCSCjciyClZs7LVIQ_ruTzlkE_Bg0
id: search-api-server-form
label: 'Add or edit a Search API server'
module: search_api
routes:
-
route_name: entity.search_api_server.add_form
-
route_name: entity.search_api_server.edit_form
tips:
search-api-server-form-introduction:
id: search-api-server-form-introduction
plugin: text
label: 'Adding or editing a Server'
weight: 1
body: 'This form can be used to edit an existing server or add a new server to your site. Servers will hold your indexed data.'
search-api-server-form-name:
id: search-api-server-form-name
plugin: text
label: 'Server name'
weight: 2
selector: '#edit-name'
body: 'Enter a name to identify this server. For example, "Solr server". This will only be displayed in the admin user interface.'
search-api-server-form-description:
id: search-api-server-form-description
plugin: text
label: 'Server description'
weight: 3
selector: '#edit-description'
body: 'Optionally, enter a description to explain the function of the server in more detail. This will only be displayed in the admin user interface.'
search-api-server-form-backend:
id: search-api-server-form-backend
plugin: text
label: 'Server backend'
weight: 4
selector: '#edit-backend'
body: 'Servers can be based on different technologies. These are called "backends". A server uses exactly one backend and cannot change it later. You can make the "Database" backend available by enabling the "Database Search" module. Another very common backend is <a href="https://www.drupal.org/project/search_api_solr">"Solr"</a>, which requires to be set up separately.'
uuid: 56364c4a-09d0-4004-b7a2-67b7635d76a5
langcode: ru
status: true
dependencies:
module:
- search_api
_core:
default_config_hash: j-YgGnx-C5I3OTFsDsNkTyPC8zH7ZQyBMvmZ6gUMH3Q
id: search-api-server
label: 'Information about a server'
module: search_api
routes:
-
route_name: entity.search_api_server.canonical
tips:
search-api-server-introduction:
id: search-api-server-introduction
plugin: text
label: 'Information about a server'
weight: 1
body: 'This page shows a summary of a search server.'
search-api-server-status:
id: search-api-server-status
plugin: text
label: Status
weight: 2
selector: .search-api-server-summary--status
body: 'Shows whether the server is currently enabled or disabled.'
search-api-server-backend:
id: search-api-server-backend
plugin: text
label: 'Backend class'
weight: 3
selector: .search-api-server-summary--backend
body: 'The backend plugin used for this server. The backend plugin determines how items are indexed and searched for example, using the database or an Apache Solr server.'
search-api-server-indexes:
id: search-api-server-indexes
plugin: text
label: 'Search indexes'
weight: 4
selector: .search-api-server-summary--indexes
body: 'Lists all search indexes that are attached to this server.'
search-api-server-clear:
id: search-api-server-clear
plugin: text
label: 'Delete all indexed data'
weight: 5
selector: '#edit-clear'
body: 'This will permanently remove all data currently indexed on this server for indexes that aren''t read-only. Items are queued for reindexing. Until reindexing occurs, searches for the affected indexes will not return any results.'
uuid: 32aa223c-274a-461b-b4ee-88c35dcb52a0
langcode: ru
status: true
dependencies:
module:
- views_ui
_core:
default_config_hash: XIYL1KF7ND2XQRa5AxvEcp8vgCN2kUGiuBNhCgxrPME
id: views-ui
label: 'Страница редактирования представления'
module: views_ui
routes:
-
route_name: entity.view.edit_form
-
route_name: entity.view.edit_display_form
tips:
views-main:
id: views-main
plugin: text
label: 'Управление настройками представления'
weight: 1
body: 'Просмотр или редактирование конфигурации.'
views-ui-displays:
id: views-ui-displays
plugin: text
label: 'Отображения в этом представлении'
weight: 2
selector: '#views-display-top'
body: 'Отображение - это способ вывода результатов, например, в виде страницы или блока. Представление может содержать несколько отображений, которые перечислены здесь. Активное отображение подсвечено.'
views-ui-view-admin:
id: views-ui-view-admin
plugin: text
label: 'Администрирование представления'
weight: 3
position: right
selector: '#views-display-extra-actions'
body: 'Выполнение административных задач, включающие добавление описания и создание копии. Нажмите раскрывающуюся кнопку для просмотра доступных действий.'
views-ui-format:
id: views-ui-format
plugin: text
label: 'Формат вывода'
weight: 4
selector: .views-ui-display-tab-bucket.format
body: 'Выберите способ вывода результатов. Например, выберите <em>Содержимое</em>, для вывода каждого элемента полностью, используя настроенные параметры отображения. Или выберите <em>Поля</em>, с помощью которых можно выводить только определённые поля для каждого результата. Дополнительные форматы могут быть добавлены с помощью установки модулей для <em>расширения</em> функциональности Drupal.'
views-ui-fields:
id: views-ui-fields
plugin: text
label: Поля
weight: 5
selector: .views-ui-display-tab-bucket.field
body: 'Если это представление использует поля, они будут перечислены здесь. Нажмите на поле для того, чтобы настроить его.'
views-ui-filter:
id: views-ui-filter
plugin: text
label: 'Фильтрация представления'
weight: 6
selector: .views-ui-display-tab-bucket.filter
body: 'Добавьте фильтры для ограничения вывода результатов. Например, для отображения только <em>опубликованных</em> материалов, необходимо добавить фильтр <em>Опубликовано</em> и выбрать <em>Да</em>'
views-ui-filter-operations:
id: views-ui-filter-operations
plugin: text
label: 'Действия с фильтрами'
weight: 7
selector: '.views-ui-display-tab-bucket.filter .dropbutton-widget'
body: 'Добавить, упорядочить или удалить фильтры.'
views-ui-sorts:
id: views-ui-sorts
plugin: text
label: 'Критерий сортировки'
weight: 8
selector: .views-ui-display-tab-bucket.sort
body: 'Управляйте порядком вывода результатов. Нажмите на активное правило сортировки для его настройки.'
views-ui-sorts-operations:
id: views-ui-sorts-operations
plugin: text
label: 'Действия сортировки'
weight: 9
selector: '.views-ui-display-tab-bucket.sort .dropbutton-widget'
body: 'Добавление, упорядочивание и удаление правил сортировки.'
views-ui-preview:
id: views-ui-preview
plugin: text
label: Preview
weight: 10
position: right
selector: '#preview-submit'
body: 'Показать предварительный просмотр вывода представления.'
uuid: 9f0b309e-110d-4f9a-b70d-24fb3959bf40
langcode: ru
status: true
dependencies:
module:
- history
title: 'Deletes history'
id: history_cron
weight: 0
module: history
callback: history_cron
scheduler:
id: simple
launcher:
id: serial
logger:
id: database
......@@ -15,7 +15,6 @@ dependencies:
- system
- taxonomy
- toolbar
- tour
_core:
default_config_hash: Wur9kcEOwY1Jal81NssKnz3RhVJxAvBwyWQBGcA_1Go
id: content_editor
......@@ -28,7 +27,6 @@ permissions:
- 'access contextual links'
- 'access files overview'
- 'access toolbar'
- 'access tour'
- 'administer url aliases'
- 'create article content'
- 'create page content'
......
......@@ -8,6 +8,7 @@ use Drupal\Core\Form\FormStateInterface;
* Implements hook_form_alter().
*/
function custom_commerce_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$str = 'commerce_order_item_add_to_cart_form_commerce_product';
if (strripos($form_id, $str) === 0) {
unset($form['#submit']);
......
custom_commerce.autocomplete.products:
path: '/admin/custom_commerce/autocomplete/products'
defaults:
_controller: '\Drupal\custom_commerce\Controller\ProductsAutoCompleteController::handleAutocomplete'
_format: json
requirements:
_permission: 'access content'
<?php
namespace Drupal\custom_commerce\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Entity\Element\EntityAutocomplete;
class ProductsAutoCompleteController extends ControllerBase {
protected $productStorage;
/**
* {@inheritdoc}
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->productStorage = $entity_type_manager->getStorage('commerce_product');
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
// Instantiates this form class.
return new static(
$container->get('entity_type.manager')
);
}
/**
* Handler for autocomplete request.
*/
public function handleAutocomplete(Request $request) {
/*$results = [];
$input = $request->query->get('q');
if (!$input) {
return new JsonResponse($results);
}
$input = Xss::filter($input);
$query = $this->productStorage->getQuery()
->condition('bundle', $input, 'CONTAINS');
->condition('title', $input, 'CONTAINS')
->sort('created', 'DESC')
->range(0, 10);
$ids = $query->execute();
$orderItems = $ids ? $this->productStorage->loadMultiple($ids) : [];
foreach ($orderItems as $orderItem) {
switch ($orderItem->isPublished()) {
case TRUE:
$availability = '✅';
break;
case FALSE:
default:
$availability = '🚫';
break;
}
$label = [
$orderItem->getTitle(),
'<small>(' . $node->id() . ')</small>',
$availability,
];
$results[] = [
'value' => EntityAutocomplete::getEntityLabels([$node]),
'label' => implode(' ', $label),
];
}
return new JsonResponse($results);*/
}
}
......@@ -31,7 +31,7 @@ class ProductSuggest extends BlockBase {
$products = \Drupal::entityTypeManager()
->getStorage('commerce_product')
->loadByProperties(['field_node' => $node_id]);
->loadByProperties(/*['field_node' => $node_id]*/);
foreach ($products as $product) {
$build[] = \Drupal::entityTypeManager()->getViewBuilder('commerce_product')->view($product, 'cart');
}
......
......@@ -3,29 +3,91 @@
namespace Drupal\custom_commerce\Plugin\Commerce\PromotionOffer;
use Drupal\commerce_order\Adjustment;
use Drupal\commerce_price\Price;
use Drupal\commerce_promotion\Entity\PromotionInterface;
use Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer\OrderItemPromotionOfferBase;
use Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer\OrderItemPercentageOff;
use Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer\OrderPromotionOfferBase;
use Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer\PromotionOfferBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* @CommercePromotionOffer(
* id = "custom_commerce_custom_promotion",
* label = @Translation("Buy A and B get 50%"),
* label = @Translation("Buy A and B get 50% on A+B"),
* entity_type = "commerce_order",
* )
*/
class CustomPromotion extends PromotionOfferBase {
class CustomPromotion extends OrderPromotionOfferBase {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$default_first_item = \Drupal::entityTypeManager()->getStorage('commerce_product')->load($this->configuration['first_item']);
$default_second_item = \Drupal::entityTypeManager()->getStorage('commerce_product')->load($this->configuration['second_item']);
$form['first_item'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'commerce_product',
'#title' => 'Выберите первый продукт',
'#default_value' => !empty($default_first_item) ? $default_first_item : '',
];
$form['second_item'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'commerce_product',
'#title' => 'Выберите второй продукт',
'#default_value' => !empty($default_second_item) ? $default_second_item : '',
];
return $form;
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
if (!$form_state->getErrors()) {
$values = $form_state->getValue($form['#parents']);
$this->configuration['first_item'] = $values['first_item'];
$this->configuration['second_item'] = $values['second_item'];
}
}
public function apply(EntityInterface $entity, PromotionInterface $promotion) {
$this->assertEntity($entity);
/** @var \Drupal\commerce_order\Entity\OrderInterface $order */
/** @var \Drupal\commerce_order\Entity\OrderItemInterface $order_item */
$order = $entity;
$order_items = $order->getItems();
if (count($order_items) == 2) {
$first_item = $this->configuration['first_item'];
$second_item = $this->configuration['second_item'];
$items = $order->getItems();
foreach ($items as $item) {
$variation = $item->getPurchasedEntity();
$id_product_item = $variation->getProductId();
if ($id_product_item == $first_item) {
$first_item_order = $item;
$first_unit_price = $item->getUnitPrice()->toArray();
}
if ($id_product_item == $second_item) {
$second_item_order = $item;
$second_unit_price = $item->getUnitPrice()->toArray();
}
}
if (!empty($first_item_order) and !empty($second_item_order)) {
if ($first_item_order->getQuantity() >= $second_item_order->getQuantity()) {
$quantity = $second_item_order->getQuantity();
} else {
$quantity = $first_item_order->getQuantity();
}
$discount_first_item = $first_unit_price['number'] * $quantity;
$discount_second_item = $second_unit_price['number'] * $quantity;
$price = New Price($discount_first_item + $discount_second_item, $first_unit_price['currency_code']);
$order->addAdjustment(new Adjustment([
'type' => 'promotion',
'label' => 'custom discount',
'amount' => $price->multiply(-0.5),
'source_id' => $promotion->id(),
]));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment