VS_Mostviewed - Version 1.0.0

Version Notes

This extension will help you to show most viewedproducts in left or right panel. You can manage number or product to display from admin area and also managed for left or right panel to display or not.

Download this release

Release Info

Developer Magento Core Team
Extension VS_Mostviewed
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/VS/Mostviewed/Block/Mostviewed.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Edition :- Community
5
+ * Developed By :- virendra Kumar Sharma
6
+ *
7
+ */
8
+ class VS_Mostviewed_Block_Mostviewed extends Mage_Core_Block_Template {
9
+ public function __construct(){
10
+ parent::__construct();
11
+ $howmany = Mage::getStoreConfig('mostviewed/general/howmany');
12
+ $storeId = Mage::app()->getStore()->getId();
13
+ $products = Mage::getResourceModel('reports/product_collection')
14
+ ->addOrderedQty()
15
+ // ->addAttributeToSelect('*')
16
+ ->addAttributeToSelect(array('name', 'price', 'thumbnail','small_image'))
17
+ ->setStoreId($storeId)
18
+ ->addStoreFilter($storeId)
19
+ ->addViewsCount();
20
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
21
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
22
+
23
+ $products->setPageSize($howmany)->setCurPage(1);
24
+ $this->setProductCollection($products);
25
+ }
26
+ }
app/code/community/VS/Mostviewed/Helper/Data.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Edition :- Community
5
+ * Developed By :- virendra Kumar Sharma
6
+ *
7
+ */
8
+ class VS_Mostviewed_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+
11
+ }
app/code/community/VS/Mostviewed/etc/config.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <VS_Mostviewed>
6
+ <version>2.0</version>
7
+ </VS_Mostviewed>
8
+ </modules>
9
+ <global>
10
+ <helpers>
11
+ <mostviewed>
12
+ <class>VS_Mostviewed_Helper</class>
13
+ </mostviewed>
14
+ </helpers>
15
+ <blocks>
16
+ <mostviewed>
17
+ <class>VS_Mostviewed_Block</class>
18
+ </mostviewed>
19
+ </blocks>
20
+ <resources>
21
+ <mostviewed_setup>
22
+ <setup>
23
+ <module>VS_Mostviewed</module>
24
+ </setup>
25
+ <connection>
26
+ <use>core_setup</use>
27
+ </connection>
28
+ </mostviewed_setup>
29
+ <mostviewed_write>
30
+ <connection>
31
+ <use>core_write</use>
32
+ </connection>
33
+ </mostviewed_write>
34
+ <mostviewed_read>
35
+ <connection>
36
+ <use>core_read</use>
37
+ </connection>
38
+ </mostviewed_read>
39
+ </resources>
40
+ </global>
41
+ <default>
42
+ <mostviewed>
43
+ <general>
44
+ <enabledleft>1</enabledleft>
45
+ <enabledright>1</enabledright>
46
+ <howmany>5</howmany>
47
+ </general>
48
+ </mostviewed>
49
+
50
+ </default>
51
+ <frontend>
52
+ <layout>
53
+ <updates>
54
+ <mostviewed>
55
+ <file>mostviewed.xml</file>
56
+ </mostviewed>
57
+ </updates>
58
+ </layout>
59
+ </frontend>
60
+ <adminhtml>
61
+ <acl>
62
+ <resources>
63
+ <admin>
64
+ <children>
65
+ <system>
66
+ <children>
67
+ <config>
68
+ <children>
69
+ <mostviewed>
70
+ <title>Most Viewed Products</title>
71
+ </mostviewed>
72
+ </children>
73
+ </config>
74
+ </children>
75
+ </system>
76
+ </children>
77
+ </admin>
78
+ </resources>
79
+ </acl>
80
+ </adminhtml>
81
+ </config>
app/code/community/VS/Mostviewed/etc/system.xml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <config>
4
+ <tabs>
5
+ <vs_extensions>
6
+ <label>VS Extensions</label>
7
+ <sort_order>195</sort_order>
8
+ </vs_extensions>
9
+ </tabs>
10
+ <sections>
11
+ <mostviewed translate="label" >
12
+ <label>Most Viewed Products</label>
13
+ <tab>vs_extensions</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>90</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general translate="label">
21
+ <label>Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <enabledleft translate="label">
29
+ <label>Enabled For Left</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </enabledleft>
37
+
38
+ <enabledright translate="label">
39
+ <label>Enabled For Right</label>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>adminhtml/system_config_source_yesno</source_model>
42
+ <sort_order>2</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </enabledright>
47
+ <howmany translate="label">
48
+ <label>Products to display</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>3</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </howmany>
55
+
56
+ </fields>
57
+ </general>
58
+
59
+
60
+ </groups>
61
+
62
+ </mostviewed>
63
+ </sections>
64
+ </config>
app/design/frontend/default/default/layout/mostviewed.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <layout version="0.1.0">
4
+ <default>
5
+ <reference name="left">
6
+ <block type="mostviewed/mostviewed" name="catalog.mostviewed.left" after="-">
7
+ <action method="setTemplate" ifconfig="mostviewed/general/enabledleft">
8
+ <template>mostviewed/mostviewed.phtml</template>
9
+ </action>
10
+ </block>
11
+ </reference>
12
+
13
+ <reference name="right">
14
+ <block type="mostviewed/mostviewed" name="catalog.mostviewed.right" after="-">
15
+ <action method="setTemplate" ifconfig="mostviewed/general/enabledright">
16
+ <template>mostviewed/mostviewed.phtml</template>
17
+ </action>
18
+ </block>
19
+ </reference>
20
+ </default>
21
+ </layout>
22
+
app/design/frontend/default/default/template/mostviewed/block_mostviewed.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Edition :- Community
5
+ * Developed By :- virendra Kumar Sharma
6
+ *
7
+ */
8
+ ?>
9
+ <?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
10
+ <div class="block block-related">
11
+ <div class="block-title">
12
+ <strong><span><?php echo $this->__('Most Viewed Products') ?></span></strong>
13
+ </div>
14
+ <div class="block-content">
15
+ <ol class="mini-products-list" id="block-mostviewed">
16
+ <?php $i=1; foreach ($_products->getItems() as $_item): ?>
17
+ <li class="item">
18
+ <div class="product" style="margin-left: 0px;">
19
+ <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
20
+ <div class="product-details">
21
+ <p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a></p>
22
+ </div>
23
+ </div>
24
+ </li>
25
+ <?php endforeach ?>
26
+ </ol>
27
+ <script type="text/javascript">decorateList('block-mostviewed', 'none-recursive')</script>
28
+ </div>
29
+ </div>
30
+ <?php endif ?>
app/design/frontend/default/default/template/mostviewed/mostviewed.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Edition :- Community
5
+ * Developed By :- virendra Kumar Sharma
6
+ *
7
+ */
8
+ ?>
9
+ <?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
10
+ <div class="block block-related">
11
+ <div class="block-title">
12
+ <strong><span><?php echo $this->__('Most Viewed Products') ?></span></strong>
13
+ </div>
14
+ <div class="block-content">
15
+ <ol class="mini-products-list" id="block-mostviewed">
16
+ <?php $i=1; foreach ($_products->getItems() as $_item): ?>
17
+ <li class="item">
18
+ <div class="product" style="margin-left: 0px;">
19
+ <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
20
+ <div class="product-details">
21
+ <p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a></p>
22
+ </div>
23
+ </div>
24
+ </li>
25
+ <?php endforeach ?>
26
+ </ol>
27
+ <script type="text/javascript">decorateList('block-mostviewed', 'none-recursive')</script>
28
+ </div>
29
+ </div>
30
+ <?php endif ?>
app/etc/modules/VS_Mostviewed.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <VS_Mostviewed>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </VS_Mostviewed>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>VS_Mostviewed</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Display most viewed products in left or right panel.</summary>
10
+ <description>This extension will help you to show most viewedproducts in left or right panel. You can manage number or product to display from admin area and also managed for left or right panel to display or not.</description>
11
+ <notes>This extension will help you to show most viewedproducts in left or right panel. You can manage number or product to display from admin area and also managed for left or right panel to display or not.</notes>
12
+ <authors><author><name>virendra kumar sharma</name><user>auto-converted</user><email>bhardwajveerendra@gmail.com</email></author></authors>
13
+ <date>2012-05-16</date>
14
+ <time>12:41:42</time>
15
+ <contents><target name="magecommunity"><dir name="VS"><dir name="Mostviewed"><dir name="Block"><file name="Mostviewed.php" hash="bac0d5f70e013d30301345b86ab1dcfe"/></dir><dir name="Helper"><file name="Data.php" hash="090754928dd07e3107566b198f19fa54"/></dir><dir name="etc"><file name="config.xml" hash="e2e7b32070939e4f33686d8397076ad6"/><file name="system.xml" hash="4f6c629a158da2838c171adb375e72ea"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="mostviewed"><file name="block_mostviewed.phtml" hash="de6ab963c8c0e597e862ea23777a90e5"/><file name="mostviewed.phtml" hash="de6ab963c8c0e597e862ea23777a90e5"/></dir></dir><dir name="layout"><file name="mostviewed.xml" hash="86f7152d3e42ac7931938c09260fd754"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VS_Mostviewed.xml" hash="95b8c8cecde357adf1ec8ca0ec42e39e"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>