Part 5 of my blog series on integer-net.com about framework independent code is out: Using Advanced Autoloading. This one is only relevant for the integration of legacy applications that do not use composer autoloading yet (Magento 1).
The week on StackExchange #11 / 2016
Here’s the next update with new, hopefully interesting, questions and answers on StackExchange.
New Answers
- If you are wondering wether to import classes with “use” or use the fully qualified class name, read Magento 2: use statement versus direct class path?
- What happened to the
customer_logged_in
andcustomer_logged_out
layout handles in Magento 2? Magento2. Layout Handle customer_logged_in - If you want to set up a password protected staging system with Varnish, here you go: Setting up Magento Staging Environment with Restricted Access
- My question on translation scopes in Magento 2 finally received an answer with a somewhat satisfying solution for translation conflicts: How does translation scope work in Magento 2?
- A quickie: The best way to react on changed configuration values in Magento 1: How to detect changed fields only in admin section?
New Questions
- After a day of Magento 2 develoment with JavaScript, I shared the frustrating summary on Twitter, which attracted some attention:
Today's Magento 2 workshop: 3h installing, 1h explain DI, plugins & Co, 2h coding & debugging, 2h waiting for static content to be deployed
— Fabian Schmengler (@fschmengler) 18. März 2016
Looks like I am not alone with this experience but it’s not really how it is supposed to be. This lead me to the question Which compilation commands are needed in developer mode and when? - There seems to be a bug in certain Magento versions with order reports and timezones but I could not quite pin it down yet: Magento Reporting – Is it bucketing by UTC?
The week on StackExchange #10 / 2016
Here’s the next update with new, hopefully interesting, questions and answers on StackExchange.
New Answers
- Marius attended my question about generated PHTML files in Magento 2 and also found out when they are used: When and how are phtml templates generated in view_pre geprocessed?
- I found a bug in the JavaScript function
Mage.Cookies.clear()
. It looks like it never worked, and actually it is not even used in the core. Here I describe the fix: Mage.Cookies.clear() not working - In How to limit characters in system.xml for textarea in magento I show how easy validation of inputs in the Magento configuration is possible (Spoiler: You don’t need jQuery).
- There is an interesting optimization opportunity if you don’t need URL rewrites for products: How do I get Magento to always give the /catalog/product/view/id/ style url for products?
- A problem that other Magento users who try to use Varnish with HTTPS might know as well: https redirection loop even with X-Forwarded-Proto
New Questions:
- I asked myself if it makes sense as an extension developer to add the whole Magento repository as dev-requirement: Magento 2 as composer dev requirement for extensions – the answer is as often “it depends”. It was already interesting to get insights from companies like Aheadworks and Fooman.
- There is still no answer to How does translation scope work in Magento 2? and I fear it’s because it cannot be answered. But to be sure, I offered a bounty: +50
The week on StackExchange #9 / 2016
I’ll try a new weekly format on the blog with a summary of recent questions and answers from StackExchange, all around PHP and Magento. Let’s see how it works out and start right away:
New Answers
- In Creating Integration Tests for Magento 2 Modules I explained how to place your own integration tests outside of
dev/tests/integration
. - In Protect a site from wappalyzer I evaluate, if it’s possible to protect a Magento site from automatic detection and how.
- A quickie on design patterns: Data Mapper – should I use dependency injection?
Open questions
- What happened to translation scopes with the new global
__()
function: How does translation scope work in Magento 2? - I thought I had understood static file generation in Magento 2, but what are the templates doing there: When and how are phtml templates generated in view_preprocessed?
In the next week there is more to come on the topic of Magento 2, since I am just starting to get deeper into it.
Design Patterns for Framework Agnostic Extensions/Plugins – View Model
Part 4 of my blog series on integer-net.com about framework independent code is out: Preparing Data For Output
Previous parts
Design Patterns for Framework Agnostic Extensions/Plugins – Bridge
Part 3 of my blog series on integer-net.com about framework independent code is out: Building Bridges
Previous parts
Design Patterns for Framework Agnostic Extensions/Plugins – Dependency Injection
Part 2 of my blog series on integer-net.com about framework independent code is out: Using Dependency Injection
Previous parts
Design Patterns for Framework Agnostic Extensions/Plugins
My new article series on integer-net.com introduces useful design patterns for decoupled Magento extensions, which are divided in two parts: the Magento module and a framework independent (framework agnostic) library, that is reusable for Magento 1 and Magento 2. Of course, the same principles can also be applied to other frameworks and applications.
It will not cover the refactoring process from existing extensions to this model, that’s a different topic and I am going to talk about it at Developers Paradise 2016 in Croatia. Stay tuned!
The first part is about accessing application configuration, using Configuration Value Objects.
Retrospective: The Blog 2015
Happy new year to all my readers! Just as last year I begin 2016 with a retrospective for 2015 in numbers and facts, and a preview for the upcoming year.
Since my few regulars are probably mostly German speaking, I won’t write the post in English this time.
Sorry, my non-German friends!
Use Feature Toggles in Magento
Today, Joshua Warren asked an interesting question on Twitter:
Feature flags in Magento (1|2). Any open source modules for it yet? At least a common approach? @allanmacgregor @jcowie @fbrnc #realmagento
— Joshua Warren (@JoshuaSWarren) 14. November 2015
I had thought about the topic earlier and if some genereric feature flag module would be worth developing. My conclusion was that it was too trivial in the end and I would just build feature toggles as needed for the respective project.
Feature Toggles: What and Why?
Feature toggles are a way to roll out partially developed features and keep them disabled in production, so it is often mentioned in the context of continuous delivery. They support the “ship early and often” paradigm and decouple code deployment from feature activation.
But feature toggles (or “feature flags”) also can be used to roll out new features gradually, for example only for a certain customer group, based on user location, or for randomly selected users, as with A/B testing.
Continue reading “Use Feature Toggles in Magento”