Sha256: 4565dcb241ca80adb5745c02b91cdc719e3f92f61e2abd4ea108ec8dfc9b7dee
Contents?: true
Size: 620 Bytes
Versions: 4
Compression:
Stored size: 620 Bytes
Contents
module Spree module Admin class FavoriteProductsController < Spree::Admin::BaseController def index @search = Spree::Product.favorite.search(params[:q]) @favorite_products = @search.result.order_by_favorite_users_count(sort_in_ascending_users_count?).page(params[:page]) end def users @product = Spree::Product.where(:id => params[:id]).first @users = @product.favorite_users.page(params[:page]) end private def sort_in_ascending_users_count? params[:q] && params[:q][:s] == 'favorite_users_count asc' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems