Magento.. to reinstall or not reinstall...

When you are having problems with your Magento store, you face the issue of either reinstalling Magento or leave the existing install in place and try to fix all of the bugs. This is the dilemma that I faced in one project, both solutions have their advantages and disadvantages, I have the unique experience or having tried both methods to try and resolve the problems with a website. It all stared when the decision was made to keep the existing install against my better judgement, the install had lots of bugs and problems because of bad coding methodology left by the previous developer.


Leave the install in place

I think that when the decision is made to leave a install in place there are good intentions to try and fix the problems without having to start over again. May be you get lucky and find out what the problem is or you need to leave things in place to show a new developer what the problems are. In most cases there have been custom code files that are required for the store to run properly.

In most cases you have to learn how the previous developer has set things up, in my case it took over 6 months of patient effort to completely understand everything. There were lots of orphaned files and duplicate code, the worst thing of all is that there was very little documentation on what exactly was done. I guess the rational was that if I did not try to figure things out who would.

Trying to fix a bad install is not all bad, if anything else it is a good way to learn how things work, but like any website with custom coded files, there are custom scripts that control specific functions or communicate with outside database systems. Any reinstall will require you to move these important files over without having to rewrite things all over again.

But at some point when the site can't function properly because of bad coding and scripting, you don't have a lot of choice because the existing install is so unstable and trouble some, you don't have a choice.

Reinstalling but not completely reinstalling

A reinstall does not always mean a clean reinstall, before you march off to do a reinstall of the existing Magento install, keep track off all the custom templates and code files, you may need them since they are most likely over riding the core or default file. From past experience, if you don't need to remove the MySQL database, leave it alone, not having to re-enter all of the data will save you lots of time and energy.

With the database left intact, a reinstall of Magento will completed much more quickly, the only hard part is moving the custom files back into their original position after the required extensions and templates are put back in place.

Once folders like Media, Design and Skins have been setup, be careful to not delete everything, this saves time in having to re-enter and re-import all of the information and content. Above all else, backup everything before you go about re-installing anything, there is nothing worse than having to recreate everything all over again.

The benefit of having a clean and un-altered Magento install is that you know that the core files are all clean and free of bugs. Ultimately, it may come down to reinstalling Magento, replacing the installed files so that the site can function properly is a necessary step to having a properly functioning website.

In my case, a clean reinstall of the Magento files did the trick, the final step was to clean out some of the tables in MySQL of the cached session data and the website has been well behaved ever since.

Some things to keep in mind.

The one principle to keep in mind is that the core files in Magento are not suppose to be altered, the apps/core files, apps/design base template files, and core JavaScript files are intended to be over written. This way when you remove a problem file, the Magento install will continue to function and run properly even after you remove the custom code.

Magento was setup with the intention of having the core files overridden, not replaced. Keep this in mind when you write code for Magento.