File tree Expand file tree Collapse file tree
lib/solidus_volume_pricing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,8 +17,25 @@ class Engine < Rails::Engine
1717 end
1818 end
1919
20- def self . activate
21- ::Spree ::BackendConfiguration ::CONFIGURATION_TABS << :volume_price_models
20+ if SolidusSupport . backend_available?
21+ initializer 'solidus_volume_pricing.admin_menu_item' , after : 'solidus_volume_pricing.preferences' do
22+ Spree ::Backend ::Config . configure do |config |
23+ settings_menu_item = config . menu_items . detect { |mi | mi . label == :settings }
24+
25+ # The API of the MenuItem class changes in Solidus 4.2.0
26+ if settings_menu_item . respond_to? ( :children )
27+ settings_menu_item . children . concat ( [
28+ Spree ::BackendConfiguration ::MenuItem . new (
29+ label : :volume_price_models ,
30+ url : :admin_volume_price_models_path ,
31+ match_path : %r{admin/volume_price_models}
32+ )
33+ ] )
34+ else
35+ ::Spree ::BackendConfiguration ::CONFIGURATION_TABS << :volume_price_models
36+ end
37+ end
38+ end
2239 end
2340
2441 # use rspec for tests
You can’t perform that action at this time.
0 commit comments