DigitalPianism_CustomReports - Version 0.1.1

Version Notes

- Use collections instead of loading products to speed up the system

Download this release

Release Info

Developer Digital Pianism
Extension DigitalPianism_CustomReports
Version 0.1.1
Comparing to
See all releases


Code changes from version 0.1.0 to 0.1.1

app/code/community/DigitalPianism/CustomReports/Block/Worstsellers/Grid.php CHANGED
@@ -18,8 +18,14 @@ class DigitalPianism_CustomReports_Block_Worstsellers_Grid extends Mage_Adminhtm
18
  // If the sku is not set
19
  if (!$sku)
20
  {
21
- // We get the sku by loading the product
22
- $sku = Mage::getModel('catalog/product')->load($args['row']['entity_id'])->getSku();
 
 
 
 
 
 
23
  // If there's still no sku
24
  if (!$sku)
25
  {
@@ -30,8 +36,14 @@ class DigitalPianism_CustomReports_Block_Worstsellers_Grid extends Mage_Adminhtm
30
  // If the name is not set
31
  if (!$name)
32
  {
33
- // We get the name by loading the product
34
- $name = Mage::getModel('catalog/product')->load($args['row']['entity_id'])->getName();
 
 
 
 
 
 
35
  // If there's still no name
36
  if (!$name)
37
  {
@@ -68,14 +80,24 @@ class DigitalPianism_CustomReports_Block_Worstsellers_Grid extends Mage_Adminhtm
68
  // If the sku is not set
69
  if (!$sku)
70
  {
71
- // We get the sku by loading the product
72
- $sku = Mage::getModel('catalog/product')->load($args['row']['entity_id'])->getSku();
 
 
 
 
 
73
  }
74
  // If the name is not set
75
  if (!$name)
76
  {
77
- // We get the name by loading the product
78
- $name = Mage::getModel('catalog/product')->load($args['row']['entity_id'])->getName();
 
 
 
 
 
79
  }
80
  // We fill the array with the data
81
  $this->arrayBestSellers[$args['row']['entity_id']] = array(
18
  // If the sku is not set
19
  if (!$sku)
20
  {
21
+ // We get the sku
22
+ $collection = Mage::getResourceModel('catalog/product_collection')
23
+ ->addFieldToFilter('entity_id', array($args['row']['entity_id']))
24
+ ->addAttributeToSelect(array('sku'))
25
+ ->setPageSize(1);
26
+
27
+ $sku = $collection->getFirstItem()->getSku();
28
+
29
  // If there's still no sku
30
  if (!$sku)
31
  {
36
  // If the name is not set
37
  if (!$name)
38
  {
39
+ // We get the name
40
+ $collection = Mage::getResourceModel('catalog/product_collection')
41
+ ->addFieldToFilter('entity_id', array($args['row']['entity_id']))
42
+ ->addAttributeToSelect(array('name'))
43
+ ->setPageSize(1);
44
+
45
+ $name = $collection->getFirstItem()->getName();
46
+
47
  // If there's still no name
48
  if (!$name)
49
  {
80
  // If the sku is not set
81
  if (!$sku)
82
  {
83
+ // We get the sku
84
+ $collection = Mage::getResourceModel('catalog/product_collection')
85
+ ->addFieldToFilter('entity_id', array($args['row']['entity_id']))
86
+ ->addAttributeToSelect(array('sku'))
87
+ ->setPageSize(1);
88
+
89
+ $sku = $collection->getFirstItem()->getSku();
90
  }
91
  // If the name is not set
92
  if (!$name)
93
  {
94
+ // We get the name
95
+ $collection = Mage::getResourceModel('catalog/product_collection')
96
+ ->addFieldToFilter('entity_id', array($args['row']['entity_id']))
97
+ ->addAttributeToSelect(array('name'))
98
+ ->setPageSize(1);
99
+
100
+ $name = $collection->getFirstItem()->getName();
101
  }
102
  // We fill the array with the data
103
  $this->arrayBestSellers[$args['row']['entity_id']] = array(
app/code/community/DigitalPianism/CustomReports/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <DigitalPianism_CustomReports>
5
- <version>0.1.0</version>
6
  </DigitalPianism_CustomReports>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <DigitalPianism_CustomReports>
5
+ <version>0.1.1</version>
6
  </DigitalPianism_CustomReports>
7
  </modules>
8
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DigitalPianism_CustomReports</name>
4
- <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license>Open GPL</license>
7
  <channel>community</channel>
@@ -48,12 +48,11 @@ This module includes the following reports to Magento:&#xD;
48
  &lt;/ul&gt;&#xD;
49
  &#xD;
50
  &lt;p&gt;Thus, if a product is in several categories, it will be counted as a sale for all of these categories.&lt;/p&gt;</description>
51
- <notes>- Improve memory management when dealing with large collection for all reports. 30% memory use decrease.&#xD;
52
- - Fix a bug where people were unable to set dates for the wishlist report.</notes>
53
  <authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
54
- <date>2014-09-19</date>
55
- <time>10:04:52</time>
56
- <contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="CustomReports"><dir name="Block"><dir name="Bestsellersbycategory"><file name="Grid.php" hash="8f8b0b637b77370d6b6590df7a6db54a"/></dir><file name="Bestsellersbycategory.php" hash="60483ad3e57dc461f5943c805d149c01"/><file name="Customreport.php" hash="e6bbb8a7baf7acc47f39b02e64ccbc94"/><dir name="Lifetimesales"><file name="Grid.php" hash="b36706d8594b934d1d13b236537b39cd"/></dir><file name="Lifetimesales.php" hash="94d685421ecb611a871d99c1c593ac46"/><dir name="Noupsells"><file name="Grid.php" hash="50d635cdc4268bde22ae7d029dfb125b"/></dir><file name="Noupsells.php" hash="bbc28aa60bd78b8c3ccf2fb94f470751"/><dir name="Shoppedonce"><file name="Grid.php" hash="28401d7c968100aec911545a8074dd70"/></dir><file name="Shoppedonce.php" hash="bc3b20a05d2859a710850cde353599d5"/><dir name="Signedupnoorder"><file name="Grid.php" hash="12e5f83a722b58818f0b01e6296eadef"/></dir><file name="Signedupnoorder.php" hash="30d952fcc1fa6e913c98134f195342eb"/><dir name="Wishlist"><file name="Grid.php" hash="1a77ff075cfda65ccee9c63d62725300"/></dir><file name="Wishlist.php" hash="873881855ff4b280b5c7ec84d7082808"/><dir name="Worstsellers"><file name="Grid.php" hash="cc386907b3d3bf89460989f948a45e81"/></dir><file name="Worstsellers.php" hash="f31350020ae1d4207a49270a226a6df4"/><dir name="Worstsellersbycategory"><file name="Grid.php" hash="cac879e7fa0bb1f74624f04cb5007ee5"/></dir><file name="Worstsellersbycategory.php" hash="4b94e31f8297c38904a073240b7af85e"/></dir><dir name="Model"><dir name="Reports"><dir name="Resource"><dir name="Product"><file name="Collection.php" hash="5e544f160b1916ce3e6c0ace949a8dc9"/></dir></dir></dir></dir><dir name="controllers"><file name="BestsellersbycategoryController.php" hash="bcb8ba02dbfbb37880830c24c88c4791"/><file name="LifetimesalesController.php" hash="36c23ba7464e5b23d7803babdc092097"/><file name="NoupsellsController.php" hash="ccdf273757694494daec860361c0ec52"/><file name="ShoppedonceController.php" hash="0c599676dbb5722feb9bc437cfb985f1"/><file name="SignedupnoorderController.php" hash="0d996537ef4affe736b1aa3437152bc6"/><file name="WishlistController.php" hash="1ee8c24d7ce1ffc28493aedba17505a5"/><file name="WorstsellersController.php" hash="20e935b7f822abd346f76e6a934234da"/><file name="WorstsellersbycategoryController.php" hash="bc37e6b7a41c4ed918018ecdf2042259"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2233874893d9dcc82540d61aa0668328"/><file name="config.xml" hash="0af5b83640b8bdb629171618b0c59398"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_CustomReports.xml" hash="2244af82c076ed3abf5064672036ef0b"/></dir></target><target name="magelocale"><dir name="en_US"><file name="DigitalPianism_CustomReports.csv" hash="0fcee0228d1044be8c0b76f02079bf55"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="digitalpianism"><dir name="customreports"><file name="advancedgrid.phtml" hash="0254a130e6c76bf9c8f7a9b7ce1d27ca"/><file name="grid.phtml" hash="a8d2cbad8327390e2b9cd3b7717c384d"/></dir></dir></dir></dir></dir></dir></target></contents>
57
  <compatible/>
58
  <dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
59
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DigitalPianism_CustomReports</name>
4
+ <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license>Open GPL</license>
7
  <channel>community</channel>
48
  &lt;/ul&gt;&#xD;
49
  &#xD;
50
  &lt;p&gt;Thus, if a product is in several categories, it will be counted as a sale for all of these categories.&lt;/p&gt;</description>
51
+ <notes>- Use collections instead of loading products to speed up the system</notes>
 
52
  <authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
53
+ <date>2014-09-24</date>
54
+ <time>10:12:47</time>
55
+ <contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="CustomReports"><dir name="Block"><dir name="Bestsellersbycategory"><file name="Grid.php" hash="8f8b0b637b77370d6b6590df7a6db54a"/></dir><file name="Bestsellersbycategory.php" hash="60483ad3e57dc461f5943c805d149c01"/><file name="Customreport.php" hash="e6bbb8a7baf7acc47f39b02e64ccbc94"/><dir name="Lifetimesales"><file name="Grid.php" hash="b36706d8594b934d1d13b236537b39cd"/></dir><file name="Lifetimesales.php" hash="94d685421ecb611a871d99c1c593ac46"/><dir name="Noupsells"><file name="Grid.php" hash="50d635cdc4268bde22ae7d029dfb125b"/></dir><file name="Noupsells.php" hash="bbc28aa60bd78b8c3ccf2fb94f470751"/><dir name="Shoppedonce"><file name="Grid.php" hash="28401d7c968100aec911545a8074dd70"/></dir><file name="Shoppedonce.php" hash="bc3b20a05d2859a710850cde353599d5"/><dir name="Signedupnoorder"><file name="Grid.php" hash="12e5f83a722b58818f0b01e6296eadef"/></dir><file name="Signedupnoorder.php" hash="30d952fcc1fa6e913c98134f195342eb"/><dir name="Wishlist"><file name="Grid.php" hash="1a77ff075cfda65ccee9c63d62725300"/></dir><file name="Wishlist.php" hash="873881855ff4b280b5c7ec84d7082808"/><dir name="Worstsellers"><file name="Grid.php" hash="9c1ae92c952329b1f7cc7a278234c821"/></dir><file name="Worstsellers.php" hash="f31350020ae1d4207a49270a226a6df4"/><dir name="Worstsellersbycategory"><file name="Grid.php" hash="cac879e7fa0bb1f74624f04cb5007ee5"/></dir><file name="Worstsellersbycategory.php" hash="4b94e31f8297c38904a073240b7af85e"/></dir><dir name="Model"><dir name="Reports"><dir name="Resource"><dir name="Product"><file name="Collection.php" hash="5e544f160b1916ce3e6c0ace949a8dc9"/></dir></dir></dir></dir><dir name="controllers"><file name="BestsellersbycategoryController.php" hash="bcb8ba02dbfbb37880830c24c88c4791"/><file name="LifetimesalesController.php" hash="36c23ba7464e5b23d7803babdc092097"/><file name="NoupsellsController.php" hash="ccdf273757694494daec860361c0ec52"/><file name="ShoppedonceController.php" hash="0c599676dbb5722feb9bc437cfb985f1"/><file name="SignedupnoorderController.php" hash="0d996537ef4affe736b1aa3437152bc6"/><file name="WishlistController.php" hash="1ee8c24d7ce1ffc28493aedba17505a5"/><file name="WorstsellersController.php" hash="20e935b7f822abd346f76e6a934234da"/><file name="WorstsellersbycategoryController.php" hash="bc37e6b7a41c4ed918018ecdf2042259"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2233874893d9dcc82540d61aa0668328"/><file name="config.xml" hash="0b608d206479717cc6a9c59ebdabe1c6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_CustomReports.xml" hash="2244af82c076ed3abf5064672036ef0b"/></dir></target><target name="magelocale"><dir name="en_US"><file name="DigitalPianism_CustomReports.csv" hash="0fcee0228d1044be8c0b76f02079bf55"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="digitalpianism"><dir name="customreports"><file name="advancedgrid.phtml" hash="0254a130e6c76bf9c8f7a9b7ce1d27ca"/><file name="grid.phtml" hash="a8d2cbad8327390e2b9cd3b7717c384d"/></dir></dir></dir></dir></dir></dir></target></contents>
56
  <compatible/>
57
  <dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
58
  </package>