SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Howto Hyvä
 
Compatibility Modules!
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
How to make extensions that
were built for Luma
compatible with Hyvä...
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Compatibility Modules
Replace Luma code with Hyvä compatible templates:
From ! To "
# .phtml # .phtml
$ .less # .phtml
% .js # .phtml
& .html # .phtml
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Compatibility Modules
From ! To .phtml "
# .phtml ✨ HTML5
% .less Tailwind CSS ✨
& .js ✨ vanilla + Alpine.js
' .html HTML5 + Alpine.js ✨
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Need to use a
module?
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Need to use a module?
 
First
Check the compat module tracker
— If it already is compatible:
— If not, open an issue in the tracker:
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Need to use a module?
 
Second
Request a skeleton compat module
In Slack, request a skeleton compat module, with both
— the original module Magento_Name
— the original module composer package/name
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
What does a skeleton repo contain?
.
├── LICENSE.md
├── README.md
├── composer.json
└── src
├── etc
│   ├── frontend
│   │   └── di.xml
│   └── module.xml
└── registration.php
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
$ cat composer.json
{
"name": "hyva-themes/magento2-orig-module",
"description": "Hyvä Themes Compatibility module for Orig_Module",
"type": "magento2-module",
"require": {
"magento/framework": "*",
"hyva-themes/magento2-compat-module-fallback": "*",
"orig/module": "*"
}
...
}
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
$ cat src/etc/frontend/di.xml
<config>
<type name="HyvaCompatModuleFallbackModelCompatModuleRegistry">
<arguments>
<argument name="compatModules" xsi:type="array">
<item name="hyva-magento2-orig-module" xsi:type="array">
<item name="original_module" xsi:type="string">Orig_Module</item>
<item name="compat_module" xsi:type="string">Hyva_OrigModule</item>
</item>
</argument>
</arguments>
</type>
</config>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
The CompatModuleRegistry
  
