forked from Smile-SA/elasticsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
108 changed files
with
3,550 additions
and
1,373 deletions.
There are no files selected for viewing
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
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
32 changes: 32 additions & 0 deletions
32
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/NestedFilterInterface.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer | ||
* versions in the future. | ||
* | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCatalogRule | ||
* @author Aurelien FOUCRET <[email protected]> | ||
* @copyright 2016 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
namespace Smile\ElasticsuiteCatalogRule\Model\Rule\Condition\Product; | ||
|
||
use Smile\ElasticsuiteCore\Search\Request\QueryInterface; | ||
|
||
/** | ||
* Allow to apply automatic filters on nested field during rule query conversion. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCatalogRule | ||
* @author Aurelien FOUCRET <[email protected]> | ||
*/ | ||
interface NestedFilterInterface | ||
{ | ||
/** | ||
* @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface | ||
*/ | ||
public function getFilter(); | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,25 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer | ||
* versions in the future. | ||
* | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCatalogRule | ||
* @author Aurelien FOUCRET <[email protected]> | ||
* @copyright 2016 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
* | ||
* Product search rule admin form rendering. | ||
*/ | ||
?> | ||
|
||
<?php | ||
|
||
/** @var \Smile\ElasticsuiteCatalogRule\Block\Product\Conditions $block */ | ||
|
||
$element = $block->getElement(); | ||
$fieldId = ($element->getHtmlContainerId()) ? ' id="' . $element->getHtmlContainerId() . '"' : ''; | ||
$fieldClass = "field admin__field field-{$element->getId()} {$element->getCssClass()}"; | ||
|
@@ -17,12 +38,11 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' . $block->getUiId( | |
</div> | ||
</div> | ||
|
||
|
||
<script> | ||
require([ | ||
"Magento_Rule/rules", | ||
"prototype" | ||
], function(VarienRulesForm){ | ||
window.<?php echo $block->getHtmlId() ?> = new VarienRulesForm('<?php echo $block->getHtmlId() ?>', '<?php /* @escapeNotVerified */ echo $block->getNewChildUrl() ?>'); | ||
window.<?php echo $block->getHtmlId(); ?> = new VarienRulesForm("<?php echo $block->getHtmlId() ?>", "<?php /* @escapeNotVerified */ echo $block->getNewChildUrl() ?>"); | ||
}); | ||
</script> |
18 changes: 18 additions & 0 deletions
18
src/module-elasticsuite-catalog-rule/view/adminhtml/web/css/source/_module.less
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// /** | ||
// * DISCLAIMER | ||
// * | ||
// * Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer | ||
// * versions in the future. | ||
// * | ||
// * | ||
// * @category Smile | ||
// * @package Smile\ElasticsuiteCatalogRule | ||
// * @author Aurelien FOUCRET <[email protected]> | ||
// * @copyright 2016 Smile | ||
// * @license Open Software License ("OSL") v. 3.0 | ||
// */ | ||
|
||
// Display fieldsets legend into catalog category merchandising tab. | ||
.admin__fieldset.virtual-rule-fieldset { | ||
padding: 0 | ||
} |
96 changes: 96 additions & 0 deletions
96
...le-elasticsuite-catalog-rule/view/adminhtml/web/js/component/catalog/product/form/rule.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer | ||
* versions in the future. | ||
* | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCatalogRule | ||
* @author Aurelien FOUCRET <[email protected]> | ||
* @copyright 2016 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
define([ | ||
'Magento_Ui/js/form/components/html', | ||
'jquery', | ||
'MutationObserver' | ||
], function (Component, $) { | ||
'use strict'; | ||
|
||
return Component.extend({ | ||
defaults: { | ||
value: {}, | ||
links: { | ||
value: '${ $.provider }:${ $.dataScope }' | ||
}, | ||
additionalClasses: "admin__fieldset virtual-rule-fieldset" | ||
}, | ||
initialize: function () { | ||
this._super(); | ||
this.initRuleListener(); | ||
}, | ||
|
||
initObservable: function () { | ||
this._super(); | ||
this.ruleObject = {}; | ||
this.observe('ruleObject value'); | ||
|
||
return this; | ||
}, | ||
|
||
initRuleListener: function () { | ||
var observer = new MutationObserver(function () { | ||
var rootNode = document.getElementById(this.index); | ||
if (rootNode !== null) { | ||
this.rootNode = document.getElementById(this.index); | ||
observer.disconnect(); | ||
var ruleObserver = new MutationObserver(this.updateRule.bind(this)); | ||
var ruleObserverConfig = {childList:true, subtree: true, attributes: true}; | ||
ruleObserver.observe(rootNode, ruleObserverConfig); | ||
this.updateRule(); | ||
} | ||
}.bind(this)); | ||
var observerConfig = {childList: true, subtree: true}; | ||
observer.observe(document, observerConfig) | ||
}, | ||
|
||
updateRule: function () { | ||
var ruleObject = {}; | ||
var hashValues = []; | ||
|
||
$(this.rootNode).find("[name*=" + this.index + "]").each(function () { | ||
hashValues.push(this.name + this.value.toString()); | ||
var currentRuleObject = ruleObject; | ||
|
||
var path = this.name.match(/\[([^[\[\]]+)\]/g) | ||
.map(function (pathItem) { return pathItem.substr(1, pathItem.length-2); }); | ||
|
||
while (path.length > 1) { | ||
var currentKey = path.shift(); | ||
|
||
if (currentRuleObject[currentKey] === undefined) { | ||
currentRuleObject[currentKey] = {}; | ||
} | ||
|
||
currentRuleObject = currentRuleObject[currentKey]; | ||
} | ||
|
||
currentKey = path.shift(); | ||
currentRuleObject[currentKey] = $(this).val(); | ||
}); | ||
|
||
var newHashValue = hashValues.sort().join(''); | ||
|
||
if (newHashValue !== this.currentHashValue) { | ||
if (this.currentHashValue !== undefined) { | ||
this.bubble('update', true); | ||
} | ||
this.currentHashValue = newHashValue; | ||
this.ruleObject(ruleObject); | ||
this.value(ruleObject); | ||
} | ||
} | ||
}) | ||
}); |
96 changes: 0 additions & 96 deletions
96
src/module-elasticsuite-catalog/Block/Adminhtml/Catalog/Product/Form/Renderer/Sort.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.