Class: Spree::PageSections::FeaturedProduct
Constant Summary
Spree::PageSection::BACKGROUND_COLOR_DEFAULT, Spree::PageSection::BORDER_COLOR_DEFAULT, Spree::PageSection::BOTTOM_BORDER_WIDTH_DEFAULT, Spree::PageSection::BOTTOM_PADDING_DEFAULT, Spree::PageSection::TEXT_COLOR_DEFAULT, Spree::PageSection::TOP_BORDER_WIDTH_DEFAULT, Spree::PageSection::TOP_PADDING_DEFAULT
Instance Method Summary
collapse
#available_blocks_to_add, #can_be_deleted?, #can_be_sorted?, #copy_rich_text_fields_from, #deep_clone, #deep_clone_links, #display_name, #dup, #lazy?, #lazy_path, #restore_design_settings_to_defaults, #rich_text_fields, role, #role, #theme, #to_partial_path
Instance Method Details
#blocks_available? ⇒ Boolean
41
42
43
|
# File 'app/models/spree/page_sections/featured_product.rb', line 41
def blocks_available?
true
end
|
#can_sort_blocks? ⇒ Boolean
45
46
47
|
# File 'app/models/spree/page_sections/featured_product.rb', line 45
def can_sort_blocks?
true
end
|
#icon_name ⇒ Object
6
7
8
|
# File 'app/models/spree/page_sections/featured_product.rb', line 6
def icon_name
'star'
end
|
#product ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'app/models/spree/page_sections/featured_product.rb', line 10
def product
return @product if defined?(@product)
includes = [
{ variants: { images: [], prices: [], stock_items: [], stock_locations: [], option_values: :option_type } },
]
@product ||= store.products.includes(includes).find_by(id: preferred_product_id)
end
|
#product_name ⇒ Object
26
27
28
|
# File 'app/models/spree/page_sections/featured_product.rb', line 26
def product_name
product&.name
end
|
#vendor_name ⇒ Object
20
21
22
23
24
|
# File 'app/models/spree/page_sections/featured_product.rb', line 20
def vendor_name
return unless defined?(Spree::Vendor)
@vendor_name ||= product&.vendor&.display_name || 'Brand'
end
|