Changeset 1296

Show
Ignore:
Timestamp:
01/13/07 21:31:15 (2 years ago)
Author:
james
Message:

allow products to be marked as out of stock

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • peasantonline/app/controllers/catalog_controller.rb

    r1293 r1296  
    3838                @des_obj    = Designer.find_by_name(@designer) 
    3939                #@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") 
    4141 
    4242        end 
     
    5555                @cat_obj    = Category.find_by_name(@category) 
    5656                #@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") 
    5858        end 
    5959 
     
    6666                  gender_val = true 
    6767                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") 
    6969                 
    7070        end 
  • peasantonline/app/helpers/application_helper.rb

    r1066 r1296  
    1313    sprintf("$%d.%02d", dollars, cents)  
    1414  end  
    15    
     15 
     16  def get_product_status 
     17    return ["In Stock", "Sold Out"] 
     18  end 
    1619 
    1720end 
  • peasantonline/app/views/admin/_form_products.rhtml

    r1053 r1296  
    22<p><label for="product_name">Name</label><br/> 
    33<%= text_field 'product', 'name'  %></p> 
     4 
     5<p><label for="product_status">Status</label><br/> 
     6<%= select('product', 'status', get_product_status()) %> </p> 
    47 
    58<p><label for="product_short_description">Short description</label><br/> 
  • peasantonline/db/schema.rb

    r1268 r1296  
    33# then regenerate this schema definition. 
    44 
    5 ActiveRecord::Schema.define(:version => 27) do 
     5ActiveRecord::Schema.define(:version => 28) do 
    66 
    77  create_table "categories", :force => true do |t| 
     
    8484    t.column "size_class", :string, :default => "S/M/L" 
    8585    t.column "featured_image", :integer 
     86    t.column "status", :string, :default => "In Stock" 
    8687  end 
    8788