Magazento_Homesellers - Version 1.0.0

Version Notes

1.0.0

Download this release

Release Info

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


Version 1.0.0

app/code/community/Magazento/Homepage/Block/Developer.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magazento_Homepage_Block_Developer extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
4
+
5
+ public function render(Varien_Data_Form_Element_Abstract $element) {
6
+ $content = '<p></p>';
7
+ $content.= '<style>';
8
+ $content.= '.magazento {
9
+ background:#FAFAFA;
10
+ border: 1px solid #CCCCCC;
11
+ margin-bottom: 10px;
12
+ padding: 10px;
13
+ height:auto;
14
+
15
+ }
16
+ .magazento h3 {
17
+ color: #EA7601;
18
+ }
19
+ .contact-type {
20
+ color: #EA7601;
21
+ font-weight:bold;
22
+ }
23
+ .magazento img {
24
+ border: 1px solid #CCCCCC;
25
+ float:left;
26
+ height:235px;
27
+ }
28
+ .magazento .info {
29
+ border: 1px solid #CCCCCC;
30
+ background:#E7EFEF;
31
+ padding: 5px 10px 0 5px;
32
+ margin-left:210px;
33
+ height:230px;
34
+ }
35
+ ';
36
+ $content.= '</style>';
37
+
38
+
39
+ $content.= '<div class="magazento">';
40
+ $content.= '<a href="http://www.magazento.com/" target="_blank"><img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/default/default/magazento/homepage/promo.jpg" alt="www.magazento.com" /></a>';
41
+ $content.= '<div class="info">';
42
+ $content.= '<h3>Magento extensions</h3>';
43
+ $content.= '<p><a href="http://www.magazento.com/" target="_blank">www.magazento.com</a> - experts are specializing in custom extension development for the world\'s fastest growing eCommerce platform - Magento. <br/>';
44
+ $content.= 'All extensions are designed for the Magento CMS archetecture, using native libraries and only the most efficient approaches to development.<br/>';
45
+ $content.= 'If you need Magento development or have a concept for an extension you\'d like developed for the Magento CMS platform, please contact us.</br></p>';
46
+ $content.= '--------------------------------------------------------<br>';
47
+ $content.= '<span class="contact-type">Company website:</span> <a href="http://www.magazento.com/" target="_blank">www.magazento.com</a> <br/>';
48
+ $content.= '<span class="contact-type">E-mail:</span> magazento@gmail.com <br/>';
49
+ $content.= '<span class="contact-type">Skype:</span> volgodark <br/>';
50
+ $content.= '<span class="contact-type">Phone:</span> +7 909389 2222 <br/>';
51
+ $content.= '<span class="contact-type">Magento:</span> <a href="http://www.magentocommerce.com/magento-connect/developer/Magazento" target="_blank">visit</a> <br/>';
52
+ $content.= '<span class="contact-type">Facebook:</span> <a href="http://www.facebook.com/ivan.proskuryakov" target="_blank">visit</a> <br/>';
53
+ // $content.= '<span class="contact-type">LinkedIn:</span> <a href="http://www.linkedin.com/pub/ivan-proskuryakov/31/200/316" target="_blank">visit</a> <br/>';
54
+
55
+ $content.= '</div>';
56
+
57
+ $content.= '</div>';
58
+
59
+ return $content;
60
+
61
+
62
+ }
63
+
64
+
65
+ }
app/code/community/Magazento/Homepage/Block/New.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Homepage_Block_New extends Mage_Catalog_Block_Product_Abstract {
12
+
13
+
14
+ protected function _construct() {
15
+ parent::_construct();
16
+ $this->addData(array(
17
+ 'cache_lifetime' => 86400,
18
+ 'cache_tags' => array('magazentohomepage_home_new'),
19
+ ));
20
+
21
+ }
22
+
23
+ protected function _beforeToHtml() {
24
+
25
+ $collection = Mage::getResourceModel('catalog/product_collection');
26
+ $from = Mage::getStoreConfig('homepage/new/from');
27
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
28
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
29
+ $newDate=$this->getModel()->getSellDate($this->getModel()->getHomepageDaysLimit());
30
+ $collection = $this->_addProductAttributesAndPrices($collection)
31
+ ->addStoreFilter()
32
+ ->addAttributeToFilter(array(
33
+ array('attribute'=>'created_at','from'=>$from,'to'=>$newDate['todaydate'])
34
+ ))
35
+ ->setPageSize($this->getModel()->getNewCount())
36
+ ->setCurPage(1)
37
+ ;
38
+
39
+ $this->setProductCollection($collection);
40
+ }
41
+
42
+ public function getTitle() {
43
+ return Mage::getStoreConfig('homepage/new/title') ;
44
+ }
45
+
46
+ public function getModel() {
47
+ return Mage::getModel('homepage/Data');
48
+ }
49
+
50
+ }
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+ // ->setDateRange($sellDate['startdate'], $sellDate['todaydate'])
66
+ // ->addAttributeToFilter('is_salable')
67
+ // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
68
+ // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
69
+ // ->addSaleableFilterToCollection()
70
+ // ->addInStockFilterToCollection()
71
+ // ->addUrlRewrite()
72
+ //// ->addCategoryFilter($currentCategory)
73
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
74
+ // ->setCurPage(1)
75
+ // ->addOrderedQty()
76
+ // ->setOrder('ordered_qty', 'desc');
77
+ //
78
+
79
+ // ->addAttributeToSelect(array('entity_id', 'name', 'price', 'small_image', 'short_description', 'description', 'type_id', 'status'))
80
+ // ->addOrderedQty()
81
+ // ->setStoreId($storeId)
82
+ // ->addStoreFilter($storeId)
83
+ //// ->addCategoryFilter($currentCategory)
84
+ // ->setOrder('ordered_qty', 'desc')
85
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
86
+ // ->setCurPage(1);
87
+ //
88
+ // $collection= array();
89
+ // foreach ($rawcollection as $product) {
90
+ //// $addproduct = $product->getData('is_salable');
91
+ // $collection[]=$product->getData();
92
+ // }
93
+ // var_dump($rawcollection);
94
+ ////
95
+ //
96
+ // exit();
app/code/community/Magazento/Homepage/Block/Popular.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Homepage_Block_Popular extends Mage_Catalog_Block_Product_Abstract {
12
+
13
+
14
+ protected function _construct() {
15
+ parent::_construct();
16
+ $this->addData(array(
17
+ 'cache_lifetime' => 86400,
18
+ 'cache_tags' => array('magazentohomepage_home_popular'),
19
+ ));
20
+
21
+ }
22
+
23
+ protected function _beforeToHtml() {
24
+ $storeId = Mage::app()->getStore()->getId();
25
+ $products = Mage::getResourceModel('reports/product_collection')
26
+ ->addOrderedQty()
27
+ ->addAttributeToSelect('*')
28
+ ->addAttributeToSelect(array('name', 'price', 'small_image')) //edit to suit tastes
29
+ ->setStoreId($storeId)
30
+ ->addStoreFilter($storeId)
31
+ ->addViewsCount();
32
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
33
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
34
+ $products->setPageSize($this->getModel()->getPopularCount())->setCurPage(1);
35
+ $this->setProductCollection($products);
36
+ return parent::_beforeToHtml();
37
+ }
38
+ public function getTitle() {
39
+ return Mage::getStoreConfig('homepage/popular/title') ;
40
+ }
41
+ public function getModel() {
42
+ return Mage::getModel('homepage/Data');
43
+ }
44
+
45
+ }
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ // ->setDateRange($sellDate['startdate'], $sellDate['todaydate'])
61
+ // ->addAttributeToFilter('is_salable')
62
+ // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
63
+ // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
64
+ // ->addSaleableFilterToCollection()
65
+ // ->addInStockFilterToCollection()
66
+ // ->addUrlRewrite()
67
+ //// ->addCategoryFilter($currentCategory)
68
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
69
+ // ->setCurPage(1)
70
+ // ->addOrderedQty()
71
+ // ->setOrder('ordered_qty', 'desc');
72
+ //
73
+
74
+ // ->addAttributeToSelect(array('entity_id', 'name', 'price', 'small_image', 'short_description', 'description', 'type_id', 'status'))
75
+ // ->addOrderedQty()
76
+ // ->setStoreId($storeId)
77
+ // ->addStoreFilter($storeId)
78
+ //// ->addCategoryFilter($currentCategory)
79
+ // ->setOrder('ordered_qty', 'desc')
80
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
81
+ // ->setCurPage(1);
82
+ //
83
+ // $collection= array();
84
+ // foreach ($rawcollection as $product) {
85
+ //// $addproduct = $product->getData('is_salable');
86
+ // $collection[]=$product->getData();
87
+ // }
88
+ // var_dump($rawcollection);
89
+ ////
90
+ //
91
+ // exit();
app/code/community/Magazento/Homepage/Block/Review.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Homepage_Block_Review extends Mage_Catalog_Block_Product_Abstract {
12
+
13
+ protected function _construct() {
14
+ parent::_construct();
15
+ $this->addData(array(
16
+ 'cache_lifetime' => 86400,
17
+ 'cache_tags' => array('magazentohomepage_home_review'),
18
+ ));
19
+ }
20
+
21
+
22
+ function getReviewsData(){
23
+ $pending = 2;
24
+ $declined = 3;
25
+ $reviews = $this->getReviews();
26
+ $count = 0;
27
+ foreach ($reviews as $review){
28
+ if($review['status_id'] != $pending || $review['status_id'] != $declined){
29
+ // var_dump($review);
30
+ // exit();
31
+ $vals = $this->getRatingValues($review);
32
+ // $allReviews[$count]['product_sku'] = $_product->getSku();
33
+ // $allReviews[$count]['status_id'] = $review['status_id'];
34
+ $allReviews[$count]['review_url'] = $review->getReviewUrl($review->getId());
35
+ $num = $count +1;
36
+ $allReviews[$count]['title'] = $num.'. '.$review['title'];
37
+ $allReviews[$count]['detail'] = $review['detail'];
38
+ $allReviews[$count]['nickname'] = $review['nickname'];
39
+ // $allReviews[$count]['customer_id'] = $review['customer_id'];
40
+ $allReviews[$count]['ratings'] = $vals;
41
+ $count++;
42
+ }
43
+ }
44
+
45
+ return $allReviews;
46
+ }
47
+ function getRatingValues(Mage_Review_Model_Review $review){
48
+ $avg = 0;
49
+ if( count($review->getRatingVotes()) ) {
50
+ $ratings = array();
51
+ $c = 0;
52
+ foreach( $review->getRatingVotes() as $rating ) {
53
+ $type = $rating->getRatingCode();
54
+ $pcnt = $rating->getPercent();
55
+ if($type){
56
+ $val[$c][$type] = $pcnt;
57
+
58
+ }
59
+ $ratings[] = $rating->getPercent();
60
+ }
61
+ $c++;
62
+ $avg = array_sum($ratings)/count($ratings);
63
+ }
64
+ return $val;
65
+ }
66
+
67
+ function getReviews() {
68
+ $reviews = Mage::getModel('review/review')->getResourceCollection();
69
+ $reviews->addStoreFilter( Mage::app()->getStore()->getId() )
70
+ ->addStatusFilter( Mage_Review_Model_Review::STATUS_APPROVED )
71
+ ->setDateOrder()
72
+ ->addRateVotes()
73
+ ->load();
74
+ $return=array();
75
+ $i=0;
76
+ foreach ( $reviews as $review) {
77
+ $return[] = $review;
78
+ $i++; if ($i == $this->getModel()->getReviewsCount()) break;
79
+ }
80
+ return $return;
81
+ }
82
+
83
+ public function getTitle() {
84
+ return Mage::getStoreConfig('homepage/review/title') ;
85
+ }
86
+
87
+ public function getModel() {
88
+ return Mage::getModel('homepage/Data');
89
+ }
90
+
91
+ }
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ // ->setDateRange($sellDate['startdate'], $sellDate['todaydate'])
107
+ // ->addAttributeToFilter('is_salable')
108
+ // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
109
+ // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
110
+ // ->addSaleableFilterToCollection()
111
+ // ->addInStockFilterToCollection()
112
+ // ->addUrlRewrite()
113
+ //// ->addCategoryFilter($currentCategory)
114
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
115
+ // ->setCurPage(1)
116
+ // ->addOrderedQty()
117
+ // ->setOrder('ordered_qty', 'desc');
118
+ //
119
+
120
+ // ->addAttributeToSelect(array('entity_id', 'name', 'price', 'small_image', 'short_description', 'description', 'type_id', 'status'))
121
+ // ->addOrderedQty()
122
+ // ->setStoreId($storeId)
123
+ // ->addStoreFilter($storeId)
124
+ //// ->addCategoryFilter($currentCategory)
125
+ // ->setOrder('ordered_qty', 'desc')
126
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
127
+ // ->setCurPage(1);
128
+ //
129
+ // $collection= array();
130
+ // foreach ($rawcollection as $product) {
131
+ //// $addproduct = $product->getData('is_salable');
132
+ // $collection[]=$product->getData();
133
+ // }
134
+ // var_dump($rawcollection);
135
+ ////
136
+ //
137
+ // exit();
app/code/community/Magazento/Homepage/Block/Toprated.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ class Magazento_Homepage_Block_Toprated extends Mage_Catalog_Block_Product_Abstract {
11
+
12
+
13
+ protected function _construct() {
14
+ parent::_construct();
15
+ $this->addData(array(
16
+ 'cache_lifetime' => 86400,
17
+ 'cache_tags' => array('magazentohomepage_home_toprated'),
18
+ ));
19
+ }
20
+
21
+ public function getTopRatedProduct() {
22
+ $limit = $this->getModel()->getTopratedCount();
23
+ $_products = Mage::getModel('catalog/product')->getCollection();
24
+ $_products->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
25
+ $_products->addAttributeToSelect('*')->addStoreFilter();
26
+ $_rating = array();
27
+ foreach($_products as $_product) {
28
+ $storeId = Mage::app()->getStore()->getId();
29
+ $_productRating = Mage::getModel('review/review_summary')
30
+ ->setStoreId($storeId)
31
+ ->load($_product->getId());
32
+ $_rating[] = array(
33
+ 'rating' => $_productRating['rating_summary'],
34
+ 'product' => $_product
35
+ );
36
+ }
37
+ arsort($_rating);
38
+ return array_slice($_rating, 0, $limit);
39
+ }
40
+
41
+ public function getTitle() {
42
+ return Mage::getStoreConfig('homepage/toprated/title') ;
43
+ }
44
+ public function getModel() {
45
+ return Mage::getModel('homepage/Data');
46
+ }
47
+
48
+ }
app/code/community/Magazento/Homepage/Block/Topsell.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Homepage_Block_Topsell extends Mage_Catalog_Block_Product_Abstract {
12
+
13
+
14
+ protected function _construct() {
15
+ parent::_construct();
16
+ $this->addData(array(
17
+ 'cache_lifetime' => 86400,
18
+ 'cache_tags' => array('magazentohomepage_home_topsell'),
19
+ ));
20
+
21
+ }
22
+
23
+ protected function _beforeToHtml() {
24
+
25
+ $storeId = Mage::app()->getStore()->getId();
26
+ $sellDate=$this->getModel()->getSellDate($this->getModel()->getHomepageDaysLimit());
27
+ $collection = Mage::getResourceModel('reports/product_sold_collection')
28
+ ->addOrderedQty()
29
+ ->setStoreId($storeId)
30
+ ->addStoreFilter($storeId)
31
+ ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
32
+ ->addUrlRewrite()
33
+ ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
34
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
35
+ ->setOrder('ordered_qty', 'desc')
36
+ ->setPageSize($this->getModel()->getTopsellCount())
37
+ ->setCurPage(1)
38
+ ->setOrder('ordered_qty', 'desc');
39
+
40
+ $catId = Mage::getStoreConfig('homepage/topsell/homecat');
41
+ if ($catId>0) {
42
+ $category = $this->getModel()->getCategory($catId);
43
+ $collection->addCategoryFilter($category);
44
+ }
45
+
46
+
47
+ $this->setProductCollection($collection);
48
+ return parent::_beforeToHtml();
49
+ }
50
+
51
+ public function getTitle() {
52
+ return Mage::getStoreConfig('homepage/topsell/title') ;
53
+ }
54
+ public function getModel() {
55
+ return Mage::getModel('homepage/Data');
56
+ }
57
+
58
+ }
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+ // ->setDateRange($sellDate['startdate'], $sellDate['todaydate'])
74
+ // ->addAttributeToFilter('is_salable')
75
+ // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
76
+ // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
77
+ // ->addSaleableFilterToCollection()
78
+ // ->addInStockFilterToCollection()
79
+ // ->addUrlRewrite()
80
+ //// ->addCategoryFilter($currentCategory)
81
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
82
+ // ->setCurPage(1)
83
+ // ->addOrderedQty()
84
+ // ->setOrder('ordered_qty', 'desc');
85
+ //
86
+
87
+ // ->addAttributeToSelect(array('entity_id', 'name', 'price', 'small_image', 'short_description', 'description', 'type_id', 'status'))
88
+ // ->addOrderedQty()
89
+ // ->setStoreId($storeId)
90
+ // ->addStoreFilter($storeId)
91
+ //// ->addCategoryFilter($currentCategory)
92
+ // ->setOrder('ordered_qty', 'desc')
93
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
94
+ // ->setCurPage(1);
95
+ //
96
+ // $collection= array();
97
+ // foreach ($rawcollection as $product) {
98
+ //// $addproduct = $product->getData('is_salable');
99
+ // $collection[]=$product->getData();
100
+ // }
101
+ // var_dump($rawcollection);
102
+ ////
103
+ //
104
+ // exit();
app/code/community/Magazento/Homepage/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Homepage_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+
14
+
15
+ }
app/code/community/Magazento/Homepage/Model/Data.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ Class Magazento_Homepage_Model_Data {
11
+
12
+
13
+ public function getSellDate($days) {
14
+ $product = Mage::getModel('catalog/product');
15
+ $product=array();
16
+ $outputFormat='Y-m-d H:i:s';
17
+ // $outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
18
+ // var_dump($outputFormat);
19
+ // $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
20
+ // $dateformat=Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
21
+ $product['todaydate'] = date($outputFormat, time());
22
+ $product['startdate'] = date($outputFormat, time() - 60 * 60 * 24 * $days);
23
+ return $product;
24
+
25
+ }
26
+
27
+ public function getCategory ($id){
28
+ $categoryId = $id;
29
+ if (!$categoryId || !is_numeric($categoryId))
30
+ $category = Mage::registry("current_category");
31
+ else {
32
+ $category = Mage::getModel("catalog/category")->load($categoryId);
33
+ if (!$category->getId())
34
+ $category = Mage::registry("current_category");
35
+ }
36
+ return $category;
37
+ }
38
+
39
+
40
+ public function getReviewsCount() {
41
+ $count = (int) Mage::getStoreConfig('homepage/review/count');
42
+ if ($count <=0) $count=5;
43
+ return $count;
44
+ }
45
+ public function getTopsellCount() {
46
+ $count = (int) Mage::getStoreConfig('homepage/topsell/count');
47
+ if ($count <=0) $count=5;
48
+ return $count;
49
+ }
50
+
51
+ public function getNewCount() {
52
+ $count = (int) Mage::getStoreConfig('homepage/new/count');
53
+ if ($count <=0) $count=5;
54
+ return $count;
55
+ }
56
+
57
+ public function getPopularCount() {
58
+ $count = (int) Mage::getStoreConfig('homepage/popular/count');
59
+ if ($count <=0) $count=5;
60
+ return $count;
61
+ }
62
+ public function getTopratedCount() {
63
+ $count = (int) Mage::getStoreConfig('homepage/toprated/count');
64
+ if ($count <=0) $count=5;
65
+ return $count;
66
+ }
67
+
68
+ public function getHomepageDaysLimit() {
69
+ $count = (int) Mage::getStoreConfig('homepage/topsell/days');
70
+ if ($count <=0) $count=5;
71
+ return $count;
72
+ }
73
+
74
+
75
+
76
+
77
+ }
app/code/community/Magazento/Homepage/etc/config.xml ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Homepage>
5
+ <version>1.0.0</version>
6
+ </Magazento_Homepage>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <homepage>
12
+ <file>magazento_homepage.xml</file>
13
+ </homepage>
14
+ </updates>
15
+ </layout>
16
+ <translate>
17
+ <modules>
18
+ <Magazento_Homepage>
19
+ <files>
20
+ <default>Magazento_Homepage.csv</default>
21
+ </files>
22
+ </Magazento_Homepage>
23
+ </modules>
24
+ </translate>
25
+ </frontend>
26
+
27
+ <global>
28
+ <models>
29
+ <homepage>
30
+ <class>Magazento_Homepage_Model</class>
31
+ <resourceModel>homepage_mysql4</resourceModel>
32
+ </homepage>
33
+ <homepage_mysql4>
34
+ <class>Magazento_Homepage_Model_Mysql4</class>
35
+ <entities>
36
+ <slide>
37
+ <table>magazento_homepage_slide</table>
38
+ </slide>
39
+ <slide_category>
40
+ <table>magazento_homepage_slide_category</table>
41
+ </slide_category>
42
+ <category>
43
+ <table>magazento_homepage_category</table>
44
+ </category>
45
+ <category_store>
46
+ <table>magazento_homepage_category_store</table>
47
+ </category_store>
48
+ </entities>
49
+ </homepage_mysql4>
50
+ </models>
51
+ <resources>
52
+ <homepage_setup>
53
+ <setup>
54
+ <module>Magazento_Homepage</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </homepage_setup>
60
+ <homepage_write>
61
+ <connection>
62
+ <use>core_write</use>
63
+ </connection>
64
+ </homepage_write>
65
+ <homepage_read>
66
+ <connection>
67
+ <use>core_read</use>
68
+ </connection>
69
+ </homepage_read>
70
+ </resources>
71
+ <blocks>
72
+ <homepage>
73
+ <class>Magazento_Homepage_Block</class>
74
+ </homepage>
75
+ </blocks>
76
+ <helpers>
77
+ <homepage>
78
+ <class>Magazento_Homepage_Helper</class>
79
+ </homepage>
80
+ </helpers>
81
+ </global>
82
+ <admin>
83
+ <routers>
84
+ <magazento_homepage>
85
+ <use>admin</use>
86
+ <args>
87
+ <module>Magazento_Homepage</module>
88
+ <frontName>homepage</frontName>
89
+ </args>
90
+ </magazento_homepage>
91
+ </routers>
92
+ </admin>
93
+ <adminhtml>
94
+ <acl>
95
+ <resources>
96
+ <admin>
97
+ <children>
98
+ <system>
99
+ <children>
100
+ <config>
101
+ <children>
102
+ <homepage translate="title" module="homepage">
103
+ <title>Homepage</title>
104
+ </homepage>
105
+ </children>
106
+ </config>
107
+ </children>
108
+ </system>
109
+ </children>
110
+ </admin>
111
+ </resources>
112
+ </acl>
113
+ <menu>
114
+ <magazento translate="title" module="homepage">
115
+ <title>Magazento</title>
116
+ <sort_order>65</sort_order>
117
+ <children>
118
+ <homepage translate="title" module="homepage">
119
+ <title>Homepage</title>
120
+ <sort_order>65</sort_order>
121
+ <children>
122
+ <settings translate="title" module="homepage">
123
+ <title>Settings</title>
124
+ <action>adminhtml/system_config/edit/section/homepage</action>
125
+ <sort_order>40</sort_order>
126
+ </settings>
127
+ </children>
128
+ </homepage>
129
+ </children>
130
+ </magazento>
131
+ </menu>
132
+ </adminhtml>
133
+ <default>
134
+ <homepage>
135
+ <options>
136
+ <actions>1</actions>
137
+ <price>1</price>
138
+ <salable>1</salable>
139
+ <noproduct>There are no products that match your criteria. Please try again with different options.</noproduct>
140
+ <count>4</count>
141
+ </options>
142
+ <topsell>
143
+ <enable>1</enable>
144
+ <title>TOPSELLERS</title>
145
+ <count>4</count>
146
+ <days>365</days>
147
+ <cat>0</cat>
148
+ </topsell>
149
+ <new>
150
+ <enable>1</enable>
151
+ <title>NEW PRODUCTS</title>
152
+ <count>4</count>
153
+ <from>2007-08-23</from>
154
+ </new>
155
+ <popular>
156
+ <enable>1</enable>
157
+ <title>POPULAR PRODUCTS</title>
158
+ <count>4</count>
159
+ </popular>
160
+ <toprated>
161
+ <enable>1</enable>
162
+ <title>TOPRATED PRODUCTS</title>
163
+ <count>4</count>
164
+ </toprated>
165
+ <review>
166
+ <enable>1</enable>
167
+ <title>OUR LAST REVIEWS</title>
168
+ <count>10</count>
169
+ </review>
170
+ </homepage>
171
+ </default>
172
+ </config>
app/code/community/Magazento/Homepage/etc/system.xml ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magazento translate="label">
5
+ <label>Magazento.com</label>
6
+ <sort_order>250</sort_order>
7
+ </magazento>
8
+ </tabs>
9
+ <sections>
10
+ <homepage translate="label" module="homepage">
11
+ <label>Homepage</label>
12
+ <tab>magazento</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <developer>
20
+ <frontend_model>homepage/developer</frontend_model>
21
+ <sort_order>999</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ </developer>
26
+ <options translate="label">
27
+ <label>General</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>2</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <fields>
34
+ <price translate="label">
35
+ <label>Display price</label>
36
+ <frontend_type>select</frontend_type>
37
+ <source_model>adminhtml/system_config_source_yesno</source_model>
38
+ <sort_order>53</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </price>
43
+ <actions translate="label">
44
+ <label>Display actions</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>54</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </actions>
52
+ <salable translate="label">
53
+ <label>Salable products</label>
54
+ <frontend_type>select</frontend_type>
55
+ <source_model>adminhtml/system_config_source_yesno</source_model>
56
+ <sort_order>55</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
+ </salable>
61
+ <noproduct translate="label">
62
+ <label>No product text</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>66</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </noproduct>
69
+ <count translate="label">
70
+ <label>Row count</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>68</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </count>
77
+ </fields>
78
+ </options>
79
+ <topsell translate="label">
80
+ <label>Topsellers</label>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>2</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ <fields>
87
+ <enable translate="label">
88
+ <label>Enable</label>
89
+ <frontend_type>select</frontend_type>
90
+ <source_model>adminhtml/system_config_source_yesno</source_model>
91
+ <sort_order>51</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </enable>
96
+ <title translate="label">
97
+ <label>Title</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>56</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </title>
104
+ <count translate="label">
105
+ <label>Count</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>62</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ </count>
112
+ <days translate="label">
113
+ <label>Topseller for * days</label>
114
+ <frontend_type>text</frontend_type>
115
+ <sort_order>63</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </days>
120
+ <cat translate="label">
121
+ <label>Category ID</label>
122
+ <frontend_type>text</frontend_type>
123
+ <comment>type "0" for all categories</comment>
124
+ <sort_order>64</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ </cat>
129
+ </fields>
130
+ </topsell>
131
+ <new translate="label">
132
+ <label>New Products</label>
133
+ <frontend_type>text</frontend_type>
134
+ <sort_order>3</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ <fields>
139
+ <enable translate="label">
140
+ <label>Enable</label>
141
+ <frontend_type>select</frontend_type>
142
+ <source_model>adminhtml/system_config_source_yesno</source_model>
143
+ <sort_order>51</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>1</show_in_store>
147
+ </enable>
148
+ <title translate="label">
149
+ <label>Title</label>
150
+ <frontend_type>text</frontend_type>
151
+ <sort_order>56</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ </title>
156
+ <count translate="label">
157
+ <label>Count</label>
158
+ <frontend_type>text</frontend_type>
159
+ <sort_order>62</sort_order>
160
+ <show_in_default>1</show_in_default>
161
+ <show_in_website>1</show_in_website>
162
+ <show_in_store>1</show_in_store>
163
+ </count>
164
+ <from translate="label">
165
+ <label>New from</label>
166
+ <frontend_type>text</frontend_type>
167
+ <sort_order>63</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </from>
172
+ </fields>
173
+ </new>
174
+ <popular translate="label">
175
+ <label>Popular Products</label>
176
+ <frontend_type>text</frontend_type>
177
+ <sort_order>4</sort_order>
178
+ <show_in_default>1</show_in_default>
179
+ <show_in_website>1</show_in_website>
180
+ <show_in_store>1</show_in_store>
181
+ <fields>
182
+ <enable translate="label">
183
+ <label>Enable</label>
184
+ <frontend_type>select</frontend_type>
185
+ <source_model>adminhtml/system_config_source_yesno</source_model>
186
+ <sort_order>51</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </enable>
191
+ <title translate="label">
192
+ <label>Title</label>
193
+ <frontend_type>text</frontend_type>
194
+ <sort_order>56</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <show_in_store>1</show_in_store>
198
+ </title>
199
+ <count translate="label">
200
+ <label>Count</label>
201
+ <frontend_type>text</frontend_type>
202
+ <sort_order>62</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>1</show_in_store>
206
+ </count>
207
+ </fields>
208
+ </popular>
209
+ <toprated translate="label">
210
+ <label>Toprated Products</label>
211
+ <frontend_type>text</frontend_type>
212
+ <sort_order>4</sort_order>
213
+ <show_in_default>1</show_in_default>
214
+ <show_in_website>1</show_in_website>
215
+ <show_in_store>1</show_in_store>
216
+ <fields>
217
+ <enable translate="label">
218
+ <label>Enable</label>
219
+ <frontend_type>select</frontend_type>
220
+ <source_model>adminhtml/system_config_source_yesno</source_model>
221
+ <sort_order>51</sort_order>
222
+ <show_in_default>1</show_in_default>
223
+ <show_in_website>1</show_in_website>
224
+ <show_in_store>1</show_in_store>
225
+ </enable>
226
+ <title translate="label">
227
+ <label>Title</label>
228
+ <frontend_type>text</frontend_type>
229
+ <sort_order>56</sort_order>
230
+ <show_in_default>1</show_in_default>
231
+ <show_in_website>1</show_in_website>
232
+ <show_in_store>1</show_in_store>
233
+ </title>
234
+ <count translate="label">
235
+ <label>Count</label>
236
+ <frontend_type>text</frontend_type>
237
+ <sort_order>62</sort_order>
238
+ <show_in_default>1</show_in_default>
239
+ <show_in_website>1</show_in_website>
240
+ <show_in_store>1</show_in_store>
241
+ </count>
242
+ </fields>
243
+ </toprated>
244
+ <review translate="label">
245
+ <label>Reviews</label>
246
+ <frontend_type>text</frontend_type>
247
+ <sort_order>7</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+ <fields>
252
+ <enable translate="label">
253
+ <label>Enable</label>
254
+ <frontend_type>select</frontend_type>
255
+ <source_model>adminhtml/system_config_source_yesno</source_model>
256
+ <sort_order>51</sort_order>
257
+ <show_in_default>1</show_in_default>
258
+ <show_in_website>1</show_in_website>
259
+ <show_in_store>1</show_in_store>
260
+ </enable>
261
+ <title translate="label">
262
+ <label>Title</label>
263
+ <frontend_type>text</frontend_type>
264
+ <sort_order>56</sort_order>
265
+ <show_in_default>1</show_in_default>
266
+ <show_in_website>1</show_in_website>
267
+ <show_in_store>1</show_in_store>
268
+ </title>
269
+ <count translate="label">
270
+ <label>Count</label>
271
+ <frontend_type>text</frontend_type>
272
+ <sort_order>62</sort_order>
273
+ <show_in_default>1</show_in_default>
274
+ <show_in_website>1</show_in_website>
275
+ <show_in_store>1</show_in_store>
276
+ </count>
277
+ </fields>
278
+ </review>
279
+ </groups>
280
+ </homepage>
281
+ </sections>
282
+ </config>
app/design/frontend/default/default/layout/magazento_homepage.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <cms_index_index>
5
+ <reference name="head">
6
+ <action method="addCss"><stylesheet>magazento/homepage/style.css</stylesheet></action>
7
+ </reference>
8
+ <reference name="content">
9
+ <block type="core/template"
10
+ name="magazento_homepage"
11
+ before="-"
12
+ template="magazento/homepage/data.phtml"/>
13
+ </reference>
14
+ </cms_index_index>
15
+
16
+ </layout>
17
+
18
+
19
+
20
+
21
+
app/design/frontend/default/default/template/magazento/homepage/data.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="">
2
+ <?php if (Mage::getStoreConfig('homepage/topsell/enable')): ?>
3
+ <?php echo $this->getLayout()->createBlock('homepage/topsell')->setTemplate('magazento/homepage/template.phtml')->toHtml(); ?>
4
+ <?php endif; ?>
5
+
6
+ <?php if (Mage::getStoreConfig('homepage/new/enable')): ?>
7
+ <?php echo $this->getLayout()->createBlock('homepage/new')->setTemplate('magazento/homepage/template.phtml')->toHtml(); ?>
8
+ <?php endif; ?>
9
+
10
+ <?php if (Mage::getStoreConfig('homepage/popular/enable')): ?>
11
+ <?php echo $this->getLayout()->createBlock('homepage/popular')->setTemplate('magazento/homepage/template.phtml')->toHtml(); ?>
12
+ <?php endif; ?>
13
+
14
+ <?php if (Mage::getStoreConfig('homepage/toprated/enable')): ?>
15
+ <?php echo $this->getLayout()->createBlock('homepage/toprated')->setTemplate('magazento/homepage/toprated.phtml')->toHtml(); ?>
16
+ <?php endif; ?>
17
+
18
+ <?php if (Mage::getStoreConfig('homepage/review/enable')): ?>
19
+ <?php echo $this->getLayout()->createBlock('homepage/review')->setTemplate('magazento/homepage/review.phtml')->toHtml(); ?>
20
+ <?php endif; ?>
21
+
22
+ </div>
app/design/frontend/default/default/template/magazento/homepage/review.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_reviews = $this->getReviewsData();?>
2
+
3
+
4
+ <div class="block block-homepage">
5
+ <div class="block-title .title-homepage">
6
+ <?php echo $this->getTitle(); ?>
7
+ </div>
8
+ <div class="block-content">
9
+ <div class="content-home-wrapper">
10
+ <?php $i=0; foreach($_reviews as $review): ?>
11
+ <?php# var_dump($review); ?>
12
+ <?php $ratings = $review['ratings'][0]; ?>
13
+ <dl>
14
+ <dt>
15
+ <a href="<?php echo $review['review_url']; ?>"><?php echo $review['title']; ?></a> <?php echo $this->__('Review by');?> <strong><?php echo $review['nickname']; ?></strong>
16
+ </dt>
17
+ <dd>
18
+ <table class="ratings-table">
19
+ <col width="1">
20
+ <col>
21
+ <tbody>
22
+ <tr>
23
+ <th><?php echo $this->__('Quality');?></th>
24
+ <td>
25
+ <div class="rating-box">
26
+ <div style="width: <?php echo $ratings['Quality']; ?>%;" class="rating"></div>
27
+ </div>
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <th><?php echo $this->__('Price');?></th>
32
+ <td>
33
+ <div class="rating-box">
34
+ <div style="width: <?php echo $ratings['Price']; ?>%;" class="rating"></div>
35
+ </div>
36
+ </td>
37
+ </tr>
38
+ <tr>
39
+ <th><?php echo $this->__('Value');?></th>
40
+ <td>
41
+ <div class="rating-box">
42
+ <div style="width: <?php echo $ratings['Value']; ?>%;" class="rating"></div>
43
+ </div>
44
+ </td>
45
+ </tr>
46
+ </tbody>
47
+ </table>
48
+ <?php echo $review['detail']; ?>
49
+ </dd>
50
+ </dl><br/>
51
+ <!-- <p>&nbsp;</p>-->
52
+ <?php endforeach; ?>
53
+ </div>
54
+ </div>
55
+ </div>
app/design/frontend/default/default/template/magazento/homepage/template.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_products = $this->getProductCollection(); ?>
2
+ <?php $_collectionSize = sizeof($_products); ?>
3
+ <?php $_columnCount = Mage::getStoreConfig('homepage/options/count'); ?>
4
+
5
+
6
+ <div class="block block-homepage">
7
+ <div class="block-title .title-homepage">
8
+ <?php echo $this->getTitle(); ?>
9
+ </div>
10
+ <div class="block-content">
11
+
12
+ <?php if (sizeof($_products)): ?>
13
+ <?php $i=0; foreach ($_products->getItems() as $_product): ?>
14
+ <?php if ($i++%$_columnCount==0): ?>
15
+ <ul class="products-grid">
16
+ <?php endif ?>
17
+
18
+ <?php# echo $_product->getData('is_salable') . Mage::getStoreConfig('homepage/options/salable'); ?>
19
+ <?php if ($_product->getData('is_salable')): ?>
20
+ <li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
21
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(130); ?>" width="130" height="130" alt="" /></a>
22
+ <div class="product-details">
23
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
24
+ <?php if (Mage::getStoreConfig('homepage/options/price')):?>
25
+ <?php echo $this->getPriceHtml($_product, true) ?>
26
+ <?php endif; ?>
27
+ <?php if (Mage::getStoreConfig('homepage/options/actions')):?>
28
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
29
+ <?php endif; ?>
30
+ </div>
31
+ </li>
32
+ <?php else: ?>
33
+ <?php if( Mage::getStoreConfig('homepage/options/salable')) : ?>
34
+ <li class="item">
35
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(130); ?>" width="130" height="130" alt="" /></a>
36
+ <div class="product-details">
37
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
38
+ <?php if (Mage::getStoreConfig('homepage/options/price')):?>
39
+ <?php echo $this->getPriceHtml($_product, true) ?>
40
+ <?php endif; ?>
41
+ <?php if (Mage::getStoreConfig('homepage/options/actions')):?>
42
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
43
+ <?php endif; ?>
44
+ </div>
45
+ </li>
46
+ <?php endif; ?>
47
+ <?php endif; ?>
48
+
49
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
50
+ </ul>
51
+ <?php endif ?>
52
+ <?php endforeach; ?>
53
+
54
+
55
+ <?php else: ?>
56
+ <ol id="bestseller-sidebar" class="mini-products-list">
57
+ <li class="item odd">
58
+ <?php echo Mage::getStoreConfig('homepage/options/noproduct') ?>
59
+ </li>
60
+ </ol>
61
+ <?php endif; ?>
62
+
63
+ </div>
64
+ </div>
app/design/frontend/default/default/template/magazento/homepage/toprated.phtml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_products = $this->getTopRatedProduct();?>
2
+ <?php $_collectionSize = count($_products); ?>
3
+ <?php $_columnCount = Mage::getStoreConfig('homepage/options/count'); ?>
4
+
5
+
6
+ <div class="block block-homepage">
7
+ <div class="block-title .title-homepage">
8
+ <?php echo $this->getTitle(); ?>
9
+ </div>
10
+ <div class="block-content">
11
+
12
+ <?php $i=0; foreach($_products as $_rating): ?>
13
+ <?php $_product = $_rating['product']; ?>
14
+
15
+ <?php if ($i++%$_columnCount==0): ?>
16
+ <ul class="products-grid">
17
+ <?php endif ?>
18
+
19
+ <?php# echo $_product->getData('is_salable') . Mage::getStoreConfig('homepage/options/salable'); ?>
20
+ <?php if ($_product->getData('is_salable')): ?>
21
+ <li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
22
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(130); ?>" width="130" height="130" alt="" /></a>
23
+ <div class="product-details">
24
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
25
+ <?php if (Mage::getStoreConfig('homepage/options/price')):?>
26
+ <?php echo $this->getPriceHtml($_product, true) ?>
27
+ <?php endif; ?>
28
+ <?php if (Mage::getStoreConfig('homepage/options/actions')):?>
29
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
30
+ <?php endif; ?>
31
+ </div>
32
+ </li>
33
+ <?php else: ?>
34
+ <?php if( Mage::getStoreConfig('homepage/options/salable')) : ?>
35
+ <li class="item">
36
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(130); ?>" width="130" height="130" alt="" /></a>
37
+ <div class="product-details">
38
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
39
+ <?php if (Mage::getStoreConfig('homepage/options/price')):?>
40
+ <?php echo $this->getPriceHtml($_product, true) ?>
41
+ <?php endif; ?>
42
+ <?php if (Mage::getStoreConfig('homepage/options/actions')):?>
43
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
44
+ <?php endif; ?>
45
+ </div>
46
+ </li>
47
+ <?php endif; ?>
48
+ <?php endif; ?>
49
+
50
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
51
+ </ul>
52
+ <?php endif ?>
53
+
54
+
55
+ <?php endforeach; ?>
56
+
57
+ </div>
58
+ </div>
app/etc/modules/Magazento_Homepage.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Homepage>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magazento_Homepage>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magazento_Homepage.csv ADDED
File without changes
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magazento_Homesellers</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Organize home page in few clicks. Show best sellers,popular,new,most rated products and product reviews.</summary>
10
+ <description>Homepage is the main part or any website. No matter commercial or a personal, based on magento cms or without it. It's very important to show for users relevant and needful information such as new products, topsellers, toprated products. If you a shop owner you could go to magento backend and look bestsellers,toprated and other reports under the report tab. But customer can't do it.
11
+
12
+ This Magento extensions shows the list of your store's best sellers, popular, new, most rated products and product reviews and displays it at you homepage. Extension allows you fully configure your frontend look from backend.</description>
13
+ <notes>1.0.0</notes>
14
+ <authors><author><name>volgodark</name><user>auto-converted</user><email>volgodark@gmail.com</email></author></authors>
15
+ <date>2011-05-06</date>
16
+ <time>09:45:44</time>
17
+ <contents><target name="magelocale"><dir name="en_US"><file name="Magazento_Homepage.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="magazento_homepage.xml" hash="7b244d61a84e105d831789c5e0a73b6e"/></dir><dir name="template"><dir name="magazento"><dir name="homepage"><file name="data.phtml" hash="a4c7a174ed8a46494f52cf5d8c82bf17"/><file name="review.phtml" hash="71ecfc348ddeff3fbb43d92c28f25bae"/><file name="template.phtml" hash="2302efc395dd55be06f43ac7059e7cd4"/><file name="toprated.phtml" hash="fe76c6a5509d124e31ddd0bc69f76743"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="magazento"><dir name="homepage"><file name="promo.jpg" hash="88520d456df68c98130433b5184b8e7f"/><file name="style.css" hash="21c95fe46ac3c5b670f80f63e8f53f9e"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magazento"><dir name="Homepage"><dir name="Block"><file name="Developer.php" hash="f519188aed00aa6901fe399d0a492660"/><file name="New.php" hash="7126d04ecfa37bed6ed4364825b4d2de"/><file name="Popular.php" hash="d6a4bbe8d9d722ef35702842d99b67a3"/><file name="Review.php" hash="3b150f0d01e514eaeae1f727a0bf44cc"/><file name="Toprated.php" hash="24a28eed699010d702e842636a870a36"/><file name="Topsell.php" hash="8bdd57f34cc25744c0bf67b296bef040"/></dir><dir name="etc"><file name="config.xml" hash="b54101ded19dec4ff6245825071081e8"/><file name="system.xml" hash="8bd12817342d202a9cad1a8738841b04"/></dir><dir name="Helper"><file name="Data.php" hash="a2202bd5bc733d6dacd650839e3131d8"/></dir><dir name="Model"><file name="Data.php" hash="fb3fcdccc3035c0fdc3f48e203d2403d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magazento_Homepage.xml" hash="0400a3c20ce4f66f863d0b0f6ed989cf"/></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies/>
20
+ </package>
skin/frontend/default/default/magazento/homepage/promo.jpg ADDED
Binary file
skin/frontend/default/default/magazento/homepage/style.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .block-homepage { font-size: 11px; line-height: 1.25; }
2
+ .block-homepage .products-grid {
3
+ background: none;
4
+ border-bottom: 0;
5
+ position: relative;
6
+ }
7
+ .content-home-wrapper { padding: 10px;}
8
+ .block-homepage a {font-size: 12px; font-weight: bold}
9
+ .block-homepage .title-homepage {
10
+ background-position: 0 0;
11
+ background-repeat: no-repeat;
12
+ padding-left: 10px;
13
+ line-height: 1.7;
14
+ font-weight: bold;
15
+ }