1025 MySQL error when upgrading magento

Upgrading Magento is a tricky task. Even though the process is somewhat easy, when you find errors that they are not always easy to solve. One of these errors is the 1025 mysql error. This error is related to foreign keys checks. There is no easy way to solve it. You can try modifying the app/etc/config.xml file, look for the tag and modify it to look like this: <initStatements>SET NAMES utf8; SET FOREIGN_KEY_CHECKS=0;SET UNIQUE_CHECKS=0;</initStatements> We’re Read more…

Clean way of deleting orders in Magento

If you prefer to use an extension to add a «Delete» option on the orders list, see the Seamless Delete Order extension. But if you want to do it by your own using the Magento functions, it’s quite easy. Just use something like this (this function would delete all orders, so don’t apply it directly!): foreach(Mage::getModel('sales/order')-&gt;getCollection() as $order) { $order-&gt;delete(); }

Functions in Blocks and in Helpers: what’s the difference?

For me, it’s pretty clear when the difference between a Block and a Model. Basically, the Model defines and implements our «object» in the Magento system, so we can call it whenever we need it. Blocks let us run specific functions from a concrete part of the website (defined in the layout) and call them from the phtml files that have been loaded from the page layout using a block. But imagine that you haven’t Read more…

How to get and show customer reward points in Magento Enterprise

One of the cool features in Magento Enterprise Edition is the reward points system. It’s very simple to configure and a really good way to make the customer feel «rewarded» for each action that he/she performs on the web. The reward points are shown by default in «My account» area and also in the checkout process. If we need to show the reward points in any other place on the web, we need to call Read more…

The easiest way to use jQuery in Magento

There are many different ways to use jQuery in Magento. The point on this is that given that Magento uses Prototype as default javascript framework (arghhh!), if we try to use jQuery libraries directly, there is going to be a «conflict». We can solve this activating the jQuery «no conflicts mode», but there are easier ways. The easiest I’ve found is to install the following extension: Mxperts jQuery Base After installing it, you can use Read more…

Get and show the collection SQL query on Magento

I’ve been “suffering” out of memory problems on one of our clients magento installations. The version is the 1.4.0.1, and it seems that the queries are not as efficient as they are on Magento 1.5 and above. So I needed to find out what were exactly the SQL queries that produced that out of memory error. The most difficult thing is to find where the collection query is done. Maybe there is a base collection Read more…

Solving the 404 error on the System » Configuration custom extension menu

When we install for the first time an extension that adds a menu on the System » Configuration panel, it is possible that we receive a 404 error when trying to configure it. This has happened to me on the Simple Configurable Products extension and the AheadWorks Blog extension. Solving this is really easy: 1. Clean your cache and reindex data 2. Log out from the backoffice and log in again Everything should work fine Read more…

Solving the “Customer Login” title in all pages in Magento

I’m one of those that wanted to add a login form on the sidebar of my Magento. This was really easy, I just add the following line to <reference name="header"> <block type="customer/form_login" name="mini_login" template="customer/form/mini.login.phtml" /> </reference> But after that, every page on my magento store showed the title page as “Customer Login”. This happened to me in Magento EE 1.10 and Magento CE 1.6. Solving this is really easy, if you know how. Just copy Read more…