Sha256: f6705ef0b26b4ee6a281cc2c906aaceccb4af76ad2e8887f39eb2ad167893fe2
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
class Plugins::Ecommerce::ProductItemDecorator < Draper::Decorator delegate_all def the_title get_product.the_variation_title(object.variation_id) end def the_sub_total "#{h.current_site.current_unit}#{sprintf('%.2f', object.sub_total)}" end def the_price get_product.the_price(object.variation_id) end def the_tax get_product.the_tax(object.variation_id) end def price get_product.price(object.variation_id) end def get_product @_get_product ||= object.product.decorate end # return a product variation by id def get_variation @_get_variation ||= self.product_variation.decorate end # update quantity of product or product variation used in current cart item def decrement_qty! Plugins::Ecommerce::ProductItemService.new(object.cart.site, object).decrement_qty! end # verify if the quantity of the cart item is avilable # return true if quantity is available def is_valid_qty? (get_product.the_qty_real(object.variation_id) - object.qty).to_i >= 0 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
camaleon_ecommerce-1.2 | app/decorators/plugins/ecommerce/product_item_decorator.rb |