I am working on a little project with spree + multi-vendor marketplace gem. I want to create an index and view for each vendor like https://spree-multi-vendor-marketplace.com/vendors and https://spree-multi-vendor-marketplace.com/vendors/c-amare#.
Its more than a little frustrating that this isn't core to the plugin, as it seems very basic.
It is my first time with spree and I can't see controllers. I cant see how to generate them in the documentation so I So I created a controller app/controllers/spree/vendors_controller.rb
module Spree
class VendorsController
def index
end
def show
end
end
end
I added the route in config/routes.rb
Rails.application.routes.draw do
# This line mounts Spree's routes at the root of your application.
# This means, any requests to URLs such as /products, will go to
# Spree::ProductsController.
# If you would like to change where this engine is mounted, simply change the
# :at option to something different.
#
# We ask that you don't use the :as option here, as Spree relies on it being
# the default of "spree".
mount Spree::Core::Engine, at: '/'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
Spree::Core::Engine.routes.draw do
resources :vendors
end
I have added a blank view for testing app/views/spree/vendors/index.html.erb
now I am getting undefined method `binary_params_for?' for Spree::VendorsController:Class
spree multi-vendor uses a stores controller so we have to call from it in our controller.
module Spree
class VendorsController < Spree::StoreController
def index
@vendors = Spree::Vendor.all
end
def show
end
end
end
I added that and I now have an index page. :) I hope this is helpful