Early Stage Plugins/Interceptors Don’t Work in Developer Mode · Issue #2674 · magento/magento2 This one was fun to track down. I was trying to plugin to Magento’s logger (MagentoFrameworkLoggerMonolog) but my plugin wasn’t working. Being new to Magento, I assumed the problem was an incorrect configuration, but [...]
astorm
If you’re seeing the following error in Magento 2 Invalid Base URL. Value must be a URL or one of placeholders: {{base_url}} The problem may the lack of a trailing slash on your base URLs http://example.com vs. http://example.com/ There’s some questionable URL validation going on in #File: [...]
astorm
A quick code-point mention #File: app/code/Magento/Catalog/Model/Product/Image.php public function resize() { if ($this->getWidth() === null && $this->getHeight() === null) { return $this; } $this->getImageProcessor()->resize($this->_width, $this->_height); return $this; } This method is where Magento 2 will [...]
astorm
Magento 2, even community edition, comes with a “full page cache” out of the box. This caching system lives near the top of Magento’s application dispatch. The frontcontroller will skip action controller dispatch if it can find a cached version of the page. You can turn this feature off in the backend at System -> [...]
astorm
Magento 2: Adding Arbitrary HTML to the of Every Page? This developer tried to embrace the new <head/> and <body/> standards in Magento 2’s layout, and you won’t belive what happens next. Spoilers – what happens next is he learns the <head/> directive has no way to add arbitary HTML, but that adding [...]
astorm
The error Parse error: syntax error, unexpected ’)’, expecting ’&’ or variable (T_VARIABLE) in is by far te most common thing I’m seeing during Magento 2 development. Its root cause? public function __construct( MagentoFrameworkAppRequestInterface $requestInterface, ) I’m injecting a dependency by [...]
astorm
eBayEnterprise/magento-log An interesting Magento 1 project that creates a PSR 1 wrapper for Magento 1 logging. Useful if there’s a tool/library out there expecting a PSR logging interface that you want to use with Magento 1.
astorm
I ran into this error Fatal error: Call to a member function getId() on a non-object in /path/to/magento/lib/internal/Magento/Framework/View/Model/Layout/Merge.php on line 745 after loading a new system’s MySQL database into my local development environment. Magento 2’s theme settings allow you to pick a specific theme from a [...]
astorm
Magento 2: Sending a Custom Header/Response from a Controller This one’s an interesting example of the challenges faced when refactoring legacy code, as well as the limitations of what a “classical OOP” approach can do for you in a PHP enviornment. First, this answer, while correct in the fact that it works, is not [...]
astorm
This is quick, high level, possibly incorrect, overview of how Magento 2 runs applications, and what the kernel of its system architecture looks like. This is the level above MVC/MVVM, and will only be of interest to folks (like me) who need to know how everything works. From a high level point of view, Magento 2 is an abstract operating [...]
astorm
Magento 2: Serializing a Category Tree as Primitive Types
astorm
One thing that keeps biting me in the trnasition from Magento 1 to Magento 2 is that sometimes the etc folder has an area hierarchy. For example, in Magento 1, you system configuration file (respoisble for building out a module’s configuratioin UI) lived in etc/system.xml In Magento 2 this file lives in etc/adminhtml/system.xml [...]
astorm
Magento 2: Serializing a Category Tree as Primitive Types Fence post towawrds understanding Magento’s Service Contracts. (Service Contracts underly the new API system)
astorm
mage-eag/mage-enhanced-admin-grids Interesting extension I stumbled upon during a consulting gig. Lets you — via a UI — add columns to many of Magento’s backed UI grids based on the fields avaiable in the collection.
astorm
503 Service Temporarily Unavailable on Magento after Clearing Cache Some tips from me on debugging 503 errors in Magento.
astorm
In 1995, Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides — via their publisher Addison-Wesley — released a book titled Design Patterns. This book describes 23 different approaches for
astorm
Magento 2 and Composer: Tutorial preview – Session Digital Speaking of James Cowie, here’s his video introduction to Magento 2, as well as a more in depth discussion of Magento 2 and composer.
astorm
The following steps are, as of October 22, 2015, the quickest way to get a working version of Magento 2 up and running without checking out the source from GitHub. The following will install the merchant beta – which is a stable, mostly feature complete version of Magento 2. There have been changes to the Magento 2 source since [...]
astorm
Here’s another gotcha to be careful of when using the sales/quote model objects. If you pass the following methods setBillingAddress, setShippingAddress, assignCustomerWithAddressChange an existing quote address object, these methods will reassign the address to the current quote (removing it from the old quote). If you were [...]
astorm
Here’s another caution sign if you’re using the sales/quote object’s deleteItem or removeItem method. If you look at the code that marks an item for deletion $item->isDeleted(true); if ($item->getHasChildren()) { foreach ($item->getChildren() as $child) { $child->isDeleted(true); } } $parent = [...]
astorm