Prechádzať zdrojové kódy

规格明细增加状态码

abiao 5 rokov pred
rodič
commit
d9cd1a3388

+ 2 - 2
app/models/product.rb

@@ -44,7 +44,7 @@ class Product < ActiveRecord::Base
         if SIZE_ENUM.length ==0 && !self.id.nil?
             linkSize = ProductAttrConfig.where("product_id=? and size_type='size'",self.relate_product_id).first
             if !linkSize.blank?
-                productAttrs = ProductAttr.where("attr_key_id=?",linkSize.attr_key_id).order("recommend desc")
+                productAttrs = ProductAttr.where("attr_key_id=? and status=1 ",linkSize.attr_key_id).order("recommend desc")
                 productAttrs.each do |attr|
                     a=[attr.name,attr.id]
                     SIZE_ENUM.push(a)
@@ -56,7 +56,7 @@ class Product < ActiveRecord::Base
         if COLOR_ENUM.length==0 && !self.id.nil?
             linkColor = ProductAttrConfig.where("product_id=? and size_type='color'",self.relate_product_id).first
             if !linkColor.blank?
-                productColorAttrs = ProductAttr.where("attr_key_id=?",linkColor.attr_key_id).order("recommend desc")
+                productColorAttrs = ProductAttr.where("attr_key_id=? and status=1",linkColor.attr_key_id).order("recommend desc")
                 productColorAttrs.each do |color_attr|
                     b=[color_attr.name,color_attr.id]
                     COLOR_ENUM.push(b)

+ 3 - 0
app/models/product_attr.rb

@@ -20,6 +20,7 @@ class ProductAttr < ActiveRecord::Base
             field :product_attr_key
             field :name 
             field :recommend
+            field :status
         end
 
         show do
@@ -27,12 +28,14 @@ class ProductAttr < ActiveRecord::Base
             field :product_attr_key
             field :name
             field :recommend
+            field :status
         end
 
         edit do 
             field :product_attr_key
             field :name
             field :recommend
+            field :status
         end 
 
     end

+ 2 - 0
config/locales/models/product_attr.yml

@@ -9,5 +9,7 @@ zh-CN:
         attr_key_id: 规格ID
         product_attr_key: 规格
         recommend: 推荐程度
+        status: 是否发布
+