Author image
Senior Mind

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

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.