dimanche 27 décembre 2015

How to get spree product properties and spree properties for spree gem based application?

I am using spree gem. I am trying to get spree properties and spree product properties. But I got error

undefined local variable or method "prpty" for #<Class:0x007fa32588b128>

for CSV file in product. Where am I doing wrong?

 Spree::Product.class_eval do

    def self.to_csv
      CSV.generate do |csv|  
           all.each do |pro|
           csv << [ "property_name", "property_presentation", "property_value" ]
           var = Spree::Variant.find_by(product_id: pro.id)
           pro_prpty = Spree::ProductProperty.find_by(product_id: pro.id)
           prpty = Spree::Property.where(:id => pro_prpty.property_id)
           csv << [  pro_prpty.name, pro_prpty.value, pro_prpty.presentation,
           end
      end
     end
 end

Aucun commentaire:

Enregistrer un commentaire