66. Araxis Merge File Comparison Report

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

66.1 Files compared

#LocationFileLast Modified
1/Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Filterproducts/Block/HomeSaleList.php2018-06-14 03:36:42 +0000
2/Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Filterproducts/Block/HomeSaleList.php2020-08-17 03:01:48 +0000

66.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged15162
Changed1375
Inserted115
Removed00

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

66.4 Active regular expressions

No regular expressions were active.

66.5 Comparison detail

1 <?php 1 <?php
2  2 
3 namespace Smartwave\Filterproducts\Block\Home; 3 namespace Smartwave\Filterproducts\Block\Home;
4  4 
5 use Magento\Catalog\Api\CategoryRepositoryInterface; 5 use Magento\Catalog\Api\CategoryRepositoryInterface;
6  6 
7 class SaleList extends \Magento\Catalog\Block\Product\ListProduct { 7 class SaleList extends \Magento\Catalog\Block\Product\ListProduct {
8  8 
9     protected $_collection; 9     protected $_collection;
10  10 
11     protected $categoryRepository; 11     protected $categoryRepository;
12      12 
13     protected $_resource; 13     protected $_resource;
14      14 
15     public function __construct( 15     public function __construct(
16     \Magento\Catalog\Block\Product\Context $context,  16     \Magento\Catalog\Block\Product\Context $context,
17             \Magento\Framework\Data\Helper\PostHelper $postDataHelper,  17             \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
18             \Magento\Catalog\Model\Layer\Resolver $layerResolver,  18             \Magento\Catalog\Model\Layer\Resolver $layerResolver,
19             CategoryRepositoryInterface $categoryRepository, 19             CategoryRepositoryInterface $categoryRepository,
20             \Magento\Framework\Url\Helper\Data $urlHelper,  20             \Magento\Framework\Url\Helper\Data $urlHelper,
21             \Magento\Catalog\Model\ResourceModel\Product\Collection $collection,  21             \Magento\Catalog\Model\ResourceModel\Product\Collection $collection,
22             \Magento\Framework\App\ResourceConnection $resource, 22             \Magento\Framework\App\ResourceConnection $resource,
23             array $data = [] 23             array $data = []
24     ) { 24     ) {
25         $this->categoryRepository = $categoryRepository; 25         $this->categoryRepository = $categoryRepository;
26         $this->_collection = $collection; 26         $this->_collection = $collection;
27         $this->_resource = $resource; 27         $this->_resource = $resource;
28  28 
29         parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data); 29         parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data);
30     } 30     }
31  31 
32     protected function _getProductCollection() { 32     protected function _getProductCollection() {
33         return $this->getProducts(); 33         return $this->getProducts();
34     } 34     }
35      35 
36     public function getProducts() { 36     public function getProducts() {
37         $count = $this->getProductCount(); 37         $count = $this->getProductCount();
38         $category_id = $this->getData("category_id"); 38         $category_id = $this->getData("category_id");
39         $collection = clone $this->_collection; 39         $collection = clone $this->_collection;
40         $collection->clear()->getSelect()->reset(\Magento\Framework\DB\Select::WHERE)->reset(\Magento\Framework\DB\Select::ORDER)->reset(\Magento\Framework\DB\Select::LIMIT_COUNT)->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET)->reset(\Magento\Framework\DB\Select::GROUP); 40         $collection->clear()->getSelect()->reset(\Magento\Framework\DB\Select::WHERE)->reset(\Magento\Framework\DB\Select::ORDER)->reset(\Magento\Framework\DB\Select::LIMIT_COUNT)->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET)->reset(\Magento\Framework\DB\Select::GROUP);
41  41 
42         if(!$category_id) { 42         if(!$category_id) {
43             $category_id = $this->_storeManager->getStore()->getRootCategoryId(); 43             $category_id = $this->_storeManager->getStore()->getRootCategoryId();
44         } 44         }
45         $category = $this->categoryRepository->get($category_id); 45         $category = $this->categoryRepository->get($category_id);
46         $now = date('Y-m-d'); 46         $now = date('Y-m-d');
47         if(isset($category) && $category) { 47         if(isset($category) && $category) {
48             $collection->addMinimalPrice() 48             $collection->addMinimalPrice()
49                 ->addFinalPrice() 49                 ->addFinalPrice()
50                 ->addTaxPercents() 50                 ->addTaxPercents()
51                 ->addAttributeToSelect('name') 51                 ->addAttributeToSelect('name')
52                 ->addAttributeToSelect('image') 52                 ->addAttributeToSelect('image')
53                 ->addAttributeToSelect('small_image') 53                 ->addAttributeToSelect('small_image')
54                 ->addAttributeToSelect('thumbnail') 54                 ->addAttributeToSelect('thumbnail')
55                 ->addAttributeToSelect('special_from_date') 55                 ->addAttributeToSelect('special_from_date')
56                 ->addAttributeToSelect('special_to_date') 56                 ->addAttributeToSelect('special_to_date')
57                 ->addAttributeToFilter('special_price', ['neq' => '']) 57                 ->addAttributeToFilter('special_price', ['neq' => ''])
58                 ->addAttributeToFilter([ 58                 ->addCategoryFilter($category)
59                     [ 59                 ->addAttributeToFilter(
60                         'attribute' => 'special_from_date', 60                     '
special_from_date',
61                         'lteq' => date('Y-m-d G:i:s', strtotime($now)), 61                     ['date' => true, 'to' => $this->getEndOfDayDate()],
62                         'date' => true, 62                     'left')
63                     ], 63                 ->addAttributeToFilter(
    64                     'special_to_date',
64                     [ 65                     [
65                         'attribute' => 'special_to_date', 66                         'or' => [
66                         'gteq' => date('Y-m-d G:i:s', strtotime($now)), 67                             0 => ['date' => true, 'from' => $this->getStartOfDayDate()],
67                         'date' => true, 68                             1 => ['is' => new \Zend_Db_Expr('null')],
68                     ] 69                         ]
69                 ]) 70                     ],
70                 ->addAttributeToFilter('is_saleable', 1, 'left'); 71                     'left')
    72                 ->addAttributeToSort(
    73                     'news_from_date',
    74                     'desc')
    75                 ->addStoreFilter($this->getStoreId())
    76                 ->setCurPage(1);
71         } else { 77         } else {
72             $collection->addMinimalPrice() 78             $collection->addMinimalPrice()
73                 ->addFinalPrice() 79                 ->addFinalPrice()
74                 ->addTaxPercents() 80                 ->addTaxPercents()
75                 ->addAttributeToSelect('name') 81                 ->addAttributeToSelect('name')
76                 ->addAttributeToSelect('image') 82                 ->addAttributeToSelect('image')
77                 ->addAttributeToSelect('small_image') 83                 ->addAttributeToSelect('small_image')
78                 ->addAttributeToSelect('thumbnail') 84                 ->addAttributeToSelect('thumbnail')
79                 ->addAttributeToFilter('special_price', ['neq' => '']) 85                 ->addAttributeToFilter('special_price', ['neq' => ''])
80                 ->addAttributeToSelect('special_from_date') 86                 ->addAttributeToSelect('special_from_date')
81                 ->addAttributeToSelect('special_to_date') 87                 ->addAttributeToSelect('special_to_date')
82                 ->addAttributeToFilter([ 88                 ->addAttributeToFilter(
83                     [ 89                     '
special_from_date',
84                         'attribute' => 'special_from_date', 90                     ['date' => true, 'to' => $this->getEndOfDayDate()],
85                         'lteq' => date('Y-m-d G:i:s', strtotime($now)), 91                     'left')
86                         'date' => true, 92                 ->addAttributeToFilter(
87                     ], 93                     'special_to_date',
88                     [ 94                     [
89                         'attribute' => 'special_to_date', 95                         'or' => [
90                         'gteq' => date('Y-m-d G:i:s', strtotime($now)), 96                             0 => ['date' => true, 'from' => $this->getStartOfDayDate()],
91                         'date' => true, 97                             1 => ['is' => new \Zend_Db_Expr('null')],
92                     ] 98                         ]
93                 ]) 99                     ],
94                 ->addAttributeToFilter('is_saleable', 1, 'left'); 100                     'left')
    101                 ->addAttributeToSort(
    102                     'news_from_date',
    103                     'desc')
    104                 ->addStoreFilter($this->getStoreId())
    105                 ->setCurPage(1);
95         } 106         }
96          107 
97         $collection->getSelect() 108         $collection->getSelect()
98                 ->limit($count); 109                 ->limit($count);
99          110 
100         return $collection; 111         return $collection;
101     } 112     }
102  113 
103     public function getLoadedProductCollection() { 114     public function getLoadedProductCollection() {
104         return $this->getProducts(); 115         return $this->getProducts();
105     } 116     }
106  117 
107     public function getProductCount() { 118     public function getProductCount() {
108         $limit = $this->getData("product_count"); 119         $limit = $this->getData("product_count");
109         if(!$limit) 120         if(!$limit)
110             $limit = 10; 121             $limit = 10;
111         return $limit; 122         return $limit;
112     } 123     }
    124 
    125     public function getStartOfDayDate()
    126     {
    127         return $this->_localeDate->date()->setTime(0, 0, 0)->format('Y-m-d H:i:s');
    128     }
    129 
    130     public function getEndOfDayDate()
    131     {
    132         return $this->_localeDate->date()->setTime(23, 59, 59)->format('Y-m-d H:i:s');
    133     }
    134 
    135     public function getStoreId()
    136     {
    137         return $this->_storeManager->getStore()->getId();
    138     }
113 } 139 }