Skip to main content

Increase the performance of Drupal's ubercart for sites with a large number of products

An article from ComputerMinds - Building with Drupal in the UK since 2005
12th Apr 2008

Mike Dixon

Senior Mind
Mike Dixon
Hey, you seem to look at this article a lot! Why not Bookmark this article so you can find it easily in the future?

We are in the process of putting together a large (20k products) store with ubercart and ran into some performance issues due to the hook_forms implementation.

The problem obviously is that a form is being registered for each product regardless of if that product is being displayed or not. This is a bit unnecessary, so our solution was to do the following :

  • comment out the hook_forms implementation in uc_product
  • write a little module that keeps tabs on which product nodes have been loaded and implements hook_forms to register forms for only those products,

We have attached the module below, remember that to use the module you need to COMMENT out the function uc_product_forms in the uc_product module. (NOTE - we generally do not advocate changing core or contrib modules, but sometimes you have little choice)

Using the improved method we halved our page load times and dropped the memory footprint of each page by nearly 70% - which will make our sys admin happier

[EDIT] Sorry, but we lost the attachment in a server migration.

Hi, thanks for reading

ComputerMinds are the UK’s Drupal specialists with offices in Bristol and Coventry. We offer a range of Drupal services including Consultancy, Development, Training and Support. Whatever your Drupal problem, we can help.