Class: Comable::OrderItem
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::OrderItem
- Includes:
- Liquidable, Csvable, SkuChoice, SkuItem
- Defined in:
- app/models/comable/order_item.rb,
app/models/comable/order_item/csvable.rb
Defined Under Namespace
Modules: Csvable
Instance Method Summary collapse
- #complete ⇒ Object
-
#copy_attributes ⇒ Object
TODO: カート投入時との差額表示.
-
#current_price ⇒ Object
時価を取得.
-
#current_subtotal_price ⇒ Object
時価小計を取得.
- #sku_h_choice_name ⇒ Object
- #sku_h_item_name ⇒ Object
- #sku_v_choice_name ⇒ Object
- #sku_v_item_name ⇒ Object
- #stock ⇒ Object
- #stock=(stock) ⇒ Object
-
#subtotal_price ⇒ Object
売価小計を取得.
- #unstocked? ⇒ Boolean
Methods included from SkuChoice
Methods included from SkuItem
Instance Method Details
#complete ⇒ Object
24 25 26 |
# File 'app/models/comable/order_item.rb', line 24 def complete # Nothing to do end |
#copy_attributes ⇒ Object
TODO: カート投入時との差額表示
29 30 31 |
# File 'app/models/comable/order_item.rb', line 29 def copy_attributes self.attributes = current_attributes end |
#current_price ⇒ Object
時価を取得
34 35 36 |
# File 'app/models/comable/order_item.rb', line 34 def current_price variant.price end |
#current_subtotal_price ⇒ Object
時価小計を取得
39 40 41 |
# File 'app/models/comable/order_item.rb', line 39 def current_subtotal_price current_price * quantity end |
#sku_h_choice_name ⇒ Object
60 61 62 |
# File 'app/models/comable/order_item.rb', line 60 def sku_h_choice_name variant.option_values.first.try(:name) end |
#sku_h_item_name ⇒ Object
52 53 54 |
# File 'app/models/comable/order_item.rb', line 52 def sku_h_item_name product.option_types.first.try(:name) end |
#sku_v_choice_name ⇒ Object
64 65 66 |
# File 'app/models/comable/order_item.rb', line 64 def sku_v_choice_name variant.option_values.second.try(:name) end |
#sku_v_item_name ⇒ Object
56 57 58 |
# File 'app/models/comable/order_item.rb', line 56 def sku_v_item_name product.option_types.second.try(:name) end |
#stock ⇒ Object
68 69 70 |
# File 'app/models/comable/order_item.rb', line 68 def stock variant.stocks.first end |
#stock=(stock) ⇒ Object
72 73 74 |
# File 'app/models/comable/order_item.rb', line 72 def stock=(stock) self.variant = stock.variant || stock.build_variant end |
#subtotal_price ⇒ Object
売価小計を取得
44 45 46 |
# File 'app/models/comable/order_item.rb', line 44 def subtotal_price price * quantity if price end |
#unstocked? ⇒ Boolean
48 49 50 |
# File 'app/models/comable/order_item.rb', line 48 def unstocked? !variant.can_supply? quantity end |