Magento Quickies

Feliratkozás Magento Quickies hírcsatorna csatornájára
the professional weblog; because we have to
Frissítve: 6 óra 35 perc

How PHP Runs a Program

h, 02/26/2018 - 13:21
When I found the PHP Internals site a few months back, I noticed there was a small credit at the bottom. Built by Thomas Punt & Liam Mann Some Googling showed that Thomas Punt had written this How PHP Executes — from Source Code to Render article for sitepoint. While the article was accurate, like a lot of pro internet content it was a breezy, high level read that didn’t set out to get into the specifics of how all these systems worked. Fortunatly, my Where’s the php-src/PHP-Internals Main Entry Point question over on Stack Overflow got a great response […]
Kategóriák: IT Hírek

Understanding Git Rebase

sze, 02/21/2018 - 13:49
I first saw a version of this talk (from @ellotheth) at PHPPNW in 2015, and it’s the first thing that made git rebasing make sense to me. Too many rebasing tutorials are so busy selling you on the benifits that they gloss over what’s happening to repository. Gemma’s talk not only dives into what a git rebase actually is, but does in a straight forward, gentle way that avoids a lot of the computer science machismo overdoes (or outright bluffing) that you find from other tutorials/polemics on the subject.
Kategóriák: IT Hírek

Using a Magento 2 Theme for Transactional Email

h, 02/19/2018 - 13:05
Given Magento 2’s enterprise ambitions, it wouldn’t surprise me if most stores are routing their transactional emails through a seperate (or a series of seperate) email systems. Because Enterprise™. However, if you’re sticking to Magento’s default email system for the password reset, order thank you, sign up, etc. emails, then you might want to check out Daniel Sloof’s Custom Email Theme extension. This extension allows you pick any installed Magento theme and have Magento use it (instead of the Blank theme) for transactional emails. It’s odd to see this sort of fuctionality missing from Magento’s core more than two years […]
Kategóriák: IT Hírek

Using “Not Quite JSON” with PHP

k, 02/13/2018 - 13:55
One of the odd side effects of JSON’s wide spread success is how often you’ll run across data that’s not quite json A hello world example looks something like this {a: "Hello World"} If you look at that string, you might think Hey, it’s a JSON string! However, it’s not strict JSON — the a needs to be a quoted string. Consider the output of the following. $foo = json_decode('{a: 8531329}'); var_dump($foo); //NULL $bar = json_decode('{"a": 8531329}'); var_dump($bar); //the object “Not Quite JSON” exists because JSON’s elevator pitch is We encode everything using javacsript objects This means there’s a ton […]
Kategóriák: IT Hírek

Useful Magento 2 JavaScript Helper Functions

k, 02/06/2018 - 13:57
I had to fix a typo in it (thanks Vinai!), so why not squeeze a link out of my Magento 2: uiElement Standard Library Primer article from last year’s uiElements Internals series. I’m reasonably proud of that, and its predecesor UI Component series. I’m also diappointed (but not surprised) that frontend development in Magento 2 remains complicated, slow, and something most smart developers avoid.
Kategóriák: IT Hírek

New Docs Site for PHP Internals

cs, 02/01/2018 - 13:16
A new documentation site for PHP Internals (the pile of C code that’s used to build PHP itself) magically appeared a few weeks ago and it’s pretty great. While the PHP Internals Book tries to give you the context you need to work in the PHP source code, this new PHP Internals site is trying to document every symbol and the broad hierarchy of systems that make up PHP’s source. If you’re the sort of programmer who needs a plain english understanding of something in order to have it click, this new site looks invaluable.
Kategóriák: IT Hírek

Simple Command Line Image Manipulation is OS X/MaxOS

k, 01/30/2018 - 13:45
File this one under old-but-new-to-me tech: OS X/Mac OS ships with a simple command line application named sips that lets you perform simple image manipulations like resizing, rotating, image flips, crops, etc.
Kategóriák: IT Hírek

