I was active on Magento StackExchange again, here are a few interesting questions and answers from the last three weeks:
Magento 1
- (Why) do we need these ugly ___store and ___from_store URL parameters? M1: Remove “?___store=default” from the URL. And isn’t it at least possible to make them look nicer (“SEO friendly”)? Optimise URL when changing Store and language switcher to maintain SEO standards
- One question, three completely different approaches: how to add default products to related products list
- Sounds easy, but isn’t quite straightforward: Exclude Category when showing product collection
Magento 2
- A dirty hack, but very useful for development: Add same plugin to all public methods of a type
- Since Magento 2.1, creating own category attributes gets remarkably more complex: Add category attribute to custom attribute group. And this is how it looks with a source model: Create multiselect with source model in UI component
- I’m unsatisfied with the catalog service contracts again… “Call to a member function getIsInStock() on null” with getExtensionAttributes()->getStockItem() (or: How do I get products with stock info from the repository?)
Magento Architecture
Good question for understanding “MVC” in Magento: Why does Magento need blocks?. There was a similar question once here: Where’s The V in Magento’s MVC? And is there better name?