Find and eliminate dead parent connections

Recently I had the strange problem. In an old Magento installation there where many simple products connected to parent-ids that didn’t exist anymore. Normally that should’t be possible because of foreign key constraints in MySQL but  in fact they where there. Perhaps there was a bug in an importer script or foreign key checks where […]

Simulate a MySQL query before running it

It is possible to Simulate a MySQL query before running it with the use of  MySQL-Transactions and the build in ROLLBACK-Feature of MySQL: For example:

For further information see https://dev.mysql.com/doc/refman/5.0/en/commit.html and my answer on stackoverflow.com.

Force HTTPS for the whole store

Since Magento 1.9.1 you can force HTTPS for the whole shop by adding the following configuration-snipped to /app/etc/config.xml or any module config.xml (own module!!!):

After cleaning the config cache, Magento should generate secure URLs everywhere. That’s how to force secure URL’s in Magento.

Redirect all requests to the a preferred domain

In many cases a website or web application should be accessible by multiple domains.  The Problem is, that google could treat that as duplicated content (https://support.google.com/webmasters/answer/66359?hl=en) and also the trust is divided between all domains.  That’s why google suggests to choose a preferred (canonical) destination URL and to redirect all requests to the a preferred domain (https://support.google.com/webmasters/answer/93633?hl=en). To achieve that, […]

Get all saleable simple products from configurable product

The following function just gets all saleable (if saleable check is enabled in the Magento configuration) child products from a configurable product: