Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mage Titans USA 2016 - Igor Melnykov - Staging and Preview

645 views

Published on

Staging and preview is new functionality added in Magento Enterprise Edition 2.1. It makes it faster, easier and less expensive to add new campaigns, catalog updates, promotions and other changes that help keep site fresh and improve conversion rate. Ability to preview, test prior to launch and schedule when changes should be applied allow to deliver right customer experience. In this session I will give a brief overview of the functionality and talk about some implementation details.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Mage Titans USA 2016 - Igor Melnykov - Staging and Preview

  1. 1. © 2016 Magento, Inc. Page | 2
  2. 2. © 2016 Magento, Inc. Page | 5 Agenda 1. Overview 2. Staging Architecture 3. Sample Module with Staging 4. QA
  3. 3. © 2016 Magento, Inc. Page | 6 Overview
  4. 4. © 2016 Magento, Inc. Page | 7 Making Content Changes on Magento EE < 2.1 Make changes on separate copy of a store Make sure changes look good On scheduled date replicate changes on live store Make sure changes look good Troubleshoot and fix issues on live site if not replicated correctly
  5. 5. © 2016 Magento, Inc. Page | 8 Staging and Preview Make changes in one place Make sure changes look good using preview Schedule when changes applied Changes applied automatically
  6. 6. © 2016 Magento, Inc. Page | 10 Staging Campaigns • Create, edit, and delete updates to: – Products – prices, page designs, descriptions, images, and more – Categories – menu and display options, which categories are enabled – CMS Content – page content and layouts – Promotions – catalog and shopping cart price rules – Additional entities with customization • Group individual updates into campaigns for easier management • Schedule an unlimited number of updates Updating product content with quick access to other scheduled changes
  7. 7. © 2016 Magento, Inc. Page | 11 Staging Dashboard • Manage all updates from a single dashboard with grid and timeline views • Easily monitor key campaign information: – Start and end dates – Campaign components – Campaign status • Drill down into campaigns to preview, make edits or delete updates Dashboard grid view – complete list of all campaigns and their components within a specified date range
  8. 8. © 2016 Magento, Inc. Page | 12 Staging Timeline Dashboard Dashboard timeline view – shows all current and upcoming campaigns in a calendar, making it easy to confirm you have a coordinated merchandising strategy in place
  9. 9. © 2016 Magento, Inc. Page | 13 Preview Updates • Preview and verify updates by date and store view • Screen the user experience through checkout without placing orders • Share links with others to preview pages
  10. 10. © 2016 Magento, Inc. Page | 14 Staging Architecture
  11. 11. © 2016 Magento, Inc. Page | 15 The Big Picture Changes to Schema From Condition Renderer Entity Manager Sequence Manager Version Manager Persistence Operations for Stageable Entities *Staging Modules Cron Jobs Business Logic Persistence Layer Database Configurable Ui Elements Ui
  12. 12. © 2016 Magento, Inc. Page | 16 Database Schema row_id PK int entity_id int created_in int updated_in int sku varchar … … value_id int attribtue_id int store_id int row_id int value varchar catalog_product_entit y_varchar catalog_product_entit y product_id int website_id int catalog_product _website Stagable attributes and relations linked by row_id Non stagable attributes linked by entity_id (sequence id) id bigint start_time datetime name varchar description int rollback_id bigint is_campaign tinyint is_rollback tinyint moved_to bigint stagign_update sequence_ value int sequence_product
  13. 13. © 2016 Magento, Inc. Page | 17 Entity Version created_in – version from which update is active, default 1 updated_in – version to which update is active, default 2147483647 1 and 2147483647 are left and right margins for the version +------+---------+----------+----------+---------+-----+-------------------------------+ |row_id|entity_id|created_in|updated_in|name |price|short_description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 1| 1| 1| 999|Product 1|10.99|Product 1 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 2| 2| 200| 999|Product 2|15.00|Product 2 short description | +------+---------+----------+----------+---------+-----+-------------------------------+
  14. 14. © 2016 Magento, Inc. Page | 18 Select Current Version staging_update +---+-------------------+-----------------------------------+ |id | start_time|name | +---+-------------------+-----------------------------------+ |100|2016-08-31 04:05:00|Update 1 for Product 1 | +---+-------------------+-----------------------------------+ |200|2016-09-12 04:05:00|Update 2 for Product 1 | +---+-------------------+-----------------------------------+ |300|2016-09-18 04:05:00|Update 3 for Product 1 | +-----------------------+-----------------------------------+ SELECT * FROM staging_update WHERE start_time <= '2016-09-12 04:05:00' DESC LIMIT 1 2016-09-12 04:05:00 is current date and time
  15. 15. © 2016 Magento, Inc. Page | 19 Select Active Updates +------+---------+----------+----------+---------+-----+-------------------------------+ |row_id|entity_id|created_in|updated_in|name |price|short_description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 1| 1| 1| 999|Product 1|10.99|Product 1 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 2| 2| 1| 200|Product 2|15.00|Product 2 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 3| 2| 200| 300|Product 2|12.00|Product 2 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 4| 2| 300| 999|Product 2|12.00|Product 2 new short description| +------+---------+----------+----------+---------+-----+-------------------------------+ 1 300200 999 Product 1 Product 2 Price updated Description updated SELECT * FROM catalog_product_entity WHERE created_in <= 200 AND updated_in > 200
  16. 16. © 2016 Magento, Inc. Page | 20 Permanent Update catalog_product_entity +------+---------+----------+----------+---------+-----+-------------------------------+ |row_id|entity_id|created_in|updated_in|name |price|short_description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 1| 1| 100| 999|Product 1|10.99|Product 1 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ catalog_product_entity – after creating permanent update +------+---------+----------+----------+---------+-----+-------------------------------+ |row_id|entity_id|created_in|updated_in|name |price|short_description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 1| 1| 100| 200|Product 1|10.99|Product 1 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 2| 1| 200| 999|Product 1|12.00|Product 1 new short description| +------+---------+----------+----------+---------+-----+-------------------------------+ staging_update +---+-----------------------------------+-----------+ |id |name |is_rollback| +---+-----------------------------------+-----------+ |200|Update for Product 1 | 0| +---------------------------------------+-----------+
  17. 17. © 2016 Magento, Inc. Page | 21 Temporary Update catalog_product_entity – after creating temporary update +------+---------+----------+----------+---------+-----+-------------------------------+ |row_id|entity_id|created_in|updated_in|name |price|short_description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 1| 1| 100| 200|Product 1|10.99|Product 1 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ | 2| 1| 200| 300|Product 1|12.00|Product 1 new short description| +------+---------+----------+----------+---------+-----+-------------------------------+ | 3| 1| 300| 999|Product 1|10.99|Product 1 short description | +------+---------+----------+----------+---------+-----+-------------------------------+ staging_update +---+-----------------------------------+-----------+ |id |name |is_rollback| +---+-----------------------------------+-----------+ |200|Update for Product 1 | 0| +---------------------------------------+-----------+ |300|Rollback for “Update for Product 1”| 1| +---------------------------------------+-----------+
  18. 18. © 2016 Magento, Inc. Page | 22 Entity Manager Entity Manager Operations Main Entity EAV Attributes Relation and Extension Attributes Read, Create, Update, Delete, CheckIfExists Persistence of main entity Persistence of EAV attributes MagentoFrameworkEntityManager Handlers Persistence of related and extension attributes, delegates all work to handlers
  19. 19. © 2016 Magento, Inc. Page | 23 Operations for Staging • Redefined in the DI for each stageable entity • In addition to persistence of main entity perform additional actions – Manage campaigns – Manage updates
  20. 20. © 2016 Magento, Inc. Page | 24 From SQL Condition Renderer You don’t need to specify active version, MagentoStagingModelSelectFromRenderer modifies select queries and you always get active version in application. SELECT * FROM catalog_product_entity WHERE created_in <= version AND updated_in > version Load entity by sequence id (in our case, for product - entity_id), not row_id
  21. 21. © 2016 Magento, Inc. Page | 25 Version Manager and Sequence Manager Version Manager – get current version in the system Sequence Manager – generates sequence id, unique identifier for all of the versions of the same entity
  22. 22. © 2016 Magento, Inc. Page | 26 Cron Jobs The following actions executed by cron jobs • Apply updates – make updates visible when they become active • Move updates from one campaign to another – when you change effective dates for the campaign, Magento creates new campaign and move updates to the new campaign using cron • Clean up old updates
  23. 23. © 2016 Magento, Inc. Page | 27 How Does Preview Work • Version Manager provides requested version • Calculates page data on fly, it's always up to date • Preview uses all system cache types, except FPC (Full Page Cache) • Indexes (as a database cache) also skipped at preview
  24. 24. © 2016 Magento, Inc. Page | 29 Sample Module with Staging
  25. 25. © 2016 Magento, Inc. Page | 30 Requirements • Need to be able display and manage blog posts • Post need to have the following fields: title, description • Module should work in both Community and Enterprise editions • Enterprise edition need to allow – Schedule updates for posts – See upcoming updates in staging dashboard – Preview changes
  26. 26. © 2016 Magento, Inc. Page | 31 Persistence • Different database schema in Community and Enterprise • Different configuration for Entity Manager • Staging specific operations for Entity Manager instead of default ones
  27. 27. © 2016 Magento, Inc. Page | 32 Ui • Configure and add to form reusable staging Ui components – Upcoming updates form modal and grid – Edit update form – Select update grid on edit update form – Remove form – Select update grid on remove form • Add controllers to handle save and delete operations for updates
  28. 28. © 2016 Magento, Inc. Page | 33 API Provide API for managing updates interface PostStagingInterface { public function schedule(PostInterface $post, $version, $arguments = []); public function unschedule(PostInterface $post, $version); }
  29. 29. © 2016 Magento, Inc. Page | 34 Resources
  30. 30. © 2016 Magento, Inc. Page | 35 Resources • https://github.com/melnikovi/magento2-samples • http://devdocs.magento.com/guides/v2.1/extension-dev- guide/staging/Staging.html
  31. 31. © 2016 Magento, Inc. Page | 36 Q&A
  32. 32. © 2016 Magento, Inc. Page | 37 Thank You imelnikov@magento.com

×