Products_Sold_Counter_By_Synotive - Version 1.1.0

Version Notes

Products Sold Counter is stable version. We have tested it many different version.

Download this release

Release Info

Developer Synotive Technologies
Extension Products_Sold_Counter_By_Synotive
Version 1.1.0
Comparing to
See all releases


Version 1.1.0

app/code/community/SPL/CounterSales/Helper/Data.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SPL
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category SPL
13
+ * @package SPL_CounterSales
14
+ * @copyright Copyright (c) 2015 SPL.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class SPL_CounterSales_Helper_Data extends Mage_Core_Helper_Abstract
19
+ {
20
+
21
+ }
app/code/community/SPL/CounterSales/Model/Observer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SPL
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category SPL
13
+ * @package SPL_CounterSales
14
+ * @copyright Copyright (c) 2015 SPL.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class SPL_CounterSales_Model_Observer
18
+ {
19
+
20
+
21
+ const ENABLEDSALES = 'catalog/spl_countersales/enabledsales';
22
+
23
+ public function catalogProductLoadAfter(Varien_Event_Observer $observer)
24
+ {
25
+ if (Mage::getStoreConfigFlag(self::ENABLEDSALES)) {
26
+ $productId = $observer->getProduct()->getId();
27
+ $collection = Mage::getResourceModel('sales/order_item_collection');
28
+ $collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
29
+ $collection->getSelect()->join( array('order_history'=> sales_flat_order_status_history), 'order_history.parent_id = main_table.order_id', array('order_history.status'))
30
+ ->columns(array('SUM(qty_ordered) as order_quantity'))
31
+ ->where(sprintf("main_table.product_id = %s AND order_history.status = %s", $productId,'"complete"'));
32
+
33
+ $salesCountArr=$collection->getData();
34
+ $salescount=$salesCountArr[0]['order_quantity'];
35
+ $observer->getProduct()->setSalesCount($salescount);
36
+
37
+ }
38
+ }
39
+
40
+ public function catalogProductCollectionLoadAfter(Varien_Event_Observer $observer)
41
+ {
42
+ if (Mage::getStoreConfigFlag(self::ENABLEDSALES)) {
43
+ $productCollection = $observer->getCollection();
44
+ foreach ($productCollection as $product) {
45
+ $id = $product->getId();
46
+ $collection = Mage::getResourceModel('sales/order_item_collection');
47
+ $collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
48
+ $collection->getSelect()->join( array('order_history'=> sales_flat_order_status_history), 'order_history.parent_id = main_table.order_id', array('order_history.status'))
49
+ ->columns(array('SUM(qty_ordered) as order_quantity'))
50
+ ->where(sprintf("main_table.product_id = %s AND order_history.status = %s", $id,'"complete"'));
51
+ $salesCountArr=$collection->getData();
52
+ $salescount=$salesCountArr[0]['order_quantity'];
53
+ $product->setSalesCount($salescount);
54
+ }
55
+ }
56
+ }
57
+ }
app/code/community/SPL/CounterSales/etc/config.xml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * SPL
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * @category SPL
14
+ * @package SPL_CounterSales
15
+ * @copyright Copyright (c) 2015 SPL.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <SPL_CounterSales>
22
+ <version>1.1.0</version>
23
+ </SPL_CounterSales>
24
+ </modules>
25
+ <global>
26
+ <helpers>
27
+ <spl_countersales>
28
+ <class>SPL_CounterSales_Helper</class>
29
+ </spl_countersales>
30
+ </helpers>
31
+ <models>
32
+ <spl_countersales>
33
+ <class>SPL_CounterSales_Model</class>
34
+ </spl_countersales>
35
+ </models>
36
+ </global>
37
+ <frontend>
38
+ <layout>
39
+ <updates>
40
+ <countersales>
41
+ <file>countersales.xml</file>
42
+ </countersales>
43
+ </updates>
44
+ </layout>
45
+ <events>
46
+ <catalog_product_load_after>
47
+ <observers>
48
+ <spl_countersales>
49
+ <type>singleton</type>
50
+ <class>SPL_CounterSales_Model_Observer</class>
51
+ <method>catalogProductLoadAfter</method>
52
+ </spl_countersales>
53
+ </observers>
54
+ </catalog_product_load_after>
55
+ <catalog_product_collection_load_after>
56
+ <observers>
57
+ <spl_countersales>
58
+ <type>singleton</type>
59
+ <class>SPL_CounterSales_Model_Observer</class>
60
+ <method>catalogProductCollectionLoadAfter</method>
61
+ </spl_countersales>
62
+ </observers>
63
+ </catalog_product_collection_load_after>
64
+ </events>
65
+ </frontend>
66
+ </config>
app/code/community/SPL/CounterSales/etc/system.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * SPL
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * @category SPL
14
+ * @package SPL_SaleswishlistCounter
15
+ * @copyright Copyright (c) 2015 SPL.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+ <config>
20
+ <sections>
21
+ <catalog module="spl_countersales" label="label">
22
+ <groups>
23
+ <spl_countersales translate="label">
24
+ <label>Sales Counter Settings</label>
25
+ <sort_order>100</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ <fields>
30
+ <enabledsales translate="label">
31
+ <label>Enable Sales Counter</label>
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ <sort_order>50</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </enabledsales>
39
+ </fields>
40
+ </spl_countersales>
41
+ </groups>
42
+ </catalog>
43
+ </sections>
44
+ </config>
app/design/frontend/base/default/layout/countersales.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <catalog_product_view translate="label">
4
+ <reference name="product.info.media">
5
+ <action method="setTemplate">
6
+ <template>countersales/media.phtml</template>
7
+ </action>
8
+ </reference>
9
+ </catalog_product_view>
10
+ <catalog_category_default translate="label">
11
+ <reference name="product_list">
12
+ <action method="setTemplate">
13
+ <template>countersales/list.phtml</template>
14
+ </action>
15
+ </reference>
16
+ </catalog_category_default>
17
+ <catalog_category_layered translate="label">
18
+ <reference name="product_list">
19
+ <action method="setTemplate">
20
+ <template>countersales/list.phtml</template>
21
+ </action>
22
+ </reference>
23
+ </catalog_category_layered>
24
+ </layout>
app/etc/modules/SPL_CounterSales.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SPL_CounterSales>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </SPL_CounterSales>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Products_Sold_Counter_By_Synotive</name>
4
+ <version>1.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Products Sold Counter is an awesome way to make your customer engage with your store.</summary>
10
+ <description>Products Sold Counter is an awesome way to make your customer engage with your store.</description>
11
+ <notes>Products Sold Counter is stable version. We have tested it many different version.</notes>
12
+ <authors><author><name>Synotive Technologies</name><user>Synotive</user><email>magento@synotive.com</email></author></authors>
13
+ <date>2015-01-27</date>
14
+ <time>09:27:02</time>
15
+ <contents><target name="magecommunity"><dir name="SPL"><dir name="CounterSales"><dir name="Helper"><file name="Data.php" hash="ab669f2479f772cb3755b4f3fd4d6b6f"/></dir><dir name="Model"><file name="Observer.php" hash="e6aa1edb5ed53e3452a343db9fe8e850"/></dir><dir name="etc"><file name="config.xml" hash="a712e76ab0dd071322568b5e9773dc25"/><file name="system.xml" hash="be69c4ccb9e33c535bd32a794a5231af"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SPL_CounterSales.xml" hash="fe1cd2cf82b1c2f3d88603b2e1c35762"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="countersales.xml" hash="b9a4604d1effc32a98136bebc6436d99"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>5.5.0</max></php></required></dependencies>
18
+ </package>