What is it good for?
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Automatic
Template Overrides
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Automatic Template Overrides
— Original module
Smile_ElasticsuiteCatalog
view/frontend/templates/layer/view.phtml
— Two alternative override options in
Hyva_SmileElasticsuiteCatalog:
view/frontend/templates/layer/view.phtml
view/frontend/templates/Smile_ElasticsuiteCatalog/layer/view.phtml
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Other tools
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Luma Reference Store View
!
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Hyvä Prefix Layout Updates
Luma:
default.xml
customer_address_edit.xml
customer_account.xml
Hyvä:
default.xml
hyva_default.xml
customer_address_edit.xml
hyva_customer_address_edit.xml
customer_account.xml
hyva_customer_account.xml
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Is this Hyvä?
In Observers / Plugins:
Does the requested store view have a Hyvä theme?
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Is this Hyvä?
public function __construct(
HyvaThemeServiceCurrentTheme $currentTheme
) {
$this->currentTheme = $currentTheme;
}
public function execute(Event $event) {
if (!$this->currentTheme->isHyva()) {
return;
}
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
First steps
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Step by Step
1. Copy offending template into compat module
2. Rewrite JavaScript
3. Rewrite Styles
4. Repeat
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Rewrite JavaScript
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Rewrite Luma JavaScript to
1. Vanilla JS
2. Alpine JS
3. External JS Libraries
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Vanilla JS
<script>
function ebizmartsMailChimpCampaignCatcher() {
// ...
}
window.addEventListener('DOMContentLoaded', ebizmartsMailChimpCampaignCatcher);
</script>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Alpine JS
<script>
function initCheckoutGiftCards() {
return {
receiveSectionData(data) { ... },
toggleGiftcardForm() { ... },
}
}
</script>
<div x-data="initCheckoutGiftCards()"
@private-content-loaded.window="receiveSectionData($event.detail.data)">
<div @click="toggleGiftcardForm"
@keydown.enter="toggleGiftcardForm">
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
External JS Library
<div id="fake-widget-placeholder">
...
</div>
<script>
(function() {
function init() {
const script = document.createElement('script')
script.src = '<?= $escaper->escapeUrl($block->getViewFileUrl('My_Module/js/my-library.js')) ?>';
// The function initLibrary would be provided by the external JS
script.addEventListener('load', () => initLibrary('fake-widget-placeholder'));
document.head.append(script);
}
document.body.addEventListener('touchstart', init, {once: true});
document.body.addEventListener('mouseover', init, {once: true});
})();
</script>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
jQuery ➡ Vanilla JS
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
jQuery ➡ Vanilla JS
jQuery
$('#product-addtocart-button')
.click(function(e) {
e.preventDefault();
// some custom check
// if ok
$('#product_addtocart_form')
.submit();
});
Vanilla
document
.getElementById('product-addtocart-button')
.addEventListener('click', (e) => {
e.preventDefault();
// some custom check
// if ok
document
.getElementById('product_addtocart_form')
.submit();
})
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
jQuery ➡ Vanilla JS
https://youMightNotNeedjQuery.com/
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Ajax / GraphQL ➡ fetch()
fetch(
url + '?form_key=' + hyva.getFormKey(),
{
method: 'post',
body: JSON.stringify(data),
headers: {contentType: 'application/json'}
}
)
.then(response => response.json())
.then(result => {
// ...
})
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
window.hyva
— hyva.getCookie(name)
— hyva.setCookie(name, value, days, skipSetDomain)
— hyva.getBrowserStorage()
— hyva.postForm(postParams)
— hyva.getFormKey()
— hyva.formatPrice(value, showSign)
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Customer Section Data
<div x-data="" @private-content-loaded.window="console.log($event.detail.data)"></div>
{
messages: {...},
customer: {...},
compare-products: {...},
last-ordered-items: {...},
cart: {...},
directory-data: {...},
instant-purchase: {...},
loggedAsCustomer: {...},
captcha: {...},
persistent: {...},
review: {...},
wishlist: {...},
recently_viewed_product: {...},
recently_compared_product: {...},
product_data_storage: {...},
paypal-billing-agreement': {...}
}
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Reload Customer Section Data
no automatic invalidation
window.dispatchEvent(
new CustomEvent("reload-customer-section-data")
);
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Rewrite Styles
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Replace Luma styles
Luma
<ul class="compare wrapper">
<li class="item link compare">
<a class="action compare no-display" title="Compare products"
Hyvä
<div class="flex items-center order-3">
<a id="compare-link"
class="relative invisible inline-block mx-1 no-underline sm:ml-3 hover:text-black"
title="Compare Products"
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
Remove additional .less styles
➡ replace with inline Tailwind CSS classes
<!-- Remove in compat module layout XML -->
<remove src="Magezon_Core::css/styles.css"/>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
 
External non-Luma CSS
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
External non-Luma CSS
Used in Critical Rendering Path?
<remove src="Amasty_ShopbyBase::css/swiper.min.css"/>
➡ replace with inline Tailwind CSS classes
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
External non-Luma CSS
Not part of Critical Rendering Path?
document.addEventListener('DOMContentLoaded', function () {
function init() {
const link = document.createElement('link')
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '<?= $escaper->escapeUrl($block->getViewFileUrl('Ho_Templatehints::css/hints.css')) ?>';
document.head.append(link);
}
document.body.addEventListener('touchstart', init, {once: true});
document.body.addEventListener('mouseover', init, {once: true});
}, {once: true});
➡ keep & load when needed
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
[Commercial] Windy Browser Plugin
Automatically convert styles to Tailwind CSS!
https://usewindy.com/
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
PHP View Models
Modern View Helpers
/** @var HyvaThemeModelViewModelRegistry $viewModels */
$currentProduct = $viewModels->require(
HyvaThemeViewModelCurrentProduct::class
);
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
PHP View Models
<?php
$modal = $viewModels->require(HyvaThemeViewModelModal::class)
->createModal()
->withTemplate('My_Module::my-dialog-content.phtml')
->withAriaLabel('Example modal with content template');
?>
<div x-data="hyva.modal()">
<button @click="show" type="button" class="btn">
<?= $escaper->escapeHtml(__('Show Modal')) ?>
</button>
<?= $modal ?>
</div>
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
 
Enjoy & Thanks!
https://hyva.io
@hyva_io
@VinaiKopp
Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPressHarshad Mane
 
Introduction To Micro Frontends
Introduction To Micro Frontends Introduction To Micro Frontends
Introduction To Micro Frontends Meitar Karas
 
Odoo - How to create awesome websites and e-commerce
Odoo - How to create awesome websites and e-commerceOdoo - How to create awesome websites and e-commerce
Odoo - How to create awesome websites and e-commerceOdoo
 
What are Microservices | Microservices Architecture Training | Microservices ...
What are Microservices | Microservices Architecture Training | Microservices ...What are Microservices | Microservices Architecture Training | Microservices ...
What are Microservices | Microservices Architecture Training | Microservices ...Edureka!
 
Web application framework
Web application frameworkWeb application framework
Web application frameworkPankaj Chand
 
A quick introduction to Strapi CMS
A quick introduction to Strapi CMSA quick introduction to Strapi CMS
A quick introduction to Strapi CMSAshokkumar T A
 
Wordpress CMS tutorial and guide manual
Wordpress CMS tutorial and guide manualWordpress CMS tutorial and guide manual
Wordpress CMS tutorial and guide manualRalph Francis Cue
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptxHarish Verma
 
Micro frontend architecture_presentation_ssoni
Micro frontend architecture_presentation_ssoniMicro frontend architecture_presentation_ssoni
Micro frontend architecture_presentation_ssoniSandeep Soni
 
WordPress what is Wordpress
WordPress what is WordpressWordPress what is Wordpress
WordPress what is WordpressShahid Husain
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice ArchitectureNguyen Tung
 
WordPress Website Creation Training Course Slides
WordPress Website Creation Training Course SlidesWordPress Website Creation Training Course Slides
WordPress Website Creation Training Course SlidesEquinet Academy
 
ODI ( Oracle Data Integrator ) and Git Repository Integration Basic Steps
ODI ( Oracle Data Integrator ) and Git Repository Integration Basic StepsODI ( Oracle Data Integrator ) and Git Repository Integration Basic Steps
ODI ( Oracle Data Integrator ) and Git Repository Integration Basic StepsVinayaseshu Ginjupalli
 
Content Management - The story of headless CMS
Content Management - The story of headless CMSContent Management - The story of headless CMS
Content Management - The story of headless CMSStrapi
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPressEunus Hosen
 

Was ist angesagt? (20)

Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPress
 
Introduction To Micro Frontends
Introduction To Micro Frontends Introduction To Micro Frontends
Introduction To Micro Frontends
 
Odoo - How to create awesome websites and e-commerce
Odoo - How to create awesome websites and e-commerceOdoo - How to create awesome websites and e-commerce
Odoo - How to create awesome websites and e-commerce
 
HTML5
HTML5HTML5
HTML5
 
Content management system
Content management systemContent management system
Content management system
 
What are Microservices | Microservices Architecture Training | Microservices ...
What are Microservices | Microservices Architecture Training | Microservices ...What are Microservices | Microservices Architecture Training | Microservices ...
What are Microservices | Microservices Architecture Training | Microservices ...
 
Microservices
Microservices Microservices
Microservices
 
Web application framework
Web application frameworkWeb application framework
Web application framework
 
A quick introduction to Strapi CMS
A quick introduction to Strapi CMSA quick introduction to Strapi CMS
A quick introduction to Strapi CMS
 
Headless Architecture
Headless ArchitectureHeadless Architecture
Headless Architecture
 
Wordpress CMS tutorial and guide manual
Wordpress CMS tutorial and guide manualWordpress CMS tutorial and guide manual
Wordpress CMS tutorial and guide manual
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptx
 
Micro frontend architecture_presentation_ssoni
Micro frontend architecture_presentation_ssoniMicro frontend architecture_presentation_ssoni
Micro frontend architecture_presentation_ssoni
 
Going Cloud Native
Going Cloud NativeGoing Cloud Native
Going Cloud Native
 
WordPress what is Wordpress
WordPress what is WordpressWordPress what is Wordpress
WordPress what is Wordpress
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
WordPress Website Creation Training Course Slides
WordPress Website Creation Training Course SlidesWordPress Website Creation Training Course Slides
WordPress Website Creation Training Course Slides
 
ODI ( Oracle Data Integrator ) and Git Repository Integration Basic Steps
ODI ( Oracle Data Integrator ) and Git Repository Integration Basic StepsODI ( Oracle Data Integrator ) and Git Repository Integration Basic Steps
ODI ( Oracle Data Integrator ) and Git Repository Integration Basic Steps
 
Content Management - The story of headless CMS
Content Management - The story of headless CMSContent Management - The story of headless CMS
Content Management - The story of headless CMS
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPress
 

Ähnlich wie Hyvä: Compatibility Modules

Vue micro frontend implementation patterns
Vue micro frontend implementation patternsVue micro frontend implementation patterns
Vue micro frontend implementation patternsAlbert Brand
 
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...Magecom UK Limited
 
One year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospectOne year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospectJonne Kats
 
Js foo - Sept 8 upload
Js foo - Sept 8 uploadJs foo - Sept 8 upload
Js foo - Sept 8 uploadDebnath Sinha
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento Ravi Mehrotra
 
Search engine optimization for symfony developers
Search engine optimization for symfony developersSearch engine optimization for symfony developers
Search engine optimization for symfony developersMaximilian Berghoff
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSAntonio Peric-Mazar
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Spike Brehm
 
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile AppsGet your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile AppsAckee
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Matt Raible
 
Magento vs big commerce a detailed comparison guide - ziffity
Magento vs big commerce  a detailed comparison guide - ziffityMagento vs big commerce  a detailed comparison guide - ziffity
Magento vs big commerce a detailed comparison guide - ziffityZiffity Solutions LLC
 
EECI - EE And Magento Integration
EECI - EE And Magento IntegrationEECI - EE And Magento Integration
EECI - EE And Magento IntegrationSimplified Safety
 
API Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoAPI Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoMagecom UK Limited
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntônio Roberto Silva
 
How to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionHow to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionStephan Hochdörfer
 
Planbox Backbone MVC
Planbox Backbone MVCPlanbox Backbone MVC
Planbox Backbone MVCAcquisio
 

Ähnlich wie Hyvä: Compatibility Modules (20)

Vue micro frontend implementation patterns
Vue micro frontend implementation patternsVue micro frontend implementation patterns
Vue micro frontend implementation patterns
 
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
 
One year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospectOne year of Sitecore XC9 in retrospect
One year of Sitecore XC9 in retrospect
 
Js foo - Sept 8 upload
Js foo - Sept 8 uploadJs foo - Sept 8 upload
Js foo - Sept 8 upload
 
Mangento
MangentoMangento
Mangento
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Magento
MagentoMagento
Magento
 
Search engine optimization for symfony developers
Search engine optimization for symfony developersSearch engine optimization for symfony developers
Search engine optimization for symfony developers
 
Yoav Kutner Dutchento
Yoav Kutner DutchentoYoav Kutner Dutchento
Yoav Kutner Dutchento
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)
 
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile AppsGet your mobile app in production in 3 months: Native and Reactive Mobile Apps
Get your mobile app in production in 3 months: Native and Reactive Mobile Apps
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Magento 2 development
Magento 2 developmentMagento 2 development
Magento 2 development
 
