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:

http://www.magentocommerce.com/wiki/groups/227/check_magento_version

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:

http://www.catonmat.net/blog/perl-one-liners-explained-part-six/

BTW … here’s the security alert:

http://www.magentocommerce.com/blog/comments/important-security-update-zend-platform-vulnerability/

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

0

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:

http://www.iis.net/download/URLRewrite

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

0

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 “acme.com”. Then create an alias domain like “dev.acme.com” or “acme.greatdesigns.com”. 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 “acme.com” 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.

0

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:
    http://blog.nexcess.net/2011/03/11/upgrading-to-magento-1-5-0-1/
  • 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:

    http://screencastworld.com/2010/07/magento/how-to-fix/php-fatal-error-call-to-a-member-function-tohtml-on-a-non-object-in-layout-php-on-line-529

  • 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:

    http://www.magentocommerce.com/boards/viewthread/201998/

  • 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:

    http://www.magthemes.com/magento-blog/checkout-does-not-work-with-credit-card-payment-method-in-magento-1-4-1-0/

    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:

    to:

    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:

1

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.

7