swissup / module-breeze-amasty-shopby
Amasty Improved Layered Navigation integration with Breeze Frontend
Installs: 1 722
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Language:JavaScript
Type:magento2-module
README
Tested on Improved Layered Navigation by Amasty 3.3.0
Required patches
vendor/amasty/shopby/view/frontend/web/js/amShopbyAjax.js
- Replace the following code in the
callAjax
function (line 180):
return $.ajax({ url: clearUrl, data: data, cache: true, success: function (response) { try { $.mage.amShopbyAjax.prototype.startAjax = false; response = JSON.parse(response); if (response.isDisplayModePage) { throw new Error(); }
with
return $.ajax({ url: clearUrl, data: data, cache: true, success: function (response) { try { $.mage.amShopbyAjax.prototype.startAjax = false; response = typeof response === 'object' ? response : JSON.parse(response);// Breeze patch if (response.isDisplayModePage) { throw new Error(); }
- In the same function, replace (line 220):
$(document).trigger('amshopby:ajax_filter_applied'); } catch (e) { var url = self.clearUrl ? self.clearUrl : self.options.clearUrl; window.location = (this.url.indexOf('shopbyAjax') == -1) ? this.url : url; }
with
$(document).trigger('amshopby:ajax_filter_applied'); } catch (e) { var url = self.clearUrl ? self.clearUrl : self.options.clearUrl; window.location = url; // Breeze patch }
- In the
updateTopNavigation
function, replace (line 422):
if (!data.categoryProducts || data.categoryProducts.indexOf('amasty-catalog-topnav') == -1) { $topNavigation = $(this.selectors.top_navigation).first(); $topNavigation.replaceWith(data.navigationTop); // we should reinitialize element - because it was replaced $topNavigation = $(this.selectors.top_navigation).first(); $topNavigation.trigger('contentUpdated'); }
with
if (!data.categoryProducts || data.categoryProducts.indexOf('amasty-catalog-topnav') == -1) { $topNavigation = $(this.selectors.top_navigation).first(); if ($topNavigation.length) { $topNavigation.replaceWith(data.navigationTop); // we should reinitialize element - because it was replaced $topNavigation = $(this.selectors.top_navigation).first(); $topNavigation.trigger('contentUpdated'); } }
Installation
composer require swissup/module-breeze-amasty-shopby bin/magento setup:upgrade --safe-mode=1