Skip to content

Commit 864fd9e

Browse files
author
Dmytro Poperechnyy
committed
Merge remote-tracking branch 'origin/develop' into MAGETWO-44327
2 parents 3f9889c + e0a56a7 commit 864fd9e

File tree

21 files changed

+257
-100
lines changed

21 files changed

+257
-100
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@
466466
click: function () {
467467
(function ($) {
468468
$.ajax({
469-
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>//',
469+
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>',
470470
method: 'POST',
471471
data: pd.join(""),
472472
showLoader: true

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,5 @@ define([
761761
}
762762
};
763763

764-
jQuery(document).ready(function(){
765-
productConfigure = new ProductConfigure();
766-
});
767-
764+
productConfigure = new ProductConfigure();
768765
});

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\CatalogSearch\Model\Adapter\Mysql\Filter;
77

88
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
910
use Magento\CatalogSearch\Model\Search\TableMapper;
1011
use Magento\Eav\Model\Config;
1112
use Magento\Framework\App\ResourceConnection;
@@ -97,7 +98,7 @@ public function process(FilterInterface $filter, $isNegation, $query)
9798
*/
9899
private function processQueryWithField(FilterInterface $filter, $isNegation, $query)
99100
{
100-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
101+
/** @var Attribute $attribute */
101102
$attribute = $this->config->getAttribute(Product::ENTITY, $filter->getField());
102103
if ($filter->getField() === 'price') {
103104
$resultQuery = str_replace(
@@ -114,24 +115,16 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
114115
$this->connection->quoteIdentifier($alias . '.' . $attribute->getAttributeCode()),
115116
$query
116117
);
117-
} elseif ($filter->getType() === FilterInterface::TYPE_TERM
118-
&& in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
118+
} elseif (
119+
$filter->getType() === FilterInterface::TYPE_TERM &&
120+
in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
119121
) {
120-
$alias = $this->tableMapper->getMappingAlias($filter);
121-
if (is_array($filter->getValue())) {
122-
$value = sprintf(
123-
'%s IN (%s)',
124-
($isNegation ? 'NOT' : ''),
125-
implode(',', $filter->getValue())
126-
);
127-
} else {
128-
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
129-
}
130-
$resultQuery = sprintf(
131-
'%1$s.value %2$s',
132-
$alias,
133-
$value
134-
);
122+
$resultQuery = $this->processTermSelect($filter, $isNegation);
123+
} elseif (
124+
$filter->getType() === FilterInterface::TYPE_RANGE &&
125+
in_array($attribute->getBackendType(), ['decimal', 'int'], true)
126+
) {
127+
$resultQuery = $this->processRangeNumeric($filter, $query, $attribute);
135128
} else {
136129
$table = $attribute->getBackendTable();
137130
$select = $this->connection->select();
@@ -161,4 +154,57 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
161154

162155
return $resultQuery;
163156
}
157+
158+
/**
159+
* @param FilterInterface $filter
160+
* @param string $query
161+
* @param Attribute $attribute
162+
* @return string
163+
*/
164+
private function processRangeNumeric(FilterInterface $filter, $query, $attribute)
165+
{
166+
$tableSuffix = $attribute->getBackendType() === 'decimal' ? '_decimal' : '';
167+
$table = $this->resource->getTableName("catalog_product_index_eav{$tableSuffix}");
168+
$select = $this->connection->select();
169+
170+
$currentStoreId = $this->scopeResolver->getScope()->getId();
171+
172+
$select->from(['main_table' => $table], 'entity_id')
173+
->columns([$filter->getField() => 'main_table.value'])
174+
->where('main_table.attribute_id = ?', $attribute->getAttributeId())
175+
->where('main_table.store_id = ?', $currentStoreId)
176+
->having($query);
177+
178+
$resultQuery = 'search_index.entity_id IN (
179+
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
180+
)';
181+
182+
return $resultQuery;
183+
}
184+
185+
/**
186+
* @param FilterInterface $filter
187+
* @param bool $isNegation
188+
* @return string
189+
*/
190+
private function processTermSelect(FilterInterface $filter, $isNegation)
191+
{
192+
$alias = $this->tableMapper->getMappingAlias($filter);
193+
if (is_array($filter->getValue())) {
194+
$value = sprintf(
195+
'%s IN (%s)',
196+
($isNegation ? 'NOT' : ''),
197+
implode(',', $filter->getValue())
198+
);
199+
} else {
200+
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
201+
}
202+
$resultQuery = sprintf(
203+
'%1$s.value %2$s',
204+
$alias,
205+
$value
206+
);
207+
208+
return $resultQuery;
209+
}
164210
}

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
newAttributeSetContainer = $('[data-role=affected-attribute-set-new-name-container]'),
3434
existingAttributeSetContainer = $('[data-role=affected-attribute-set-existing-name-container]');
3535

36+
$form.find('input[type=text]').on('keypress',function(e){
37+
if(e.keyCode === 13){
38+
e.preventDefault();
39+
$form.closest('[data-role=modal]').find('button[data-action=confirm]').click();
40+
}
41+
});
3642

3743
$('[data-form=edit-product]').append($('<input>', {
3844
type: 'hidden',
@@ -48,6 +54,9 @@
4854
},
4955
buttons: [{
5056
text: '<?php /* @escapeNotVerified */ echo __('Confirm'); ?>',
57+
attr: {
58+
'data-action': 'confirm'
59+
},
5160
'class': 'action-secondary',
5261
click: function() {
5362
var affectedAttributeSetId = $form.find('input[name=affected-attribute-set]:checked').val();

app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@
2424
<arguments>
2525
<argument name="id" xsi:type="string">grouped_grid_popup</argument>
2626
</arguments>
27-
<block class="Magento\Backend\Block\Widget\Grid\Column" as="entity_id">
27+
<block class="Magento\Backend\Block\Widget\Grid\Column" as="entity_ids">
2828
<arguments>
29-
<argument name="header" xsi:type="string" translate="true">ID</argument>
3029
<argument name="type" xsi:type="string">skip-list</argument>
3130
<argument name="renderer" xsi:type="string">Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkbox</argument>
31+
<argument name="name" xsi:type="string">entity_ids</argument>
32+
<argument name="index" xsi:type="string">entity_id</argument>
33+
</arguments>
34+
</block>
35+
<block class="Magento\Backend\Block\Widget\Grid\Column" as="entity_id">
36+
<arguments>
37+
<argument name="header" xsi:type="string" translate="true">ID</argument>
3238
<argument name="index" xsi:type="string">entity_id</argument>
3339
</arguments>
3440
</block>

app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ define([
132132

133133
if (!target.is('input')) {
134134
target.closest('[data-role=row]')
135-
.find('[data-column=entity_id] input')
135+
.find('[data-column=entity_ids] input')
136136
.prop('checked', function (element, value) {
137137
return !value;
138138
})
@@ -142,7 +142,7 @@ define([
142142

143143
popup.on(
144144
'change',
145-
'[data-role=row] [data-column=entity_id] input',
145+
'[data-role=row] [data-column=entity_ids] input',
146146
$.proxy(function (event) {
147147
var element = $(event.target),
148148
product = {};
@@ -175,12 +175,12 @@ define([
175175
return $(element).val();
176176
}).toArray();
177177
ajaxSettings.data.filter = $.extend(ajaxSettings.data.filter || {}, {
178-
'entity_id': ids
178+
'entity_ids': ids
179179
});
180180
})
181181
.on('gridajax', function (event, ajaxRequest) {
182182
ajaxRequest.done(function () {
183-
popup.find('[data-role=row] [data-column=entity_id] input')
183+
popup.find('[data-role=row] [data-column=entity_ids] input')
184184
.each(function (index, element) {
185185
var $element = $(element);
186186
$element.prop('checked', !!selectedProductList[$element.val()]);

app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,34 @@
2121
"use strict";
2222

2323
$.each({
24+
'validate-card-type': [
25+
function (number, item, allowedTypes) {
26+
var cardInfo,
27+
i,
28+
l;
29+
30+
if (!creditCardNumberValidator(number).isValid) {
31+
return false;
32+
} else {
33+
cardInfo = creditCardNumberValidator(number).card;
34+
35+
for (i = 0, l = allowedTypes.length; i < l; i++) {
36+
if (cardInfo.title == allowedTypes[i].type) {
37+
return true;
38+
}
39+
}
40+
return false;
41+
}
42+
},
43+
'Please enter a valid credit card type number.'
44+
],
2445
'validate-card-number': [
2546
/**
2647
* Validate credit card number based on mod 10
2748
* @param number - credit card number
2849
* @return {boolean}
2950
*/
30-
function (number) {
51+
function (number) {
3152
return creditCardNumberValidator(number).isValid;
3253
},
3354
'Please enter a valid credit card number.'

app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
id: getCode() + '_cc_number',
5151
title: $t('Credit Card Number'),
5252
'data-container': getCode() + '-cc-number',
53-
'data-validate': JSON.stringify({'required-number':true, 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})},
53+
'data-validate': JSON.stringify({'required-number':true, 'validate-card-type':getCcAvailableTypesValues(), 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})},
5454
enable: isActive($parents),
5555
value: creditCardNumber,
5656
valueUpdate: 'keyup' "/>

app/code/Magento/ProductVideo/view/adminhtml/web/js/video-modal.js

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,54 @@
44
*/
55
define([
66
'jquery',
7+
'productGallery',
78
'jquery/ui',
89
'Magento_Ui/js/modal/modal',
910
'mage/translate',
1011
'mage/backend/tree-suggest',
1112
'mage/backend/validation'
12-
], function ($) {
13+
], function ($, productGallery) {
1314
'use strict';
1415

15-
$.widget('mage.productGallery',
16-
$.mage.productGallery,
17-
{
18-
19-
/**
20-
* Fired when windget initialization start
21-
* @private
22-
*/
23-
_create: function () {
24-
this._bind();
25-
},
26-
27-
/**
28-
* Bind events
29-
* @private
30-
*/
31-
_bind: function () {
32-
$(this.element).on('click', this.showModal.bind(this));
33-
$('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this));
34-
},
35-
36-
/**
37-
* Open dialog for external video
38-
* @private
39-
*/
40-
_onOpenDialog: function (e, imageData) {
41-
42-
if (imageData['media_type'] !== 'external-video') {
43-
return;
44-
}
45-
this.showModal();
46-
},
47-
48-
/**
49-
* Fired on trigger "openModal"
50-
*/
51-
showModal: function () {
52-
53-
$('#new-video').modal('openModal');
16+
$.widget('mage.productGallery', productGallery, {
17+
18+
/**
19+
* * Fired when widget initialization start
20+
* @private
21+
*/
22+
_create: function () {
23+
this._bind();
24+
},
25+
26+
/**
27+
* Bind events
28+
* @private
29+
*/
30+
_bind: function () {
31+
$(this.element).on('click', this.showModal.bind(this));
32+
$('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this));
33+
},
34+
35+
/**
36+
* Open dialog for external video
37+
* @private
38+
*/
39+
_onOpenDialog: function (e, imageData) {
40+
41+
if (imageData['media_type'] !== 'external-video') {
42+
return;
5443
}
44+
this.showModal();
45+
},
46+
47+
/**
48+
* Fired on trigger "openModal"
49+
*/
50+
showModal: function () {
51+
52+
$('#new-video').modal('openModal');
5553
}
56-
);
54+
});
5755

5856
return $.mage.productGallery;
5957
});

app/code/Magento/ProductVideo/view/frontend/layout/catalog_product_view.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
*/
77
-->
88
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
9-
<head>
10-
<link src="Magento_ProductVideo::js/fotorama-add-video-events.js"/>
11-
<link src="Magento_ProductVideo::js/load-player.js"/>
12-
</head>
139
<body>
1410
<referenceContainer name="product.info.media">
1511
<block class="Magento\ProductVideo\Block\Product\View\Gallery" name="product.info.media.video" after="product.info.media.image" template="product/view/gallery.phtml"/>

0 commit comments

Comments
 (0)