Large Configurable Products in Magento 2

h, 01/29/2018 - 13:39
Magento 2, like its forbearers, starts to fall apart when you push larger amounts of data through its systems. One example of this is Configurable Products. Configurable Products allow users to pick options for a product (size, color, etc.), and have each configuration mapped onto a single Simple Product entity. In theory, there’s no limit on the number of simple products you can link to a configurable. In practice, Magento’s UI rendering code starts to choke when the number of simple products attached to a configurable product starts getting into the thousands. Certainly not the standard case, but its not […]
Kategóriák: IT Hírek

Large Excel Data Dumps

p, 01/26/2018 - 13:22
I don’t know much about its provenance, but this small python program is just the thing if you’re trying to export a large Excel spreadsheet to a far more usable/malleable CSV file. Particularly useful for folks with Macs, since Numbers, Libre Office, and Open Office don’t handle large files well (Numbers and Open Office couldn’t open the file, and Libre Office opened the file, it couldn’t muster the energy to save it in another format)
Kategóriák: IT Hírek


sze, 01/24/2018 - 13:23
It’s been long enough and I’m now old enough that I can’t quite remember when I started following Simon Willison’s work. He’s the co-creator of Django and one of those early online programming voices that were invaluable if you were cobbling together how all this stuff worked without direct access to the technology industry. He has a new project called Datasette, which creates a simple browser based UI for exploring sqlite databases, as well as tools for turning CSV files into sqlite databases and easy hosting of Datasette instances. Beyond being useful tools, its nice to see a set of […]
Kategóriák: IT Hírek

Line On Sierra

k, 01/23/2018 - 13:07
When it comes to retro gaming I’m mostly a dillitante, and I’m mostly chasing nostalgia. That probably explains why I’ve only just discovered this fantastic four year old series from a modern game critic (LIne Hollis) playing through the origial Sierra On-Line lineup. I mention this here, on a programming blog, because I think those early games ended up training more than one programmer in how to stumble their way through a compiler or interpreter.
Kategóriák: IT Hírek

Unfriendly Fire

h, 01/22/2018 - 13:57
One of the less fun parts about working in a C code base is dealing with the toxic machismo that’s still present in the wider culture. The people I work with are (fortunatly) great, but when I’m wading through the internet for answers I come across things like this time and time again. The top answer is a rant that spends half its time throwing shade at the question asker’s code, and the other half berating the authors of GCC for their choice of default warnings. The straight-foward answer (with three votes) lingers below.
Kategóriák: IT Hírek

Mage TV Beta

k, 01/16/2018 - 13:13
Vinai Koop has opened his service/channel as a free public beta. Right now there’s over an hour of free Magento 2 tutorials, and a roapmap for what content’s coming next. It’s also an interesting example of a single person’s vision for a video delivery system. These sort of systems are common, but are usually the product of an Enterprise Sales team or Global Digital Brand — both markets that lean away from simple straightforward software. If you’re working with Magento 2, I’d label anything Vinai puts out required viewing/reading.
Kategóriák: IT Hírek

Magento 2’s Starting Order/Invoice/Shipment/Credit IDs

h, 01/15/2018 - 13:13
While there were a number of extensions for Magento 1 that let you change the IDs generated and printed for Magento’s orders, invoices, shipments, and credit memos, I haven’t seen one emerge for. This post from Classy Llama jumps down into M2’s database table and tries to figure out where Magento 2 generates these IDs.
Kategóriák: IT Hírek

Chrome Redirecting .dev to HTTPS

k, 01/09/2018 - 14:41
The latest version of Google Chrome (Chrome 63) will redirect any domain that ends in .dev and .foo to an https URL automatically. It sounds like Google felt they could do this since they bought the entire .dev and .foo global top-level domains (gTLD). I joke complained about this on Twitter before, but it seems like my Chrome finally auto-updated to version 63 in the past few days. A handful of important web applications I run directly on my computer, plus almost all my client dev sites, stopped working. It’s not hard to pick a different gTLD and change the […]
Kategóriák: IT Hírek

