-
-
Save csavoronin/a5302ef8e914cc8250e0e196086bfeeb to your computer and use it in GitHub Desktop.
[!] Select2: Product features: In eBay templates and promotions, the selected featues were not displayed. Fixed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/design/backend/css/tygh/utils/select2.less b/design/backend/css/tygh/utils/select2.less | |
index 7b87b5809e..a23b76f677 100644 | |
--- a/design/backend/css/tygh/utils/select2.less | |
+++ b/design/backend/css/tygh/utils/select2.less | |
@@ -53,6 +53,7 @@ Select 2 | |
.select2-container .select2-search--inline { | |
width: 100%; | |
+ pointer-events: none; | |
} | |
.select2-container--disabled .select2-search { | |
@@ -592,6 +593,20 @@ select#customer_add { | |
.select2-wrapper { | |
position: relative; | |
+ | |
+ &--width-auto { | |
+ | |
+ @media (min-width: 769px) { | |
+ display: inline-block; | |
+ } | |
+ | |
+ select { | |
+ | |
+ @media (max-width: 768px) { | |
+ max-width: none; | |
+ } | |
+ } | |
+ } | |
} | |
.control-group.error .object-categories-add .select2-search { | |
diff --git a/design/backend/templates/addons/ebay/views/ebay/components/select_product_identifier.tpl b/design/backend/templates/addons/ebay/views/ebay/components/select_product_identifier.tpl | |
index 9798beb002..e732b9e8da 100644 | |
--- a/design/backend/templates/addons/ebay/views/ebay/components/select_product_identifier.tpl | |
+++ b/design/backend/templates/addons/ebay/views/ebay/components/select_product_identifier.tpl | |
@@ -13,7 +13,9 @@ | |
{/foreach} | |
</select> | |
{if isset($variants['feature'])} | |
- <select id="feature_{$tag_id}" name="{$tag_name}" class="hidden" disabled> | |
- <option value="{$value}"></option> | |
- </select> | |
+ <div class="select2-wrapper--width-auto"> | |
+ <select id="feature_{$tag_id}" name="{$tag_name}" class="hidden" disabled> | |
+ <option value="{$value}"></option> | |
+ </select> | |
+ </div> | |
{/if} | |
\ No newline at end of file | |
diff --git a/design/backend/templates/views/promotions/components/condition.tpl b/design/backend/templates/views/promotions/components/condition.tpl | |
index 01fb3d3de8..9cead8f27f 100644 | |
--- a/design/backend/templates/views/promotions/components/condition.tpl | |
+++ b/design/backend/templates/views/promotions/components/condition.tpl | |
@@ -46,11 +46,13 @@ | |
{/if} | |
{if $schema.conditions[$condition_data.condition].type == "chained"} | |
- <select name="{$prefix}[condition_element]" id="promotion_chained_condition_parent_{$p_md}"> | |
- {if $condition_data.condition_element} | |
- <option value="{$condition_data.condition_element}" selected></option> | |
- {/if} | |
- </select> | |
+ <div class="select2-wrapper--width-auto"> | |
+ <select name="{$prefix}[condition_element]" id="promotion_chained_condition_parent_{$p_md}"> | |
+ {if $condition_data.condition_element} | |
+ <option value="{$condition_data.condition_element}" selected></option> | |
+ {/if} | |
+ </select> | |
+ </div> | |
{/if} | |
{if $schema.conditions[$condition_data.condition].type != "list" && $schema.conditions[$condition_data.condition].type != "statement"} | |
@@ -95,11 +97,15 @@ | |
{__("yes")} | |
{elseif $schema.conditions[$condition_data.condition].type == "chained"} | |
- <select name="{$prefix}[value]" {if $condition_data.operator == 'in' || $condition_data.operator == 'nin'}multiple{/if} class="hidden" id="promotion_chained_condition_child_{$p_md}"> | |
- {foreach from=","|explode:$condition_data.value item="preselected_child"} | |
- <option value="{$preselected_child}" selected></option> | |
- {/foreach} | |
- </select> | |
+ <div class="select2-wrapper--width-auto"> | |
+ <select name="{$prefix}[value]" {if $condition_data.operator == 'in' || $condition_data.operator == 'nin'}multiple{/if} class="hidden" id="promotion_chained_condition_child_{$p_md}"> | |
+ {foreach from=","|explode:$condition_data.value item="preselected_child"} | |
+ {if $preselected_child} | |
+ <option value="{$preselected_child}" selected></option> | |
+ {/if} | |
+ {/foreach} | |
+ </select> | |
+ </div> | |
<input id="promotion_chained_condition_child_input_{$p_md}" type="text" name="{$prefix}[value]" value="{$condition_data.value}" | |
class="hidden input-long"/> | |
<input id="promotion_chained_condition_child_input_name_{$p_md}" type="text" name="{$prefix}[value_name]" | |
diff --git a/js/tygh/backend/promotion_update.js b/js/tygh/backend/promotion_update.js | |
index 64ddc316de..aad6c18a51 100644 | |
--- a/js/tygh/backend/promotion_update.js | |
+++ b/js/tygh/backend/promotion_update.js | |
@@ -87,7 +87,7 @@ | |
self.initChildSelect(self.$parentSelect.select2('data')[0]); | |
}); | |
- this.$childSelect.on('select2:select', function (e) { | |
+ this.$childSelect.on('select2:select select2:unselect', function (e) { | |
self.onChildSelect(e.params.data); | |
}); | |
}, | |
@@ -115,13 +115,15 @@ | |
this.$childInput.addClass('hidden'); | |
this.$childSelect.prop('disabled', false); | |
- if (loadViaAjax && this.$childSelect.val()) { | |
+ var value = $.makeArray(this.$childSelect.val()).filter(function (val) { return Boolean(val); } ); | |
+ | |
+ if (loadViaAjax && value.length) { | |
var self = this; | |
$.ceAjax('request', childSelect2Settings.dataUrl, { | |
hidden: true, | |
caching: false, | |
data: { | |
- preselected: this.$childSelect.val(), | |
+ preselected: value, | |
page_size: 0 | |
}, | |
callback: function (data) { | |
@@ -134,7 +136,6 @@ | |
object.selected = true; | |
}); | |
childSelect2Settings.data = childPreselectedObjects; | |
- self.$childSelect.empty().val(null).trigger('change'); | |
self.$childSelect.ceObjectSelector(childSelect2Settings); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment