Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Update
Matthew Kennedy9cdcf051c6a0
diff --git a/backend/app/assets/javascripts/spree/backend/spree-select2.js b/backend/app/assets/javascripts/spree/backend/spree-select2.jsindex b77e1f709c..9670c3a69f 100644--- a/backend/app/assets/javascripts/spree/backend/spree-select2.js+++ b/backend/app/assets/javascripts/spree/backend/spree-select2.js@@ -3,6 +3,10 @@ document.addEventListener('DOMContentLoaded', function() {// Remember to add a place holder in the HTML as needed.$('select.select2').select2({})+ $('select.select2-multiple').select2({+ multiple: true+ })+// Initiate a Select2 with the option to clear, on any select element with the class .select2-clear// Set: include_blank: true in the ERB.// A placeholder is auto-added here as it is required to clear the Select2.diff --git a/backend/app/views/spree/admin/payment_methods/_form.html.erb b/backend/app/views/spree/admin/payment_methods/_form.html.erbindex 17bb2571f6..f6f7aa2cb1 100644--- a/backend/app/views/spree/admin/payment_methods/_form.html.erb+++ b/backend/app/views/spree/admin/payment_methods/_form.html.erb@@ -26,7 +26,7 @@<div data-hook="store" class="form-group"><%= label_tag :payment_method_store, Spree.t(:store) %>- <%= collection_select(:payment_method, :store_id, @stores, :id, :unique_name, { include_blank: true }, {id: 'store_id', class: 'select2-clear'}) %>+ <%= collection_select(:payment_method, :store_ids, @stores, :id, :unique_name, {}, { miltiple: true, id: 'store_id', class: 'select2-multiple' }) %><small class="form-text text-muted"><%= Spree.t('payment_method_form.stores_help') %></small></div>diff --git a/core/app/models/spree/payment_method.rb b/core/app/models/spree/payment_method.rbindex e92237750e..f5d94e4baa 100644--- a/core/app/models/spree/payment_method.rb+++ b/core/app/models/spree/payment_method.rb@@ -12,7 +12,7 @@ module Spreevalidates :name, presence: true- belongs_to :store+ has_and_belongs_to_many :storeswith_options dependent: :restrict_with_error dohas_many :payments, class_name: 'Spree::Payment', inverse_of: :payment_methoddiff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rbindex 3edce8a407..442c531b8a 100644--- a/core/app/models/spree/store.rb+++ b/core/app/models/spree/store.rb@@ -21,6 +21,8 @@ module Spreehas_one_attached :logohas_one_attached :mailer_logo+ has_many :payment_methods+validates :mailer_logo, content_type: ['image/png', 'image/jpg', 'image/jpeg']before_save :ensure_default_exists_and_is_uniquediff --git a/core/db/migrate/20210114182625_add_payment_methods_stores_associasion.rb b/core/db/migrate/20210114182625_add_payment_methods_stores_associasion.rbnew file mode 100644index 0000000000..716019d9b5--- /dev/null+++ b/core/db/migrate/20210114182625_add_payment_methods_stores_associasion.rb@@ -0,0 +1,8 @@+class AddPaymentMethodsStoresAssociasion < ActiveRecord::Migration[6.0]+ def change+ create_table :spree_payment_methods_stores, id: false do |t|+ t.belongs_to :payment_method+ t.belongs_to :store+ end+ end+enddiff --git a/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb b/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rbnew file mode 100644index 0000000000..b62f395926--- /dev/null+++ b/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb@@ -0,0 +1,5 @@+class RemoveStoreIdFromSpreePaymentMethods < ActiveRecord::Migration[6.0]+ def change+ remove_column :spree_payment_methods, :store_id+ end+end