Ayaline_MostViewed - Version 1.1.1

Version Notes

Enhance your site content by allowing to display your catalog most viewed products

Download this release

Release Info

Developer Magento Core Team
Extension Ayaline_MostViewed
Version 1.1.1
Comparing to
See all releases


Version 1.1.1

Files changed (24) hide show
  1. app/code/community/Ayaline/MostViewed/Block/List.php +57 -0
  2. app/code/community/Ayaline/MostViewed/Block/Sidebar.php +102 -0
  3. app/code/community/Ayaline/MostViewed/Block/Widget/MostViewed.php +24 -0
  4. app/code/community/Ayaline/MostViewed/Helper/Data.php +21 -0
  5. app/code/community/Ayaline/MostViewed/Model/Adminhtml/System/Config/Source/ListMode.php +24 -0
  6. app/code/community/Ayaline/MostViewed/Model/MostViewed.php +160 -0
  7. app/code/community/Ayaline/MostViewed/Model/MostViewedIndex.php +72 -0
  8. app/code/community/Ayaline/MostViewed/Model/Mysql4/MostViewed.php +74 -0
  9. app/code/community/Ayaline/MostViewed/Model/Mysql4/MostViewed/Collection.php +162 -0
  10. app/code/community/Ayaline/MostViewed/Model/Mysql4/MostViewedIndex.php +82 -0
  11. app/code/community/Ayaline/MostViewed/Model/Observer.php +31 -0
  12. app/code/community/Ayaline/MostViewed/controllers/Catalog/MostviewedController.php +30 -0
  13. app/code/community/Ayaline/MostViewed/etc/adminhtml.xml +33 -0
  14. app/code/community/Ayaline/MostViewed/etc/config.xml +136 -0
  15. app/code/community/Ayaline/MostViewed/etc/system.xml +133 -0
  16. app/code/community/Ayaline/MostViewed/etc/widget.xml +57 -0
  17. app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-install-0.1.0.php +31 -0
  18. app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-upgrade-0.1.0-0.1.1.php +48 -0
  19. app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-upgrade-0.1.1-0.1.2.php +40 -0
  20. app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-upgrade-0.1.2-0.1.3.php +49 -0
  21. app/etc/modules/Ayaline_MostViewed.xml +23 -0
  22. app/locale/en_US/Ayaline_MostViewed.csv +27 -0
  23. app/locale/fr_FR/Ayaline_MostViewed.csv +27 -0
  24. package.xml +26 -0
