|
1 |
| -Magento\GiftMessage module allows to add a message to order or to each ordered item either on frontend or backend. |
| 1 | +# Magento_GiftMessage module |
| 2 | + |
| 3 | +This module allows to add a message to order or to each ordered item either on frontend or backend. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +Before installing this module, note that the Magento_GiftMessage is dependent on the following modules: |
| 8 | + |
| 9 | +- `Magento_Catalog` |
| 10 | +- `Magento_Sales` |
| 11 | +- `Magento_Quote` |
| 12 | + |
| 13 | +Before disabling or uninstalling this module, note that the Magento_GiftMessageGraphQl module depends on this module |
| 14 | + |
| 15 | +The Magento_GiftMessage module creates the `gift_message` table in the database. |
| 16 | + |
| 17 | +This module modifies the following tables in the database: |
| 18 | + |
| 19 | +- `quote` - adds column `gift_message_id` |
| 20 | +- `quote_address` - adds column `gift_message_id` |
| 21 | +- `quote_item` - adds column `gift_message_id` |
| 22 | +- `quote_address_item` - adds column `gift_message_id` |
| 23 | +- `sales_order` - adds column `gift_message_id` |
| 24 | +- `sales_order_item` - adds columns `gift_message_id` and `gift_message_available` |
| 25 | + |
| 26 | +For information about a module installation in Magento 2, see [Enable or disable modules](https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-subcommands-enable.html). |
| 27 | + |
| 28 | +## Extensibility |
| 29 | + |
| 30 | +Extension developers can interact with the Magento_GiftMessage module. For more information about the Magento extension mechanism, see [Magento plugins](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html). |
| 31 | + |
| 32 | +[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_GiftMessage module. |
| 33 | + |
| 34 | +A lot of functionality in the module is on JavaScript, use [mixins](https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_mixins.html) to extend it. |
| 35 | + |
| 36 | +### Events |
| 37 | + |
| 38 | +The module dispatches the following events: |
| 39 | +- `gift_options_prepare_items` event in the `\Magento\GiftMessage\Block\Message\Inline::getItems` method. Parameters: |
| 40 | + - `items` is a entityItems (`array` type) |
| 41 | + |
| 42 | +- `gift_options_prepare` event in the `\Magento\GiftMessage\Block\Message\Inline::isMessagesOrderAvailable` method. Parameters: |
| 43 | + - `entity` is an entity object |
| 44 | + |
| 45 | +For information about an event in Magento 2, see [Events and observers](http://devdocs.magento.com/guides/v2.4/extension-dev-guide/events-and-observers.html#events). |
| 46 | + |
| 47 | +### Layout |
| 48 | + |
| 49 | +This module introduces the following layouts in the `view/frontend/layout` and `view/adminhtml/layout` directories: |
| 50 | +- `view/adminhtml/layout`: |
| 51 | + - `sales_order_create_index` |
| 52 | + - `sales_order_create_load_block_data` |
| 53 | + - `sales_order_create_load_block_items` |
| 54 | + - `sales_order_view` |
| 55 | +- `view/frontend/layout`: |
| 56 | + - `checkout_cart_index` |
| 57 | + - `checkout_cart_item_renderers` |
| 58 | + |
| 59 | +For more information about a layout in Magento 2, see the [Layout documentation](https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-overview.html). |
| 60 | + |
| 61 | +### Public APIs |
| 62 | + |
| 63 | +#### Data |
| 64 | + |
| 65 | +- `Magento\GiftMessage\Api\Data\MessageInterface` |
| 66 | + - gift message data |
| 67 | + |
| 68 | +#### Cart |
| 69 | + |
| 70 | +- `\Magento\GiftMessage\Api\CartRepositoryInterface` |
| 71 | + - get the gift message by cart ID for specified shopping cart |
| 72 | + - set the gift message for an entire shopping cart |
| 73 | + |
| 74 | +- `\Magento\GiftMessage\Api\GuestCartRepositoryInterface` |
| 75 | + - get the gift message by cart ID for specified shopping cart |
| 76 | + - set the gift message for an entire shopping cart |
| 77 | + |
| 78 | +#### Cart Item |
| 79 | + |
| 80 | +- `\Magento\GiftMessage\Api\GuestItemRepositoryInterface` |
| 81 | + - get the gift message for a specified item in a specified shopping cart |
| 82 | + - set the gift message for a specified item in a specified shopping cart |
| 83 | + |
| 84 | +- `\Magento\GiftMessage\Api\ItemRepositoryInterface` |
| 85 | + - get the gift message for a specified item in a specified shopping cart |
| 86 | + - set the gift message for a specified item in a specified shopping cart |
| 87 | + |
| 88 | +#### Order |
| 89 | + |
| 90 | +- `\Magento\GiftMessage\Api\OrderItemRepositoryInterface` |
| 91 | + - get the gift message for a specified order |
| 92 | + - set the gift message for an entire order |
| 93 | + |
| 94 | +#### Order Item |
| 95 | + |
| 96 | +- `\Magento\GiftMessage\Api\OrderItemRepositoryInterface` |
| 97 | + - get the gift message for a specified item in a specified order |
| 98 | + - set the gift message for a specified item in a specified order |
| 99 | + |
| 100 | +For information about a public API in Magento 2, see [Public interfaces & APIs](http://devdocs.magento.com/guides/v2.4/extension-dev-guide/api-concepts.html). |
| 101 | + |
| 102 | +## Additional information |
| 103 | + |
| 104 | +[Learn more about Gift Options and Gift Message](https://docs.magento.com/user-guide/sales/gift-options.html). |
0 commit comments