Search This Blog

Thursday, 2 February 2012

Upgrading Magento and Data Management

Database repair tool: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool

Moving Magento To Another Server: http://www.magentocommerce.com/wiki/groups/227/moving_magento_to_another_server

Moving Magento from development to production: http://www.iwebux.com/moving-magento-from-development-to-production/

Magento 2 Magento data migration: http://www.shopping-cart-migration.com/shopping-cart-migration-options/223-magento-to-magento-migration


Magento 2 Magento data migration: http://www.shopping-cart-migration.com/shopping-cart-migration-options/223-magento-to-magento-migration

My approach for upgrading Magento involves following:
1. Setting up a New Development Environment (ex: dev.domain.com or domain.com/dev etc.,) As upgrading Magento in production server is not recommended
2. In production, archive all the customizations that should be part of the upgrade and copy them to dev Environment
a. Export the production database.
b. Media directory from production installation
c. All theme files
d. All the custom Modules
e. Extensions and other core extensions or customizations
3. In dev Environment, download the latest stabled version
4. Resetting file permissions in dev server to make the Magento work properly
5. Make appropriate changes in Dev Database base URLs to reflect dev environment links
6. Run setup wizard to upgrade the Magento
7. Make changes to the customizations to match the new version standards [If the existing customizations conflicts with the new version of Magento]
8. Testing upgraded site to ensure everything working properly
9. Once everything is done, make the production site unavailable / down for the users until below process is completed
a. Backup product Database and file system
b. Remove all cache
c. Copy all the files from development to production environment
d. Run setup wizard to upgrade the production Magento with existing database (so that we will not lose any data like orders, products and customers)
e. Test and ensure everything is fine
10. Making the upgraded site live for all the users.
11. The best time for production Magento upgrade would be night hours.


Wednesday, 16 November 2011

Emails not sending in Magento 1.3.1

 As a temporary measure a fix can be issued in the form of editing core code.

1) Enter the root directory of your Magento store and enter
# mkdir app/code/local/Mage
# mkdir app/code/local/Mage/Core
# mkdir app/code/local/Mage/Core/Model
# mkdir app/code/local/Mage/Core/Model/Email
# cp app/code/core/Mage/Core/Model/Email/Template.php  app/code/local/Mage/Core/Model/Email/
2) Using your favourite editor open up Template.php and make changes at these lines
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
        ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
        $mail = $this->getMail();
        if (is_array($email)) {
            foreach ($email as $emailOne) {
+               # Fix for mini_sendmail
+                # $mail->addTo($emailOne, $name);
+                $mail->addTo($emailOne);
-                $mail->addTo($emailOne, $name);
            }
        } else {
+           # Fix for mini_sendmail
+           # $mail->addTo($email, '=?utf-8?B?'.base64_encode($name).'?=');
+           $mail->addTo($email);
-           $mail->addTo($email, '=?utf-8?B?'.base64_encode($name).'?=');
        }
        $this->setUseAbsoluteLinks(true);
        $text = $this->getProcessedTemplate($variables, true);
$mail->setSubject('=?utf-8?B?'.base64_encode($this->getProcessedTemplateSubject($variables)).'?=');
+       # Fix for mini_sendmail
+       # $mail->setFrom($this->getSenderEmail(), $this->getSenderName());
+       mail->setFrom($this->getSenderEmail());
-       $mail->setFrom($this->getSenderEmail(), $this->getSenderName());
3) Recompile (if using extension) to update includes
It is not a perfect solution, but should provide a fix until we find an alternative to mini_sendmail.

For more information click here

If the issue is not in 1.3.1 version then the solution can be found here 

Friday, 11 November 2011

Preventing Enter Button event from Form Submission

    if (document.layers)
        document.captureEvents(Event.KEYDOWN);
    document.onkeydown = function (evt) {
    var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
    if (keyCode == 13) {
        return false;
        //Your function here.
    }
    else
        return true;
    };

 OR

function preventEnter(evt) {
    var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
    if (keyCode == 13)
        return false;
    else
        return true;
};

Usage:  onkeydown="return preventEnter(event);"

Wednesday, 9 November 2011

How to add "date" type custom option for products and make it work?

 Many Magento users, like my company, have similar requirements to let customers choose date through pop-up calendar in the product view page. But Magento merely offer 2 groups of input type, “Text” and “Select”, in Catelog→Manage Products→Custom Options page by default. Is there any possibility for us to add the support for “Date” or “Date Time” input types?

http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/how_to_add

IE 9 Issues with Magento

The quick fix is to fool IE9 to “think” it’s acting as IE8 by adding a custom meta tag to the page header like so:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
.htaccess approach
Add this to the end of your .htaccess file:

BrowserMatch MSIE best-standards-support
Header set X-UA-Compatible IE=8 env=best-standards-support

Latest update is the Prototype JS file is updated in latest version of Magento hope all the issues with IE9 will be fixed.

Thursday, 8 September 2011

Using Collections in Magento

A collection is a Model type containing other Models, it is basically used in Magento to handle product lists (ie. from a category or a bundle option), but not only.
TO DO: Explain how Magento Implements a collection - Use this to explain how Magento implements a collection by looking at code in a model, so that people can learn to write their own collections
This is a simple example of loading some product collection from a category and ordering them on their product name using Magento’s API.

http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/using_collections_in_magento