app/code/community/Ayaline/MostViewed/Block/List.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+
17
+ class Ayaline_MostViewed_Block_List extends Mage_Catalog_Block_Product_List {
18
+
19
+ protected $_collection;
20
+
21
+ public function _construct(){
22
+ parent::_construct();
23
+ $this->_collection = $this->_getProductCollection();
24
+ }
25
+
26
+ public function getListName() {
27
+ return Mage::helper('ayalinemostviewed')->__('Most viewed');
28
+ }
29
+
30
+ protected function _getProductCollection() {
31
+ if(!$this->_collection) {
32
+ /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
33
+ $collection = parent::_getProductCollection();
34
+
35
+ $collection = Mage::getSingleton('ayalinemostviewed/mostViewed')
36
+ ->addToProductCollection($collection, true, $this->_getLastXDays() - 1)
37
+ ;
38
+ $collection->getSelect()->order('most_viewed DESC');
39
+
40
+ $this->_collection = $collection;
41
+ }
42
+
43
+ return $this->_collection;
44
+ }
45
+
46
+ protected function _getLastXDays() {
47
+ return Mage::getStoreConfig('ayalinemostviewed/list/size');
48
+ }
49
+
50
+ protected function _beforeToHtml() {
51
+ parent::_beforeToHtml();
52
+
53
+ $this->getToolbarBlock()->setData('_current_grid_mode', Mage::getStoreConfig('ayalinemostviewed/list/display_mode'));
54
+
55
+ return $this;
56
+ }
57
+ }
app/code/community/Ayaline/MostViewed/Block/Sidebar.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Block_Sidebar extends Mage_Catalog_Block_Product_Abstract
17
+ {
18
+ const XML_PATH_NB_DAYS = 'ayalinemostviewed/sidebar/nb_days';
19
+ const XML_PATH_COUNT = 'ayalinemostviewed/sidebar/count';
20
+ const XML_PATH_TRUNCATE_NAME = 'ayalinemostviewed/sidebar/truncate_name';
21
+
22
+ protected $_nbDays = null;
23
+ protected $_count = null;
24
+ protected $_useStrictMode = true;
25
+
26
+ /**
27
+ * Number of days used to calculate the most viewed
28
+ * Should be called in layouts
29
+ */
30
+ public function setNbDays($nbDays) {
31
+ $this->_nbDays = $nbDays;
32
+ }
33
+
34
+ public function getNbDays() {
35
+ if($this->_nbDays) {
36
+ return $this->_nbDays;
37
+ } else {
38
+ return Mage::getStoreConfig(self::XML_PATH_NB_DAYS);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Number of products displayed in sidebar
44
+ * Should be called in layouts
45
+ */
46
+ public function setCount($count) {
47
+ $this->_count = $count;
48
+ }
49
+
50
+ public function getCount() {
51
+ if($this->_count) {
52
+ return $this->_count;
53
+ } else {
54
+ return Mage::getStoreConfig(self::XML_PATH_COUNT);
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Define the mode. If not strict, products never viewed are still loadeds
60
+ * Should be called in layouts
61
+ */
62
+ public function setUseStrictMode($strict) {
63
+ $this->_useStrictMode = $strict;
64
+ }
65
+
66
+ public function getUseStrictMode() {
67
+ return (bool)$this->_useStrictMode;
68
+ }
69
+
70
+ public function getProductCollection() {
71
+ $productCollection = Mage::getModel('ayalinemostviewed/mostViewed')->getCollection()
72
+ ->addLastDaysFilter($this->getNbDays())
73
+ ->useStrictMode($this->getUseStrictMode())
74
+ ->getProductCollection()
75
+ ->addStoreFilter(Mage::app()->getStore()->getId())
76
+ ->addAttributeToSelect('name')
77
+ ->addAttributeToFilter('status', array('eq' => 1))
78
+ ->setPageSize($this->getCount())
79
+ ;
80
+
81
+ if($category = Mage::registry('current_category')) {
82
+ $productCollection->addCategoryFilter($category);
83
+ }
84
+
85
+ $productCollection = $this->_addProductAttributesAndPrices($productCollection);
86
+
87
+ Mage::dispatchEvent('ayalinemostviewed_sidebar_prepare_collection', array('collection' => $productCollection));
88
+
89
+ return $productCollection;
90
+ }
91
+
92
+ public function getProductName($product) {
93
+ $name = $this->helper('catalog/output')->productAttribute($product, $product->getName(), 'name');
94
+
95
+ if($nb = Mage::getStoreConfig(self::XML_PATH_TRUNCATE_NAME)) {
96
+ $useless = '';
97
+ return Mage::helper('core/string')->truncate($name, $nb, '...', $useless, false);
98
+ }
99
+
100
+ return $name;
101
+ }
102
+ }
app/code/community/Ayaline/MostViewed/Block/Widget/MostViewed.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Block_Widget_MostViewed extends Ayaline_MostViewed_Block_Sidebar implements Mage_Widget_Block_Interface {
17
+
18
+ protected function _construct() {
19
+ parent::_construct();
20
+ $this->setCount($this->getData('products_count')); // nb products in template
21
+ $this->setColumnCount($this->getData('column_count')); // if grid template, number of columns
22
+ }
23
+
24
+ }
app/code/community/Ayaline/MostViewed/Helper/Data.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Helper_Data extends Mage_Core_Helper_Abstract
17
+ {
18
+ public function listIsActive() {
19
+ return Mage::getStoreConfig('ayalinemostviewed/list/is_active');
20
+ }
21
+ }
app/code/community/Ayaline/MostViewed/Model/Adminhtml/System/Config/Source/ListMode.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Model_Adminhtml_System_Config_Source_ListMode
17
+ {
18
+ public function toOptionArray() {
19
+ return array(
20
+ array('value'=>'grid', 'label'=>Mage::helper('ayalinemostviewed')->__('Grid')),
21
+ array('value'=>'list', 'label'=>Mage::helper('ayalinemostviewed')->__('List')),
22
+ );
23
+ }
24
+ }
app/code/community/Ayaline/MostViewed/Model/MostViewed.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Model_MostViewed extends Mage_Core_Model_Abstract
17
+ {
18
+ /**
19
+ * XML configuration paths
20
+ */
21
+ const XML_PATH_NB_DAYS_EXPIRY = 'ayalinemostviewed/general/nb_days_expiry';
22
+ const XML_PATH_SIDEBAR_NB_DAYS = 'ayalinemostviewed/sidebar/nb_days';
23
+ const XML_PATH_GENERAL_SHOW_OUT_OF_STOCK = 'ayalinemostviewed/general/show_out_of_stock';
24
+
25
+ protected function _construct() {
26
+ $this->_init('ayalinemostviewed/mostViewed');
27
+ }
28
+
29
+ public function getNbDaysExpiry($storeId=null) {
30
+ return Mage::getStoreConfig(self::XML_PATH_NB_DAYS_EXPIRY, $storeId);
31
+ }
32
+
33
+ public function cleanOld($storeIds=null) {
34
+ if($storeIds instanceof Mage_Cron_Model_Schedule) {
35
+ $storeIds = null;
36
+ }
37
+
38
+ if(is_null($storeIds)) {
39
+ $storeIds = Mage::app()->getStores(true);
40
+ } elseif(!is_array($storeIds)) {
41
+ $storeIds = array($storeIds);
42
+ }
43
+
44
+ foreach($storeIds as $store) {
45
+ $storeId = $store->getId();
46
+
47
+ $date = new Zend_Date();
48
+ $nbDaysExpiry = $this->getNbDaysExpiry($storeId);
49
+ $date->sub($nbDaysExpiry, Zend_Date::DAY);
50
+
51
+ $this->_getResource()->cleanOlderThan($storeId, $date->get('YYYY-MM-dd'));
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Increase most viewed count for the given parameters.
57
+ *
58
+ * @param int $productId
59
+ * @param int $storeId
60
+ * @param string $date
61
+ * @param int $nbViewed
62
+ * @param string $zdFormat : date format for $date (see Zend_Date)
63
+ *
64
+ * @return bool : true if updates
65
+ */
66
+ public function increaseMostViewedCount($productId, $storeId, $date, $nbViewed=1, $zdFormat='YYYY-MM-dd HH:mm:ss') {
67
+ $zd = new Zend_Date($date, $zdFormat);
68
+
69
+ $session = Mage::getSingleton('customer/session');
70
+ if(is_null($session->getData('ayalinemostviewed_informations'))) {
71
+ $session->setData('ayalinemostviewed_informations', new Varien_Object());
72
+ }
73
+ $informations = $session->getData('ayalinemostviewed_informations');
74
+ if(is_null($informations->getData('store_' . $storeId))) {
75
+ $informations->setData('store_' . $storeId, new Varien_Object());
76
+ }
77
+ $storeInformations = $informations->getData('store_' . $storeId);
78
+
79
+ if(is_null($storeInformations->getData('product_' . $productId))) {
80
+ // To avoid multiple increases on the same product for one user
81
+ $this->_getResource()->increaseMostViewedCount($productId, $storeId, $zd->get('YYYY-MM-dd'), $nbViewed);
82
+ $storeInformations->setData('product_' . $productId, true);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Decrease most viewed count for the given parameters.
88
+ * If no count if found for these parameters, do nothing.
89
+ *
90
+ * @param int $productId
91
+ * @param int $storeId
92
+ * @param string $date
93
+ * @param int $nbViewed
94
+ * @param string $zdFormat : date format for $date (see Zend_Date)
95
+ *
96
+ * @return bool : true if updates
97
+ */
98
+ public function decreaseMostViewedCount($productId, $storeId, $date, $nbViewed, $zdFormat='YYYY-MM-dd HH:mm:ss') {
99
+ $zd = new Zend_Date($date, $zdFormat);
100
+
101
+ return $this->_getResource()->decreaseMostViewedCount($productId, $storeId, $zd->get('YYYY-MM-dd'), $nbViewed);
102
+ }
103
+
104
+ /**
105
+ *
106
+ * Prepare collection with most_viewed_count attribute
107
+ *
108
+ * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
109
+ * @param boolean $strict : get also the products already viewed or not
110
+ * @param int $nbDays : number of days (inclusive)
111
+ * @param int $store : store id (default : current store)
112
+ * @param string $alias : the name of the alias
113
+ *
114
+ * @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
115
+ */
116
+ public function addToProductCollection($collection, $strict = false, $nbDays = null, $store = null, $alias = 'most_viewed'){
117
+ /** Manage strict Param **/
118
+ if($strict === true){
119
+ $join = 'joinInner';
120
+ }else{
121
+ $join = 'joinLeft';
122
+ }
123
+
124
+ /** Manage store Param **/
125
+ if(!$store){
126
+ $store = Mage::app()->getStore()->getId();
127
+ }
128
+
129
+ /** Manage nbDays Param **/
130
+ if($nbDays == null){
131
+ $nbDays = Mage::getStoreConfig(self::XML_PATH_SIDEBAR_NB_DAYS, $store);
132
+ }
133
+
134
+ $joinConditions = array('e.entity_id = amvi.product_id',
135
+ "amvi.store_id = '".$store."'",
136
+ "amvi.day = '".$nbDays."'");
137
+
138
+ $collection
139
+ ->getSelect()
140
+ ->$join(
141
+ array('amvi' => $collection->getTable('ayalinemostviewed/most_viewed_index')),
142
+ implode(' AND ', $joinConditions),
143
+ array($alias => 'amvi.nb_viewed')
144
+ )
145
+ ;
146
+
147
+ if(!Mage::getStoreConfig(self::XML_PATH_GENERAL_SHOW_OUT_OF_STOCK)) {
148
+ $collection->getSelect()
149
+ ->joinInner(
150
+ array('ciss' => $collection->getTable('cataloginventory/stock_status')),
151
+ "ciss.product_id = e.entity_id AND ciss.website_id = '".Mage::app()->getStore($store)->getWebsiteId()."'",
152
+ array()
153
+ )
154
+ ->where('ciss.stock_status = ?', Mage_CatalogInventory_Model_Stock_Status::STATUS_IN_STOCK)
155
+ ;
156
+ }
157
+
158
+ return $collection;
159
+ }
160
+ }
app/code/community/Ayaline/MostViewed/Model/MostViewedIndex.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Model_MostViewedIndex extends Mage_Core_Model_Abstract {
17
+
18
+ protected function _construct() {
19
+ $this->_init('ayalinemostviewed/mostViewedIndex');
20
+ }
21
+
22
+ /**
23
+ * Création de la table d'index des produits les plus consultés
24
+ *
25
+ * @param array(Mage_Core_Model_Store) $stores
26
+ * @param bool $withDefault
27
+ */
28
+ public function indexMostViewed($stores = null) {
29
+ if((is_array($stores) && empty($stores)) || is_null($stores) || $stores instanceof Mage_Cron_Model_Schedule) {
30
+ $stores = Mage::app()->getStores();
31
+ } elseif(!is_array($stores)) {
32
+ $stores = array($stores);
33
+ }
34
+
35
+ try {
36
+ $this->_getResource()->truncateIdxTable();
37
+
38
+ foreach($stores as $_store) {
39
+ if($_store instanceof Mage_Core_Model_Store) {
40
+ $storeId = $_store->getStoreId();
41
+ } else {
42
+ $storeId = $_store;
43
+ }
44
+ try {
45
+ $this->_getResource()->indexMostViewed($storeId);
46
+ } catch(Exception $e) {
47
+ $notificationObject = new Varien_Object(array(
48
+ 'title' => Mage::helper('ayalinemostviewed')->__('An error occurred while indexing %s to the store %s', Mage::helper('ayalinemostviewed')->__('Most viewed'), $_store->getName()),
49
+ 'date' => date('Y-m-d H:i:s'),
50
+ 'url' => '#',
51
+ 'description' => $e->getMessage().'<br />'.Mage::helper('ayalinecore')->__('See exception.log'),
52
+ ));
53
+ Mage::helper('ayalinecore')->addCustomAdminNotification($notificationObject);
54
+ Mage::logException($e);
55
+ }
56
+ }
57
+
58
+ $this->_getResource()->renameTables();
59
+
60
+ } catch(Exception $e) {
61
+ $notificationObject = new Varien_Object(array(
62
+ 'title' => Mage::helper('ayalinemostviewed')->__('An error occurred while indexing %s', Mage::helper('ayalinemostviewed')->__('Most viewed')),
63
+ 'date' => date('Y-m-d H:i:s'),
64
+ 'url' => '#',
65
+ 'description' => $e->getMessage().'<br />'.Mage::helper('ayalinecore')->__('See exception.log'),
66
+ ));
67
+ Mage::helper('ayalinecore')->addCustomAdminNotification($notificationObject);
68
+ Mage::logException($e);
69
+ }
70
+ }
71
+
72
+ }
app/code/community/Ayaline/MostViewed/Model/Mysql4/MostViewed.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Model_Mysql4_MostViewed extends Mage_Core_Model_Mysql4_Abstract
17
+ {
18
+ protected function _construct() {
19
+ $this->_init('ayalinemostviewed/most_viewed', 'most_viewed_id');
20
+ }
21
+
22
+ public function increaseMostViewedCount($productId, $storeId, $date, $nbViewed) {
23
+ if(!$this->_getRow($productId, $storeId, $date)) {
24
+ $this->_getWriteAdapter()->insert($this->getMainTable(), array(
25
+ 'product_id' => $productId,
26
+ 'store_id' => $storeId,
27
+ 'most_viewed_date' => $date,
28
+ 'most_viewed_count' => $nbViewed,
29
+ ));
30
+ } else {
31
+ $conditions = array();
32
+ $conditions[] = $this->_getWriteAdapter()->quoteInto('product_id = ?', $productId);
33
+ $conditions[] = $this->_getWriteAdapter()->quoteInto('store_id = ?', $storeId);
34
+ $conditions[] = $this->_getWriteAdapter()->quoteInto('most_viewed_date = ?', $date);
35
+
36
+ $this->_getWriteAdapter()->update($this->getMainTable(), array('most_viewed_count' => new Zend_Db_Expr('most_viewed_count + ' . $nbViewed)), $conditions);
37
+ }
38
+ }
39
+
40
+ public function decreaseMostViewedCount($productId, $storeId, $date, $nbViewed) {
41
+ if(!$this->_getRow($productId, $storeId, $date)) {
42
+ return false;
43
+ }
44
+
45
+ $conditions = array();
46
+ $conditions[] = $this->_getWriteAdapter()->quoteInto('product_id = ?', $productId);
47
+ $conditions[] = $this->_getWriteAdapter()->quoteInto('store_id = ?', $storeId);
48
+ $conditions[] = $this->_getWriteAdapter()->quoteInto('most_viewed_date = ?', $date);
49
+
50
+ $this->_getWriteAdapter()->update($this->getMainTable(), array('most_viewed_count' => new Zend_Db_Expr('most_viewed_count - ' . $nbViewed)), $conditions);
51
+
52
+ return true;
53
+ }
54
+
55
+ public function cleanOlderThan($storeId, $date) {
56
+ $this->_getWriteAdapter()->delete(
57
+ $this->getMainTable(),
58
+ array(
59
+ $this->_getWriteAdapter()->quoteInto('most_viewed_date < ?', $date),
60
+ $this->_getWriteAdapter()->quoteInto('store_id = ?', $storeId),
61
+ )
62
+ );
63
+ }
64
+
65
+ protected function _getRow($productId, $storeId, $date) {
66
+ $select = $this->_getReadAdapter()->select()
67
+ ->from($this->getMainTable())
68
+ ->where('product_id = ?', $productId)
69
+ ->where('store_id = ?', $storeId)
70
+ ->where('most_viewed_date = ?', $date)
71
+ ;
72
+ return $this->_getReadAdapter()->fetchRow($select);
73
+ }
74
+ }
app/code/community/Ayaline/MostViewed/Model/Mysql4/MostViewed/Collection.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Model_Mysql4_MostViewed_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
17
+ {
18
+ protected $_storeFilterApplied = false;
19
+ protected $_useStrictMode = false;
20
+
21
+ public function _construct() {
22
+ $this->_init('ayalinemostviewed/mostViewed');
23
+ }
24
+
25
+ /**
26
+ * Returns a new product collection after joining with current collection
27
+ * Only $fields are added to product collection select
28
+ *
29
+ * @param array $fields
30
+ * @param string $sortOrder
31
+ * @param string $sortDirection
32
+ */
33
+ public function getProductCollection($fields=array(), $sortOrder='most_viewed_count', $sortDirection='desc') {
34
+ if(sizeof($fields) == 0) {
35
+ $fields = array('most_viewed_count' => new Zend_Db_Expr('SUM(most_viewed_count)'));
36
+ }
37
+
38
+ /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product */
39
+ $collection = Mage::getModel('catalog/product')->getCollection();
40
+
41
+ $mostViewedCollection = clone($this);
42
+ $mostViewedCollection->load();
43
+
44
+ if($this->_useStrictMode) {
45
+ $collection->getSelect()
46
+ ->joinInner(
47
+ array('abs' => $mostViewedCollection->getSelect()),
48
+ 'e.entity_id = abs.product_id',
49
+ $fields
50
+ );
51
+ } else {
52
+ $collection->getSelect()
53
+ ->joinLeft(
54
+ array('abs' => $mostViewedCollection->getSelect()),
55
+ 'e.entity_id = abs.product_id',
56
+ $fields
57
+ );
58
+ }
59
+
60
+ $collection->getSelect()
61
+ ->group('e.entity_id')
62
+ ->order("$sortOrder $sortDirection")
63
+ ;
64
+
65
+ return $collection;
66
+ }
67
+
68
+ protected function _beforeLoad() {
69
+ if(!$this->_storeFilterApplied) {
70
+ $this->addStoreFilter(Mage::app()->getStore()->getId());
71
+ }
72
+ return parent::_beforeLoad();
73
+ }
74
+
75
+ public function useStrictMode($strict=true) {
76
+ $this->_useStrictMode = $strict;
77
+ return $this;
78
+ }
79
+
80
+ public function addLastDaysFilter($nbDays, $strict=false) {
81
+ $date = new Zend_Date();
82
+ $date->sub($nbDays, Zend_Date::DAY);
83
+ $this->addAfterDateFilter($date->get('YYYY-MM-dd'), $strict);
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ * @param string $date
89
+ * @param bool $strict
90
+ * @param string $zdFormat : date format for $date (see Zend_Date)
91
+ */
92
+ public function addAfterDateFilter($date, $strict=false, $zdFormat='YYYY-MM-dd') {
93
+ $operand = $strict ? 'gt' : 'gteq';
94
+
95
+ return $this->_addDateFilter($date, $zdFormat, $operand);
96
+ }
97
+
98
+ /**
99
+ * @param string $date
100
+ * @param bool $strict
101
+ * @param string $zdFormat : date format for $date (see Zend_Date)
102
+ */
103
+ public function addBeforeDateFilter($date, $strict=false, $zdFormat='YYYY-MM-dd') {
104
+ $operand = $strict ? 'lt' : 'lteq';
105
+
106
+ return $this->_addDateFilter($date, $zdFormat, $operand);
107
+ }
108
+
109
+ /**
110
+ * @param string $date
111
+ * @param string $zdFormat : date format for $date (see Zend_Date)
112
+ */
113
+ public function addDateFilter($date, $zdFormat='YYYY-MM-dd') {
114
+ return $this->_addDateFilter($date, $zdFormat, 'eq');
115
+ }
116
+
117
+ protected function _addDateFilter($date, $zdFormat, $operand) {
118
+ $zd = new Zend_Date($date, $zdFormat);
119
+
120
+ $this->addFieldToFilter('main_table.most_viewed_date', array($operand => $zd->get('YYYY-MM-dd')));
121
+
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Add Products Filter
127
+ *
128
+ * @param int|array $productId
129
+ * @return Ayaline_MostViewed_Model_Mysql4_MostViewed_Collection
130
+ */
131
+ public function addProductFilter($productId) {
132
+ if(!is_array($productId)) {
133
+ $productId = array($productId);
134
+ }
135
+
136
+ $this->addFieldToFilter('main_table.product_id', array('in' => $productId));
137
+
138
+ return $this;
139
+ }
140
+
141
+ /**
142
+ * Add Stores Filter
143
+ *
144
+ * @param int|array $storeId
145
+ * @return Ayaline_MostViewed_Model_Mysql4_MostViewed_Collection
146
+ */
147
+ public function addStoreFilter($storeId, $withAdmin = true) {
148
+ if(!is_array($storeId)) {
149
+ $storeId = array($storeId);
150
+ }
151
+
152
+ if($withAdmin) {
153
+ $storeId[] = 0;
154
+ }
155
+
156
+ $this->addFieldToFilter('main_table.store_id', array('in' => $storeId));
157
+
158
+ $this->_storeFilterApplied = true;
159
+
160
+ return $this;
161
+ }
162
+ }
app/code/community/Ayaline/MostViewed/Model/Mysql4/MostViewedIndex.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Model_Mysql4_MostViewedIndex extends Mage_Core_Model_Mysql4_Abstract {
17
+
18
+ const XML_PATH_GENERAL_NB_DAYS_EXPIRY = 'ayalinemostviewed/general/nb_days_expiry';
19
+
20
+ protected function _construct() {
21
+ $this->_init('ayalinemostviewed/most_viewed_index', 'index_id');
22
+ }
23
+
24
+ /**
25
+ * Table d'index
26
+ *
27
+ * @param int $storeId
28
+ */
29
+ public function indexMostViewed($storeId) {
30
+ $indexSize = $this->_getIndexSize($storeId);
31
+
32
+ for($i = 0; $i <= $indexSize; $i++) {
33
+ $date = new Zend_Date();
34
+ $date->subDay($i);
35
+
36
+ /* @var $select Varien_Db_Select */
37
+ $select = $this->_getReadAdapter()->select()
38
+ ->from(
39
+ $this->getTable('ayalinemostviewed/most_viewed'),
40
+ array('product_id', 'day' => new Zend_Db_Expr($i), 'store_id', 'nb_viewed' => 'SUM(most_viewed_count)'))
41
+ ->where('most_viewed_date >= ?', $date->toString('y-MM-dd'))
42
+ ->where('store_id = ?', $storeId)
43
+ ->group('product_id')
44
+ ;
45
+
46
+ $query = $select->insertFromSelect($this->getTable('ayalinemostviewed/most_viewed_index_idx'), array('product_id', 'day', 'store_id', 'nb_viewed'));
47
+ $this->_getWriteAdapter()->query($query);
48
+ }
49
+ }
50
+
51
+ public function truncateIdxTable() {
52
+ $this->_getWriteAdapter()->truncate($this->getTable('ayalinemostviewed/most_viewed_index_idx'));
53
+ }
54
+
55
+ public function renameTables() {
56
+ $sql = "
57
+ RENAME TABLE
58
+ `{$this->getTable('ayalinemostviewed/most_viewed_index_idx')}` TO `ayalinemostviewed_most_viewed_index_tmp`,
59
+ `{$this->getMainTable()}` TO `{$this->getTable('ayalinemostviewed/most_viewed_index_idx')}`,
60
+ `ayalinemostviewed_most_viewed_index_tmp` TO `{$this->getMainTable()}`;
61
+ ";
62
+
63
+ $this->_getWriteAdapter()->query($sql);
64
+ }
65
+
66
+
67
+ protected function _getIndexSize($storeId) {
68
+ $indexSize = Mage::getStoreConfig(self::XML_PATH_GENERAL_NB_DAYS_EXPIRY, $storeId);
69
+ return $indexSize-1;
70
+ }
71
+
72
+ protected function _getRow($productId, $day, $storeId) {
73
+ $select = $this->_getReadAdapter()->select()
74
+ ->from($this->getMainTable())
75
+ ->where('product_id = ?', $productId)
76
+ ->where('day = ?', $day)
77
+ ->where('store_id = ?', $storeId)
78
+ ;
79
+ return $this->_getReadAdapter()->fetchRow($select);
80
+ }
81
+
82
+ }
app/code/community/Ayaline/MostViewed/Model/Observer.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Model_Observer extends Mage_Core_Model_Abstract
17
+ {
18
+ /**
19
+ * Event : controller_action_postdispatch_catalog_product_view
20
+ *
21
+ * @param Varien_Event_Observer $observer
22
+ * @return Ayaline_BestSales_Model_Observer
23
+ */
24
+ public function increaseProductView(Varien_Event_Observer $observer) {
25
+ $product = Mage::registry('current_product');
26
+
27
+ $zd = new Zend_Date();
28
+ Mage::getSingleton('ayalinemostviewed/mostViewed')->increaseMostViewedCount($product->getId(), $product->getStoreId(), $zd->get('YYYY-MM-dd'));
29
+ }
30
+ }
31
+
app/code/community/Ayaline/MostViewed/controllers/Catalog/MostviewedController.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ /**
13
+ *
14
+ * @package Ayaline_MostViewed
15
+ */
16
+ class Ayaline_MostViewed_Catalog_MostviewedController extends Mage_Core_Controller_Front_Action {
17
+
18
+ protected function _construct() {
19
+ $this->_realModuleName = 'Ayaline_MostViewed';
20
+ }
21
+
22
+ public function indexAction() {
23
+ if(!Mage::helper('ayalinemostviewed')->listIsActive()) {
24
+ $this->_forward('cms/index/noRoute');
25
+ return;
26
+ }
27
+ $this->loadLayout();
28
+ $this->renderLayout();
29
+ }
30
+ }
app/code/community/Ayaline/MostViewed/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * created : 29/08/2011
5
+ *
6
+ * @category Ayaline
7
+ * @package Ayaline_MostViewed
8
+ * @author aYaline
9
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
10
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
11
+ */
12
+ -->
13
+ <config>
14
+ <acl>
15
+ <resources>
16
+ <admin>
17
+ <children>
18
+ <system>
19
+ <children>
20
+ <config>
21
+ <children>
22
+ <ayalinemostviewed translate="title" module="ayalinemostviewed">
23
+ <title>Ayaline Most Viewed</title>
24
+ </ayalinemostviewed>
25
+ </children>
26
+ </config>
27
+ </children>
28
+ </system>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/Ayaline/MostViewed/etc/config.xml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * created : 29/08/2011
5
+ *
6
+ * @category Ayaline
7
+ * @package Ayaline_MostViewed
8
+ * @author aYaline
9
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
10
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
11
+ */
12
+ -->
13
+ <config>
14
+ <modules>
15
+ <Ayaline_MostViewed>
16
+ <version>1.1.1</version>
17
+ </Ayaline_MostViewed>
18
+ </modules>
19
+ <global>
20
+ <blocks>
21
+ <ayalinemostviewed>
22
+ <class>Ayaline_MostViewed_Block</class>
23
+ </ayalinemostviewed>
24
+ </blocks>
25
+ <models>
26
+ <ayalinemostviewed>
27
+ <class>Ayaline_MostViewed_Model</class>
28
+ <resourceModel>ayalinemostviewed_mysql4</resourceModel>
29
+ </ayalinemostviewed>
30
+ <ayalinemostviewed_mysql4>
31
+ <class>Ayaline_MostViewed_Model_Mysql4</class>
32
+ <entities>
33
+ <most_viewed>
34
+ <table>ayaline_most_viewed</table>
35
+ </most_viewed>
36
+ <most_viewed_index>
37
+ <table>ayaline_most_viewed_index</table>
38
+ </most_viewed_index>
39
+ <most_viewed_index_idx>
40
+ <table>ayaline_most_viewed_index_idx</table>
41
+ </most_viewed_index_idx>
42
+ </entities>
43
+ </ayalinemostviewed_mysql4>
44
+ </models>
45
+ <resources>
46
+ <ayalinemostviewed_setup>
47
+ <setup>
48
+ <module>Ayaline_MostViewed</module>
49
+ </setup>
50
+ </ayalinemostviewed_setup>
51
+ </resources>
52
+ <helpers>
53
+ <ayalinemostviewed>
54
+ <class>Ayaline_MostViewed_Helper</class>
55
+ </ayalinemostviewed>
56
+ </helpers>
57
+ <events>
58
+ <controller_action_postdispatch_catalog_product_view>
59
+ <observers>
60
+ <ayalinemostviewed_increase_product_view>
61
+ <class>ayalinemostviewed/observer</class>
62
+ <method>increaseProductView</method>
63
+ </ayalinemostviewed_increase_product_view>
64
+ </observers>
65
+ </controller_action_postdispatch_catalog_product_view>
66
+ </events>
67
+ </global>
68
+ <adminhtml>
69
+ <translate>
70
+ <modules>
71
+ <Ayaline_MostViewed>
72
+ <files>
73
+ <default>Ayaline_MostViewed.csv</default>
74
+ </files>
75
+ </Ayaline_MostViewed>
76
+ </modules>
77
+ </translate>
78
+ </adminhtml>
79
+ <frontend>
80
+ <translate>
81
+ <modules>
82
+ <Ayaline_MostViewed>
83
+ <files>
84
+ <default>Ayaline_MostViewed.csv</default>
85
+ </files>
86
+ </Ayaline_MostViewed>
87
+ </modules>
88
+ </translate>
89
+ <layout>
90
+ <updates>
91
+ <ayalinemostviewed>
92
+ <file>ayaline/most_viewed.xml</file>
93
+ </ayalinemostviewed>
94
+ </updates>
95
+ </layout>
96
+ <routers>
97
+ <catalog>
98
+ <args>
99
+ <modules>
100
+ <ayalinemostviewed before="Mage_Catalog">Ayaline_MostViewed_Catalog</ayalinemostviewed>
101
+ </modules>
102
+ </args>
103
+ </catalog>
104
+ </routers>
105
+ </frontend>
106
+ <default>
107
+ <ayalinemostviewed>
108
+ <general>
109
+ <nb_days_expiry>30</nb_days_expiry>
110
+ <show_out_of_stock>0</show_out_of_stock>
111
+ </general>
112
+ <sidebar>
113
+ <count>5</count>
114
+ <nb_days>30</nb_days>
115
+ <truncate_name>0</truncate_name>
116
+ </sidebar>
117
+ <list>
118
+ <is_active>1</is_active>
119
+ <size>30</size>
120
+ <display_mode>grid</display_mode>
121
+ </list>
122
+ </ayalinemostviewed>
123
+ </default>
124
+ <crontab>
125
+ <jobs>
126
+ <ayalinemostviewed_clean_old>
127
+ <schedule><cron_expr>0 0 * * *</cron_expr></schedule>
128
+ <run><model>ayalinemostviewed/mostViewed::cleanOld</model></run>
129
+ </ayalinemostviewed_clean_old>
130
+ <ayalinemostviewed_index_most_viewed>
131
+ <schedule><cron_expr>0 1 * * *</cron_expr></schedule>
132
+ <run><model>ayalinemostviewed/mostViewedIndex::indexMostViewed</model></run>
133
+ </ayalinemostviewed_index_most_viewed>
134
+ </jobs>
135
+ </crontab>
136
+ </config>
app/code/community/Ayaline/MostViewed/etc/system.xml ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * created : 29/08/2011
5
+ *
6
+ * @category Ayaline
7
+ * @package Ayaline_MostViewed
8
+ * @author aYaline
9
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
10
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
11
+ */
12
+ -->
13
+ <config>
14
+ <sections>
15
+ <ayalinemostviewed translate="label" module="ayalinemostviewed">
16
+ <label>Most viewed</label>
17
+ <tab>ayaline</tab>
18
+ <header_css>ayaline-header</header_css>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>150</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <groups>
25
+ <general translate="label">
26
+ <label>General options</label>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>100</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <fields>
33
+ <nb_days_expiry translate="label">
34
+ <label>Number of days before expiry</label>
35
+ <frontend_type>text</frontend_type>
36
+ <frontend_class>validate-number</frontend_class>
37
+ <sort_order>10</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ </nb_days_expiry>
42
+ <show_out_of_stock translate="label">
43
+ <label>Display Out of Stock Products</label>
44
+ <frontend_type>select</frontend_type>
45
+ <source_model>adminhtml/system_config_source_yesno</source_model>
46
+ <sort_order>20</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </show_out_of_stock>
51
+ </fields>
52
+ </general>
53
+ <sidebar translate="label">
54
+ <label>Most viewed sidebar</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>200</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ <fields>
61
+ <count translate="label">
62
+ <label>Max products displayed</label>
63
+ <frontend_type>text</frontend_type>
64
+ <frontend_class>validate-number</frontend_class>
65
+ <sort_order>10</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </count>
70
+ <nb_days translate="label">
71
+ <label>Number of days</label>
72
+ <frontend_type>text</frontend_type>
73
+ <frontend_class>validate-number</frontend_class>
74
+ <sort_order>20</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <comment>Most viewed sidebar will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value.</comment>
79
+ </nb_days>
80
+ <truncate_name translate="label comment">
81
+ <label>Max characters number displayed in product name</label>
82
+ <frontend_type>text</frontend_type>
83
+ <frontend_class>validate-number</frontend_class>
84
+ <sort_order>30</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ <comment>Use 0 value for no limit.</comment>
89
+ </truncate_name>
90
+ </fields>
91
+ </sidebar>
92
+ <list translate="label">
93
+ <label>Most viewed list</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>300</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <fields>
100
+ <is_active translate="label">
101
+ <label>Is active</label>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>adminhtml/system_config_source_yesno</source_model>
104
+ <sort_order>10</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </is_active>
109
+ <size translate="label comment">
110
+ <label>Number of days</label>
111
+ <frontend_type>text</frontend_type>
112
+ <frontend_class>validate-number</frontend_class>
113
+ <sort_order>20</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ <comment><![CDATA[Most viewed list will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value.]]></comment>
118
+ </size>
119
+ <display_mode translate="label">
120
+ <label>Display mode</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>ayalinemostviewed/adminhtml_system_config_source_listMode</source_model>
123
+ <sort_order>30</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </display_mode>
128
+ </fields>
129
+ </list>
130
+ </groups>
131
+ </ayalinemostviewed>
132
+ </sections>
133
+ </config>
app/code/community/Ayaline/MostViewed/etc/widget.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * created : 29/08/2011
5
+ *
6
+ * @category Ayaline
7
+ * @package Ayaline_MostViewed
8
+ * @author aYaline
9
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
10
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
11
+ */
12
+ -->
13
+ <widgets>
14
+
15
+ <ayalinemostviewed_widget_mostviewed type="ayalinemostviewed/widget_mostViewed" module="ayalinemostviewed" translate="name description label">
16
+ <name>Most Viewed Products</name>
17
+ <description>Display most viewed products (if widget is displayed in category, products will be filter by it)</description>
18
+ <parameters>
19
+ <products_count>
20
+ <visible>1</visible>
21
+ <required>1</required>
22
+ <value>5</value>
23
+ <label>Number of Products to Display</label>
24
+ <type>text</type>
25
+ <sort_order>10</sort_order>
26
+ </products_count>
27
+ <column_count>
28
+ <visible>1</visible>
29
+ <required>1</required>
30
+ <value>3</value>
31
+ <label>Number of Columns</label>
32
+ <type>text</type>
33
+ <sort_order>15</sort_order>
34
+ <depends><template><value>ayaline/most_viewed/widget/grid.phtml</value></template></depends>
35
+ </column_count>
36
+ <template>
37
+ <label>Template</label>
38
+ <visible>1</visible>
39
+ <required>1</required>
40
+ <type>select</type>
41
+ <value>ayaline/most_viewed/widget/list.phtml</value>
42
+ <values>
43
+ <default>
44
+ <value>ayaline/most_viewed/widget/list.phtml</value>
45
+ <label>Products list template</label>
46
+ </default>
47
+ <grid>
48
+ <value>ayaline/most_viewed/widget/grid.phtml</value>
49
+ <label>Products grid template</label>
50
+ </grid>
51
+ </values>
52
+ <sort_order>20</sort_order>
53
+ </template>
54
+ </parameters>
55
+ </ayalinemostviewed_widget_mostviewed>
56
+
57
+ </widgets>
app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ $installer = $this;
13
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
14
+
15
+ $installer->run("
16
+
17
+ DROP TABLE IF EXISTS {$this->getTable('ayalinemostviewed/most_viewed')};
18
+ CREATE TABLE {$this->getTable('ayalinemostviewed/most_viewed')} (
19
+ `most_viewed_id` int(10) unsigned NOT NULL auto_increment,
20
+ `product_id` int(10) unsigned NOT NULL,
21
+ `store_id` smallint(5) unsigned NOT NULL,
22
+ `most_viewed_date` date NOT NULL default '0000-00-00',
23
+ `most_viewed_count` int(10) unsigned NOT NULL default '0',
24
+ PRIMARY KEY (`most_viewed_id`),
25
+ UNIQUE KEY `UK_AYALINE_MOSTVIEWED` (`product_id`,`store_id`,`most_viewed_date`),
26
+ CONSTRAINT `FK_AYALINE_MOSTVIEWED_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog/product')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
27
+ CONSTRAINT `FK_AYALINE_MOSTVIEWED_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
29
+
30
+
31
+ ");
app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ $installer = $this;
13
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
14
+
15
+ $installer->startSetup();
16
+
17
+ $installer->run("
18
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('ayalinemostviewed/most_viewed_index')}` (
19
+ `index_id` INT(10) NOT NULL AUTO_INCREMENT ,
20
+ `product_id` INT(10) UNSIGNED NOT NULL ,
21
+ `day` SMALLINT(5) UNSIGNED NOT NULL ,
22
+ `store_id` SMALLINT(5) UNSIGNED NOT NULL ,
23
+ `nb_viewed` INT(10) UNSIGNED NOT NULL ,
24
+ PRIMARY KEY (`index_id`) ,
25
+
26
+ INDEX `AYALINE_MOST_VIEWED_INDEX_DAY_IDX` (`day` ASC) ,
27
+ INDEX `AYALINE_MOST_VIEWED_INDEX_PRODUCT_ID_IDX` (`product_id` ASC) ,
28
+ INDEX `AYALINE_MOST_VIEWED_INDEX_STORE_ID_IDX` (`store_id` ASC) ,
29
+
30
+ UNIQUE INDEX `AYALINE_MOST_VIEWED_INDEX_UNIQUE_KEY` (`product_id` ASC, `day` ASC, `store_id` ASC) ,
31
+
32
+ CONSTRAINT `FK_AYALINE_MOST_VIEWED_INDEX_PRODUCT_ID`
33
+ FOREIGN KEY (`product_id` )
34
+ REFERENCES `{$installer->getTable('catalog/product')}` (`entity_id` )
35
+ ON DELETE NO ACTION
36
+ ON UPDATE NO ACTION,
37
+
38
+ CONSTRAINT `FK_AYALINE_MOST_VIEWED_INDEX_STORE_ID`
39
+ FOREIGN KEY (`store_id` )
40
+ REFERENCES `{$installer->getTable('core/store')}` (`store_id` )
41
+ ON DELETE NO ACTION
42
+ ON UPDATE NO ACTION)
43
+
44
+ ENGINE = InnoDB;
45
+
46
+ ");
47
+
48
+ $installer->endSetup();
app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ $installer = $this;
13
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
14
+
15
+ $installer->startSetup();
16
+
17
+ $installer->run("
18
+
19
+ ALTER TABLE `{$installer->getTable('ayalinemostviewed/most_viewed_index')}` DROP FOREIGN KEY `FK_AYALINE_MOST_VIEWED_INDEX_PRODUCT_ID`;
20
+ ALTER TABLE `{$installer->getTable('ayalinemostviewed/most_viewed_index')}` DROP FOREIGN KEY `FK_AYALINE_MOST_VIEWED_INDEX_STORE_ID`;
21
+
22
+ ALTER TABLE `{$installer->getTable('ayalinemostviewed/most_viewed_index')}` ADD
23
+ CONSTRAINT `FK_AYALINE_MOST_VIEWED_INDEX_PRODUCT_ID`
24
+ FOREIGN KEY (`product_id` )
25
+ REFERENCES `{$installer->getTable('catalog/product')}` (`entity_id` )
26
+ ON DELETE CASCADE
27
+ ON UPDATE CASCADE
28
+ ;
29
+
30
+ ALTER TABLE `{$installer->getTable('ayalinemostviewed/most_viewed_index')}` ADD
31
+ CONSTRAINT `FK_AYALINE_MOST_VIEWED_INDEX_STORE_ID`
32
+ FOREIGN KEY (`store_id` )
33
+ REFERENCES `{$installer->getTable('core/store')}` (`store_id` )
34
+ ON DELETE CASCADE
35
+ ON UPDATE CASCADE
36
+ ;
37
+
38
+ ");
39
+
40
+ $installer->endSetup();
app/code/community/Ayaline/MostViewed/sql/ayalinemostviewed_setup/mysql4-upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * created : 29/08/2011
4
+ *
5
+ * @category Ayaline
6
+ * @package Ayaline_MostViewed
7
+ * @author aYaline
8
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
9
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
10
+ */
11
+
12
+ $installer = $this;
13
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
14
+
15
+ $installer->startSetup();
16
+
17
+ $installer->run("
18
+
19
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('ayalinemostviewed/most_viewed_index_idx')}` (
20
+ `index_id` INT(10) NOT NULL AUTO_INCREMENT ,
21
+ `product_id` INT(10) UNSIGNED NOT NULL ,
22
+ `day` SMALLINT(5) UNSIGNED NOT NULL ,
23
+ `store_id` SMALLINT(5) UNSIGNED NOT NULL ,
24
+ `nb_viewed` INT(10) UNSIGNED NOT NULL ,
25
+ PRIMARY KEY (`index_id`) ,
26
+
27
+ INDEX `AYALINE_MOST_VIEWED_INDEX_IDX_DAY_IDX` (`day` ASC) ,
28
+ INDEX `AYALINE_MOST_VIEWED_INDEX_IDX_PRODUCT_ID_IDX` (`product_id` ASC) ,
29
+ INDEX `AYALINE_MOST_VIEWED_INDEX_IDX_STORE_ID_IDX` (`store_id` ASC) ,
30
+
31
+ UNIQUE INDEX `AYALINE_MOST_VIEWED_INDEX_IDX_UNIQUE_KEY` (`product_id` ASC, `day` ASC, `store_id` ASC) ,
32
+
33
+ CONSTRAINT `FK_AYALINE_MOST_VIEWED_INDEX_IDX_PRODUCT_ID`
34
+ FOREIGN KEY (`product_id` )
35
+ REFERENCES `{$installer->getTable('catalog/product')}` (`entity_id` )
36
+ ON DELETE CASCADE
37
+ ON UPDATE CASCADE,
38
+
39
+ CONSTRAINT `FK_AYALINE_MOST_VIEWED_INDEX_IDX_STORE_ID`
40
+ FOREIGN KEY (`store_id` )
41
+ REFERENCES `{$installer->getTable('core/store')}` (`store_id` )
42
+ ON DELETE CASCADE
43
+ ON UPDATE CASCADE)
44
+
45
+ ENGINE = InnoDB;
46
+
47
+ ");
48
+
49
+ $installer->endSetup();
app/etc/modules/Ayaline_MostViewed.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * created : 29/08/2011
5
+ *
6
+ * @category Ayaline
7
+ * @package Ayaline_MostViewed
8
+ * @author aYaline
9
+ * @copyright Ayaline - 2012 - http://magento-shop.ayaline.com
10
+ * @license http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html
11
+ */
12
+ -->
13
+ <config>
14
+ <modules>
15
+ <Ayaline_MostViewed>
16
+ <active>true</active>
17
+ <codePool>community</codePool>
18
+ <depends>
19
+ <Ayaline_Core />
20
+ </depends>
21
+ </Ayaline_MostViewed>
22
+ </modules>
23
+ </config>
app/locale/en_US/Ayaline_MostViewed.csv ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Ayaline Most Viewed","Ayaline Most Viewed"
2
+ "Most viewed","Most viewed"
3
+ "General options","General options"
4
+ "Number of days before expiry","Number of days before expiry"
5
+ "Most viewed sidebar","Most viewed sidebar"
6
+ "Max products displayed","Max products displayed"
7
+ "Number of days","Number of days"
8
+ "Most viewed sidebar will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value.","Most viewed sidebar will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value."
9
+ "Max characters number displayed in product name","Max characters number displayed in product name"
10
+ "Use 0 value for no limit.","Use 0 value for no limit."
11
+ "Most viewed list","Most viewed list"
12
+ "Most viewed list will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value.","Most viewed list will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value."
13
+ "Display Out of Stock Products","Display Out of Stock Products"
14
+ "View all most viewed","View all most viewed"
15
+ "Grid","Grid"
16
+ "List","List"
17
+ "Display mode","Display mode"
18
+ "Is active","Is active"
19
+ "An error occurred while indexing ""%s"" to the store %s","An error occurred while indexing ""%s"" to the store %s"
20
+ "An error occurred while indexing ""%s""",""An error occurred while indexing ""%s"""
21
+ "Most Viewed Products","Most Viewed Products"
22
+ "Display most viewed products (if widget is displayed in category, products will be filter by it)","Display most viewed products (if widget is displayed in category, products will be filter by it)"
23
+ "Number of Products to Display","Number of Products to Display"
24
+ "Number of Columns","Number of Columns"
25
+ "Template","Template"
26
+ "Products list template","Products list template"
27
+ "Products grid template","Products grid template"
app/locale/fr_FR/Ayaline_MostViewed.csv ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Ayaline Most Viewed","Ayaline Les plus consultés"
2
+ "Most viewed","Les plus consultés"
3
+ "General options","Options générales"
4
+ "Number of days before expiry","Nombre de jours avant expiration"
5
+ "Most viewed sidebar","Barre latérale des plus consultés"
6
+ "Max products displayed","Nombre maximum de produits affichés"
7
+ "Number of days","Nombre de jours"
8
+ "Most viewed sidebar will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value.","La barre latérale des plus consultés affichera les produits consultés les N derniers jours. La valeur doit être inférieure à la valeur 'Nombre de jours avant expiration'."
9
+ "Max characters number displayed in product name","Nombre maximum de caractères affichés dans le nom du produit"
10
+ "Use 0 value for no limit.","Utiliser 0 pour ne pas limiter."
11
+ "Most viewed list","Liste des plus consultés"
12
+ "Most viewed list will display products viewed the last N days. The value should be smaller than 'Number of days before expiry' value.","La liste des plus consultés affichera les produits achetés les N derniers jours. La valeur doit être inférieure à la valeur 'Nombre de jours avant expiration'."
13
+ "Display Out of Stock Products","Afficher les produits hors stock"
14
+ "View all most viewed","Voir tous les plus consultés"
15
+ "Grid","Grille"
16
+ "List","Liste"
17
+ "Display mode","Mode d'affichage"
18
+ "Is active","Activé"
19
+ "An error occurred while indexing ""%s"" to the store %s","Une erreur est survenue lors de l'indexation de ""%s"", pour le magasin %s"
20
+ "An error occurred while indexing ""%s""","Une erreur est survenue lors de l'indexation de ""%s"""
21
+ "Most Viewed Products","Most Viewed Products"
22
+ "Display most viewed products (if widget is displayed in category, products will be filter by it)","Affiche les produits les plus consultés (si le widget est affiché dans une catégorie, les produits seront filtrés sur celle-ci)"
23
+ "Number of Products to Display","Nombre de produits à afficher"
24
+ "Number of Columns","Nombre de colonnes"
25
+ "Template","Gabarit"
26
+ "Products list template","Liste de produits"
27
+ "Products grid template","Grille de produits"
package.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ayaline_MostViewed</name>
4
+ <version>1.1.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://shop.ayaline.com/magento/fr/conditions-generales-de-vente.html">aYaline Custom License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Enhance your site content by allowing to display your catalog most viewed products</summary>
10
+ <description>Ayaline_MostViewed count the most often viewed products of your site during the last days.&#xD;
11
+ &#xD;
12
+ This module doesn&#x2019;t rely on Magento&#x2019;s core reporting tables but uses it&#x2019;s own set of data for performance reasons.&#xD;
13
+ &#xD;
14
+ Ayaline_MostViewed will allow to present the most viewed products in front-office. The included block &#x201C;sidebar&#x201D; display most viewed products for the current category.&#xD;
15
+ &#xD;
16
+ Outside the scope of a category, best viewed products all category together are displaid.&#xD;
17
+ &#xD;
18
+ Ayaline_MostViewed also offer a dedicated list page showing all the sites most viewed products. This page can be enable or not.</description>
19
+ <notes>Enhance your site content by allowing to display your catalog most viewed products</notes>
20
+ <authors><author><name>aYaline Team</name><user>auto-converted</user><email>magento@ayaline.com</email></author></authors>
21
+ <date>2012-04-11</date>
22
+ <time>09:07:30</time>
23
+ <contents><target name="magecommunity"><dir name="Ayaline"><dir name="MostViewed"><dir name="Block"><dir name="Widget"><file name="MostViewed.php" hash="81483a827eec213ddff9ba2568f9e82e"/></dir><file name="List.php" hash="b62edeef03d89eb311e59437d70e93e9"/><file name="Sidebar.php" hash="e3611effb65526f2d7ac0bacac8be917"/></dir><dir name="Helper"><file name="Data.php" hash="cb3f4e3cd0f5135c7fb279dbd329c6f0"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="ListMode.php" hash="f90983cfbfec6aea6fe35f7e75a39fde"/></dir></dir></dir></dir><dir name="Mysql4"><dir name="MostViewed"><file name="Collection.php" hash="d48654ad1134bb5e079c6a99f4fe1eeb"/></dir><file name="MostViewed.php" hash="c6e65245ba52524007d109f0a68f6562"/><file name="MostViewedIndex.php" hash="41f691850666af38d064decdf59e3876"/></dir><file name="MostViewed.php" hash="863ec04a688721fbfa1040fe96b52a3d"/><file name="MostViewedIndex.php" hash="b03b1daa3639aec1e24a6eb8c47b2207"/><file name="Observer.php" hash="0fe9479ca694082615a24d89f89b9362"/></dir><dir name="controllers"><dir name="Catalog"><file name="MostviewedController.php" hash="e1b0306f6c3e219c6f1a52c2bda4e9ec"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="109acd853032538c109bec86707d2b90"/><file name="config.xml" hash="33c199aea74ded469ad76f345e16ce82"/><file name="system.xml" hash="50056e3fe319d462fcba4ed542e1d358"/><file name="widget.xml" hash="669f85db892f724ed3d172084a2ada13"/></dir><dir name="sql"><dir name="ayalinemostviewed_setup"><file name="mysql4-install-0.1.0.php" hash="76c5875919c012ff6ecf78372a2be80f"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="19102873fd8fa44de05ecd997510c894"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="29eaaed3b90f05b67c01e3ee65fd00f0"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="c2e049fc8d10329516819c152c8c5ef4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ayaline"><file name="most_viewed.xml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ayaline_MostViewed.xml" hash="877c072ea8395e98d58e6c7227315086"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Ayaline_MostViewed.csv" hash="b07443e0818e96cd76bf3babce76850d"/></dir><dir name="fr_FR"><file name="Ayaline_MostViewed.csv" hash="fc70403f309bd0d82092c0d7ac78ea18"/></dir></target></contents>
24
+ <compatible/>
25
+ <dependencies><required><package><name>Ayaline_Core</name><channel>community</channel><min></min><max></max></package></required></dependencies>
26
+ </package>