|
@@ -12,20 +12,18 @@ class Product < ActiveRecord::Base
|
|
|
COLOR_ENUM = []
|
|
COLOR_ENUM = []
|
|
|
def get_size_enum
|
|
def get_size_enum
|
|
|
SIZE_ENUM.clear
|
|
SIZE_ENUM.clear
|
|
|
-=begin
|
|
|
|
|
if SIZE_ENUM.length ==0
|
|
if SIZE_ENUM.length ==0
|
|
|
linkSize = ProductAttrConfig.where("product_id=? and size_type='size'",self.id).first
|
|
linkSize = ProductAttrConfig.where("product_id=? and size_type='size'",self.id).first
|
|
|
if !linkSize.blank?
|
|
if !linkSize.blank?
|
|
|
- productAttrs = ProductAttr.where("attr_key_id=?",linkSize.id).order("recommend desc")
|
|
|
|
|
|
|
+ productAttrs = ProductAttr.where("attr_key_id=?",linkSize.attr_key_id).order("recommend desc")
|
|
|
productAttrs.each do |attr|
|
|
productAttrs.each do |attr|
|
|
|
a=[attr.name,attr.id]
|
|
a=[attr.name,attr.id]
|
|
|
SIZE_ENUM.push(a)
|
|
SIZE_ENUM.push(a)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
-=end
|
|
|
|
|
|
|
|
|
|
- #COLOR_ENUM.clear
|
|
|
|
|
|
|
+ COLOR_ENUM.clear
|
|
|
if COLOR_ENUM.length==0
|
|
if COLOR_ENUM.length==0
|
|
|
linkColor = ProductAttrConfig.where("product_id=? and size_type='color'",self.id).first
|
|
linkColor = ProductAttrConfig.where("product_id=? and size_type='color'",self.id).first
|
|
|
if !linkColor.blank?
|
|
if !linkColor.blank?
|
|
@@ -231,11 +229,13 @@ class Product < ActiveRecord::Base
|
|
|
field :virtual_sold_count
|
|
field :virtual_sold_count
|
|
|
field :purchase_limit_count
|
|
field :purchase_limit_count
|
|
|
field :share_content
|
|
field :share_content
|
|
|
|
|
+=begin
|
|
|
field :v_share_img, :file_upload do
|
|
field :v_share_img, :file_upload do
|
|
|
pretty_value do
|
|
pretty_value do
|
|
|
bindings[:view].tag(:img, {:src => bindings[:object].get_share_img, :class => 'preview'})
|
|
bindings[:view].tag(:img, {:src => bindings[:object].get_share_img, :class => 'preview'})
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
+=end
|
|
|
field :seckill_start
|
|
field :seckill_start
|
|
|
field :seckill_end
|
|
field :seckill_end
|
|
|
field :seckill_price
|
|
field :seckill_price
|