browse the blogs

[ 6 Feb 2016 ]

Welcome to your fortnightly “Open Magento 2 Technical Questions” post. If you’ve got an answer to any of the following please use the provided Stack Exchange thread to answer, or say hello via email if public communication isn’t possible.

First off, we’ve got a slew of new questions. After that, some follow up from last week’s open questions. There’s always more information in the linked Stack Exchange threads.

New Questions!

How does Theme Layout Handle XML File Merging Work

This one is partially answered, although I’d love to see a full breakdown of where Magento merges/sorts out the layout handle XML file loading.

Programmatically Triggering a 404, 500, 503, etc. error

Many PHP frameworks have globally available methods that …

[ 4 Feb 2016 ]

This one deserves a longer post, but my schedule is not forgiving. This assumes you’ve read and understand the concepts from my Magento object manager series.

Many Magento provided classes have a special context object in their constructor.

#File: vendor/magento/module-catalog/Controller/Product/View.php 
//...
use Magento\Framework\App\Action\Context;    
//...    

public function __construct(
    Context $context,
    \Magento\Catalog\Helper\Product\View $viewHelper,
    \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory,
    PageFactory $resultPageFactory
) {
    $this->viewHelper = $viewHelper;
    $this->resultForwardFactory = $resultForwardFactory;
    $this->resultPageFactory = $resultPageFactory;
    parent::__construct($context);
}

These objects are there to help keep the number of objects injected in a constructor to a minimum. If you look at the source of …

[ 3 Feb 2016 ]

Magestead – A Vagrant LEMP Stack for Magento Developers:

Magestead looks like another contender in the “geting a Magento 2 system up and running using vagrant and VMs”. Homestead inspired, it may be worth checking out.

[ 3 Feb 2016 ]

Request: .user.ini files for FPM config · Issue #705 · magento/magento2:

Somehow I’d always assumed nginx worked hard to be apache compatible. It doesn’t sound like that’s the case, which is a shame. I also found this on the official nginx wiki

Stop using .htaccess. It’s horrible for performance. NGINX is designed to be efficient. Adding something like this destroys that.

I’m probably one to talk about injecting too mucy personality in tech writing, but the last thing I want to see in an official manual is a statment like this. A explanation of the tradeoffs? Sure. A borderline bullying bit of text urging you not to do something instead of teaching you to …

[ 3 Feb 2016 ]

For over a decade I’ve kept most my development work confined to the physical Macintosh OS X laptop I use every day, running server software using the OS X unix/bsd/darwin internals. I pick a stable version of PHP and install the php-osx package (previously the entropy.ch package), install MySQL via MySQL/Oracle’s OS X installer, use brew (previously ports) to install any unix packages I need, and compile the occasional thing from source as needed.

This stable set of software has served me well, and by side-stepping virtual machine/vagrant/version-managers it’s kept my code on the straight and narrow – i.e. applicable to generic PHP versions and not shutting people out who don’t have the liberty of choosing their hosting environment.

Magento …

[ 3 Feb 2016 ]

I’m not super conversant in the less CSS preprocessor, so I’m not sure how useful they are, but Magento 2 ships with some useful looking UI library docs in

lib/web/css/docs/index.html

You won’t be able to browse to these files via HTTP – you’ll need to open them directly in a web browser.

[ 1 Feb 2016 ]

Magento 2 Marketplace Upload Validation Tool (Quick Note):

Magento’s lead architect, Alan Kent, just posted a small command line program to validate a “composer zip archive” for Magento Marketplace. Magento Marketplace is the replacement for Magento Connect, and although its details remain a secret, its assumed to be an in browser Magento application for installing composer based packages into Magento 2 systems.

Part of the submission process includes zipping up a composer archive and submitting it to Magento. The script Alan Kent provided performs some basic validation on that archive to make sure its something the Marketplace system will be able to work with.

It’s a little weird that this sort of validation won’t be included in Marketplace, or …

[ 28 Jan 2016 ]

Thanks to some late, post merchant beta changes made to Magento, distributing modules via Composer (PHP’s de-facto package/dependency manager) has never been easier. While we’re all interested to see how the new Marketplace turns out, thanks to Magento 2’s architecture changes we should all be able to distribute our modules without needing to buy into whatever tradeoffs will be involved with official distribution channels.

As a module developer, the bare minimum composer.json file you’ll want for your module should look something like this

{
"name": "pulsestorm/module-name",
"description": "A description of your extension",
"authors": [
{
...

[ 26 Jan 2016 ]

Permission issues with static generated files in pub directory · Issue #2412 · magento/magento2:

I built my first website in 1995 – which means I’ve had over 20 years of battling unix file permissions. Or, more appropriatly, fighting the software world’s myriad ways of dealing and not dealing with them.

[ 25 Jan 2016 ]

A quick, semi-regular roundup of open Magento 2 technical questions.

How to use ui_component

Magento introduces a new layout handle XML node named uiComponent that lets you insert specific user interface elemnts into your application. Unfortunately, documentation on how to use this is woefully incomplete. The documentation that does exist looks like it will be useful to anyone who’s already familiar with the system, but there’s nothing there that gets people familiar with the system.

I’ve got a few questions on this on the Magento Stack Exchange, but none with answers that come close to what a new user would need to get started with a UI Grid in Magento 2. This one is just the latest

Magento 2: UI …