70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'app/models/piggybak/line_item.rb', line 70
def preprocess_shipment
if !self._destroy
if (self.new_record? || self.shipment.status != 'shipped') && self.shipment && self.shipment.shipping_method
calculator = self.shipment.shipping_method.klass.constantize
self.price = calculator.rate(self.shipment.shipping_method, self.order)
self.price = ((self.price*100).to_i).to_f/100
self.description = self.shipment.shipping_method.description
end
if self.shipment.nil? || self.shipment.shipping_method.nil?
self.price = 0.00
self.description = "Shipping"
end
end
end
|