Today I faced an issue with the standard cPanel redirects not working with Magento running on litespeed.

When you create a redirect from within cPanel, a Mod Rewrite rule is written to the .htaccess file located in the document root of the domain the rule is for.

If you open the .htaccess file, you should see this at the very bottom (after creating the redirect in cPanel):

RewriteCond %{HTTP_HOST} ^www\.lacrosse4all\.com$
RewriteRule ^(.*)$ "http\:\/\/lacrosse4all\.com\/$1" [R=301,L]

There are two issues related to litespeed.

1. The Rewrite rule must be placed at the top of your .htaccess file (some rules set by Magento conflict with litespeed’s rule interpreter)
2. The Rewrite rule must be formatted correctly (remove the escaping backslashes from the RewriteRule).

Your update rule should look like this:

RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^(.*)$ "http://domain.com/$1" [R=301,L]

After making these changes and saving your .htaccess file, your Magento www URLs should now redirect to their respective non-www URL counterparts.

magento-category-loading

If you’re running a large Magento store, you may encounter an the dreaded “Please Wait” popup that hangs for a long period of time when attempting to move a category.

I looked into it, and discovered that Magneto was calling a reindexing process, which usually takes a bit of time to complete. You obviously don’t want to wait an eternity to move a single category, so you can simply do the following as a temporary way of disabling the reindexing when you move a category.

Disclaimer: This has been tested only on Magento 1.6.2

1. Open app/code/core/Mage/Catalog/Model/Category.php
2. Look for the following, around line 248:

Mage::getSingleton('index/indexer')->processEntityAction(
  $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE
);
Mage::app()->cleanCache(array(self::CACHE_TAG));

3. Simply comment out this code like this:
/*Mage::getSingleton('index/indexer')->processEntityAction(
  $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE
);
Mage::app()->cleanCache(array(self::CACHE_TAG));
*/

4. Save the file, and start moving your categories around instantly.

You can alternatively do this permanently by overriding the Category.php file by copying the file to app/code/local/Mage/Catalog/Model/Category.php and commenting out the code above.

Magento is a great platform, but sometimes I wonder why the developers make some of their decisions (like adding a resource intensive reindexing to a simple action like moving a category).

If you’re familiar with Rackspace Cloud Databases, you are probably aware that you cannot directly connect to your database remotely (outside of the Rackspace internal network).

You can, however, use an SSH Tunnel to access your database remotely through a rackspace cloud server instance.  Here’s how.
Read more…

magento_code-already-exists-error-issue

Today I encountered a “Code already exists.” error in Magento when trying to save a massive amount of Tax Rates to a Tax Rule.
Read more…

I encountered an issue where Google Analytics wasn’t receiving the ecommerce data it normally receives when a user places an order.

The issue is related to a small oversight by Magento developers, in the core GoogleAnalytics extension included with Magento.

If you have any quotes in your Magento’s store name, the Tracking Code will fail.  This is due to the quotes not being escaped in the javascript for the Analytics code.

To fix this issue, do the following…

  1. Copy app/code/core/GoogleAnalytics/Block/Ga.php
    to app/code/local/Mage/GoogleAnalytics/Block/Ga.php
  2. Open app/code/local/Mage/GoogleAnalytics/Block/Ga.php
  3. On Line 122, Find: Mage::app()->getStore()->getFrontendName()
  4. Replace With: $this->jsQuoteEscape(Mage::app()->getStore()->getFrontendName())
  5. Save the file and test.

This basically escapes any quotes that may be included in your Magento store name.

Magento does some excessive logging to track customers. This in return causes your Magento database to expand exponentially in size, and inevitably decreases your sites overall performance.

I found that disabling logging from the Magento admin does not stop Magento from writing to the log tables in the database. To tell Magento to completely stop, do the following.

1. Open your app/etc/local.xml file
2. Paste in the following, right before the </config> closing tag:

<frontend>
    <events>
        <controller_action_predispatch>
            <observers><log><type>disabled</type></log></observers>
        </controller_action_predispatch>
        <controller_action_postdispatch>
            <observers><log><type>disabled</type></log></observers>
        </controller_action_postdispatch>
        <customer_login>
            <observers><log><type>disabled</type></log></observers>
        </customer_login>
        <customer_logout>
            <observers><log><type>disabled</type></log></observers>
        </customer_logout>
        <sales_quote_save_after>
            <observers><log><type>disabled</type></log></observers>
        </sales_quote_save_after>
        <checkout_quote_destroy>
            <observers><log><type>disabled</type></log></observers>
        </checkout_quote_destroy>
    </events>
</frontend>

3. Save your local.xml file, and flush all of your caches.

Magento should no longer write logs to these tables.

To clean out your existing log tables, just run the following SQL command against your Magento database.

WARNING: Once you truncate these tables, the log information will be permanently lost. If you have no need for this log data, then by all means get rid of it!

TRUNCATE 'log_customer';
TRUNCATE 'log_quote';
TRUNCATE 'log_summary';
TRUNCATE 'log_summary_type';
TRUNCATE 'log_url';
TRUNCATE 'log_url_info';
TRUNCATE 'log_visitor';
TRUNCATE 'log_visitor_info';
TRUNCATE 'log_visitor_online';
TRUNCATE 'report_event';

magento_datetime-featured

In your extension’s Form.php:

For Example: app/code/local/CompanyName/ModuleName/Block/Adminhtml/ModuleName/Edit/Tab/Form.php

Add the following code:

$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('start_date', 'date', array(
  'name'   => 'start_date',
  'label'  => Mage::helper('events')->__('Start Date'),
  'title'  => Mage::helper('events')->__('Start Date'),
  'image'  => $this->getSkinUrl('images/grid-cal.gif'),
  'input_format' => $dateFormatIso,
  'format'       => $dateFormatIso,
  'time' => true
));

The key things to make it work are the “input_format”, “format”, and “time” parameters in the addField array. Setting the “time” variable to “true” makes the time input fields appear in the date selector pop-up.

Developing code locally on your computer has some major benefits over using a web server. For one, it’s usually faster as you don’t have to wait for your file changes to upload to the web.
Read more…

Ultimate Carbon Patterns Pack

I created a 16 set pattern pack for your everyday designs.   The pack is compatible with Adobe Photoshop.

deviantART 3D Wallpaper Pack

deviantART 3D Wallpaper Pack

I’ve made a wallpaper package for all of you deviantART fans.  I have included 10 colors, 2 style variations and variety of resolutions.  Read more…