|
|
@@ -9,6 +9,15 @@ class Product < ActiveRecord::Base
|
|
|
TYPE_ENUM = [["直营","direct_sale"]]
|
|
|
#["代销","user_sale"]
|
|
|
|
|
|
+ SIZE_ENUM = []
|
|
|
+ def get_size_enum
|
|
|
+ @Size = ProductAttrConfig.where("product_id=? and type='size'",self.id).first
|
|
|
+ @productAttrs = ProductAttr.where("attr_key_id=?",@Size.id).order("recommend desc")
|
|
|
+ @productAttrs.each do |attr|
|
|
|
+ a=[attr.name,attr.id]
|
|
|
+ SIZE_ENUM.push(a)
|
|
|
+ end
|
|
|
+ end
|
|
|
IMG_STORE_PATH = "product"
|
|
|
|
|
|
def v_share_img=file
|
|
|
@@ -95,7 +104,11 @@ class Product < ActiveRecord::Base
|
|
|
end
|
|
|
field :is_only_new
|
|
|
field :video_state
|
|
|
- field :size_id
|
|
|
+ field :size_id, :enum do
|
|
|
+ enum do
|
|
|
+ SIZE_ENUM
|
|
|
+ end
|
|
|
+ end
|
|
|
field :color_id
|
|
|
field :relate_product_id
|
|
|
field :show_flag
|