|
1 |
| -Magento\Persistent module enables set customer a long-term cookie containing internal id (random hash - to exclude brute |
2 |
| -force) of persistent session. Persistent session data is kept in DB - so it's not deleted in some days and is kept for |
| 1 | +# Magento_Persistent module |
| 2 | + |
| 3 | +This module enables setting a long-term cookie containing internal id (random hash - to exclude brute |
| 4 | +force) of persistent session for customer. Persistent session data is kept in DB - so it's not deleted in some days and is kept for |
3 | 5 | as much time as we need. DB session keeps customerId + some data from real customer session that we want to sync (e.g.
|
4 | 6 | num items in shopping cart). For registered customer this info is synced to persistent session if choose "Remember me"
|
5 | 7 | checkbox during first login.
|
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +Before installing this module, note that the Magento_Persistent is dependent on the following modules: |
| 12 | +- `Magento_Checkout` |
| 13 | +- `Magento_PageCache` |
| 14 | + |
| 15 | +The Magento_Persistent module creates the `persistent_session` table in the database. |
| 16 | + |
| 17 | +This module modifies the following tables in the database: |
| 18 | +- `quote` - adds column `is_persistent` |
| 19 | + |
| 20 | +All database schema changes made by this module are rolled back when the module gets disabled and setup:upgrade command is run. |
| 21 | + |
| 22 | +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). |
| 23 | + |
| 24 | +## Extensibility |
| 25 | + |
| 26 | +Extension developers can interact with the Magento_Persistent module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html). |
| 27 | + |
| 28 | +[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_Persistent module. |
| 29 | + |
| 30 | +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. |
| 31 | + |
| 32 | +### Events |
| 33 | + |
| 34 | +The module dispatches the following events: |
| 35 | + |
| 36 | +#### Controller |
| 37 | + |
| 38 | +- `persistent_session_expired` event in the `\Magento\Persistent\Controller\Index\UnsetCookie::execute` method |
| 39 | + |
| 40 | +#### Observer |
| 41 | + |
| 42 | +- `persistent_session_expired` event in the `\Magento\Persistent\Observer\CheckExpirePersistentQuoteObserver::execute` method |
| 43 | + |
| 44 | +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). |
| 45 | + |
| 46 | +### Layouts |
| 47 | + |
| 48 | +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). |
| 49 | + |
| 50 | +## Additional information |
| 51 | + |
| 52 | +More information can get at articles: |
| 53 | +- [Persistent Shopping Cart](https://docs.magento.com/user-guide/configuration/customers/persistent-shopping-cart.html) |
| 54 | +- [Persistent Cart](https://docs.magento.com/user-guide/sales/cart-persistent.html) |
| 55 | + |
| 56 | +### Cron options |
| 57 | + |
| 58 | +Cron group configuration can be set at `etc/crontab.xml`: |
| 59 | +- `persistent_clear_expired` - clear expired persistent sessions |
| 60 | + |
| 61 | +[Learn how to configure and run cron in Magento.](http://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-cron.html). |
0 commit comments