Posts

Massive 10GB Magento Database

This is a classic, a venerable magento database was presented to me today – it had grown over time to 10GB and was in danger of being booted right off its hosting due to its wide girth!  I’d say cron hadn’t been run for years.

Anyway its very easy to clean up the magento database, most of the data bloat is stored in a group of log tables and can be just delete right away by running the following queries on the DB:

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;

This reduced the DB size from 10GB to about 150MB.

Magento – Cannot set property ‘disabled’ of undefined error in one page checkout

We hit a strange Magento problem yesterday, on one of our sites the one page checkout stopped working. Once the various fields were filled out on the billing details pane and the ‘Continue’ button was pressed, then the checkout would not progress onto the next pane. Debugging on chrome showed that the following JavaScript error was occurring:

 

Uncaught Type Error: Cannot set property ‘disabled’ of undefined.

 

Googling the error produced some hits but no concrete solutions were offered, so we started switching things off one by one to see if we could get rid of the problem…

 

It turned out that removing the twitter feed from the footer fixed the problem…. who knows why, I’ll try to debug it tomorrow…

 

I hope this helps somebody in a similar situation.

 

How to turn off the magento compile feature in a hurry when you discover it has broken your site #magento

Magento has a ‘compile’ feature which is supposed to get your site to run much faster, what it will most likely do instead is completely break your site, so that you can’t even get in it turn the ‘feature’ off!

 

Don’t panic a quick edit of this file, will get your site up and running again:

 
includes/config.php/
 

Edit the file via FTP or similar and make sure the the following lines are commented out like this:

#define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
#define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');

Once you have completed the edit your site should work again!

 

Magento, Customized theme not using overridden images

Q: I have created a new skins folder beside my default theme’s skin folder, and placed some images that I want to override into an images sub folder. I have changed the ‘Skin (Images / CSS)’ setting in System -> Configuration -> Design -> Themes to point to my new skins, I have cleared the magento cache about 10 million times, but magento still won’t use my new images, it keeps using the originals…. what do I do?

 

A: This has caught me out once or twice and I have always forgotten about it by the time it happens again! The problem stems from the fact that the theme css file calls in images using a relative path, e.g.:

 


body {background-image:url('../images/bg.gif');}

 

So because the css file that uses your images remains in its original location it will still use your original images, to get it to use your overridden images you must create a css folder in your new skin folder and copy any css files that reference the images into there and clear the cache a further 20 times – hopefully magento will then use your new images!

 

Have a look here for some more details:

 

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

 

Realex & Magento – New Return URL for Payments Module v2.0

If you are hooking magento up to realex for payment on your eCommerce website then you will most likely be using the payments module kindly provided by StudioForty9 in Cork.

 

As part of configuring this you will need to tell realex what your cart’s ‘return URL’ is, this URL has changed since the introduction of the newer version of this module (v2.0) which it seems is for use with magneto v1.5 and greater. The new URL format for use with the newer module is:

 

http://www.yourdomain.com/realex/response/

 

In case you are still using the old module, the url format for that is:

 

http://www.yourdomain.com/Realex/standard/success

 

Magento – jQuery clash with testimonials, prototype.js & showcase

If you use testimonials on magento and then place them onto a page that contains the prototype extension showcase, you may notice that both the testimonial and showcase animation stops working, and that an absolute snow of javascript errors are generated.

 

If this is happens to you, it may be caused by a jQuery library conflict. The testimonials PHP template directly includes jQuery and this may clash with the prototype library, we found that we could resolve the library conflict by placing good old:

 


jQuery.noConflict();

 

In the file testimonial_advance.phtml just before document/ready, like this…

 

[code]

jQuery.noConflict();

 

jQuery(document).ready(function() {
….
}

[/code]

 

Adding this solved the problem for us.

 

testimonial_advance.phtml should be found in this folder:

 

app/design/frontend/default/default/template/testimonial

 

However, it is not good magento practice to alter this version of the file, instead you should create a testimonials folder under:

 

app/design/frontend/default/[your folder]/template/

 

Then copy testimonial_advance.phtml to this folder and edit it there. Remember to clear the magento cache when testing changes!