From 7516872bed018c12993a0f872e9b6787a809ce8f Mon Sep 17 00:00:00 2001 From: Sascha Karnatz <68833+kulturbande@users.noreply.github.com> Date: Mon, 27 May 2024 17:20:36 +0200 Subject: [PATCH 1/3] Fix variant select ingredient The Variant select didn't showed any result, because the text and frontend_display are not available on the variant entity. It is now replaced by a multiline output to make it easier to find the correct product variant. --- .../alchemy/solidus/admin/variant_select.js | 32 +++++++++++++------ .../_spree_variant_editor.html.erb | 22 ++++++++++++- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/alchemy/solidus/admin/variant_select.js b/app/assets/javascripts/alchemy/solidus/admin/variant_select.js index 160452a..c9f573b 100644 --- a/app/assets/javascripts/alchemy/solidus/admin/variant_select.js +++ b/app/assets/javascripts/alchemy/solidus/admin/variant_select.js @@ -1,7 +1,25 @@ //= require alchemy/solidus/admin/select2_config $.fn.alchemyVariantSelect = function(options) { - var config = Alchemy.Solidus.getSelect2Config(options) + const config = Alchemy.Solidus.getSelect2Config(options) + + function formatSelection(variant) { + return variant.options_text ? `${variant.name} - ${variant.options_text}` : variant.name + } + + function formatResult(variant) { + return ` +