Magento “Invalid website id requested.” error in backend on product save

Today I got a error in the Magento  backend telling me, that I have requested an invalid website_id (Invalid website id requested.), when I tried to save a product. The problem was, that I had deleted unused websites and stores over the Magento backend. Unfortunately Magento seemed to keep the relation between website and product, although […]

MySQL server has gone away error fix for Magento

Today I wanted to test a tiny shell script, that didn’t do such magic stuff. It only generates a few websites, stores and storeviews and associates approximately 200 products to 4 websites. When I ran it locally I had no problems at all. But on the staging server I got the following error message when […]

Stop running indexes of Magento

Sometimes Magento indexes hang up unexpectedly. They are shown as running in Magento backend but looking at the process status (@see https://www.ask-sheldon.com/list-processes-after-cpu-usage/), you recognize that the respective process doesn’t do anything. Other common problems are, that there are payment transactions failures when price index is running (catalog_product_price @see http://magento.stackexchange.com/questions/260/price-re-index-causes-db-deadlocks-during-checkout) or that the search doesn’t work properly, […]

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 […]

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.

No category tree in Magento backend

Perhaps you now the problem shown below. The category tree of the products isn’t rendered correctly. That’s because I don’t set level and children_count during import of categories. This little script corrects this for me:

I Found this solution in this blog post from Nikola Stojiljkovic: http://inchoo.net/magento/solving-problems-with-category-tree-database-information/  

Install community channel

Sometimes it is necessary to install the community channel manually. F.e. in EE. 1.14.0.1 I got the following error massage in the Magento-Connect-Manager shell when I tried to install a package via “Direct package file upload”:

What I had to do is to run the following commands on shell:

After that you should see […]

Error cause by DEFINER in MySQL-dumps

When importing MySQL- dumps of a Magento database sometimes you get an error message like that (although you can connect to the database via shell f.e.):

In these cases you’ ll recognize that the user, who tries to connect, is wrong (not the user defined in the mysql-call). This is caused by  DEFINER declarations […]

Magento – Reset Filepermissions

To reset filepermissions of Magento, you can run these commands on shell from within the Magento root folder:

perhaps you have to use sudo!!! As a bash script Or you can place all commands in a shellscript like the following one. I personally put these kind of tools in a folder tools/shellscripts that is situated […]

Automatically load custom product attribute with collection (every time)

You can do this with the following XML in your config.xml:

But ATTENTION: This can become a performance issue, because it loads the attribute every time the product collection is loaded! If you added too many attributes, the performance can get worse!