The last part (for now) of my blog series on integer-net.com about framework independent code is out: Iterating Iterators.
The week on StackExchange #15 / 2016
Here’s the next update with hopefully interesting questions ans answers on StackExchange!
Magento 2
- How can you check if the current page is the home page? Best way to check if page is home page
- How do you get the quote items and order items? Answers in Magento 2 – How to get all items in cart? and Magento2 Correct Way to get Order items
Open Questions
- It seems like I am not alone with this problem, but there is still no answer: Magento 2 Admin Panel hangs forever until page refresh. There is a bounty of +150 reputation.
- After Magento announced its new PaaS solution “Magento Enterprise Cloud Edition” at Imagine, I could not wait to know technical details: Magento Enterprise Cloud Edition: What are the development and deployment tools?
Magento 1
- It should be known, how to list all class rewrites, but what about controller overrides? How to get list of overridden controllers?
Software Design
This week something from programmers.stackexchange.com:
- Can/should you apply the Principle Of Least Astonishment on (API) interfaces? Principle of least astonishment (POLA) and interfaces
- How do you handle validation on a higer level? Data validation: separated class or not?
Magento Extension: Estimated Delivery
Today I present you a little commercial Magento 1.x extension I have been working on with my team at SGH:
SGH_EstimatedDelivery ($79.00)
It calculates estimated delivery date and shows the customer how much time is left to get the order on this date. This information can be shown on the shopping cart and on product pages:
Continue reading “Magento Extension: Estimated Delivery”
The week on StackExchange #14 / 2016
Here’s the next update, again only with new, hopefully interesting answers on Magento StackExchange.
Magento 2
- In case you have been wondering, what “Context” does in various constructors: What is Context Object purpose in any class’s constructor DI ? How Context works?
- Should you turn on developer mode by modifying
app/etc/env.php
? Is this good idea to change current application mode from Env.php
Magento 1
- How to build a “buy now” single item checkout that does not affect the current content of the cart: Checkout only 1 item from magento cart
- The question has been closed but still might be useful: Sort products by their product id in the order they were imported (how to allow sorting products by creation date without custom code)
- Another one: Cron configuration without SSH – Magento 1.9.2.4 (with or without Aoe_Scheduler)
Filtering Magento Collections: addFilter() vs. addFieldToFilter()
There was an interesting question on StackExchange recently that did not get much attention:
Magento collection has two methods for filtering:
Varien_Data_Collection_Db::addFieldToFilter
Varien_Data_Collection::addFilter
Seems that both methods add where condition to
Zend_Db_Select
. And what advantages doesaddFilter
bring? When should I use it instead ofaddFieldToFilter
?
I had to dig a bit into addFilter
myself because I was only familiar with addFieldToFilter
and here is what I found:
Link to the question: addFilter vs addFieldToFilter
Continue reading “Filtering Magento Collections: addFilter() vs. addFieldToFilter()”
The week on StackExchange #12 / 2016
Here’s the next update, this time only with new, hopefully interesting answers on Magento StackExchange.
Magento 2
- Which compilation commands are needed in developer mode and when? received a few useful answers. The +150 bounty for the best canoncial answer is still open.
- I shared some thoughts about efficient usage of builders: Use preconfigured builders (e.g. for SearchCriteria) in Magento 2 Thanks to Vinai for helping out here!
- Do you miss good old local code pool overrides? Read this: Override abstract class in Magento 2
- Confused with the mixture of
$()
,$$()
andjQuery()
in JavaScript? What does $$ in javascript of Magento 2 mean?
Magento 1
- Saving CMS pages and blocks programmatically (e.g. in a setup script) can be tricky: Saving CMS block/page from collection removes store ID’s
- Somebody couldn’t overwrite template via xml added by external module – a common pitfall with the layout XML when block names are reused.
- And a quickie, which events to observe to react on cart changes: Is there an event that fires when the cart/quote is empty?
Design Patterns for Framework Agnostic Extensions/Plugins – Autoloading
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).
Previous Parts
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
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