Sha256: 8b63d47d00e3248b98b6359b4dfc1c39aedbcb1bd4cd8e0142802767edb82d31

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

module Gemgento
  class Api::V1::ProductsController < ApplicationController
    include Gemgento::Api::V1::Base
    include Gemgento::Api::V1::ProductFilters

    def index
      if params[:category_id]
        @products = Gemgento::Category.find(params[:category_id]).products(current_store)
      else
        @products = current_store.products.order(:id)
      end

      @products = @products.where(basic_filters)
      @products = @products.filter(attribute_filters, current_store) if attribute_filters.any?
      @products = @products.page(@page[:number]).per(@page[:size])
    end

    def show
      @product = Gemgento::Product.find(params[:id])
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemgento-2.8.0 app/controllers/gemgento/api/v1/products_controller.rb