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