Magento vs big commerce a detailed comparison guide - ziffity
Magento vs big commerce  a detailed comparison guide - ziffityMagento vs big commerce  a detailed comparison guide - ziffity
Magento vs big commerce a detailed comparison guide - ziffity
 
EECI - EE And Magento Integration
EECI - EE And Magento IntegrationEECI - EE And Magento Integration
EECI - EE And Magento Integration
 
API Design Best Practices by Igor Miniailo
API Design Best Practices by Igor MiniailoAPI Design Best Practices by Igor Miniailo
API Design Best Practices by Igor Miniailo
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
How to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionHow to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring Edition
 
Planbox Backbone MVC
Planbox Backbone MVCPlanbox Backbone MVC
Planbox Backbone MVC
 

Mehr von vinaikopp

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023vinaikopp
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHPvinaikopp
 
Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019vinaikopp
 
Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018vinaikopp
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponentsvinaikopp
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNvinaikopp
 
Magento 2 TDD Code Kata
Magento 2 TDD Code KataMagento 2 TDD Code Kata
Magento 2 TDD Code Katavinaikopp
 
Magento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata IntroMagento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata Introvinaikopp
 
Testing Magento 2
Testing Magento 2Testing Magento 2
Testing Magento 2vinaikopp
 
ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017vinaikopp
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17devinaikopp
 
