1 / 55

Litium Certified Developer

Explore the Litium CMS domain model for websites, pages, and blocks. Learn to create reusable content snippets, manage global instances, and utilize the BlockModel entity. Enhance your development skills in product information management, customer relations, media handling, and search functionalities.

mmoya
Download Presentation

Litium Certified Developer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Litium Certified Developer

  2. Websites

  3. Domain model • Pages can be “active” in different channels • DraftPage is similar to Page, is the working copy

  4. Blocks

  5. Blocks • New independent entity from L7 • Has data modelling • Can be marked as • Global = true -> web pages that uses the block has reference to a “global instance” • Global = false -> web pages that uses the block has its own “block instance” • View as “Information snippets” • That can be “reused” in the same web page (global = false blocks) • That can be “reused” across web pages (global = true blocks) • Can be “moved” (visual location) inside the “Container”

  6. In the accelerator usual reference is to the BlockModel Note that BlockModel only contains the SystemId of the Block (Similar to all other related entities in Litium API)

  7. Accelerator code:

  8. Product Information ManagementPIM

  9. Data model Litium 5 Product Base product Information common to all variants. Variant Variant specific information. Price Inventory

  10. Data model Litium 5 Product Field template Base product level - Name - Description … Variant level - Color - Size … Base product Information common to all variants. Article number* Field template Variant Variant specific information. Articlenumber* * Article number - Mandatory system field - Both levels base product and variant

  11. Data model Litium 5 Assortment Categories Channel Published Product One is main category List

  12. Data model Litium 5 Relations between products and categories Product Categories Base product Relation Variant Relation Relationship types Directional “Accessories” Bi-directional “Similar products” Relation

  13. Display templates • Possible to use different template per website • ASP.NET WebForms or ASP.NET MVC 5 • Products can use either base product url or variant url

  14. Extend PIM • Replace implementation logic • IPriceCalculator • IStockStatusCalculator

  15. Area: Customers

  16. Customers (Relations module) • A registry of customers, groups & organizations • Registering a new customer • Accelerator creates a new customer from checkout page if “create account” checkbox is selected when creating an order • RegisterNewUser() method in Src\Litium.Accelerator\Services\CheckoutServiceImpl.cs

  17. Area: Media

  18. Media • Images and files stored here • Physically images are in the “Files folder” • Use CommonFilesDirectory in multiserver scenarios • Products need to be enriched with respective images: ”media mapping” • Use media mapper addOn • Without media mapper addon • Write custom code to map the image

  19. Media • How to create a folder template and a folder from codehttps://docs.litium.com/documentation/developer-guides/media/creating-a-media-folder-field-template-and-a-folder • Giving access permission to folderhttps://docs.litium.com/documentation/developer-guides/media/adding-permissions-to-a-media-folder

  20. Search and routing

  21. Search • Litium uses Lucene as search engine • Search query • Conditions: Or / Exclude / Range • Paging, sorting • TagTerms • To view indexed values • Indexfiles stored in files directory • https://docs.litium.com/documentation/architecture/search

  22. Administration UI • Rewrite in PIM • Angular • ASP.NET WebAPI • Signalr

  23. Litium is based on standard technology • ASP.NET Core (Microsoft/Open Source) • Dependency injection • Logging • Configuration • Entity Framework Core (Microsoft/Open Source) • Newtonsoft JSON (Open Source) • AutoMapper (Open Source) • ASP.NET MVC 5 (Microsoft) • ASP.NET WebAPI 5 (Microsoft) • Angular JS (Google/Open Source)

  24. Eco system PAYMENTS PRICE COMPARISON SEARCH & RECOMMENDATIONS SEO & CONVERSION ANALYTICS + and more EMAIL MARKETING PREMIUM PIM CUSTOMER SERVICE PRINT SOCIAL MARKETING AdobeInDesign + and more ERP + and more

  25. AddOns • Following are some of the most frequently used AddOns • Product Media Mapper • To connect images and files to products automatically • Payment providers • Klarna, Dibs, PayEx, Adyen, PayPal, Nets, Handelsbanken Ecster, Skrill • Integration kit • Platform to develop file based integrations towards Litium

  26. Integration Integration Kit InRiverConnector ERP / PIM / CRM Product info Images & media Order status Delivery status Customer Info Stock balance Prices Credit limits Order Payments Customer Info etc. https://kc.litiumstudio.se/more/best-practices/integrate/best-practice-for-integration-architecture

  27. Audit • Logging of updates • Update log

  28. Error handling • Unhandled errors are logged in • In web requests– this.WebLog() (Exceptional) • In background tasks– this.Log() • Handled errors should be logged by the developer. • Always log the exception when logging in try/catch

  29. Error handling • Event log • Logging to a file

  30. WebLog • Built on StackExchange Exceptional • Logs the whole web-request

  31. Service bus • Used to send messages between applications. • Local on application if no Service Bus is configured • Queue outside application • Processed even if application restarts • Free up resources by running queue in the background • Two different types of message queues • Queue – Same message queue for all applications • Topic – Unique queue for each application • Used in all multi-server solutions • Web farms for load balancing • Multiple developers towards same database • Note: Servers are updated “Near real time”

  32. Task: Service Bus New questionsshould not be addedinstantly to the FAQ page butweneed to monitor submittedsubmittedquestions to manuallyupdate the questiondatabasewhenneeded. • See the example on https://docs.litium.com/documentation/architecture/service-bus and create a new Queue in FAQService • Add the methodSubmitQuestion(string question) to IFAQService and implement it in FAQService, the messageshouldsend the postedquestion to yourqueue. • ImplementmethodProcessQueueMessage (see KC for example) in FAQService and in thismethodwrite a Info levelmessage to Litium event log • In the Index methodofFAQController post a new question, thenload the page and verifythat the question gets written to the log. Optional • Removepostingofquestion on page load and insteadcreate a form with a textbox and button on the FAQ page and use it to submit new questions. • Installpapercut (and set smtp to 127.0.0.1 in web.config) and send a mail on every new questioninsteadof just writing to log, injectIMailService in FAQService and use it to send the mail.

  33. Event system • All events are handled by a an EventBroker (publish/subscribe) • All events are triggered by the application • All events are local • i.e. in a multi server environment, if an entity is changed in one server, its changed event is raised only in that server. • If not declared otherwise explicitly (set scope when publishing event, remote scope sends via service bus to all applications)

  34. Event system (new API) • All events have its own class. • The domain object is a parameter in the event handler method. • EventBroker can be used in the project to write your own events, or to listen or to trigger existing events.

  35. Eventsystem

  36. Litium.Validation.IValidationRule Business rules validation (new API) • New validation framework for business rules.

  37. Task: Validateurl • Ourclientneed to prevent the usageof ÅÄÖ in producturls, weneed a validation to preventusers from addingthesecharacters. Create the classValidateVariantUrl in namespaceLitium.Accelerator.Validationsthatinherits from Litium.Validations.ValidationRuleBase<Variant> and implement the method the interitancerequires • In the methodverifythat the charactersåäöare not present in the url (useentity.GetUrl(ModuleCMS.Instance.WebSites.DefaultWebSiteID) to get url). • GetUrl is an extension methodthatrequire: usingLitium.Foundation.Modules.ExtensionMethods; • Remembernull-check of the urlbeforechecking the value • If incorrecturladd a errormessage in the ValidationResultthat the methodreturns by calling the AddError() method on the ValidationResult • As first parameter in AddError() pass "_url” as parameter, thiswillattach the error to the urlsystemfield in the UI • Open the productGivinTunic Lite in Litium Backoffice > Products, open the propertiestab for any variant and verifythat variants can no longer be updated to a urlcontainingåäö. Optional • Url’sneed to be validated for Categories and BaseProductsalso, useLitium.Validations.ValidationRuleBase<Category> and Litium.Validations.ValidationRuleBase<BaseProduct>, test baseproductusing the productNolita Scarf that has itsurl set on BaseProduct and not on Variant.

  38. Batching data (new API) Litium.Data.DataService.CreateBatch • Framework for handling batches of domain objects to • Delete, create or update • A batch is a single transaction • If one operation fails, the whole batch is rolled back. • All entities in a single batch are logged together in logging for auditing.

  39. Batching data (new API) Litium.Data.DataService.CreateBatch Both baseproduct and variant created in one transaction, if variant fails no baseproduct is created

  40. Querying Litium.Data.DataService.CreateQuery • Querying direct towards database. • Do not use towards public site, without implementing own caching.

  41. Querying Litium.Data.DataService.CreateQuery

  42. Concurrency • Optimistic concurrency is available in Ecommerce area • All other areas do not have concurrency checks • Can enforce pessimistic concurrency through DistributedLock object

  43. Web API

  44. Web API • Useful for • RESTful applications • Integration when server is communicating with other servers. • Avaliable since Litium version 5.5 • Service Accounts – Access services without access to Litium Backend • OnlyJwtAuthorization - attribute to restrict API endpoint to only use JSON Web Token (JWT) • OnlyServiceAccountAuthorization – attribute to restrict API endpoint to only allow Service Accounts https://kc.litiumstudio.se/documentation/architecture/web-api

  45. Headless API AddOn • Platform to build integrations via webapi’s • In particular to use external CMS systems with Litium as the Ecommerce processing and PIM data engine • https://docs.litium.com/documentation/add-ons/integration/litium-headless-api

  46. Task: FAQ API • In the Mvc project create Controllers/Api/FaqApiController.cs by copying SampleApiController from https://kc.litiumstudio.se/documentation/architecture/web-api • Inject IFAQService in controller constructor and make the api return questions from the service. Optional – API Security • Create a new servcieaccount in settings • Implement OnlyJwtAuthorization attribute on the controller, use postman to get a JWT token and use the token to get questions.

  47. Upgrading

  48. Upgrading • As with installation, upgrading is done through Visual Studio. • There is no separate upgrading program.

  49. Upgrading • Upgrading data in database is done through upgrading script • Files/Images that are saved in product catalog are moved to the Media Archive upon first application start of Litium 5. • Storage folder structure is also changed during upgrade

  50. Roadmap and support

More Related