DevelopmentTips

Optimizing Jacuzzi Bath’s Product Specifications

By May 11, 2011 No Comments

Before yesterday, if you were trying to find product specifications for a particular Jacuzzi Baths bathtub, you had to go to each individual product page, and view/download the PDF(s) one at a time. Now, you can just click on “Product Specifications” in the handy utility bar that flows across the bottom of each page, or from the Sitemap “navication” flopdown, and you are greeted by all available Product Specification downloads on a single page. With the Cake PHP custom content management system powering the Jacuzzi Baths site, it took some serious collaborating between Ian, Russell and myself, but the finished product (pun?) worked out nice.

The complexity was with Cake’s use of the MVC (model – view – controller) system. The soda pdf creator uploads are tied to particular configurations of bathtubs – for example, the Acero 66x36x25 Soaking Bath. Each is like a child of a particular bathtub itself, and the tubs are grouped in to Categories – Luxury, Comfort, or Espree. So looping through Categories to get all Tubs, to get all particular breakdowns, to get all PDF uploads worked, but it was slow – the Cake debug showed something like “3765 queries took 1229 ms”.

After reconfiguring it, writing one custom SQL query directly in the Uploads “model”, the (Specifications) Page controller could then bypass Categories and Products entirely, which cut the process down to 13 queries in 13 ms, or nearly a 1000% improvement (did i do the math right?) in performance. Not too shabby.

Alex Chousmith

Alex has been building with Ninthlink since '06, and a San Diegan since the turn of the century. A background of Mathematics – Computer Science / Interdisciplinary Computing & Arts from UCSD, plus Drupal / WordPress / jQuery / CSS3 / HTML5 / bass guitar / homebrew skill, powers him to get the job done, no matter what.

Leave a Reply