Sabo
03/08/2023, 9:51 AMSpree::Core::Search::Base
and Spree::Core::ControllerHelpers::Search
for searching not only for the Product model
module SearchDecorator
class Base
end
class Product
#something
end
class Other
#something
end
::Spree::Core::Search.prepend self
end
module BuidlSearchHelperDecorator
module Product
def build_searcher(params)
#something
end
end
module Other
def build_searcher(params)
#something
end
end
def build_searcher(params)
end
::Spree::Core::ControllerHelpers::Search.prepend self
end
There is the code I wrote in /app/overrides
I was wondering if this is the right approach
------
Solidus 3.2.0Zyad A
03/08/2023, 1:50 PMSteve Simitzis
03/10/2023, 6:06 PMjakemumu
03/12/2023, 7:02 PMDaniel Senff
03/13/2023, 11:53 AMTaxonController#show
to retrieve the list of all products in the given taxon, you go through the searcher_class - search for products having the given taxon_id. Why is this instead of using @taxon.products
or @taxon.classifications
? I also wonder how the search class is respecting Classification#position, I don't find any references to this in Spree::Core::Search::Base
.Sabo
03/15/2023, 9:18 AMadmin/products/index.html.erb
but I get the error undefined method 'name_cont' for Ransack::Search<class: Spree::Kit, base: Grouping <combinator: and>>:Ransack::Search
# frozen_string_literal: true
module Spree
module Admin
class NewPanelController < ResourceController
update.before :update_before
helper_method :clone_object_url
before_action :split_params, only: [:create, :update]
def show
redirect_to action: :edit
end
def index
session[:return_to] = request.url
respond_with(@collection)
end
def destroy
...
end
def clone
...
end
private
def collection
return @collection if @collection
params[:q] ||= {}
params[:q][:s] ||= "name asc"
# @search needs to be defined as this is passed to search_form_for
@search = super.ransack(params[:q])
@collection = @search.result.
order(id: :asc).
includes(:images).
page(params[:page]).
per(Spree::Config[:admin_kits_per_page])
end
def split_params
end
def update_before
...
end
def clone_object_url(resource)
clone_admin_kit_url resource
end
end
end
end
index.html.erb
<%= search_form_for [:admin, @search] do |f| %>
<%- locals = {f: f} %>
<div class="row" data-hook="admin_kits_index_search" >
<div class="col-10">
<div class="field">
<%= f.label :name_cont, Spree::Kit.human_attribute_name(:name) %>
<%= f.text_field :name_cont, size: 15 %>
</div>
</div>
<div class="col-2">
<div class="field checkbox">
<label>
<%= f.check_box :with_discarded, { checked: params[:q][:with_discarded] == 'true', class: 'js-with-discarded-input' }, 'true', 'false' %>
<%= t('spree.show_deleted') %>
</label>
</div>
</div>
</div>
<div class="actions filter-actions" data-hook="admin_kits_index_search_buttons">
<%= button_tag t('spree.search'), class: 'btn btn-primary' %>
</div>
<% end %>
Tom Wilson
03/16/2023, 9:22 PMcoquerel
03/20/2023, 4:20 PMmuhammet faik
03/21/2023, 7:46 AMcoquerel
03/21/2023, 8:25 AMmuhammet faik
03/21/2023, 10:18 AMmuhammet faik
03/21/2023, 10:22 AMconfig/spree.rb
filemuhammet faik
03/21/2023, 10:24 AMmuhammet faik
03/21/2023, 10:24 AMdanielepalombo
03/21/2023, 2:10 PMDaniel Senff
03/22/2023, 12:48 PMDaniel Senff
03/22/2023, 12:49 PMcoquerel
03/22/2023, 3:48 PMcoquerel
03/22/2023, 9:24 PMcoquerel
03/23/2023, 10:08 AMmuhammet faik
03/24/2023, 10:04 AMmuhammet faik
03/24/2023, 10:04 AMmuhammet faik
03/24/2023, 10:04 AMmuhammet faik
03/24/2023, 10:05 AMcoquerel
03/24/2023, 11:50 AMI think I have a tax error
Because as I added two items to my menu, by default I have the impression that he wants to tax them but I would like to deactivate that. I don't use it. Look at :
benmorganio
03/24/2023, 8:01 PM/solidus/api
instead of /api
?coquerel
03/25/2023, 4:52 PMHi guys ! I managed to make a lot of changes, thanks to you, but I'm far from getting the result I'd like. For example, I managed to create two new elements thanks to this code in the spree.rb file: config.menu_items << config.class::MenuItem.new(
[:event],
'calendar',
url: '/admin/events',
position: 0
) However, they are both created in home/products/categories, and therefore inherit the ecommerce settings, which I don't want. I would like it to be really two modules apart from ecommerce, keeping the same topbar, with the 3 elements visible and clickable exaetera. Same on the homepage, I don't want to be able to see the articles, because it's not in the ecommerce element. Do you have any ideas to help me fix this please? :heart:
benmorganio
03/25/2023, 10:28 PMbenmorganio
03/25/2023, 10:29 PMSabo
03/27/2023, 11:28 AMclone_admin_product POST /admin/products/:id/clone(.:format) spree/admin/products#clone
config/route.rb
namespace :admin do
resources :kits
post 'kits/:id/clone', to: 'kits#clone'
end
but I get `action_dispatch/routing/route_set.rb588in add_route': Invalid route name, already in use: 'admin' (ArgumentError)