Sha256: b515cc819c21ff9b25e9a3f99dc7a9af8c925f37d1f0e2f3712474eabfa4da08

Contents?: true

Size: 615 Bytes

Versions: 7

Compression:

Stored size: 615 Bytes

Contents

class Plugins::Ecommerce::ProductItem < ActiveRecord::Base
  include CamaleonCms::Metas
  self.table_name = 'plugins_ecommerce_products'
  belongs_to :cart, class_name: 'Plugins::Ecommerce::Cart', foreign_key: :order_id, touch: true
  belongs_to :order, class_name: 'Plugins::Ecommerce::Order'
  belongs_to :product, foreign_key: :product_id, class_name: 'CamaleonCms::Post'
  belongs_to :product_variation, class_name: 'Plugins::Ecommerce::ProductVariation', foreign_key: :variation_id

  def sub_total
    p = self.product.decorate
    (p.price(self.variation_id) + p.tax(self.variation_id)) * self.qty
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
camaleon_ecommerce-2.0.4 app/models/plugins/ecommerce/product_item.rb
camaleon_ecommerce-2.0.3 app/models/plugins/ecommerce/product_item.rb
camaleon_ecommerce-2.0.2 app/models/plugins/ecommerce/product_item.rb
camaleon_ecommerce-2.0.1 app/models/plugins/ecommerce/product_item.rb
camaleon_ecommerce-2.0.0 app/models/plugins/ecommerce/product_item.rb
camaleon_ecommerce-1.2.1 app/models/plugins/ecommerce/product_item.rb
camaleon_ecommerce-1.2 app/models/plugins/ecommerce/product_item.rb