Преглед на файлове

增加商品属性定义

abiao преди 5 години
родител
ревизия
f54a4d58dd
променени са 1 файла, в които са добавени 1 реда и са изтрити 11 реда
  1. 1 11
      app/models/product.rb

+ 1 - 11
app/models/product.rb

@@ -29,7 +29,7 @@ class Product < ActiveRecord::Base
         if COLOR_ENUM.length==0
             linkColor = ProductAttrConfig.where("product_id=? and size_type='color'",self.id).first
             if !linkColor.blank?
-                productColorAttrs = ProductAttr.where("attr_key_id=?",linkColor.id).order("recommend desc")
+                productColorAttrs = ProductAttr.where("attr_key_id=?",linkColor.attr_key_id).order("recommend desc")
                 productColorAttrs.each do |color_attr|
                     b=[color_attr.name,color_attr.id]
                     COLOR_ENUM.push(b)
@@ -59,16 +59,6 @@ class Product < ActiveRecord::Base
     end
 
     def v_share_img=file
-        if COLOR_ENUM.length==0
-            linkColor = ProductAttrConfig.where("product_id=? and size_type='color'",self.id).first
-            if !linkColor.blank?
-                productColorAttrs = ProductAttr.where("attr_key_id=?",linkColor.attr_key_id).order("recommend desc")
-                productColorAttrs.each do |color_attr|
-                    b=[color_attr.name,color_attr.id]
-                    COLOR_ENUM.push(b)
-                end
-            end
-        end
         unless file.blank?
         file_name = "#{UUID.new.generate[0...8].downcase}.jpg"
         file_path = "#{IMG_STORE_PATH}/product/share/#{file_name}"