Stories from the other side
Stories from the other sideStories from the other side
Stories from the other sidevinaikopp
 
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
Writing Testable Code (for Magento 1 and 2)  2016 RomainaWriting Testable Code (for Magento 1 and 2)  2016 Romaina
Writing Testable Code (for Magento 1 and 2) 2016 Romainavinaikopp
 
Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)vinaikopp
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)vinaikopp
 
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)vinaikopp
 
Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)vinaikopp
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slidesvinaikopp
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecturevinaikopp
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014vinaikopp
 

Mehr von vinaikopp (20)

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHP
 
Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019
 
Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponents
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRN
 
Magento 2 TDD Code Kata
Magento 2 TDD Code KataMagento 2 TDD Code Kata
Magento 2 TDD Code Kata
 
Magento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata IntroMagento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata Intro
 
Testing Magento 2
Testing Magento 2Testing Magento 2
Testing Magento 2
 
ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17de
 
Stories from the other side
Stories from the other sideStories from the other side
Stories from the other side
 
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
Writing Testable Code (for Magento 1 and 2)  2016 RomainaWriting Testable Code (for Magento 1 and 2)  2016 Romaina
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
 
Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)
 
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
 
Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slides
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecture
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014
 

Kürzlich hochgeladen

Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 

Kürzlich hochgeladen (20)

Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 

