Easy_Topsellers - Version 1.1.5

Version Notes

Flat catalog support

Download this release

Release Info

Developer volgodark
Extension Easy_Topsellers
Version 1.1.5
Comparing to
See all releases


Code changes from version 1.1.4 to 1.1.5

app/code/community/Magazento/Easytopsell/Block/Category.php CHANGED
@@ -29,15 +29,29 @@ class Magazento_Easytopsell_Block_Category extends Mage_Catalog_Block_Product_Ab
29
  ->addStoreFilter($storeId)
30
  ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
31
  ->addUrlRewrite()
32
- // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
33
- // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
34
  ->setOrder('ordered_qty', 'desc')
35
  ->setPageSize($this->getModel()->getCatProductsLimit())
36
  ->setCurPage(1)
37
  ->setOrder('ordered_qty', 'desc');
38
 
39
- Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
40
- Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
 
43
  $c = Mage::registry("current_category");
29
  ->addStoreFilter($storeId)
30
  ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
31
  ->addUrlRewrite()
 
 
32
  ->setOrder('ordered_qty', 'desc')
33
  ->setPageSize($this->getModel()->getCatProductsLimit())
34
  ->setCurPage(1)
35
  ->setOrder('ordered_qty', 'desc');
36
 
37
+
38
+ if ($collection->isEnabledFlat())
39
+ {
40
+ $collection->getSelect()
41
+ ->joinLeft(
42
+ array('cpl' => $collection->getResource()->getFlatTableName()),
43
+ "e.entity_id = cpl.entity_id"
44
+ )
45
+ ->where("cpl.visibility IN (?)",
46
+ array(
47
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG,
48
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH
49
+ )
50
+ );
51
+ } else {
52
+ $collection->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)));
53
+ $collection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
54
+ }
55
 
56
 
57
  $c = Mage::registry("current_category");
app/code/community/Magazento/Easytopsell/Block/Home.php CHANGED
@@ -30,12 +30,28 @@ class Magazento_Easytopsell_Block_Home extends Mage_Catalog_Block_Product_Abstra
30
  ->addStoreFilter($storeId)
31
  ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
32
  ->addUrlRewrite()
33
- ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
34
- ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
35
  ->setOrder('ordered_qty', 'desc')
36
  ->setPageSize($this->getModel()->getHomepageProductsLimit())
37
  ->setCurPage(1)
38
  ->setOrder('ordered_qty', 'desc');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  $catId=$this->getModel()->getHomepageCatID();
41
  if ($catId>0) {
30
  ->addStoreFilter($storeId)
31
  ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
32
  ->addUrlRewrite()
 
 
33
  ->setOrder('ordered_qty', 'desc')
34
  ->setPageSize($this->getModel()->getHomepageProductsLimit())
35
  ->setCurPage(1)
36
  ->setOrder('ordered_qty', 'desc');
37
+
38
+ if ($collection->isEnabledFlat())
39
+ {
40
+ $collection->getSelect()
41
+ ->joinLeft(
42
+ array('cpl' => $collection->getResource()->getFlatTableName()),
43
+ "e.entity_id = cpl.entity_id"
44
+ )
45
+ ->where("cpl.visibility IN (?)",
46
+ array(
47
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG,
48
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH
49
+ )
50
+ );
51
+ } else {
52
+ $collection->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)));
53
+ $collection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
54
+ }
55
 
56
  $catId=$this->getModel()->getHomepageCatID();
