The next uiElement default we’re going to talk about is the statefull default. Before we begin, let us bask is the programmer’s glory of the misspelling of “stateful” making it into a production release. The statefull default allows you to create a uiElement object with properties that will be automatically [...]
astorm
Earlier, we described the modules defaults for Magento uiElement javascript constructor functions. If you look at the uiElement definition, you’ll see there’s one modules default already configured for all uiElements #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js modules: { storage: '${ [...]
astorm
One Magento uiElement default you don’t need to worry about is the maps default, seen here in uiElement’s source file #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults:{ /* ... */ maps: { imports: {}, exports: {} }, /* ... */ } This isn’t a magic default, it’s just the uiElement [...]
astorm
Continuing in our informal series of quickies explaining the more magical defaults properties of Magento uiElement objects, today we’ll explore the modules default. The modules default allows you to link a property in your new object with an object in Magento’s uiRegistry via the registry’s “async” feature. [...]
astorm
This entry is part 1 of 6 in the series Magento 2: uiElement Internals. Later posts include Magento 2: Javascript Primer for uiElement Internals, Tracing Javascript's Prototype Chain, Magento 2: uiElement Standard Library Primer, Magento 2: Using the uiClass Object Constructor, and Magento 2: uiClass Internals. I was chatting with Vinai [...]
astorm
This entry is part 10 of 13 in the series Magento 2 UI Components. Earlier posts include Magento 2: Introducing UI Components, Magento 2: Simplest UI Component, Magento 2: Simplest UI Knockout Component, Magento 2: Simplest XSD Valid UI Component, Magento 2: ES6 Template Literals, Magento 2: uiClass Data Features, Magento 2: UI Component [...]
astorm
Another quick post on another defaults entry for Magento’s uiElement javascript class/constructor function. Before we can talk about listens though, we’ll need to quickly review imports. In your Magento backend, navigate to the customer listing grid at Customers -> All Customers in Magento’s backend. Then, in your [...]
astorm
Every uiElement based object has an observe method. This method allows you to turn any value into a Knockout.js observable. UiElement = requirejs('uiElement'); object = new UiElement; object.foo = 'bar'; object.observe('foo'); console.log(object.foo()); As you can see from the above, we’ve turned the foo property, formerly a [...]
astorm
When Magento 2 creates a new constructor functions based on the uiElements constructor functions, Magento 2 will often use a links default return Element.extend({ defaults: { /* ... */ links: { value: '${ $.provider }:${ $.dataScope }' } /* ... */ }, /* ... */ The links property looks similar to the imports and exports feature, in that [...]
astorm
Here’s a quick run down on the javascript involved in placing a Magento 2 order. Once again, specifics here are Magento 2.1.1 but concepts should apply across versions. If you need to get started with Magento’s javascript my Advanced Javascript and UI Components tutorial series are great places to start. Also, a lot of the [...]
astorm
This one’s a long winding journey through all the javascript code involved when Magento updates the Shipping Rates section of the checkout application. The specifics here are Magento 2.1.1 – and I know for a fact there are some small differences in the 2.0.x branch w/r/t to how the validation listeners get setup. Concepts [...]
astorm
This entry is part 9 of 13 in the series Magento 2 UI Components. Earlier posts include Magento 2: Introducing UI Components, Magento 2: Simplest UI Component, Magento 2: Simplest UI Knockout Component, Magento 2: Simplest XSD Valid UI Component, Magento 2: ES6 Template Literals, Magento 2: uiClass Data Features, Magento 2: UI Component [...]
astorm
This is more pure KnockoutJS than it is Magento 2, but since I’m neck deep in KnockoutJS right now, a quickie it becomes. I wrote about observables over on alanstorm.com because they’re a pretty important part of KnockoutJS, and Magento’s RequireJS programs use them like they were candy. I didn’t mention [...]
astorm
This entry is part 5 of 6 in the series Magento 2: Advanced Javascript. Earlier posts include Magento 2: Javascript Init Scripts, KnockoutJS Primer for Magento Developers, Magento 2: KnockoutJS Integration, and The Curious Case of Magento 2 Mixins. Later posts include Modifying a jQuery Widget in Magento 2. The concept of [...]
astorm
More notes on Magento 2’s checkout application. This post has a 1,000 ft. view of the code that runs when a user clicks the the Next button to move from the shipping step to the payment step. Apologies up front that this isn’t as in-depth as I’d like, or too in depth at other parts, but my Patrons are hard task masters [...]
astorm
One other neat thing I noticed about Magento’s 2 checkout is the stylized progress bar involved zero images. The orange lines and step numbers surrounded by circles are 100% driven by non-background image CSS. The checkmark that indicates the active step comes from the following CSS rules .opc-progress-bar-item._active > [...]
astorm
Writing this one down to remember it – hopefully this makes sense to someone else. The following method is the one responsible for moving the Checkout from one step to another. #File: vendor/magento/module-checkout/view/frontend/web/js/model/step-navigator.js next: function() { var activeIndex = 0; [...]
astorm
This is mainly a post-mortem from some help I provided to a patron recently. Magento 2 uses composer to manage its various PHP packages. This includes extensions purchased or acquired via Magento’s Marketplace, as well as core Magento 2 modules and themes. In Magento’s backend at System -> Tools -> Web Setup Wizard you [...]
astorm
Nearly a year into Magento 2, I finally feel like we have the tools we need to adequately debug stock system behavior. That Magento Inc. left this to the community and each partner agency to figure out on their own speaks to where their priorities are these days (marketing, enterprise partnerships, etc.), but at least we’re at a [...]
astorm
Hot on the heels of Commerce Bug 3.2.0, Pulse Storm has just released Commerce Bug 3.2.1. This is small but important release that adds region debugging into the KO Scopes tab. These are the regions we talked about here last week. Free and recommended for all Commerce Bug 3 users – especially if you’re dealing with Checkout [...]
astorm