33. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2021-05-13 09:08:39 +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.

33.1 Files compared

#LocationFileLast Modified
12021-05-13 09:08:39 +0000
2/Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/Plugins/Model/Layer/FilterItem.php2016-09-27 16:15:52 +0000

33.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged00
Changed00
Inserted175
Removed00

33.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

33.4 Active regular expressions

No regular expressions were active.

33.5 Comparison detail

    1 <?php
    2 namespace Mageplaza\LayeredNavigation\Plugins\Model\Layer\Filter;
    3 
    4 class Item
    5 {
    6 »       protected $_url;
    7 »       protected $_htmlPagerBlock;
    8 »       protected $_request;
    9 »       protected $_moduleHelper;
    10 
    11 »       public function __construct(
    12 »       »       \Magento\Framework\UrlInterface $url,
    13 »       »       \Magento\Theme\Block\Html\Pager $htmlPagerBlock,
    14 »       »       \Magento\Framework\App\RequestInterface $request,
    15 »       »       \Mageplaza\LayeredNavigation\Helper\Data $moduleHelper
    16 »       ) {
    17 »       »       $this->_url = $url;
    18 »       »       $this->_htmlPagerBlock = $htmlPagerBlock;
    19 »       »       $this->_request = $request;
    20 »       »       $this->_moduleHelper = $moduleHelper;
    21 »       }
    22 
    23     public function aroundGetUrl(\Magento\Catalog\Model\Layer\Filter\Item $item, $proceed)
    24     {
    25 »       »       if(!$this->_moduleHelper->isEnabled()){
    26 »       »       »       return $proceed();
    27 »       »       }
    28 
    29 »       »       $value = array();
    30 »       »       $requestVar = $item->getFilter()->getRequestVar();
    31 »       »       if($requestValue = $this->_request->getParam($requestVar)){
    32 »       »       »       $value = explode(',', $requestValue);
    33 »       »       }
    34 »       »       $value[] = $item->getValue();
    35 
    36 »       »       if($requestVar == 'price'){
    37 »       »       »       $value = ["{price_start}-{price_end}"];
    38 »       »       }
    39 
    40         $query = [
    41 »       »       »       $item->getFilter()->getRequestVar() => implode(',', $value),
    42             // exclude current page from urls
    43 »       »       »       $this->_htmlPagerBlock->getPageVarName() => null,
    44         ];
    45         return $this->_url->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true, '_query' => $query]);
    46     }
    47 
    48     public function aroundGetRemoveUrl(\Magento\Catalog\Model\Layer\Filter\Item $item, $proceed)
    49     {
    50 »       »       if(!$this->_moduleHelper->isEnabled()){
    51 »       »       »       return $proceed();
    52 »       »       }
    53 
    54 »       »       $value = array();
    55 »       »       $requestVar = $item->getFilter()->getRequestVar();
    56 »       »       if($requestValue = $this->_request->getParam($requestVar)){
    57 »       »       »       $value = explode(',', $requestValue);
    58 »       »       }
    59 
    60 »       »       if(in_array($item->getValue(), $value)){
    61 »       »       »       $value = array_diff($value, array($item->getValue()));
    62 »       »       }
    63 
    64 »       »       if($requestVar == 'price'){
    65 »       »       »       $value = [];
    66 »       »       }
    67 
    68         $query = [$requestVar => count($value) ? implode(',', $value) : $item->getFilter()->getResetValue()];
    69         $params['_current'] = true;
    70         $params['_use_rewrite'] = true;
    71         $params['_query'] = $query;
    72         $params['_escape'] = true;
    73         return $this->_url->getUrl('*/*/*', $params);
    74     }
    75 }