Sha256: 7771fa060eda4d2a46cedafd9e74bd1df3386065ea833def03045caeceec0024
Contents?: true
Size: 868 Bytes
Versions: 9
Compression:
Stored size: 868 Bytes
Contents
module ShopDiscounts module Tags module Item include Radiant::Taggable [:value, :discount].each do |symbol| desc %{ outputs the #{symbol} of the current cart item } tag "shop:cart:item:#{symbol}" do |tag| attr = tag.attr.symbolize_keys item = tag.locals.shop_line_item Shop::Tags::Helpers.currency(item.send(symbol),attr) end end desc %{ expands if the item has a discount} tag "shop:cart:item:if_discounted" do |tag| item = tag.locals.shop_line_item tag.expand if item.price != item.value end desc %{ expands if the item has a discount} tag "shop:cart:item:unless_discounted" do |tag| item = tag.locals.shop_line_item tag.expand if item.price == item.value end end end end
Version data entries
9 entries across 9 versions & 1 rubygems