21. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-11-23 04:31:21 +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.

21.1 Files compared

#LocationFileLast Modified
1/Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme 4.0.6/app/code/Smartwave/FilterproductsFeaturedList.php2020-03-13 09:43:56 +0000
2/Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme 4.0.7/app/code/Smartwave/FilterproductsFeaturedList.php2020-03-13 09:43:56 +0000

21.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged1196
Changed00
Inserted00
Removed00

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

21.4 Active regular expressions

No regular expressions were active.

21.5 Comparison detail

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