Hyvä: Compatibility Modules

  • 1. Howto Hyvä   Compatibility Modules! Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 2. How to make extensions that were built for Luma compatible with Hyvä... Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 3. Compatibility Modules Replace Luma code with Hyvä compatible templates: From ! To " # .phtml # .phtml $ .less # .phtml % .js # .phtml & .html # .phtml Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 4. Compatibility Modules From ! To .phtml " # .phtml ✨ HTML5 % .less Tailwind CSS ✨ & .js ✨ vanilla + Alpine.js ' .html HTML5 + Alpine.js ✨ Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 5.   Need to use a module? Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 6. Need to use a module?   First Check the compat module tracker — If it already is compatible: — If not, open an issue in the tracker: Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 7. Need to use a module?   Second Request a skeleton compat module In Slack, request a skeleton compat module, with both — the original module Magento_Name — the original module composer package/name Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 8. What does a skeleton repo contain? . ├── LICENSE.md ├── README.md ├── composer.json └── src ├── etc │   ├── frontend │   │   └── di.xml │   └── module.xml └── registration.php Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 9. $ cat composer.json { "name": "hyva-themes/magento2-orig-module", "description": "Hyvä Themes Compatibility module for Orig_Module", "type": "magento2-module", "require": { "magento/framework": "*", "hyva-themes/magento2-compat-module-fallback": "*", "orig/module": "*" } ... } Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 10. $ cat src/etc/frontend/di.xml <config> <type name="HyvaCompatModuleFallbackModelCompatModuleRegistry"> <arguments> <argument name="compatModules" xsi:type="array"> <item name="hyva-magento2-orig-module" xsi:type="array"> <item name="original_module" xsi:type="string">Orig_Module</item> <item name="compat_module" xsi:type="string">Hyva_OrigModule</item> </item> </argument> </arguments> </type> </config> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 11. The CompatModuleRegistry    What is it good for? Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 12.   Automatic Template Overrides Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 13. Automatic Template Overrides — Original module Smile_ElasticsuiteCatalog view/frontend/templates/layer/view.phtml — Two alternative override options in Hyva_SmileElasticsuiteCatalog: view/frontend/templates/layer/view.phtml view/frontend/templates/Smile_ElasticsuiteCatalog/layer/view.phtml Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 14.   Other tools Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 15. Luma Reference Store View ! Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 16. Hyvä Prefix Layout Updates Luma: default.xml customer_address_edit.xml customer_account.xml Hyvä: default.xml hyva_default.xml customer_address_edit.xml hyva_customer_address_edit.xml customer_account.xml hyva_customer_account.xml Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 17. Is this Hyvä? In Observers / Plugins: Does the requested store view have a Hyvä theme? Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 18. Is this Hyvä? public function __construct( HyvaThemeServiceCurrentTheme $currentTheme ) { $this->currentTheme = $currentTheme; } public function execute(Event $event) { if (!$this->currentTheme->isHyva()) { return; } Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 19. First steps Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 20. Step by Step 1. Copy offending template into compat module 2. Rewrite JavaScript 3. Rewrite Styles 4. Repeat Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 21.   Rewrite JavaScript Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 22. Rewrite Luma JavaScript to 1. Vanilla JS 2. Alpine JS 3. External JS Libraries Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 23. Vanilla JS <script> function ebizmartsMailChimpCampaignCatcher() { // ... } window.addEventListener('DOMContentLoaded', ebizmartsMailChimpCampaignCatcher); </script> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 24. Alpine JS <script> function initCheckoutGiftCards() { return { receiveSectionData(data) { ... }, toggleGiftcardForm() { ... }, } } </script> <div x-data="initCheckoutGiftCards()" @private-content-loaded.window="receiveSectionData($event.detail.data)"> <div @click="toggleGiftcardForm" @keydown.enter="toggleGiftcardForm"> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 25. External JS Library <div id="fake-widget-placeholder"> ... </div> <script> (function() { function init() { const script = document.createElement('script') script.src = '<?= $escaper->escapeUrl($block->getViewFileUrl('My_Module/js/my-library.js')) ?>'; // The function initLibrary would be provided by the external JS script.addEventListener('load', () => initLibrary('fake-widget-placeholder')); document.head.append(script); } document.body.addEventListener('touchstart', init, {once: true}); document.body.addEventListener('mouseover', init, {once: true}); })(); </script> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 26.   jQuery ➡ Vanilla JS Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 27. jQuery ➡ Vanilla JS jQuery $('#product-addtocart-button') .click(function(e) { e.preventDefault(); // some custom check // if ok $('#product_addtocart_form') .submit(); }); Vanilla document .getElementById('product-addtocart-button') .addEventListener('click', (e) => { e.preventDefault(); // some custom check // if ok document .getElementById('product_addtocart_form') .submit(); }) Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 28. jQuery ➡ Vanilla JS https://youMightNotNeedjQuery.com/ Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 29. Ajax / GraphQL ➡ fetch() fetch( url + '?form_key=' + hyva.getFormKey(), { method: 'post', body: JSON.stringify(data), headers: {contentType: 'application/json'} } ) .then(response => response.json()) .then(result => { // ... }) Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 30. window.hyva — hyva.getCookie(name) — hyva.setCookie(name, value, days, skipSetDomain) — hyva.getBrowserStorage() — hyva.postForm(postParams) — hyva.getFormKey() — hyva.formatPrice(value, showSign) Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 31. Customer Section Data <div x-data="" @private-content-loaded.window="console.log($event.detail.data)"></div> { messages: {...}, customer: {...}, compare-products: {...}, last-ordered-items: {...}, cart: {...}, directory-data: {...}, instant-purchase: {...}, loggedAsCustomer: {...}, captcha: {...}, persistent: {...}, review: {...}, wishlist: {...}, recently_viewed_product: {...}, recently_compared_product: {...}, product_data_storage: {...}, paypal-billing-agreement': {...} } Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 32. Reload Customer Section Data no automatic invalidation window.dispatchEvent( new CustomEvent("reload-customer-section-data") ); Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 33.   Rewrite Styles Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 34. Replace Luma styles Luma <ul class="compare wrapper"> <li class="item link compare"> <a class="action compare no-display" title="Compare products" Hyvä <div class="flex items-center order-3"> <a id="compare-link" class="relative invisible inline-block mx-1 no-underline sm:ml-3 hover:text-black" title="Compare Products" Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 35. Remove additional .less styles ➡ replace with inline Tailwind CSS classes <!-- Remove in compat module layout XML --> <remove src="Magezon_Core::css/styles.css"/> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 36.     External non-Luma CSS Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 37. External non-Luma CSS Used in Critical Rendering Path? <remove src="Amasty_ShopbyBase::css/swiper.min.css"/> ➡ replace with inline Tailwind CSS classes Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 38. External non-Luma CSS Not part of Critical Rendering Path? document.addEventListener('DOMContentLoaded', function () { function init() { const link = document.createElement('link') link.rel = 'stylesheet'; link.type = 'text/css'; link.href = '<?= $escaper->escapeUrl($block->getViewFileUrl('Ho_Templatehints::css/hints.css')) ?>'; document.head.append(link); } document.body.addEventListener('touchstart', init, {once: true}); document.body.addEventListener('mouseover', init, {once: true}); }, {once: true}); ➡ keep & load when needed Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 39. [Commercial] Windy Browser Plugin Automatically convert styles to Tailwind CSS! https://usewindy.com/ Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 40. PHP View Models Modern View Helpers /** @var HyvaThemeModelViewModelRegistry $viewModels */ $currentProduct = $viewModels->require( HyvaThemeViewModelCurrentProduct::class ); Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 41. PHP View Models <?php $modal = $viewModels->require(HyvaThemeViewModelModal::class) ->createModal() ->withTemplate('My_Module::my-dialog-content.phtml') ->withAriaLabel('Example modal with content template'); ?> <div x-data="hyva.modal()"> <button @click="show" type="button" class="btn"> <?= $escaper->escapeHtml(__('Show Modal')) ?> </button> <?= $modal ?> </div> Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io
  • 42.   Enjoy & Thanks! https://hyva.io @hyva_io @VinaiKopp Meet-Magento Romania – Howto Hyvä: Compatibility Modules – 2021-10-08 – © Vinai Kopp - https://hyva.io