57
  if ($catId>0) {
app/code/community/Magazento/Easytopsell/Block/Home_1.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Easytopsell_Block_Home extends Mage_Catalog_Block_Product_Abstract {
12
+
13
+
14
+ // protected function _construct() {
15
+ // parent::_construct();
16
+ // $this->addData(array(
17
+ // 'cache_lifetime' => 86400,
18
+ // 'cache_tags' => array('magazentoeasytopsell_home'),
19
+ // ));
20
+ //
21
+ // }
22
+
23
+ protected function _beforeToHtml() {
24
+
25
+ $storeId = Mage::app()->getStore()->getId();
26
+ $sellDate=$this->getModel()->getSellDate($this->getModel()->getHomepageDaysLimit());
27
+ $collection = Mage::getResourceModel('reports/product_sold_collection')
28
+ ->addOrderedQty()
29
+ ->setStoreId($storeId)
30
+ ->addStoreFilter($storeId)
31
+ ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
32
+ ->addUrlRewrite()
33
+ ->setOrder('ordered_qty', 'desc')
34
+ ->setPageSize($this->getModel()->getHomepageProductsLimit())
35
+ ->setCurPage(1)
36
+ ->setOrder('ordered_qty', 'desc');
37
+
38
+ if ($collection->isEnabledFlat())
39
+ {
40
+ $collection->getSelect()
41
+ ->joinLeft(
42
+ array('cpl' => $collection->getResource()->getFlatTableName()),
43
+ "e.entity_id = cpl.entity_id"
44
+ )
45
+ ->where("cpl.visibility IN (?)",
46
+ array(
47
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG,
48
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH
49
+ )
50
+ );
51
+ } else {
52
+ $collection->addAttributeToFilter('cpl.visibility',
53
+ array(
54
+ 'in' => array(
55
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG,
56
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH
57
+ )
58
+ )
59
+ );
60
+ }
61
+
62
+ $catId=$this->getModel()->getHomepageCatID();
63
+ if ($catId>0) {
64
+ $category = $this->getModel()->getCategory($catId);
65
+ $collection->addCategoryFilter($category);
66
+ }
67
+
68
+
69
+ $this->setProductCollection($collection);
70
+ return parent::_beforeToHtml();
71
+ }
72
+
73
+ public function getModel() {
74
+ return Mage::getModel('easytopsell/Data');
75
+ }
76
+
77
+ }
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+ // ->setDateRange($sellDate['startdate'], $sellDate['todaydate'])
93
+ // ->addAttributeToFilter('is_salable')
94
+ // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
95
+ // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
96
+ // ->addSaleableFilterToCollection()
97
+ // ->addInStockFilterToCollection()
98
+ // ->addUrlRewrite()
99
+ //// ->addCategoryFilter($currentCategory)
100
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
101
+ // ->setCurPage(1)
102
+ // ->addOrderedQty()
103
+ // ->setOrder('ordered_qty', 'desc');
104
+ //
105
+
106
+ // ->addAttributeToSelect(array('entity_id', 'name', 'price', 'small_image', 'short_description', 'description', 'type_id', 'status'))
107
+ // ->addOrderedQty()
108
+ // ->setStoreId($storeId)
109
+ // ->addStoreFilter($storeId)
110
+ //// ->addCategoryFilter($currentCategory)
111
+ // ->setOrder('ordered_qty', 'desc')
112
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
113
+ // ->setCurPage(1);
114
+ //
115
+ // $collection= array();
116
+ // foreach ($rawcollection as $product) {
117
+ //// $addproduct = $product->getData('is_salable');
118
+ // $collection[]=$product->getData();
119
+ // }
120
+ // var_dump($rawcollection);
121
+ ////
122
+ //
123
+ // exit();
app/code/community/Magazento/Easytopsell/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Magazento_Easytopsell>
5
- <version>1.0.0</version>
6
  </Magazento_Easytopsell>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Magazento_Easytopsell>
5
+ <version>1.1.5</version>
6
  </Magazento_Easytopsell>
7
  </modules>
8
  <frontend>
package.xml CHANGED
@@ -1,21 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easy_Topsellers</name>
4
- <version>1.1.4</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento module generates the list of your online store's best selling products and displays it in sidebars. Extension allows you fully configure your bestsellers on your store and of cource this extension fully configurable at backend.</summary>
10
  <description>Magento module generates the list of your online store's best selling products and displays it in sidebars. Extension allows you fully configure your bestsellers on your store and of cource this extension fully configurable at backend.</description>
11
- <notes>Visibility bug fix:&#xD;
12
- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.visibility' in 'where clause' &#xD;
13
- With: Mage::getSingleton('catalog/product_status')-&gt;addVisibleFilterToCollection($collection);&#xD;
14
- Mage::getSingleton('catalog/product_visibility')-&gt;addVisibleInCatalogFilterToCollection($collection);</notes>
15
- <authors><author><name>volgodark</name><user>auto-converted</user><email>volgodark@gmail.com</email></author></authors>
16
- <date>2012-07-11</date>
17
- <time>07:19:37</time>
18
- <contents><target name="magecommunity"><dir name="Magazento"><dir name="Easytopsell"><dir name="Block"><file name="Category.php" hash="24f169574656a3378bc6d331b47f162a"/><file name="Developer.php" hash="752a0367c8a88bf9cb08d424e4286914"/><file name="Home.php" hash="f5b8575d86893115c356a4c10370d918"/></dir><dir name="Helper"><file name="Data.php" hash="9f977e8bb58ad496025983804d9460e8"/></dir><dir name="Model"><file name="Data.php" hash="3c5607e5a08b3ba8d8b45e25d0413c2c"/></dir><dir name="etc"><file name="config.xml" hash="0eded0066def1816a54e91108e575c93"/><file name="system.xml" hash="e20e824fb205752d3d3bdc96e35776b8"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="magazento"><dir name="easytopsell"><file name="category_left.phtml" hash="65aff4867906f97d148126ff32f354f0"/><file name="category_right.phtml" hash="3d2edd1cc57bc839d1e8e0b145e77a87"/><file name="home_left.phtml" hash="507757ebf3dd1e9f781070138ad7b189"/><file name="home_right.phtml" hash="ee23e0f9ded93c70ab5e4c2c1670ca09"/></dir></dir></dir><dir name="layout"><file name="magazento_easytopsell.xml" hash="a2a91c96a57d1c8d652635371ab4e703"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magazento_Easytopsell.xml" hash="bcf1d8c496a3d7759a347cc782e934c6"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="magazento"><dir name="easytopseller"><file name="logo_onecheckout.jpg" hash="cf71a3d20cf06abaf99521651c2fe3d1"/><file name="logo_pdf.jpg" hash="5a0d745372115da1d61168e2529c0c0d"/><file name="logo_sitemap.jpg" hash="937495eec93cb1640b6244bff4cb31a2"/><file name="menu_box.jpg" hash="e76e4c6b62b096ca87175eb0f5270062"/><file name="promo.jpg" hash="88520d456df68c98130433b5184b8e7f"/><file name="style.css" hash="fcf1d218462d72cf8d14648fba62ac32"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Magazento_Easytopsell.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target></contents>
19
  <compatible/>
20
- <dependencies/>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easy_Topsellers</name>
4
+ <version>1.1.5</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento module generates the list of your online store's best selling products and displays it in sidebars. Extension allows you fully configure your bestsellers on your store and of cource this extension fully configurable at backend.</summary>
10
  <description>Magento module generates the list of your online store's best selling products and displays it in sidebars. Extension allows you fully configure your bestsellers on your store and of cource this extension fully configurable at backend.</description>
11
+ <notes>Flat catalog support</notes>
12
+ <authors><author><name>volgodark</name><user>volgodark</user><email>volgodark@gmail.com</email></author></authors>
13
+ <date>2012-12-20</date>
14
+ <time>13:36:19</time>
15
+ <contents><target name="magecommunity"><dir name="Magazento"><dir name="Easytopsell"><dir name="Block"><file name="Category.php" hash="c2a7e72cbd23a10cac576d7a692d8b39"/><file name="Developer.php" hash="752a0367c8a88bf9cb08d424e4286914"/><file name="Home.php" hash="91e9832c779f57980bc53416bd1995d5"/><file name="Home_1.php" hash="abe3cb12e92fd9fea27a77d249f35581"/></dir><dir name="Helper"><file name="Data.php" hash="9f977e8bb58ad496025983804d9460e8"/></dir><dir name="Model"><file name="Data.php" hash="3c5607e5a08b3ba8d8b45e25d0413c2c"/></dir><dir name="etc"><file name="config.xml" hash="72cf608f34e9b9cef9d21450c0926a68"/><file name="system.xml" hash="e20e824fb205752d3d3bdc96e35776b8"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="magazento"><dir name="easytopsell"><file name="category_left.phtml" hash="65aff4867906f97d148126ff32f354f0"/><file name="category_right.phtml" hash="3d2edd1cc57bc839d1e8e0b145e77a87"/><file name="home_left.phtml" hash="507757ebf3dd1e9f781070138ad7b189"/><file name="home_right.phtml" hash="ee23e0f9ded93c70ab5e4c2c1670ca09"/></dir></dir></dir><dir name="layout"><file name="magazento_easytopsell.xml" hash="a2a91c96a57d1c8d652635371ab4e703"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magazento_Easytopsell.xml" hash="bcf1d8c496a3d7759a347cc782e934c6"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="magazento"><dir name="easytopseller"><file name="logo_onecheckout.jpg" hash="cf71a3d20cf06abaf99521651c2fe3d1"/><file name="logo_pdf.jpg" hash="5a0d745372115da1d61168e2529c0c0d"/><file name="logo_sitemap.jpg" hash="937495eec93cb1640b6244bff4cb31a2"/><file name="menu_box.jpg" hash="e76e4c6b62b096ca87175eb0f5270062"/><file name="promo.jpg" hash="88520d456df68c98130433b5184b8e7f"/><file name="style.css" hash="fcf1d218462d72cf8d14648fba62ac32"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Magazento_Easytopsell.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target></contents>
 
 
 
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>