CSL_MostViewed - Version 1.0.0

Version Notes

Mostviewed Products Extension CSL

Download this release

Release Info

Developer Cristian Sanclemente
Extension CSL_MostViewed
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/CSL/MostViewed/Block/Mostviewed.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class CSL_MostViewed_Block_Mostviewed extends Mage_Catalog_Block_Product_List
3
+ {
4
+ public function getProducts(){
5
+
6
+ $product_count = 10;
7
+ $storeId = Mage::app()->getStore()->getId();
8
+ $products = Mage::getResourceModel('reports/product_collection')
9
+ ->addAttributeToSelect('*')
10
+ ->setStoreId($storeId)
11
+ ->addStoreFilter($storeId)
12
+ ->addAttributeToSelect(array('name', 'price', 'minimal_price', 'small_image'))
13
+ ->addViewsCount()
14
+ ->setPageSize($product_count);
15
+
16
+ Mage::getSingleton('catalog/product_status')
17
+ ->addVisibleFilterToCollection($products);
18
+ Mage::getSingleton('catalog/product_visibility')
19
+ ->addVisibleInCatalogFilterToCollection($products);
20
+
21
+ return $products;
22
+ }
23
+ }
24
+
25
+ ?>
app/code/community/CSL/MostViewed/controllers/IndexController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class CSL_MostViewed_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout(); //RECUPERAMOS EL LAYOUT
8
+ $this->getLayout()->getBlock('head')->setTitle($this->__('List of 10 Most viewed products')); //Para cambiar el titulo
9
+ $this->renderLayout();
10
+ }
11
+
12
+
13
+ }
14
+
15
+ ?>
app/code/community/CSL/MostViewed/etc/config.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <CSL_MostViewed>
5
+ <version>1.0.0</version>
6
+ </CSL_MostViewed>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <mostviewed>
11
+ <class>CSL_MostViewed_Block</class>
12
+ </mostviewed>
13
+ </blocks>
14
+ </global>
15
+ <frontend>
16
+ <routers>
17
+ <ruta>
18
+ <use>standard</use>
19
+ <args>
20
+ <module>CSL_MostViewed</module>
21
+ <frontName>mostviewed</frontName>
22
+ </args>
23
+ </ruta>
24
+ </routers>
25
+ <layout>
26
+ <updates>
27
+ <mostviewed>
28
+ <file>csl-mostviewed.xml</file>
29
+ </mostviewed>
30
+ </updates>
31
+ </layout>
32
+ </frontend>
33
+ </config>
app/design/frontend/base/default/layout/csl-mostviewed.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <ruta_index_index>
3
+ <label>Most Viewed List</label>
4
+ <reference name="left">
5
+ <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
6
+ </reference>
7
+ <reference name="content">
8
+ <block type="mostviewed/mostviewed" name="MostViewed List" template="mostviewed/list.phtml" />
9
+ </reference>
10
+ </ruta_index_index>
11
+ </layout>
app/design/frontend/base/default/template/mostviewed/list.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ $_productCollection = $this->getProducts();
4
+ $_helper = $this->helper('catalog/output');
5
+ ?>
6
+ <h1> List of 10 most viewed products </h1>
7
+ <div class="category-products">
8
+ <?php $_iterator = 0; ?>
9
+ <ol class="products-list" id="products-list">
10
+ <?php foreach ($_productCollection as $_product): ?>
11
+ <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
12
+ <?php // Product Image ?>
13
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
14
+ <?php // Product description ?>
15
+ <div class="product-shop">
16
+ <div class="f-fix">
17
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
18
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
19
+ <?php if($_product->getRatingSummary()): ?>
20
+ <?php echo $this->getReviewsSummaryHtml($_product) ?>
21
+ <?php endif; ?>
22
+ <?php echo $this->getPriceHtml($_product, true) ?>
23
+ <?php if($_product->isSaleable()): ?>
24
+ <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
25
+ <?php else: ?>
26
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
27
+ <?php endif; ?>
28
+ <div class="desc std">
29
+ <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
30
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
31
+ </div>
32
+ <ul class="add-to-links">
33
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
34
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
35
+ <?php endif; ?>
36
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
37
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
38
+ <?php endif; ?>
39
+ </ul>
40
+ </div>
41
+ </div>
42
+ </li>
43
+ <?php endforeach; ?>
44
+ </ol>
45
+ <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
46
+ </div>
app/etc/modules/CSL_All.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <CSL_MostViewed>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ </CSL_MostViewed>
7
+ </modules>
8
+ </config>
package.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>CSL_MostViewed</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>List the top 10 of your store products online</summary>
10
+ <description>CSL MostViewed Products &#xD;
11
+ &#xD;
12
+ The top 10 list of your online store with only install this extension products. &#xD;
13
+ &#xD;
14
+ The list of products will be visible in the public part in: &#xD;
15
+ http://yourshop/mostviewed</description>
16
+ <notes>Mostviewed Products Extension CSL</notes>
17
+ <authors><author><name>Cristian Sanclemente</name><user>crissanclick</user><email>cristian@clickelectrodomesticos.com</email></author></authors>
18
+ <date>2014-07-02</date>
19
+ <time>10:23:28</time>
20
+ <contents><target name="magecommunity"><dir name="CSL"><dir name="MostViewed"><dir name="Block"><file name="Mostviewed.php" hash="3b422e266c79cee0f1c5af09a363c97b"/></dir><dir name="controllers"><file name="IndexController.php" hash="a329f4dfd583c842fbcc526496a0a6b8"/></dir><dir name="etc"><file name="config.xml" hash="38599bd82ff5806a2917fd834f477468"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="csl-mostviewed.xml" hash="dd579f8ce65f097d968f7293c97d7497"/></dir><dir name="template"><dir name="mostviewed"><file name="list.phtml" hash="827cb77dca70f1c7697a62a0f4cd776d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CSL_All.xml" hash="89ac6c60ddec2e95238ad1d7fb0305f5"/></dir></target></contents>
21
+ <compatible/>
22
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
23
+ </package>