Skip to content

armgit / spree

Public Imported from GitHub
0

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.

SD-1349 Use dropdown for currency not text input in Promotion UI for the order

Tomek Urban127d6ee69a71
diff --git a/backend/app/helpers/spree/admin/base_helper.rb b/backend/app/helpers/spree/admin/base_helper.rb
index 250cd0cedb..d8851958f0 100644
--- a/backend/app/helpers/spree/admin/base_helper.rb
+++ b/backend/app/helpers/spree/admin/base_helper.rb
@@ -59,6 +59,10 @@ module Spree
end
def preference_field_tag(name, value, options)
+ if options[:key] == :currency
+ return select_tag(name, options_from_collection_for_select(supported_currencies, :iso_code, :iso_code, value), class: 'select2')
+ end
+
case options[:type]
when :integer
text_field_tag(name, value, preference_field_options(options))
diff --git a/backend/app/views/spree/admin/promotions/calculators/_default_fields.html.erb b/backend/app/views/spree/admin/promotions/calculators/_default_fields.html.erb
index 5e2b27e0cb..736b2d45dc 100644
--- a/backend/app/views/spree/admin/promotions/calculators/_default_fields.html.erb
+++ b/backend/app/views/spree/admin/promotions/calculators/_default_fields.html.erb
@@ -5,6 +5,7 @@
<%= preference_field_tag(
field_name,
calculator.get_preference(key),
- type: calculator.preference_type(key)) %>
+ type: calculator.preference_type(key),
+ key: key) %>
</div>
<% end %>