Module: Workarea::Storefront::OptionSetViewModel

Extended by:
ActiveSupport::Concern
Included in:
ProductTemplates::OptionSelectsViewModel, ProductTemplates::OptionThumbnailsViewModel
Defined in:
app/view_models/workarea/storefront/option_set_view_model.rb

Overview

Mixed into ProductViewModels for options-selection-based templates.

Instance Method Summary collapse

Instance Method Details

#current_skuObject



12
13
14
# File 'app/view_models/workarea/storefront/option_set_view_model.rb', line 12

def current_sku
  options[:sku].presence || option_set.current_sku
end

#imagesObject



21
22
23
24
25
26
27
# File 'app/view_models/workarea/storefront/option_set_view_model.rb', line 21

def images
  @images_for_options_set ||= if images_matching_options.any?
    images_matching_options
  else
    images_matching_primary(super.primary)
  end
end

#pricingObject



16
17
18
19
# File 'app/view_models/workarea/storefront/option_set_view_model.rb', line 16

def pricing
  return super unless options[:pricing].blank? && option_set.current_sku.present?
  @pricing ||= Pricing::Collection.new(option_set.current_sku)
end