No Clear Wins

v, 12/31/2017 - 13:19
Two of the biggest mind shifts I’ve had to make in coming back to C programming have been strings and variable scope/lifetime. This Stack Overflow question is a nice encasulation of both. First off — strings aren’t a first class type in C. They’re just a char array of individual characters, with a NULL character as the final element. This might not seem that bad, until you remember that arrays aren’t the simple “lists of stuff” you might be used to in higher level languages. In C, an array is a literal allocation of “N” bytes of RAM. Arrays are […]
Kategóriák: IT Hírek

The Odd Semantics of Magento 2’s referenceBlock

sze, 12/27/2017 - 13:01
In Magento 1, it was pretty common to write a bit of layout update XML that looked like the following. <reference name="head"> <action method="setLabel"> <label>skin_js</label> </action> </reference> This XML translates roughly into the following PHP pseudo code $block = $layout->getBlock('head'); $block->setLabel('skin_js'); Or, in plain english, Magento fetches a reference to the already instantiated block object named head, and then calls this block’s setLabel method. This syntax has survived, mostly, into the Magento 2 era. Although the Magento provided “dev docs” say the syntax is “not recommended“, action methods still work <referenceBlock name="catalog-search-advanced-link"> <action method="setLabel"> <argument name="value" xsi:type="string">Does this Work</argument> </action> […]
Kategóriák: IT Hírek

Layout XML Merging in Magento 2

k, 12/26/2017 - 13:50
One of the bigger changes to Magento 2’s layout system is how a end-user-programmer uses layout handles. In Magento 1, layout handles were top level configuration nodes in a set of layout update xml files <handle_name> <!-- layout update xml nodes --> </handle_name> In Magento 2, layout handles are individual XML files (which I’ve been calling layout handle XML files) #File: path/to/module/view/layout/handle_name.xml <!-- layout update xml nodes --> One interesting side effect of this is, unlike Magento 1, Magento 2’s layout XML files are susceptible to node level merging. i.e. — consider this core XML file #File: vendor/magento/module-catalog-search/view/frontend/layout/default.xml <?xml version="1.0"?> […]
Kategóriák: IT Hírek

Magento 2’s Poorly Named Layout Argument Nodes

v, 12/24/2017 - 13:51
Magento 2 introduced a new node type to its Layout XML DSL — the <arguments/> and <argument/> node. #File: vendor/magento/module-shipping/view/frontend/layout/sales_guest_view.xml <referenceBlock name="sales.order.view"> <block class="Magento\Shipping\Block\Tracking\Link" name="tracking-info-link" template="Magento_Shipping::tracking/link.phtml"> <arguments> <argument name="label" xsi:type="string" translate="true"> Track your order </argument> </arguments> </block> </referenceBlock> Like so much of Magento — the names of these new nodes hide their purpose from developers. All the <argument/> nodes do ensure a value will be set on the final block object. i.e. The above code will set a label property on the tracking-info-link block (instantiated from the PHP class Magento\Shipping\Block\Tracking\Link). This means you can access the property from your phtml […]
Kategóriák: IT Hírek

Getting out of the Block Business

h, 12/18/2017 - 13:30
This in an interesting Magento layout technique that came my way via Vinai Kopp (of fame). Magento 2’s automatic constructor dependency injection system presents a problem for class trees with multiple levels of inheritance. First, programmers end up needing to call parent constructors with the right arguments, and in the right order. Second, class hierarchies also create confusion w/r/t the object manager’s configuration — namely, which constructor should the object manager reference when looking for arguments to instantiate and inject? Magento 1’s block class hierarchy has a lot of inheritance. Magento 1 plugins modeled on the core code also […]
Kategóriák: IT Hírek