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

68.1 Files compared

#LocationFileLast Modified
1/Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Filterproducts/BlockFeaturedList.php2018-01-11 10:27:16 +0000
22021-05-13 09:08:40 +0000

68.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged00
Changed00
Inserted00
Removed1100

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

68.4 Active regular expressions

No regular expressions were active.

68.5 Comparison detail

1 <?php    
2     
3 namespace Smartwave\Filterproducts\Block;    
4     
5 class FeaturedList extends \Magento\Catalog\Block\Product\AbstractProduct {    
6     
7     protected $_catalogProductVisibility;    
8     
9     protected $_productCollectionFactory;    
10     
11     protected $_categoryFactory;    
12     
13     protected $urlHelper;    
14     
15     public function __construct(    
16         \Magento\Catalog\Block\Product\Context $context,    
17         \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,    
18         \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,    
19         \Magento\Catalog\Model\CategoryFactory $categoryFactory,    
20         \Magento\Framework\Url\Helper\Data $urlHelper,    
21         array $data = []    
22     ) {    
23         $this->_categoryFactory = $categoryFactory;    
24         $this->_productCollectionFactory = $productCollectionFactory;    
25         $this->_catalogProductVisibility = $catalogProductVisibility;    
26         $this->urlHelper = $urlHelper;    
27     
28         parent::__construct($context, $data);    
29     }    
30     
31     public function getProducts() {    
32         $count = $this->getProductCount();    
33         $category_id = $this->getData("category_id");    
34         $collection = $this->_productCollectionFactory->create();    
35         $collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());    
36     
37         $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter();    
38     
39         if(!$category_id) {    
40             $category_id = $this->_storeManager->getStore()->getRootCategoryId();    
41         }    
42         $category = $this->_categoryFactory->create()->load($category_id);    
43         if(isset($category) && $category) {    
44             $collection->addMinimalPrice()    
45                 ->addFinalPrice()    
46                 ->addTaxPercents()    
47                 ->addAttributeToSelect('name')    
48                 ->addAttributeToSelect('image')    
49                 ->addAttributeToSelect('small_image')    
50                 ->addAttributeToSelect('thumbnail')    
51                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())    
52                 ->addUrlRewrite()    
53                 ->addAttributeToFilter('is_saleable', 1, 'left')    
54                 ->addAttributeToFilter('sw_featured', 1, 'left')    
55                 ->addCategoryFilter($category);    
56         } else {    
57             $collection->addMinimalPrice()    
58                 ->addFinalPrice()    
59                 ->addTaxPercents()    
60                 ->addAttributeToSelect('name')    
61                 ->addAttributeToSelect('image')    
62                 ->addAttributeToSelect('small_image')    
63                 ->addAttributeToSelect('thumbnail')    
64                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())    
65                 ->addUrlRewrite()    
66                 ->addAttributeToFilter('is_saleable', 1, 'left')    
67                 ->addAttributeToFilter('sw_featured', 1, 'left');    
68         }    
69     
70         $collection->getSelect()    
71             ->order('rand()')    
72             ->limit($count);    
73     
74         return $collection;    
75     }    
76     
77     public function getAddToCartPostParams(\Magento\Catalog\Model\Product $product)    
78     {    
79         $url = $this->getAddToCartUrl($product);    
80         return [    
81             'action' => $url,    
82             'data' => [    
83                 'product' => $product->getEntityId(),    
84                 \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED =>    
85                     $this->urlHelper->getEncodedUrl($url),    
86             ]    
87         ];    
88     }    
89     
90     public function getLoadedProductCollection() {    
91         return $this->getProducts();    
92     }    
93     
94     public function getProductCount() {    
95         $limit = $this->getData("product_count");    
96         if(!$limit)    
97             $limit = 10;    
98         return $limit;    
99     }    
100 }