Skip to content

Commit 24a927d

Browse files
Merge pull request #23 from mageplaza/2.3-develop
2.3 develop
2 parents 217808f + ad50cf0 commit 24a927d

File tree

3 files changed

+87
-93
lines changed

3 files changed

+87
-93
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"mageplaza/module-core": "^1.4.5"
66
},
77
"type": "magento2-module",
8-
"version": "1.0.6",
8+
"version": "1.0.7",
99
"license": "proprietary",
1010
"authors": [
1111
{

view/frontend/templates/layer/view.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<script type="text/x-magento-init">
8080
{
8181
".block-content.filter-content":{
82-
"mpAjax": <?= /** @noEscape */ $block->escapeJs($layerConfig) ?>
82+
"mpAjax": <?= /** @noEscape */ $layerConfig ?>
8383
}
8484
}
8585
</script>
Lines changed: 85 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,85 @@
1-
/**
2-
* Mageplaza
3-
*
4-
* NOTICE OF LICENSE
5-
*
6-
* This source file is subject to the Mageplaza.com license that is
7-
* available through the world-wide-web at this URL:
8-
* https://www.mageplaza.com/LICENSE.txt
9-
*
10-
* DISCLAIMER
11-
*
12-
* Do not edit or add to this file if you wish to upgrade this extension to newer
13-
* version in the future.
14-
*
15-
* @category Mageplaza
16-
* @package Mageplaza_AjaxLayer
17-
* @copyright Copyright (c) Mageplaza (http://www.mageplaza.com/)
18-
* @license https://www.mageplaza.com/LICENSE.txt
19-
*/
20-
21-
define(
22-
[
23-
'jquery',
24-
'mage/storage',
25-
'Mageplaza_AjaxLayer/js/model/loader',
26-
'mage/apply/main'
27-
],
28-
function ($, storage, loader, mage) {
29-
'use strict';
30-
31-
var productContainer = $('#layer-product-list'),
32-
layerContainer = $('.layered-filter-block-container'),
33-
quickViewContainer = $('#mpquickview-popup');
34-
35-
return function (submitUrl, isChangeUrl) {
36-
/** save active state */
37-
var actives = [],
38-
data;
39-
$('.filter-options-item').each(function (index) {
40-
if ($(this).hasClass('active')) {
41-
actives.push($(this).attr('attribute'));
42-
}
43-
});
44-
window.layerActiveTabs = actives;
45-
46-
/** start loader */
47-
loader.startLoader();
48-
49-
/** change browser url */
50-
if (typeof window.history.pushState === 'function' && (typeof isChangeUrl === 'undefined')) {
51-
window.history.pushState({url: submitUrl}, '', submitUrl);
52-
}
53-
54-
if (isChangeUrl){
55-
data = '{}';
56-
}else{
57-
data = JSON.stringify({'mp_layer': 1});
58-
}
59-
60-
return storage.post(submitUrl, data).done(
61-
function (response) {
62-
if (response.backUrl) {
63-
window.location = response.backUrl;
64-
return;
65-
}
66-
if (response.navigation) {
67-
layerContainer.html(response.navigation);
68-
}
69-
if (response.products) {
70-
productContainer.html(response.products);
71-
}
72-
if (response.quickview) {
73-
quickViewContainer.html(response.quickview);
74-
}
75-
76-
if (mage) {
77-
mage.apply();
78-
}
79-
}
80-
).fail(
81-
function () {
82-
window.location.reload();
83-
}
84-
).always(
85-
function () {
86-
loader.stopLoader();
87-
}
88-
);
89-
};
90-
}
91-
);
1+
/**
2+
* Mageplaza
3+
*
4+
* NOTICE OF LICENSE
5+
*
6+
* This source file is subject to the Mageplaza.com license that is
7+
* available through the world-wide-web at this URL:
8+
* https://www.mageplaza.com/LICENSE.txt
9+
*
10+
* DISCLAIMER
11+
*
12+
* Do not edit or add to this file if you wish to upgrade this extension to newer
13+
* version in the future.
14+
*
15+
* @category Mageplaza
16+
* @package Mageplaza_AjaxLayer
17+
* @copyright Copyright (c) Mageplaza (http://www.mageplaza.com/)
18+
* @license https://www.mageplaza.com/LICENSE.txt
19+
*/
20+
21+
define(
22+
[
23+
'jquery',
24+
'mage/storage',
25+
'Mageplaza_AjaxLayer/js/model/loader',
26+
'mage/apply/main'
27+
],
28+
function ($, storage, loader, mage) {
29+
'use strict';
30+
31+
var productContainer = $('#layer-product-list'),
32+
layerContainer = $('.layered-filter-block-container'),
33+
quickViewContainer = $('#mpquickview-popup');
34+
35+
return function (submitUrl, isChangeUrl) {
36+
/** save active state */
37+
var actives = [],
38+
data;
39+
$('.filter-options-item').each(function (index) {
40+
if ($(this).hasClass('active')) {
41+
actives.push($(this).attr('attribute'));
42+
}
43+
});
44+
window.layerActiveTabs = actives;
45+
46+
/** start loader */
47+
loader.startLoader();
48+
49+
/** change browser url */
50+
if (typeof window.history.pushState === 'function' && (typeof isChangeUrl === 'undefined')) {
51+
window.history.pushState({url: submitUrl}, '', submitUrl);
52+
}
53+
54+
return storage.get(submitUrl).done(
55+
function (response) {
56+
if (response.backUrl) {
57+
window.location = response.backUrl;
58+
return;
59+
}
60+
if (response.navigation) {
61+
layerContainer.html(response.navigation);
62+
}
63+
if (response.products) {
64+
productContainer.html(response.products);
65+
}
66+
if (response.quickview) {
67+
quickViewContainer.html(response.quickview);
68+
}
69+
70+
if (mage) {
71+
mage.apply();
72+
}
73+
}
74+
).fail(
75+
function () {
76+
window.location.reload();
77+
}
78+
).always(
79+
function () {
80+
loader.stopLoader();
81+
}
82+
);
83+
};
84+
}
85+
);

0 commit comments

Comments
 (0)