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
Small tweaks.
Matthew Kennedy2fe6c4a7f178
diff --git a/core/app/models/spree/menu.rb b/core/app/models/spree/menu.rbindex b8e67e6966..fc17bdea95 100644--- a/core/app/models/spree/menu.rb+++ b/core/app/models/spree/menu.rb@@ -3,6 +3,7 @@ module Spreehas_many :menu_items, dependent: :destroyhas_and_belongs_to_many :stores+ before_save :paremeterize_unique_codeafter_create :set_rootafter_save :set_root_menu_item_name@@ -16,10 +17,12 @@ module Spreeprivate- def set_root- code_name = name.parameterize+ def paremeterize_unique_code+ self.unique_code = unique_code.parameterize+ end- self.root ||= MenuItem.create!(menu_id: id, name: name, item_type: 'Container', code: "#{code_name}-root")+ def set_root+ self.root ||= MenuItem.create!(menu_id: id, name: name, item_type: 'Container', code: "#{name}-root")enddef set_root_menu_item_namediff --git a/core/app/models/spree/menu_item.rb b/core/app/models/spree/menu_item.rbindex 5cf8079457..715176113b 100644--- a/core/app/models/spree/menu_item.rb+++ b/core/app/models/spree/menu_item.rb@@ -5,9 +5,8 @@ module Spreeacts_as_nested_set dependent: :destroy- before_save :reset_link_attributes- before_save :check_for_image- before_save :build_path+ before_save :reset_link_attributes, :check_for_image,+ :build_path, :paremeterize_codehas_one_attached :image_asset@@ -83,7 +82,13 @@ module Spreedef check_for_rootif menu.try(:root).present? && parent_id.nil?- errors.add(:root_conflict, 'This Menu already has a root item')+ errors.add(:root_conflict, Spree.t(:this_menu_already_has_a_root_item))+ end+ end++ def paremeterize_code+ if code+ self.code = code.parameterizeendendenddiff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 48ee35e3a7..bcd4ca2cf3 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -1745,6 +1745,7 @@ en:message: If you have received this email, then your email settings are correct.subject: Test Mailtest_mode: Test Mode+ this_menu_already_has_a_root_item: This Menu already has a root itemthank_you_for_your_order: Thank you for your business. Please print out a copy of this confirmation page for your records.there_are_no_items_for_this_order: There are no items for this order. Please add an item to the order to continue.there_were_problems_with_the_following_fields: There were problems with the following fields