The week weeks on StackExchange #24-29 / 2016

The weekly format did not last long, but a few posts on Magento StackExchange assembled in the last 5 weeks that might be worth some attention (and a new t-shirt):

Magento 2

Magento 1

Magento Theme Refactoring

A very common issue in 2014 was „I updated to Magento 1.8 and now my (login|cart) form is not working anymore”. The reason for this happening was that starting with Magento 1.8, the form key was used in more forms as a security feature (it prevents CSRF attacks). But any theme that had its own version of the according templates did not include the form key, so that the server side validation of the form silently failed.

Of course there are themes whose markups are so different from the default theme, that most templates are overridden with good reason. However I see at least as many themes, especially custom themes, where all templates were copied from base/default and then modified. There is almost no excuse to overwrite layout XML files because one can modify the layout in many ways with an additional theme specific local.xml file.

The issue mentioned above is a good example of the reasons for the „pay attention to updatability“ mantra. The errors could have been avoided if only files had been copied, that really required adjustment(s).

With this article I want to explain the process I’m following for theme refactoring (just the structural part, the HTML source will look exactly as before afterwards — except from changes in newer versions of the default templates).


Form Problems after Magento Update to CE 1.8.1 or EE 1.13.1 (Login, Cart)

If the login forms in the frontend do not work anymore after an update to Magento CE 1.8.1 or EE 1.13.1, the used theme has to be updated. These forms now need a form key, if it is missing, validation in the controller fails. The same applies for the “Update Cart” button in cart.phtml. How to fix it, see this link:

Of course it would be optimal, if the them overrides as little core templates as possible and does its changes with layout updates in [theme]/local.xml and CSS wherever possible.