module SolidusRecommendations module Recommendable ## # Provides methods to get recommended products based on certain criteria # such as "Bought Together" or "Users also bought" # class Products < Base ## # Acceptable indices to pass as index option # to methods # ACCEPTED_INDICES = [:user, :order] ## # Gets recommended products # # @example Get recommended products based on user index. # product = Spree::Product.find(4) # recommended = SolidusRecommendations::Client.new # recommended.products.get(product) # # # Good for getting recommendations based on what other users have # # have purchased. # # @example Get recommended products based on order index. # product = Spree::Product.find(4) # recommmended = SolidusRecommendations::Client.new # recommended.products.get(product, index: :order) # # # Good for getting recommendations based on what others checkout with # # frequently. # # @param [Spree::Product, Integer] product The product to base recommendations off of. # @param [Hash] options # @option options [Symbol, String] :index The index to perform aggregation on. (*Defaults to :user*) # @option options [Integer] :size The number of recommendations to return. (*Defaults to 10*) # # @return [Array