<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/migrate/20091104151730_add_some_indexes.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -10,12 +10,6 @@ class ProductsController &lt; Spree::BaseController
 
   include Spree::Search
 
-  index do
-    before do
-      @product_cols = 3
-    end
-  end
-
   def change_image
     @product = Product.available.find_by_param(params[:id])
     img = Image.find(params[:image_id])
@@ -25,8 +19,12 @@ class ProductsController &lt; Spree::BaseController
   private
 
   def load_data
-    load_object
-    @selected_variant = @product.variants.detect { |v| v.available? }
+    #load_object  
+    @variants = Variant.active.find_all_by_product_id(@product.id, 
+                :include =&gt; [:option_values, :images])
+    @product_properties = ProductProperty.find_all_by_product_id(@product.id, 
+                          :include =&gt; [:property])
+    @selected_variant = @variants.detect { |v| v.available? }
 
     referer = request.env['HTTP_REFERER']
 </diff>
      <filename>app/controllers/products_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ class Spree::BaseController &lt; ActionController::Base
   helper :application
   before_filter :instantiate_controller_and_action_names
   filter_parameter_logging :password, :password_confirmation, :number, :verification_value
-  helper_method :current_user_session, :current_user, :title, :set_title
+  helper_method :current_user_session, :current_user, :title, :set_title, :get_taxonomies
 
   # Pick a unique cookie name to distinguish our session data from others'
   session_options['session_key'] = '_spree_session_id'
@@ -17,23 +17,23 @@ class Spree::BaseController &lt; ActionController::Base
     User.first(:include =&gt; :roles, :conditions =&gt; [&quot;roles.name = 'admin'&quot;])
   end
 
-  # retrieve the order_id from the session and then load from the database (or return a new order if no 
+  # retrieve the order_id from the session and then load from the database (or return a new order if no
   # such id exists in the session)
-  def find_order      
+  def find_order
     unless session[:order_id].blank?
       @order = Order.find_or_create_by_id(session[:order_id])
-    else      
+    else
       @order = Order.create
     end
     session[:order_id]    = @order.id
     session[:order_token] = @order.token
     @order
   end
-    
+
   def access_forbidden
     render :text =&gt; 'Access Forbidden', :layout =&gt; true, :status =&gt; 401
   end
-  
+
   # Used for pages which need to render certain partials in the middle
   # of a view. Ex. Extra user form fields
   def initialize_extension_partials
@@ -45,7 +45,7 @@ class Spree::BaseController &lt; ActionController::Base
   def set_title(title)
     @title = title
   end
-  
+
   def title
     if @title.blank?
       default_title
@@ -53,11 +53,11 @@ class Spree::BaseController &lt; ActionController::Base
       @title
     end
   end
-  
+
   def default_title
     Spree::Config[:site_name]
   end
- 
+
   protected
   def reject_unknown_object
     # workaround to catch problems with loading errors for permalink ids (reconsider RC permalink hack elsewhere?)
