Module: Gemgento::ProductsHelper
- Defined in:
- app/helpers/gemgento/products_helper.rb
Instance Method Summary collapse
Instance Method Details
#current_category_products ⇒ Object
18 19 20 |
# File 'app/helpers/gemgento/products_helper.rb', line 18 def current_category_products @current_category_product_ids ||= @current_category.products.active.catalog_visible.to_a end |
#next_product ⇒ Object
4 5 6 7 8 9 |
# File 'app/helpers/gemgento/products_helper.rb', line 4 def next_product @next_product ||= begin current_index = current_category_products.index(@product) current_index < current_category_products.length ? current_category_products[current_index + 1] : nil end end |
#previous_product ⇒ Object
11 12 13 14 15 16 |
# File 'app/helpers/gemgento/products_helper.rb', line 11 def previous_product @previous_product ||= begin current_index = current_category_products.index(@product) current_index > 0 ? current_category_products[current_index - 1] : nil end end |