Visit Linked Page
Headless Magento 2 Resources “Headless Magento” – that is, an ecommerce store whose user interface uses some other technology stack for the UI/UX (i.e. javascript) while relying on Magento’s REST API endpoints for store functionality – is a hot topic in the Magento world. While this approach can explode a project’s budget (you’re reimplementing the a front-end store and any extension functionality) it is, none-the-less, popular with agencies looking to put their javascript engineering teams to work. If your sales team has thrown you in the headless deep-end, the sitewards/headless-magento2-resources and ishakhsuvarov/going-headless GitHub repositories are two small projects that are […]
astorm
Whether you’re using your IDE, a debugging extension, or calling get_class and new ReflectionClass yourself, PHP (or any language’s) ability to examine itself at runtime is a vital tool for debugging a program. Most bugs come down to “this variable does not have what I thought it had in it”, or “the thing in [...]
astorm
So what is a Magento 2 theme? To understand that, we’ll first need to talk about the Magento_Theme module. The Magento_Theme module contains page layout XML files that define the basic containers for every Magento page layout. This allows other Magento modules to use layout handle XML files to Add frontend assets (JavaScript, CSS, [...]
astorm
I’m working on adding DDL (data definition language) code generation to pestle – i.e. the code that ultimately creates your database tables that lives in the InstallSchema or UpgradeSchema classes. I came across this bit of weirdness #File: vendor/magento/module-cms/Setup/InstallSchema.php )->addColumn( 'identifier', [...]
astorm
Here’s a fun pestle command I forgot about. pestle.phar magento2:search:search_controllers This command accepts a file path as a single argument, searches through the specified folder for anything that looks like a Magento controller file, and then displays that controller file’s execute method along with its relative file [...]
astorm
UI Component Item source Nodes are Redundant I finally got an answer out of Magento engineering on those <item name="source"/> nodes and their best guess is as good as ours. i.e., they’re redundant/not-used. There’s a few interesting points to make here for folks just learning to program, and just getting settled into [...]
astorm
Although there’s no documentation stating this, based on system behavior it seems like the Package/Module/Setup/InstallSchema.php class files are sort of required by a Magento module. I say sort of required because you can run a module without them. You can use that module to add features to Magento. However, a version number for [...]
astorm
While PHP production environments have long made use of extra systems like memcache, varnish, and redis, most successful PHP projects also let developers and technically savvy folks drop an archive of files on a server, point the web server at those files, configure the application to point to a traditional RDMS/database, and have a [...]
astorm
Tangentially Magento related: Magento uses the lusitanian/oauth composer package to handle some oAuth related tasks. In addition to the usual “create the cryptic Authorization: headers” code you’d expect to find in an oAuth library, there’s also these two folders of code [...]
astorm
In a typical adminhtml UI Form Component, each individual form element has a corresponding view model object. For text input fields, these view models come from the constructor function returned by the Magento_Ui/js/form/element/abstract RequireJS module. The view model’s value property, an Knockout observable object, contains the [...]
astorm
GitHub – DavidLambauer/awesome-magento2: Curated list of awesome Magento 2 Extensions, Resources and other Highlights I haven’t reviewed these, but a working developer’s take on what makes an “awesome” module is always worth investigating.
astorm
Keeping with UI Component form theme but drawing a wider circle, if you take a look at HTML source of a button on a backend Magento 2 HTML form, you’ll see something like the following <button id="back" title="Back" type="button" class="action- scalable back" onclick="location.href = [...]
astorm
Merged Layout schema validation error in Magento 2 A peek at the complexity deep in Magento 2’s layout rendering engine.
astorm
It surprised me that over a year after Magento 2’s introduction I haven’t had an opportunity to create a new form component using the UI Component system. In the extensions and themes I’ve helped folks port over it made a lot more sense to just convert the old PHP rendered HTML to the new extension. When time is money [...]
astorm
For backend UI Components, the rendered x-magento-init JSON argument contains two top level keys: types and components { "*": { "Magento_Ui/js/core/app": { "types": {/*...*/}, "components": {/*...*/} } } } The Magento_Ui/js/core/app module/application uses the data in components to instantiated a nested tree of uiClass based objets and [...]
astorm
mattwellss/magento-composer-autoloader For folks still playing “wait and see” with Magento 2, (i.e. most current Magento systems), and who are using some sort of Composer workflow (not most Magento 1 systems), this is a small autoloader optimization that fixes Magento 1’s selfish “if I try to load someone [...]
astorm
So, over the summer I covered how to invoke a function returning RequireJS modules via an x-magento-init script. Today I discovered there’s a syntax for doing this with an object returning RequireJS module. If you’ve got an x-magento-init that looks like this <script type="text/x-magento-init"> { "*": { [...]
astorm
One of the challenges Magento 2, (and all “full stack” oriented frameworks), face is data synchronization between the front end and the server. Server data will always represent the “source of truth” for any particular piece of data, but good front end developers will always be looking to reduce to number of round [...]
astorm
How to clear billing form validation errors when using Magento UI components A “quick” (har har) answer from me on how to reset a form field’s validation state in the Magento 2 checkout application. This is also a nice example of how, no matter how far we progress with computers doing things for us, it’s always [...]
astorm
A useful code snippet that came out of a discussion on the Patreon slack today. requirejs([ 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/shipping-rate-registry' ], function(quote, rateRegistry){ //get address from quote observable var address = quote.shippingAddress(); //changes the object so observable sees it as [...]
astorm