114. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-03-13 03:00:45 +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.

114.1 Files compared

#LocationFileLast Modified
1Porto v4.0.4/Porto Theme/app/code/Smartwave/Porto/BlockCategoryCollection.php2018-07-18 19:42:46 +0000
2Porto v4.0.5/Porto Theme/app/code/Smartwave/Porto/BlockCategoryCollection.php2018-07-18 19:42:46 +0000

114.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged1248
Changed00
Inserted00
Removed00

114.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

114.4 Active regular expressions

No regular expressions were active.

114.5 Comparison detail

1 <?php 1 <?php
2 namespace Smartwave\Porto\Block; 2 namespace Smartwave\Porto\Block;
3  3 
4 class CategoryCollection extends \Magento\Framework\View\Element\Template 4 class CategoryCollection extends \Magento\Framework\View\Element\Template
5 { 5 {
6  6 
7      protected $_categoryHelper; 7      protected $_categoryHelper;
8      protected $categoryFlatConfig; 8      protected $categoryFlatConfig;
9      protected $topMenu; 9      protected $topMenu;
10     /** 10     /**
11      * @param \Magento\Framework\View\Element\Template\Context $context 11      * @param \Magento\Framework\View\Element\Template\Context $context
12      * @param \Magento\Catalog\Helper\Category $categoryHelper 12      * @param \Magento\Catalog\Helper\Category $categoryHelper
13      * @param array $data 13      * @param array $data
14      */ 14      */
15     public function __construct( 15     public function __construct(
16         \Magento\Framework\View\Element\Template\Context $context, 16         \Magento\Framework\View\Element\Template\Context $context,
17         \Magento\Catalog\Helper\Category $categoryHelper, 17         \Magento\Catalog\Helper\Category $categoryHelper,
18         \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, 18         \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState,
19         \Magento\Theme\Block\Html\Topmenu $topMenu 19         \Magento\Theme\Block\Html\Topmenu $topMenu
20     ) { 20     ) {
21  21 
22         $this->_categoryHelper = $categoryHelper; 22         $this->_categoryHelper = $categoryHelper;
23         $this->categoryFlatConfig = $categoryFlatState; 23         $this->categoryFlatConfig = $categoryFlatState;
24         $this->topMenu = $topMenu; 24         $this->topMenu = $topMenu;
25         parent::__construct($context); 25         parent::__construct($context);
26     } 26     }
27     /** 27     /**
28      * Return categories helper 28      * Return categories helper
29      */    29      */   
30     public function getCategoryHelper() 30     public function getCategoryHelper()
31     { 31     {
32         return $this->_categoryHelper; 32         return $this->_categoryHelper;
33     } 33     }
34  34 
35     /** 35     /**
36      * Return categories helper 36      * Return categories helper
37      * getHtml($outermostClass = '', $childrenWrapClass = '', $limit = 0) 37      * getHtml($outermostClass = '', $childrenWrapClass = '', $limit = 0)
38      * example getHtml('level-top', 'submenu', 0) 38      * example getHtml('level-top', 'submenu', 0)
39      */    39      */   
40     public function getHtml() 40     public function getHtml()
41     { 41     {
42         return $this->topMenu->getHtml(); 42         return $this->topMenu->getHtml();
43     } 43     }
44     /** 44     /**
45      * Retrieve current store categories 45      * Retrieve current store categories
46      * 46      *
47      * @param bool|string $sorted 47      * @param bool|string $sorted
48      * @param bool $asCollection 48      * @param bool $asCollection
49      * @param bool $toLoad 49      * @param bool $toLoad
50      * @return \Magento\Framework\Data\Tree\Node\Collection|\Magento\Catalog\Model\Resource\Category\Collection|array 50      * @return \Magento\Framework\Data\Tree\Node\Collection|\Magento\Catalog\Model\Resource\Category\Collection|array
51      */     51      */    
52    public function getStoreCategories($sorted = false, $asCollection = false, $toLoad = true) 52    public function getStoreCategories($sorted = false, $asCollection = false, $toLoad = true)
53     { 53     {
54         return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad); 54         return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad);
55     } 55     }
56     /** 56     /**
57      * Retrieve child store categories 57      * Retrieve child store categories
58      * 58      *
59      */  59      */ 
60     public function getChildCategories($category) 60     public function getChildCategories($category)
61     { 61     {
62         if ($this->categoryFlatConfig->isFlatEnabled() && $category->getUseFlatResource()) { 62         if ($this->categoryFlatConfig->isFlatEnabled() && $category->getUseFlatResource()) {
63             $subcategories = (array)$category->getChildrenNodes(); 63             $subcategories = (array)$category->getChildrenNodes();
64         } else { 64         } else {
65             $subcategories = $category->getChildren(); 65             $subcategories = $category->getChildren();
66         } 66         }
67         return $subcategories; 67         return $subcategories;
68     } 68     }
69      69     
70     public function getChildCategoryHtml($category, $icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") { 70     public function getChildCategoryHtml($category, $icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") {
71         $html = ''; 71         $html = '';
72         if($childrenCategories = $this->getChildCategories($category)) { 72         if($childrenCategories = $this->getChildCategories($category)) {
73             $html .= '<ul>'; 73             $html .= '<ul>';
74             $i = 0; 74             $i = 0;
75             foreach($childrenCategories as $childrenCategory) { 75             foreach($childrenCategories as $childrenCategory) {
76                 if (!$childrenCategory->getIsActive()) { 76                 if (!$childrenCategory->getIsActive()) {
77                     continue; 77                     continue;
78                 } 78                 }
79                 $i++; 79                 $i++;
80                 $html .= '<li><a href="'.$this->_categoryHelper->getCategoryUrl($childrenCategory).'">'.$childrenCategory->getName().'</a>'; 80                 $html .= '<li><a href="'.$this->_categoryHelper->getCategoryUrl($childrenCategory).'">'.$childrenCategory->getName().'</a>';
81                 $html .= $this->getChildCategoryHtml($childrenCategory, $icon_open_class, $icon_close_class); 81                 $html .= $this->getChildCategoryHtml($childrenCategory, $icon_open_class, $icon_close_class);
82                 $html .= '</li>'; 82                 $html .= '</li>';
83             } 83             }
84             $html .= '</ul>'; 84             $html .= '</ul>';
85             if($i > 0) 85             if($i > 0)
86                 $html .= '<a href="javascript:void(0)" class="expand-icon"><em class="'.$icon_open_class.'"></em></a>'; 86                 $html .= '<a href="javascript:void(0)" class="expand-icon"><em class="'.$icon_open_class.'"></em></a>';
87         } 87         }
88         return $html; 88         return $html;
89     } 89     }
90      90     
91     public function getCategorySidebarHtml($icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") { 91     public function getCategorySidebarHtml($icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") {
92         $html = ''; 92         $html = '';
93         $categories = $this->getStoreCategories(true,false,true); 93         $categories = $this->getStoreCategories(true,false,true);
94         $html .= '<ul class="category-sidebar">'; 94         $html .= '<ul class="category-sidebar">';
95         foreach($categories as $category) { 95         foreach($categories as $category) {
96             if (!$category->getIsActive()) { 96             if (!$category->getIsActive()) {
97             continue; 97             continue;
98             } 98             }
99             $html .= '<li>'; 99             $html .= '<li>';
100             $html .= '<a href="'.$this->_categoryHelper->getCategoryUrl($category).'">'.$category->getName().'</a>'; 100             $html .= '<a href="'.$this->_categoryHelper->getCategoryUrl($category).'">'.$category->getName().'</a>';
101             $html .= $this->getChildCategoryHtml($category, $icon_open_class, $icon_close_class); 101             $html .= $this->getChildCategoryHtml($category, $icon_open_class, $icon_close_class);
102             $html .= '</li>'; 102             $html .= '</li>';
103         } 103         }
104         $html .= '</ul>'; 104         $html .= '</ul>';
105         $html .= '<script type="text/javascript"> 105         $html .= '<script type="text/javascript">
106             require([ 106             require([
107                 \'jquery\' 107                 \'jquery\'
108               ], function ($) { 108               ], function ($) {
109                 $(".category-sidebar li > .expand-icon").click(function(){ 109                 $(".category-sidebar li > .expand-icon").click(function(){
110                     if($(this).parent().hasClass("opened")){ 110                     if($(this).parent().hasClass("opened")){
111                         $(this).parent().children("ul").slideUp(); 111                         $(this).parent().children("ul").slideUp();
112                         $(this).parent().removeClass("opened"); 112                         $(this).parent().removeClass("opened");
113                         $(this).children(".'.$icon_close_class.'").removeClass("'.$icon_close_class.'").addClass("'.$icon_open_class.'"); 113                         $(this).children(".'.$icon_close_class.'").removeClass("'.$icon_close_class.'").addClass("'.$icon_open_class.'");
114                     } else { 114                     } else {
115                         $(this).parent().children("ul").slideDown(); 115                         $(this).parent().children("ul").slideDown();
116                         $(this).parent().addClass("opened"); 116                         $(this).parent().addClass("opened");
117                         $(this).children(".'.$icon_open_class.'").removeClass("'.$icon_open_class.'").addClass("'.$icon_close_class.'"); 117                         $(this).children(".'.$icon_open_class.'").removeClass("'.$icon_open_class.'").addClass("'.$icon_close_class.'");
118                     } 118                     }
119                 }); 119                 });
120             }); 120             });
121         </script>'; 121         </script>';
122         return $html; 122         return $html;
123     } 123     }
124 } 124 }