Category: Programming Quickies
Back in they day, I ran a Tumblr blog named Magento Quickies where I’d post shorter, less in-depth posts about my travels through Magento’s source code. This Programming Quickies categories is the successor to that Tumblr blog. You’ll find all the old Magento Quickies content here, as well as new short posts about programming in general.
This section has its own RSS feed, the old Magento Quickies feed should should be redirecting, and we’re cross posting notifications for new posts over to magento-quickies.tumblr.com. In other words, you shouldn’t need to know any of this, but the duct tape that keeps the internet held together isn’t aging well, so your mileage may vary.
Below you'll find all the Programming Quickies articles on the site,
followed by a chronological listing of the same.
You may also browse the
7
series directly via the following links.
Pestle, Four Steps to Async Iterators, Checking in on OpenMage and Magento in 2020, Text Encoding and Unicode, Shopware's Development Environment, A Sentimental Gen-X Programmer Culls his Tech Books, and, Containers, Containers, Containers.
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
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
I’m working on an in-depth ERP project, and ran into a strange problem where I had a reference to a quote object that refused to delete its items. I could run something like this foreach($quote->getItemsCollection() as $item) { if("item meets my criteria") { $quote->deleteItem($item); } } [...]
astorm
If you’ve spent anytime doing Magento 1 module development, you’re probably familiar with the _validateControllerClassName method. This method is where Magento 1 generates and validates paths to possible controller class matches during routing. This method is gone in Magento 2 – partially due to the PSR-0 autoloader [...]
astorm
In Magento 1, it was possible to register a global variable with the static registry method. Mage::register('some_var', 'some value'); var_dump(Mage::registry('some_var')); Many extensions, include core Magento extensions, ended up using this from controller action methods to pass variables into the views. While its future is uncertain [...]
astorm
The Magento 2 developer documentation is coming along at a good clip. Unlike round one, the company behind Magento has a dedicated team of profesional technology writeres who are cranking out documents based on interviews with the core team, and feedback from the merchant beta. I’ve seem some complaints that the developer [...]
astorm