Produced by Araxis Merge on 2020-08-14 00:01:33 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Porto v3.2.3/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/Plugin/Model/Adapter | Preprocessor.php | 2018-10-10 20:33:20 +0000 |
| 2 | Porto v3.2.4/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/Plugin/Model/Adapter | Preprocessor.php | 2020-06-26 11:11:14 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 16 | 126 |
| Changed | 8 | 36 |
| Inserted | 7 | 23 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | <?php | 1 | <?php | |||
| 2 | /** | 2 | /** | |||
| 3 | * Mageplaza | 3 | * Mageplaza | |||
| 4 | * | 4 | * | |||
| 5 | * NOTICE OF LICENSE | 5 | * NOTICE OF LICENSE | |||
| 6 | * | 6 | * | |||
| 7 | * This source file is subject to the Mageplaza.com license that is | 7 | * This source file is subject to the Mageplaza.com license that is | |||
| 8 | * available through the world-wide-web at this URL: | 8 | * available through the world-wide-web at this URL: | |||
| 9 | * https://www.mageplaza.com/LICENSE.txt | 9 | * https://www.mageplaza.com/LICENSE.txt | |||
| 10 | * | 10 | * | |||
| 11 | * DISCLAIMER | 11 | * DISCLAIMER | |||
| 12 | * | 12 | * | |||
| 13 | * Do not edit or add to this file if you wish to upgrade this extension to newer | 13 | * Do not edit or add to this file if you wish to upgrade this extension to newer | |||
| 14 | * version in the future. | 14 | * version in the future. | |||
| 15 | * | 15 | * | |||
| 16 | * @category Mageplaza | 16 | * @category Mageplaza | |||
| 17 | * @package Mageplaza_LayeredNavigation | 17 | * @package Mageplaza_LayeredNavigation | |||
| 18 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | 18 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | |||
| 19 | * @license https://www.mageplaza.com/LICENSE.txt | 19 | * @license https://www.mageplaza.com/LICENSE.txt | |||
| 20 | */ | 20 | */ | |||
| 21 | 21 | |||||
| 22 | namespace Mageplaza\LayeredNavigation\Plugin\Model\Adapter; | 22 | namespace Mageplaza\LayeredNavigation\Plugin\Model\Adapter; | |||
| 23 | 23 | |||||
| 24 | use Closure; | |||||
| 24 | use Magento\Framework\App\ProductMetadataInterface; | 25 | use Magento\Framework\App\ProductMetadataInterface; | |||
| 26 | use Magento\Framework\ObjectManagerInterface; | |||||
| 27 | use Mageplaza\LayeredNavigation\Helper\Data; | |||||
| 25 | 28 | |||||
| 26 | /** | 29 | /** | |||
| 27 | * Class Preprocessor | 30 | * Class Preprocessor | |||
| 28 | * @package Mageplaza\LayeredNavigation\Model\Plugin\Adapter | 31 | * @package Mageplaza\LayeredNavigation\Model\Plugin\Adapter | |||
| 29 | */ | 32 | */ | |||
| 30 | class Preprocessor | 33 | class Preprocessor | |||
| 31 | { | 34 | { | |||
| 32 | /** | 35 | /** | |||
| 33 | * @type \Mageplaza\LayeredNavigation\Helper\Data | 36 | * @type Data | |||
| 34 | */ | 37 | */ | |||
| 35 | protected $_moduleHelper; | 38 | protected $_moduleHelper; | |||
| 36 | 39 | |||||
| 37 | /** | 40 | /** | |||
| 38 | * @type \Magento\Framework\ObjectManagerInterface | 41 | * @type | |||
| 39 | */ | 42 | */ | |||
| 40 | protected $objectManager; | 43 | protected $objectManager; | |||
| 41 | 44 | |||||
| 42 | /** | 45 | /** | |||
| 46 | * @var ProductMetadataInterface | |||||
| 47 | */ | |||||
| 48 | protected $productMetadata; | |||||
| 49 | ||||||
| 50 | /** | |||||
| 43 | * Preprocessor constructor. | 51 | * Preprocessor constructor. | |||
| 44 | * @param \Mageplaza\LayeredNavigation\Helper\Data $moduleHelper | 52 | * | |||
| 45 | * @param \Magento\Framework\ObjectManagerInterface $objectManager | 53 | * @param | |||
| 54 | * @param | |||||
| 55 | * @param ProductMetadataInterface $productMetadata | |||||
| 46 | */ | 56 | */ | |||
| 47 | public function __construct( | 57 | public function __construct( | |||
| 48 | \Mageplaza\LayeredNavigation\Helper\Data $moduleHelper, | 58 | | |||
| 49 | \Magento\Framework\ObjectManagerInterface $objectManager | 59 | | |||
| 50 | ) | 60 | ProductMetadataInterface $productMetadata | |||
| 51 | | 61 | ) { | |||
| 52 | $this->_moduleHelper = $moduleHelper; | 62 | $this->_moduleHelper = $moduleHelper; | |||
| 53 | $this->objectManager = $objectManager; | 63 | $this->objectManager = $objectManager; | |||
| 64 | $this->productMetadata = $productMetadata; | |||||
| 54 | } | 65 | } | |||
| 55 | 66 | |||||
| 56 | /** | 67 | /** | |||
| 57 | * @param \Magento\CatalogSearch\Model\Adapter\Mysql\Filter\Preprocessor $subject | 68 | * @param \Magento\CatalogSearch\Model\Adapter\Mysql\Filter\Preprocessor $subject | |||
| 58 | * @param \Closure $proceed | 69 | * @param | |||
| 59 | * @param $filter | 70 | * @param $filter | |||
| 60 | * @param $isNegation | 71 | * @param $isNegation | |||
| 61 | * @param $query | 72 | * @param $query | |||
| 73 | * | |||||
| 62 | * @return string | 74 | * @return string | |||
| 63 | */ | 75 | */ | |||
| 64 | public function aroundProcess(\Magento\CatalogSearch\Model\Adapter\Mysql\Filter\Preprocessor $subject, \Closure $proceed, $filter, $isNegation, $query) | 76 | public function aroundProcess( | |||
| 65 | { | 77 | | |||
| 66 | $productMetadata = $this->objectManager->get(ProductMetadataInterface::class); | 78 | Closure $proceed, | |||
| 67 | $version = $productMetadata->getVersion(); //will return the magento version | 79 | $filter, | |||
| 68 | 80 | $isNegation, | ||||
| 81 | $query | |||||
| 82 | ) { | |||||
| 69 | if ($this->_moduleHelper->isEnabled() && ($filter->getField() === 'category_ids')) { | 83 | if ($this->_moduleHelper->isEnabled() && ($filter->getField() === 'category_ids')) { | |||
| 84 | $filterValue = implode(',', array_map([$this, 'validateCatIds'], explode(',', $filter->getValue()))); | |||||
| 85 | ||||||
| 86 | $version = $this->productMetadata->getVersion(); | |||||
| 70 | if (version_compare($version, '2.1.13', '>=') && version_compare($version, '2.1.15', '<=')) { | 87 | if (version_compare($version, '2.1.13', '>=') && version_compare($version, '2.1.15', '<=')) { | |||
| 71 | return 'category_products_index.category_id IN (' . $filter->getValue() . ')'; | 88 | return 'category_products_index.category_id IN (' . $filterValue . ')'; | |||
| 72 | } | 89 | } | |||
| 73 | 90 | |||||
| 74 | return 'category_ids_index.category_id IN (' . $filter->getValue() . ')'; | 91 | return 'category_ids_index.category_id IN (' . $filterValue . ')'; | |||
| 75 | } | 92 | } | |||
| 76 | 93 | |||||
| 77 | return $proceed($filter, $isNegation, $query); | 94 | return $proceed($filter, $isNegation, $query); | |||
| 78 | } | 95 | } | |||
| 96 | ||||||
| 97 | /** | |||||
| 98 | * @param $catId | |||||
| 99 | * | |||||
| 100 | * @return int | |||||
| 101 | */ | |||||
| 102 | protected function validateCatIds($catId) | |||||
| 103 | { | |||||
| 104 | return (int) $catId; | |||||
| 105 | } | |||||
| 79 | } | 106 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.