browse the blogs

[ 26 Apr 2017 ]

Over in my Patreon slack, a patron came to me with the following layout handle XML chunk.

This block of XML would successfully remove the block named breadcrumbs, but it would not successfully remove the block named product_list_toolbar.

This is one of those places where Magento’s lack of documentation and/or a cogent systems philosophy really bites practitioners in the butt. Even as an experienced M2 developer, my mind came up with multiple possible causes

  • That was <remove/> in M1, will <remove/> work in M2?
  • Is remove=true something that works by coincidence but isn’t supported?
  • Is remove=true something the works for only blocks or works for only containers? (you can use referenceBlock and referenceContainer interchangeably in Magento’s core)
  • Is handle loading order to blame here?

Worse …

[ 25 Apr 2017 ]

Magento 2 Module for Custom Reporting Grids:

Haven’t tried it yet, but this looks like a Magento 2 module that will let you easily create new Reporting Grids with a simple SQL statement.

[ 22 Apr 2017 ]

Imagine2017 Summary from Yiero Founder Jisse Reitsma:

A nice, succinct wrap up of Magento’s announcements at Imagine 2017. Lots of third party service acquisitions for EE users, not much public-news/investment on the open-source/CE/independent-developer side of things.

[ 19 Apr 2017 ]

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 tracking resources for developers looking to implement a headless Magento 2 system.

[ 1 Apr 2017 ]

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 this variable behaves differently than I thought it did”. Being able to dump out the contents of a variable exactly when the bug happens during program execution is the quickest way to get to the bottom of any problem.

If you’re a seasoned debugger, the virtual types in Magento’2 di.xml system might throw you for a loop. You define a virtual type like this

<virtualType ...

[ 1 Apr 2017 ]

We’ve just released pestle 1.3.1, the investable .0.1 release following 1.3.0. The release fixes a few bugs with the generated DDL code for text and decimal based columns. Full details available in the issue that reported the problem.

If you’re at today’s Magento Imagine hackathon (or any day’s hackathon really), and if your project needs a module or common module code, please give pestle a try. Besides getting you up and running with your boilerplate faster, real world use plus bug reports is the only thing that’s ever made software better.

[ 30 Mar 2017 ]

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, Less) via the head element
  • Add new blocks and containers via layout handle XML files
  • Via blocks, add x-magento-init and data-mage-init javascript apps/widgets
  • Perform other actions (<move></move>, etc.) via layout handle XML files

By itself, all of the above is enough to build a Magento 2 site. Also, thanks to Magento’s infamous flexibility, it would also be possible “theme” – that is, change the appearance of – a Magento system strictly using …

[ 23 Mar 2017 ]

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

['nullable' => false],
'Block String Identifier'

[ 28 Feb 2017 ]

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 path.

Pipe the resulting output to a file or text editor, and you can quickly search through all Magento’s controller files. For example, today I forgot the syntax for adding a custom handle to a layout update XML file – but with magento2:search:search_controllers the syntax was and a “Ctrl-F handle” away.

$ pestle.phar magento2:search:search_controllers
function execute()
if (!$this->_auth->isLoggedIn()) {
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */

[ 24 Feb 2017 ]

UI Component Item `source` Nodes are Redundant:

I finally got an answer out of Magento engineering on those 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 the industry.

The first is software projects often grown beyond what any individual can understand, even (or especially) if that person works at the company responsible for that software. This is why programmers clammer for best-practices and consistency in their framework code. The ability to quickly trace out why something works a particular way is more important than any particular implementation, and inconsistent or over complex systems make …