One the curious/frustrating bits of approaching Magento 2 as a traditional, full-stack Magento 1 developer, is the seemingly incomplete php bin/magento. While this command allows you to clear your Magento cache php bin/magento cache:clean and a command to generate “static content” (front end javascript, css, etc. files not [...]
astorm
Progress continues on No Frills Magento 2 Layout, with Patrons receiving full access to the rough draft and initial source code samples. I just finished the section on Magento 2’s Less handling – basically an update to my article on the same topic last year. Here’s an excerpt that wraps up the section. For folks working [...]
astorm
After update from 2.1.2 to 2.1.3 causes store to redirect to wrong domain · Issue #8245 · magento/magento2 On the other end of the spectrum, it sounds like Magento 2.1.3 broke how the System Configure system handles fallback values. The lack of a clear response from Magento means we don’t know if they consider this new behavior a [...]
astorm
How to Respond to and Fix A Bug Here’s a small highlight from pestle’s issue tracker. A user ran into a situation I hadn’t considered when I created a command. I wrote my command assuming there wasn’t already a di.xml file in place, or if there was that it would already have a certain set of nodes. This user [...]
astorm
In <a href="http://magento-quickies.alanstorm.com/post/147052601955/magentos-knockoutjs-templates-arent-knockoutjs“>two previous articles, we talked a bit about Magento’s remote Knockout.js template files, and their customer tags/attributes. I’ve been doing a bit more exploring around this feature, and [...]
astorm
Tips for Running Magento 2’s Test Suite A quick writeup of some issues you’ll run into if you’re trying to run Magento’s test suite.
astorm
Magento CE 2.1.3 database diagram – Anna Völkl Community Stalwart @rescueann just released the Magento 2 follow-up to her popular Magento 1 database diagram post. Beyond the super useful utility of having something like this pre-generated, Ann’s also spent a significant amount of time grouping related tables together. Even [...]
astorm
Documentation and Code Quality As the above StackExchange answer attests to, I finally know what the Magento_Ui/js/lib/knockout/extender/bound-nodes registry is for. If you’ve got a view model, it lets you figure out which nodes that model is bound to via the scope Knockout.js binding. Part of the reason it was so hard to get an [...]
astorm
I was helping a developer recently, (Want this sort of help? My Patreon beckons), who wanted to know how Magento determines if /pub needs to be on the end of URLs for static files. The short version? The default folders can be found here #File: vendor/magento/framework/App/Filesystem/DirectoryList.php public static function [...]
astorm
If you’ve been reading through my Advanced Javascript, UI Components, and uiElement Internals series, you’re aware that Magento have extended the Knockout.js template system such that Templates can be Loaded via ajax/HTTP Knockout’s “tag-less” bindings have tag equivalents The remote HTTP templates are a [...]
astorm
Back when Magento 2 was released, I noticed the much touted API didn’t have a method for fetching a product’s canonical URL. A year later that’s still the case. Magento’s reasoning and response, both from an engineering perspective and a product perspective points to a big cultural problem that goes beyond this [...]
astorm
Magento 2: Are uiClass/uiElement Imports/Exports order sensitive? The answer is mostly no. Imports/Exports values are fetched via the uiRegistry.get’s asynchronous callback method which means if the imports or exports attempts to access an item that doesn’t exist yet in the registry, the system will “wait” until [...]
astorm
Magento 2: Extract Currently Selected Product ID or SKU on Product Page Rian managed to dig up most of the data embedded in a Magento 2 product listing page that would let a programmer extract the Product ID of the currently selected product on a configurable product page. I threw together this quick RequireJS program that shows how you [...]
astorm
If you’re following along with my UI Component and uiElement Internals series, you know about Magento’s uiRegistry module. You can use this module to fetch the scoped Knockout.js view models by registered name requirejs(['uiRegistry'], function(reg){ console.log( reg.get('customer') ); }); or by using a callback function to [...]
astorm
That I’m posting this as a quickie probably points to the amount of time I’m spending with Magento 2’s internals vs. building out client sites, but I still haven’t internalized that Magento moved the the Design configuration options from Stores -> Configuration -> Design to Content -> Design -> [...]
astorm
Time to Report Bug: Two Weeks Over on alanstorm.com we’re in the middle of a series covering the internal implementation of uiElement objects. This series was prompted by some strange behavior in the default value system w/r/t observable objects. The linked bug report covers the details of why this happens, and why it’s a [...]
astorm
Be Careful with the “new-less” form of uiClass object instantiation Last time we said Magento’s uiClass based objects don’t require the new keyword. This is true. However, when you’re using the inheritance features of these objects its possible to supply a custom constructor. If you do this, and your custom [...]
astorm
In doing research for the new uElement Internals series, I discovered that Magento’s UI Component object constructors (uiClass, uiElement, uiCollection, etc) can create new objects without the use of the new keyword. //both return a new `UiElement` object object = new UiElement; object = UiElement(); This makes these constructor [...]
astorm
Wrapping up our uiElement defaults, we have the registerNodes defaults #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults:{ /* ... */ registerNodes: true, /* ... */ } This is another node that you don’t need to worry too much about. Magento uses this to identify the uiElement objects in the [...]
astorm
Two defaults you don’t need to worry too much about are the containers and _requested defaults. #File: vendor/magento/module-ui/view/base/web/js/lib/core/element/element.js defaults: { _requesetd: {}, containers: [], /* ... */ } These are just properties that Magento’s initializing using the uiElement’s defaults [...]
astorm