@@ -75,7 +75,7 @@ class Spree::BaseController &lt; ActionController::Base
         render_404(Exception.new(&quot;missing object in #{self.class.to_s}&quot;))
       end
     end
-    return true 
+    true 
   end         
   
   def render_404(exception)
@@ -153,8 +153,12 @@ class Spree::BaseController &lt; ActionController::Base
   def instantiate_controller_and_action_names
     @current_action = action_name
     @current_controller = controller_name
+  end
   
-    @taxonomies = Taxonomy.find(:all, :include =&gt; {:root =&gt; :children})
+  def get_taxonomies
+    @taxonomies ||= Taxonomy.find(:all, :include =&gt; {:root =&gt; :children})
+    @taxonomies
   end
   
 end
+</diff>
      <filename>app/controllers/spree/base_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,10 +13,11 @@
     &lt;h2&gt;&lt;%= t('variants') %&gt;&lt;/h2&gt;
     &lt;ul&gt;
       &lt;%  has_checked = false
-          @product.variants.active.each_with_index do |v,index|
+          @variants.each do |v|
          		next if v.option_values.empty? || (!Spree::Config[:show_zero_stock_products] &amp;&amp; !v.in_stock?)
          		checked = !has_checked &amp;&amp; (Spree::Config[:allow_backorders] || v.in_stock?)
          		has_checked = true if checked %&gt;
+
         &lt;li&gt;
           &lt;label&gt;
             &lt;%= radio_button_tag &quot;products[#{@product.id}]&quot;, v.id, checked, :disabled =&gt; !Spree::Config[:allow_backorders] &amp;&amp; !v.in_stock? %&gt;</diff>
      <filename>app/views/products/_cart_form.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
-&lt;% unless @product.product_properties.empty? %&gt;
+&lt;% unless @product_properties.empty? %&gt;
 &lt;dl&gt;
-&lt;% for product_property in @product.product_properties %&gt;
+&lt;% for product_property in @product_properties %&gt;
   &lt;dt&gt;&lt;%= product_property.property.presentation %&gt;&lt;/dt&gt;
   &lt;dd&gt;&lt;%= product_property.value %&gt;&lt;/dd&gt;
 &lt;% end %&gt;</diff>
      <filename>app/views/products/_properties.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -2,9 +2,11 @@
 &lt;div id=&quot;taxon-crumbs&quot;&gt;
 &lt;h3&gt;&lt;%= t('look_for_similar_items') -%&gt;&lt;/h3&gt;
   &lt;div&gt;
+    &lt;ul id='similar_items_by_taxon'&gt;
     &lt;% @product.taxons.each do |taxon| -%&gt;
-      &lt;%= taxon_crumbs(taxon) -%&gt;
+      &lt;li&gt;&lt;%= link_to taxon.name, &quot;/t/#{taxon.permalink}&quot; %&gt;&lt;/li&gt;
     &lt;% end -%&gt;
+    &lt;/ul&gt;
   &lt;/div&gt;
 &lt;/div&gt;
 &lt;% end -%&gt;</diff>
      <filename>app/views/products/_taxons.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -7,11 +7,11 @@
   &lt;/ul&gt;
 &lt;% end %&gt;
 
-&lt;% if @product.has_variants? 
+&lt;% if @product.has_variants?
   has_checked = false %&gt;
   &lt;h4 id=&quot;variant-images&quot;&gt;&lt;%= t('images_for') %&gt;: &lt;%= @selected_variant.options_text %&gt;&lt;/h4&gt;
   &lt;ul id=&quot;variant-thumbnails&quot; class=&quot;thumbnails&quot;&gt;
-    &lt;% product.variants.each do |v|
+    &lt;% @variants.each do |v|
         checked = !has_checked &amp;&amp; (v.available?)
    		  has_checked = true if checked
         
@@ -28,7 +28,7 @@
   &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
  
     var images = new Array();
-    &lt;% product.variants.each do |v| %&gt;
+    &lt;% @variants.each do |v| %&gt;
       images[&lt;%= v.id.to_s %&gt;] = new Array();
       &lt;% v.images.each_with_index do |image, i| %&gt;
         images[&lt;%= v.id.to_s %&gt;][&lt;%= i %&gt;] = '&lt;%= image.attachment.url(:mini) %&gt;';
@@ -55,4 +55,4 @@
  
     jQuery(document).ready(function(){ add_image_handlers(); });
   &lt;/script&gt;
-&lt;% end %&gt;
\ No newline at end of file
+&lt;% end %&gt;</diff>
      <filename>app/views/products/_thumbnails.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 &lt;div id=&quot;taxonomies&quot; class=&quot;sidebar-item&quot;&gt;
-&lt;% @taxonomies.each do |taxonomy| %&gt;
+&lt;% get_taxonomies.each do |taxonomy| %&gt;
   &lt;ul class=&quot;navigation-list&quot;&gt;
 	  &lt;li&lt;%= ' class=&quot;current&quot;' if @taxon &amp;&amp; @taxon == taxonomy.root %&gt;&gt;&lt;%= link_to t(&quot;shop_by_taxonomy&quot;, :taxonomy =&gt; taxonomy.name.singularize), seo_url(taxonomy.root), :class =&gt; 'root' %&gt;&lt;/li&gt;
 	  &lt;% taxonomy.root.children.each do |taxon| %&gt;
@@ -7,4 +7,4 @@
 	  &lt;% end %&gt;
 	&lt;/ul&gt;
 &lt;% end %&gt;
-&lt;/div&gt;
\ No newline at end of file
+&lt;/div&gt;</diff>
      <filename>app/views/shared/_taxonomies.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,7 @@ module Spree::Search
     @products_scope = @product_group.apply_on(base_scope)
 
     @products = @products_scope.paginate({
+        :include  =&gt; [:images, {:variants =&gt; :images}],
         :per_page =&gt; params[:per_page],
         :page     =&gt; params[:page],
       })</diff>
      <filename>lib/spree/search.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b1045568211adad778e2a7d3b18a2d31a7acade9</id>
    </parent>
  </parents>
  <author>
    <name>Roman Smirnov</name>
    <email>roman@railsdog.com</email>
  </author>
  <url>http://github.com/railsdog/spree/commit/e38f8642afbb462571edf4648bbb905d8b7e7409</url>
  <id>e38f8642afbb462571edf4648bbb905d8b7e7409</id>
  <committed-date>2009-11-06T13:57:09-08:00</committed-date>
  <authored-date>2009-11-04T11:52:16-08:00</authored-date>
  <message>Added some indexes and reduced count of SQL-queries.

[#863 state:resolved]</message>
  <tree>d2561ebc13ccaee5320acdd081cf8410f0134e66</tree>
  <committer>
    <name>Sean Schofield</name>
    <email>sean@railsdog.com</email>
  </committer>
</commit>
