Top Nav

Archive | Web

Determine Magento Commerce Version

While urgently patching dozens of Magento Commerce installations for the latest security alert, I needed a quick way to determine the version without logging into the admin.

I found the answer in a note on the bottom of this wiki page:

Just open app/Mage.php and look for the getVersionInfo() function. You’ll see something like this:

Here’s a Perl one liner to extract the version:

Thanks to Peteris Krumins for a great blog full of Perl one-liners. The one above
was derived from this article:

BTW … here’s the security alert:

If you’ve not already patched then you should really get it done right away or contact Reliable Penguin for assistance.


WordPress URL Rewrites On Plesk 10 Windows

We needed to get URL rewrites working on a Plesk 10 Windows server for a client wanting friendly URLs in WordPress. Turned out to be pretty easy ….

1. Make sure the Microsoft IIS URL Rewrite 2 extension is installed. You can find it here:

2. Create a web.config file in the folder where you have WordPress installed with the following:


WordPress Development Sites

Had a conversation with a client yesterday about how best to develop a new WordPress stie before the domain name was pointing to the server. This might be the case if you’re building a new site while the domain is still pointing to the old site.

If the new site has to be publicly available then the only real solution is to develop on a subdomain or alternate domain. So in Plesk or CPanel create the target domain like “”. Then create an alias domain like “” or “”. Now you’ll install wordpress and do the development on the alias domain. When you’re ready to go live you can point the final name in DNS to the new server.

But there’s are several possible issues that you’ll see when you go live:

  1. WordPress stores the domain name of the site at installation in the wp_options table under the “home” and “siteurl” keys. You’ll need to update these rows to the new domain.
  2. Sometimes a theme will contain an absolute url reference. This should not be the case but sometimes mistakes happen when your building a custom theme. So make sure you search/replace the theme folders for the new name.
  3. WordPress may contain domain name references embedded in the database. I usually do a two multi step process where I
    1. dump the entire database to a sql file
    2. Plus I dump the wp_options table to another sql file
    3. Then I search/replace the new domain into the full dump and load it to the server.
    4. finally I manually edit the wp_options dump to fix url references and load it to the database

Why the multi-step process to fix up the database? WordPress widgets like to store serialzed PHP strings to the wp_options table. These strings can not be changed with a simple search and replace because the include string length information. So to when I manually fix the wp_options dump file, I have to adjust the string lengths in addition to the domain names. Overall this is a real pain is there are many widgets.  So far I don’t know a good work around for these issues.

If the new development site does not need to be public then a much easier solution is to use a hosts file on your workstation. Start by creating the domain in Plesk or Cpanel. Note the IP address assigned to the site.

Now following the instructions in the articles here:

RP Knowledgebase Migration Category

Add a hosts file entry mapping the domain name to the assigned IP address similar to this:

Now your web browser will go to the new site instead of the old site. You can install WordPress and do your development on “” and you don’t need to worry about changing anything when the site goes live.

There is just one catch, if you want to install plugins or updates from within WordPress then you’ll need to edit the wp-config.php file and add the following line:

This change gives WordPress and explicit address for it’s FTP connection instead of using DNS so it will be able to install upgrades.


Magento Upgade Notes

Here are some useful notes for upgrading Magento:

  • Before starting the upgrade, block all access to the site by turning on password protection. It is critical that only one browser execute the database upgrade.
  • Next make a full backup of all files and the database. If the upgrade fails you’ll need these to restore.
  • Using the command line seems to give the most stable results. Here’s a great article that shows the command line upgrade process:
  • In the above instructions, if Step 2 fails then try running:

    Then try Step 2 again.

  • After the upgrade you’ll need to rebuild indexes and clear caches before products will display.
  • If you get an exception like this:

    Then use the fix described here:

  • If you get an exception like this:

    Then follow these steps:

    1. Create folder at app/code/local/Mage/Core/Block/
    2. Copy app/code/core/Mage/Core/Block/Template.php to app/code/local/Mage/Core/Block/Template.php
    3. Edit app/code/local/Mage/Core/Block/Template.php and paste this code:

      directly after this existing code:

    This fix comes from here:

  • Sometimes pagination will be lost from categories that span multiple pages. This can be fixed with the following steps:

    1. Edit app/design/frontend/default/modern/layout/catalog.xml
    2. Add this line:

      after this line:

      in the “Catalog default layout” section. Also add the same line after:

      in the “Category layer navigation layout” section.
    3. Edit app/design/frontend/default/modern/template/catalog/product/list/toolbar.phtml
    4. Remove these lines:

      And replace with this line:

    5. Next edit skin/frontend/default/modern/css/boxes.css.
    6. Change the “table.pager td” definition around line 443 to:
    7. After the following lines around line 450:

      Add these lines:
    8. Locate the “.a-right” definition around line 1447 and change to:

    Note that the CSS changes in steps 5 to 8 may vary between sites and different layouts.

  • The Credit Card checkout method may be broken due to a missing javascript file reference. The symptom is that the Continue button on step file does nothing. The fix is to edit the layout/page.xml file for your theme at app/design/frontend/default/[YourThemeName]/layout/page.xml and add the following line in two places:

    Full details can be found in this article:

    Don’t forget to flush the JavaScript/CSS Cache after making these changes.

  • While the database upgrade is running, if you get an exception like this:

    Then you’ll need to manually clear the caches like this:

    The same fix applies if you get an exception like:

  • If you get SQL integrity constrain violation errors similar to this:

    Then first try to Google and find a solution. As a last resort edit app/etc/config.xml and change:


    This will disable integrity checking. Make sure you remove this change after the upgrade has been completed.

  • Sometimes in an old theme you’ll see where the developer hacked an addJs2 function into app/code/core/Mage/Page/Block/Html/Head.php and then put something like:

    into the page.xml layout.

    To fix this change the page.xml code to:

  • In older versions you could do this in a template:

    For newer versions do this instead:


Install WordPress on Ubuntu virtual server at Media Temple

Server is a MediaTemple “ve” server which is a Parallels Virtuozzo container with Ubuntu 10.04 LTS Lucid installed as the operating system.

The first step is to install packages:

Now set mysql service to start automatically:

Next create a database for wordpress:

Next we’ll download and install wordpress:

Now set the database credentials in /var/www/wp-config.php:

Finally point your web browser to the site and run the WordPress installer.