From d8564b75ad3ea28292553a1ae9f921ea97431632 Mon Sep 17 00:00:00 2001 From: Dominik Pfaffenbauer Date: Tue, 27 Aug 2019 08:42:21 +0200 Subject: [PATCH] [IndexBundle] fix index iterator interpreter --- .../pimcore/js/index/interpreters/iterator.js | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/interpreters/iterator.js b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/interpreters/iterator.js index 5b025bee03..b39c876004 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/interpreters/iterator.js +++ b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/interpreters/iterator.js @@ -18,10 +18,6 @@ coreshop.index.interpreters.iterator = Class.create(coreshop.index.interpreters. return pimcore.globalmanager.get('coreshop_index_interpreters'); }, - getClassItem: function() { - return coreshop.index.interpreters; - }, - getForm: function (record, config) { this.interpreterPanel = new Ext.form.FormPanel({ defaults: { anchor: '90%' }, @@ -77,17 +73,16 @@ coreshop.index.interpreters.iterator = Class.create(coreshop.index.interpreters. getInterpreterPanelLayout : function (type, record, parentConfig, config) { if (type) { type = type.toLowerCase(); - var classItem = this.getClassItem(); - if (classItem[type]) { - this.interpreter = new classItem[type]; + if (coreshop.index.interpreters[type]) { + this.interpreterPanelClass = new coreshop.index.interpreters[type]; - this.interpreterPanel.add(this.interpreter.getForm(record, Ext.isObject(config) ? config : {}, parentConfig)); + this.interpreterPanel.add(this.interpreterPanelClass.getForm(record, Ext.isObject(config) ? config : {}, parentConfig)); this.interpreterPanel.show(); } else { this.interpreterPanel.hide(); - this.interpreter = null; + this.interpreterPanelClass = null; } } else { this.interpreterPanel.hide(); @@ -95,21 +90,21 @@ coreshop.index.interpreters.iterator = Class.create(coreshop.index.interpreters. }, isValid: function() { - if (!this.interpreter) { - return false; + if (!this.interpreterPanelClass) { + return this.interpreterTypeCombo.getValue() ? true : false; } - return this.interpreter.isValid(); + return this.interpreterPanelClass.isValid(); }, getInterpreterData: function () { // get defined conditions - if (this.interpreter) { + if (this.interpreterPanelClass) { var interpreterConfig = {}; var interpreterForm = this.interpreterPanel.getForm(); - if (Ext.isFunction(this.interpreter.getInterpreterData)) { - interpreterConfig = this.interpreter.getInterpreterData(); + if (Ext.isFunction(this.interpreterPanelClass.getInterpreterData)) { + interpreterConfig = this.interpreterPanelClass.getInterpreterData(); } else { Ext.Object.each(interpreterForm.getFieldValues(), function (key, value) { @@ -125,6 +120,10 @@ coreshop.index.interpreters.iterator = Class.create(coreshop.index.interpreters. }; } - return {}; + return { + interpreter: { + type: this.interpreterTypeCombo.getValue() + } + }; } });