Changeset 1296
- Timestamp:
- 01/13/07 21:31:15 (2 years ago)
- Files:
-
- peasantonline/app/controllers/catalog_controller.rb (modified) (3 diffs)
- peasantonline/app/helpers/application_helper.rb (modified) (1 diff)
- peasantonline/app/views/admin/_form_products.rhtml (modified) (1 diff)
- peasantonline/db/migrate/028_add_status_to_products.rb (added)
- peasantonline/db/schema.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
peasantonline/app/controllers/catalog_controller.rb
r1293 r1296 38 38 @des_obj = Designer.find_by_name(@designer) 39 39 #@products = Product.find_all_by_designer(@des_obj.id) 40 @product_pages, @products = paginate(:products, :per_page => 9, :conditions => "designer = '#{@des_obj.id}' and gender = #{@gender_val} ", :order=>"id DESC")40 @product_pages, @products = paginate(:products, :per_page => 9, :conditions => "designer = '#{@des_obj.id}' and gender = #{@gender_val} and status = 'In Stock'", :order=>"id DESC") 41 41 42 42 end … … 55 55 @cat_obj = Category.find_by_name(@category) 56 56 #@products = Product.find_all_by_category(@cat_obj.id) 57 @product_pages, @products = paginate(:products, :per_page => 9, :conditions => "category = '#{@cat_obj.id}' and gender = #{@gender_val} ", :order=>"id DESC")57 @product_pages, @products = paginate(:products, :per_page => 9, :conditions => "category = '#{@cat_obj.id}' and gender = #{@gender_val} and status = 'In Stock'", :order=>"id DESC") 58 58 end 59 59 … … 66 66 gender_val = true 67 67 end 68 @product_pages, @products = paginate(:products, :per_page => 9, :conditions => ["gender = ?", gender_val], :order=>"id DESC")68 @product_pages, @products = paginate(:products, :per_page => 9, :conditions => "gender = #{gender_val} and status = 'In Stock'" , :order=>"id DESC") 69 69 70 70 end peasantonline/app/helpers/application_helper.rb
r1066 r1296 13 13 sprintf("$%d.%02d", dollars, cents) 14 14 end 15 15 16 def get_product_status 17 return ["In Stock", "Sold Out"] 18 end 16 19 17 20 end peasantonline/app/views/admin/_form_products.rhtml
r1053 r1296 2 2 <p><label for="product_name">Name</label><br/> 3 3 <%= text_field 'product', 'name' %></p> 4 5 <p><label for="product_status">Status</label><br/> 6 <%= select('product', 'status', get_product_status()) %> </p> 4 7 5 8 <p><label for="product_short_description">Short description</label><br/> peasantonline/db/schema.rb
r1268 r1296 3 3 # then regenerate this schema definition. 4 4 5 ActiveRecord::Schema.define(:version => 2 7) do5 ActiveRecord::Schema.define(:version => 28) do 6 6 7 7 create_table "categories", :force => true do |t| … … 84 84 t.column "size_class", :string, :default => "S/M/L" 85 85 t.column "featured_image", :integer 86 t.column "status", :string, :default => "In Stock" 86 87 end 87 88