Class: Workarea::Storefront::LegacyOrderItemViewModel
- Inherits:
-
ApplicationViewModel
- Object
- ApplicationViewModel
- Workarea::Storefront::LegacyOrderItemViewModel
- Defined in:
- app/view_models/workarea/storefront/legacy_order_item_view_model.rb
Instance Method Summary collapse
- #has_options? ⇒ Boolean
- #image ⇒ Object
- #product ⇒ Object
- #product_name ⇒ Object
- #sku_name ⇒ Object
- #total_price ⇒ Object
Instance Method Details
#has_options? ⇒ Boolean
12 13 14 |
# File 'app/view_models/workarea/storefront/legacy_order_item_view_model.rb', line 12 def model.details.present? end |
#image ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/view_models/workarea/storefront/legacy_order_item_view_model.rb', line 29 def image if product.present? product.primary_image else Catalog::ProductPlaceholderImage.cached end end |
#product ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/view_models/workarea/storefront/legacy_order_item_view_model.rb', line 21 def product return nil if product_id.blank? return @product if defined?(@product) model = Catalog::Product.find(product_id) rescue nil @product = model.present? ? ProductViewModel.wrap(model, sku: sku) : nil end |
#product_name ⇒ Object
16 17 18 19 |
# File 'app/view_models/workarea/storefront/legacy_order_item_view_model.rb', line 16 def product_name return sku_name unless product.present? product.name end |
#sku_name ⇒ Object
4 5 6 |
# File 'app/view_models/workarea/storefront/legacy_order_item_view_model.rb', line 4 def sku_name name end |
#total_price ⇒ Object
8 9 10 |
# File 'app/view_models/workarea/storefront/legacy_order_item_view_model.rb', line 8 def total_price price end |