Categories


Recent Posts


Archives


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.

oddyssey/mailtrap

Visit Linked Page

oddyssey/mailtrap A simple mailtrap extension for Magento 2. Mailtrap is a service that lets you point your development instances at an SMTP server that accepts mail, but doesn’t deliver it. Instead mailtrap collects all the mail in a single INBOX. If you’ve ever accidentally emailed an entire customer list with a subject line like Subject: Testing, hope this s——t works. you’ll instantly see the value. The Magento extension is also a simple example of how to hook into the MagentoFrameworkMailTransport class with a custom preference and change the behavior of the email system.

astorm

Reserved Words in Magento 2 URL  Paths

Visit Linked Page

Reserved Words in Magento 2 URL  Paths A StackExchange self answer where I use a plugin to work around the reserved-PHP-symbol-in-class-name problem that can plague Magento 2 URL routing. What’s extra baffling about this is Magento has a fix coded up, but only applies it to one URL segment. I suspect this is less baffling if you can gives up the idea that Magento 2 should retain its the rapid application prototyping roots of its ancestors.

astorm

Magento 2 – Form Validation

Visit Linked Page

Magento 2 – Form Validation A StackExchange post that contains most (all?) of the CSS classes that can control Magento 2’s form validation. Magento seems to apply the validation rules on all form submits – although I haven’t dug too deeply into that one so caveat emptor etc. Also, a bonus for folks who read these Tumblr desciptions — here’s a quick bit of javascript that will take M1 style HTML and make all the fields required in an M2 context. require(['jquery'], function($){ $('.required-entry').each(function(key, element){ $(element).attr('required','required'); }); }); Useful if you have a complex form built with a combination of […]

astorm

Headless Magento 2 Resources

Visit Linked Page

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 […]

astorm

Magento 2 VirtualTypes at Runtime

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 [...]

astorm