Magento 2 always_populate_raw_post_data

Magento 2 complained that I should set always_populate_raw_post_data  to -1. Changing the php.ini didn’t help. The solution was to add

php_value always_populate_raw_post_data -1

to my VirtualHost (directly after the AllowOverride of the DocumentRoot-directory config).

Configure Redis-Cache in Magento 2

To use redis for caching in magento2 I added the following part in app/etc/env.php:


Magento Update Script

To Update massive amounts of data in magento without going directly into the database I found an interesting piece of code under

I adopted this file to simply print the sku of all products in the shop and count them:

These two examples show how to iterate over all products and how to get a specific product by sku. They have to be placed in ${magento_root}/shell

To speed up updates a bit magento provides the ability to update single fields instead of the whole product as in code snippet one:

Of course the fastest way is to write SQL queries. Therefor please read into the magento EAV model.

Magento Manual Cleanup

Magento creates lots of files and database entries no one really needs. So here is how I tried to clean up the mess – based on this script from the magento site

First I logged in into the shell and executed the following in the magento directory:

After that I executed the following SQL queries:

Change base URL in magento

If you rename or move the folder containing your magento installation or want to change the domain you won’t reach it anymore because the base_url is saved in the database and used for redirects. So connect to your database and change the URLs saved there:

The URLs are saved under core_config_data and can be retrieved by:

Then just adapt the result and don’t forget to clean the cache.

Magento – Column ‘option_id’ in where clause is ambiguous.

This problem should be fixable by changing app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Option/Collection.php line 117. Just insert “main_table.” (without “) before option_id. The line shoul look like the following after that: