Sha256: 7ac1724241abdf397f553259c27b381f4e475081f0a2c82a0208b6920372e970
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module Spree Product.class_eval do def incountry?(country) clist = Spree::Zoned::Product.where "spree_product_id = ? AND spree_country_id = ?", id, country clist == [] || clist[0].orderno >= 0 end def delfrom(country) setorderno country, -1 end def backtocountry(country) setorderno country, 0 end def setprice(country, price) clist = Spree::Zoned::Product.where "spree_product_id = ? AND spree_country_id = ?", id, country if !clist || clist == [] zp = Spree::Zoned::Product.new zp.spree_country_id = country zp.spree_product_id = id zp.orderno = 0 else zp = clist[0] end zp.cprice = price zp.save end protected def setorderno(country, price) clist = Spree::Zoned::Product.where "spree_product_id = ? AND spree_country_id = ?", id, country if clist == [] zp = Spree::Zoned::Product.new zp.spree_country_id = country zp.spree_product_id = id else zp = clist[0] end zp.orderno = ono zp.save end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_zoned-0.5.20 | app/models/spree/product_decorator.rb |
spree_zoned-0.5.19 | app/models/spree/product_decorator.rb |