Version Notes
== Changelog ==
= 1.0.4 =
* Minor changes,
* "#" comments caused problems on some webserververs, now all comments removed from .phtml files
Download this release
Release Info
Developer | volgodark |
Extension | ecommerceoffice_homepage |
Version | 1.0.4 |
Comparing to | |
See all releases |
Version 1.0.4
- app/code/community/Ecommerceoffice/Homepage/Block/New.php +96 -0
- app/code/community/Ecommerceoffice/Homepage/Block/Page/Html/Footer.php +23 -0
- app/code/community/Ecommerceoffice/Homepage/Block/Popular.php +91 -0
- app/code/community/Ecommerceoffice/Homepage/Block/Review.php +137 -0
- app/code/community/Ecommerceoffice/Homepage/Block/Toprated.php +48 -0
- app/code/community/Ecommerceoffice/Homepage/Block/Topsell.php +104 -0
- app/code/community/Ecommerceoffice/Homepage/Helper/Data.php +15 -0
- app/code/community/Ecommerceoffice/Homepage/Model/Data.php +77 -0
- app/code/community/Ecommerceoffice/Homepage/etc/config.xml +177 -0
- app/code/community/Ecommerceoffice/Homepage/etc/system.xml +275 -0
- app/design/frontend/base/default/layout/ecommerceoffice_homepage.xml +21 -0
- app/design/frontend/base/default/template/ecommerceoffice/homepage/data.phtml +22 -0
- app/design/frontend/base/default/template/ecommerceoffice/homepage/new.phtml +64 -0
- app/design/frontend/base/default/template/ecommerceoffice/homepage/popular.phtml +64 -0
- app/design/frontend/base/default/template/ecommerceoffice/homepage/review.phtml +44 -0
- app/design/frontend/base/default/template/ecommerceoffice/homepage/toprated.phtml +58 -0
- app/design/frontend/base/default/template/ecommerceoffice/homepage/topsell.phtml +64 -0
- app/etc/modules/Ecommerceoffice_Homepage.xml +9 -0
- package.xml +23 -0
app/code/community/Ecommerceoffice/Homepage/Block/New.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.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 Ecommerceoffice_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('ecommerceofficehomepage_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/Ecommerceoffice/Homepage/Block/Page/Html/Footer.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.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 Ecommerceoffice_Homepage_Block_Page_Html_Footer extends Mage_Page_Block_Html_Footer
|
12 |
+
{
|
13 |
+
|
14 |
+
public function getCopyright()
|
15 |
+
{
|
16 |
+
if (!$this->_copyright) {
|
17 |
+
$this->_copyright = '<a href="http://www.magazento.com/">Magento Templates</a> '.Mage::getStoreConfig('design/footer/copyright');
|
18 |
+
}
|
19 |
+
|
20 |
+
return $this->_copyright;
|
21 |
+
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Ecommerceoffice/Homepage/Block/Popular.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.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 Ecommerceoffice_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('ecommerceofficehomepage_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/Ecommerceoffice/Homepage/Block/Review.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.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 Ecommerceoffice_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('ecommerceofficehomepage_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/Ecommerceoffice/Homepage/Block/Toprated.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.com © 2011. All Rights Reserved.
|
6 |
+
* Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
class Ecommerceoffice_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('ecommerceofficehomepage_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/Ecommerceoffice/Homepage/Block/Topsell.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.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 Ecommerceoffice_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('ecommerceofficehomepage_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/Ecommerceoffice/Homepage/Helper/Data.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.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 Ecommerceoffice_Homepage_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
|
15 |
+
}
|
app/code/community/Ecommerceoffice/Homepage/Model/Data.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Created on May 3, 2011
|
4 |
+
* Author - Ecommerceoffice.com
|
5 |
+
* Copyright Ecommerceoffice.com © 2011. All Rights Reserved.
|
6 |
+
* Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
Class Ecommerceoffice_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/Ecommerceoffice/Homepage/etc/config.xml
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ecommerceoffice_Homepage>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Ecommerceoffice_Homepage>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<layout>
|
10 |
+
<updates>
|
11 |
+
<homepage>
|
12 |
+
<file>ecommerceoffice_homepage.xml</file>
|
13 |
+
</homepage>
|
14 |
+
</updates>
|
15 |
+
</layout>
|
16 |
+
<translate>
|
17 |
+
<modules>
|
18 |
+
<Ecommerceoffice_Homepage>
|
19 |
+
<files>
|
20 |
+
<default>Ecommerceoffice_Homepage.csv</default>
|
21 |
+
</files>
|
22 |
+
</Ecommerceoffice_Homepage>
|
23 |
+
</modules>
|
24 |
+
</translate>
|
25 |
+
</frontend>
|
26 |
+
|
27 |
+
<global>
|
28 |
+
<models>
|
29 |
+
<homepage>
|
30 |
+
<class>Ecommerceoffice_Homepage_Model</class>
|
31 |
+
<resourceModel>homepage_mysql4</resourceModel>
|
32 |
+
</homepage>
|
33 |
+
<homepage_mysql4>
|
34 |
+
<class>Ecommerceoffice_Homepage_Model_Mysql4</class>
|
35 |
+
<entities>
|
36 |
+
<slide>
|
37 |
+
<table>ecommerceoffice_homepage_slide</table>
|
38 |
+
</slide>
|
39 |
+
<slide_category>
|
40 |
+
<table>ecommerceoffice_homepage_slide_category</table>
|
41 |
+
</slide_category>
|
42 |
+
<category>
|
43 |
+
<table>ecommerceoffice_homepage_category</table>
|
44 |
+
</category>
|
45 |
+
<category_store>
|
46 |
+
<table>ecommerceoffice_homepage_category_store</table>
|
47 |
+
</category_store>
|
48 |
+
</entities>
|
49 |
+
</homepage_mysql4>
|
50 |
+
</models>
|
51 |
+
<resources>
|
52 |
+
<homepage_setup>
|
53 |
+
<setup>
|
54 |
+
<module>Ecommerceoffice_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>Ecommerceoffice_Homepage_Block</class>
|
74 |
+
</homepage>
|
75 |
+
<page>
|
76 |
+
<rewrite>
|
77 |
+
<html_footer>Ecommerceoffice_Homepage_Block_Page_Html_Footer</html_footer>
|
78 |
+
</rewrite>
|
79 |
+
</page>
|
80 |
+
</blocks>
|
81 |
+
<helpers>
|
82 |
+
<homepage>
|
83 |
+
<class>Ecommerceoffice_Homepage_Helper</class>
|
84 |
+
</homepage>
|
85 |
+
</helpers>
|
86 |
+
</global>
|
87 |
+
<admin>
|
88 |
+
<routers>
|
89 |
+
<ecommerceoffice_homepage>
|
90 |
+
<use>admin</use>
|
91 |
+
<args>
|
92 |
+
<module>Ecommerceoffice_Homepage</module>
|
93 |
+
<frontName>homepage</frontName>
|
94 |
+
</args>
|
95 |
+
</ecommerceoffice_homepage>
|
96 |
+
</routers>
|
97 |
+
</admin>
|
98 |
+
<adminhtml>
|
99 |
+
<acl>
|
100 |
+
<resources>
|
101 |
+
<admin>
|
102 |
+
<children>
|
103 |
+
<system>
|
104 |
+
<children>
|
105 |
+
<config>
|
106 |
+
<children>
|
107 |
+
<homepage translate="title" module="homepage">
|
108 |
+
<title>Homepage</title>
|
109 |
+
</homepage>
|
110 |
+
</children>
|
111 |
+
</config>
|
112 |
+
</children>
|
113 |
+
</system>
|
114 |
+
</children>
|
115 |
+
</admin>
|
116 |
+
</resources>
|
117 |
+
</acl>
|
118 |
+
<menu>
|
119 |
+
<ecommerceoffice translate="title" module="homepage">
|
120 |
+
<title>Ecommerceoffice</title>
|
121 |
+
<sort_order>65</sort_order>
|
122 |
+
<children>
|
123 |
+
<homepage translate="title" module="homepage">
|
124 |
+
<title>Homepage</title>
|
125 |
+
<sort_order>65</sort_order>
|
126 |
+
<children>
|
127 |
+
<settings translate="title" module="homepage">
|
128 |
+
<title>Settings</title>
|
129 |
+
<action>adminhtml/system_config/edit/section/homepage</action>
|
130 |
+
<sort_order>40</sort_order>
|
131 |
+
</settings>
|
132 |
+
</children>
|
133 |
+
</homepage>
|
134 |
+
</children>
|
135 |
+
</ecommerceoffice>
|
136 |
+
</menu>
|
137 |
+
</adminhtml>
|
138 |
+
<default>
|
139 |
+
<homepage>
|
140 |
+
<options>
|
141 |
+
<actions>1</actions>
|
142 |
+
<price>1</price>
|
143 |
+
<salable>1</salable>
|
144 |
+
<noproduct>There are no products that match your criteria. Please try again with different options.</noproduct>
|
145 |
+
<count>4</count>
|
146 |
+
</options>
|
147 |
+
<topsell>
|
148 |
+
<enable>1</enable>
|
149 |
+
<title>TOPSELLERS</title>
|
150 |
+
<count>4</count>
|
151 |
+
<days>365</days>
|
152 |
+
<cat>0</cat>
|
153 |
+
</topsell>
|
154 |
+
<new>
|
155 |
+
<enable>1</enable>
|
156 |
+
<title>NEW PRODUCTS</title>
|
157 |
+
<count>4</count>
|
158 |
+
<from>2007-08-23</from>
|
159 |
+
</new>
|
160 |
+
<popular>
|
161 |
+
<enable>1</enable>
|
162 |
+
<title>POPULAR PRODUCTS</title>
|
163 |
+
<count>4</count>
|
164 |
+
</popular>
|
165 |
+
<toprated>
|
166 |
+
<enable>1</enable>
|
167 |
+
<title>TOPRATED PRODUCTS</title>
|
168 |
+
<count>4</count>
|
169 |
+
</toprated>
|
170 |
+
<review>
|
171 |
+
<enable>1</enable>
|
172 |
+
<title>OUR LAST REVIEWS</title>
|
173 |
+
<count>10</count>
|
174 |
+
</review>
|
175 |
+
</homepage>
|
176 |
+
</default>
|
177 |
+
</config>
|
app/code/community/Ecommerceoffice/Homepage/etc/system.xml
ADDED
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<ecommerceoffice translate="label">
|
5 |
+
<label>Ecommerceoffice.com</label>
|
6 |
+
<sort_order>250</sort_order>
|
7 |
+
</ecommerceoffice>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<homepage translate="label" module="homepage">
|
11 |
+
<label>Homepage</label>
|
12 |
+
<tab>ecommerceoffice</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 |
+
<options translate="label">
|
20 |
+
<label>General</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>2</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<price translate="label">
|
28 |
+
<label>Display price</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>53</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</price>
|
36 |
+
<actions translate="label">
|
37 |
+
<label>Display actions</label>
|
38 |
+
<frontend_type>select</frontend_type>
|
39 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
40 |
+
<sort_order>54</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</actions>
|
45 |
+
<salable translate="label">
|
46 |
+
<label>Salable products</label>
|
47 |
+
<frontend_type>select</frontend_type>
|
48 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
49 |
+
<sort_order>55</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</salable>
|
54 |
+
<noproduct translate="label">
|
55 |
+
<label>No product text</label>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<sort_order>66</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</noproduct>
|
62 |
+
<count translate="label">
|
63 |
+
<label>Row count</label>
|
64 |
+
<frontend_type>text</frontend_type>
|
65 |
+
<sort_order>68</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 |
+
</fields>
|
71 |
+
</options>
|
72 |
+
<topsell translate="label">
|
73 |
+
<label>Topsellers</label>
|
74 |
+
<frontend_type>text</frontend_type>
|
75 |
+
<sort_order>2</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
<fields>
|
80 |
+
<enable translate="label">
|
81 |
+
<label>Enable</label>
|
82 |
+
<frontend_type>select</frontend_type>
|
83 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
84 |
+
<sort_order>51</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 |
+
</enable>
|
89 |
+
<title translate="label">
|
90 |
+
<label>Title</label>
|
91 |
+
<frontend_type>text</frontend_type>
|
92 |
+
<sort_order>56</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
</title>
|
97 |
+
<count translate="label">
|
98 |
+
<label>Count</label>
|
99 |
+
<frontend_type>text</frontend_type>
|
100 |
+
<sort_order>62</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</count>
|
105 |
+
<days translate="label">
|
106 |
+
<label>Topseller for * days</label>
|
107 |
+
<frontend_type>text</frontend_type>
|
108 |
+
<sort_order>63</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</days>
|
113 |
+
<cat translate="label">
|
114 |
+
<label>Category ID</label>
|
115 |
+
<frontend_type>text</frontend_type>
|
116 |
+
<comment>type "0" for all categories</comment>
|
117 |
+
<sort_order>64</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>1</show_in_store>
|
121 |
+
</cat>
|
122 |
+
</fields>
|
123 |
+
</topsell>
|
124 |
+
<new translate="label">
|
125 |
+
<label>New Products</label>
|
126 |
+
<frontend_type>text</frontend_type>
|
127 |
+
<sort_order>3</sort_order>
|
128 |
+
<show_in_default>1</show_in_default>
|
129 |
+
<show_in_website>1</show_in_website>
|
130 |
+
<show_in_store>1</show_in_store>
|
131 |
+
<fields>
|
132 |
+
<enable translate="label">
|
133 |
+
<label>Enable</label>
|
134 |
+
<frontend_type>select</frontend_type>
|
135 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
136 |
+
<sort_order>51</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>1</show_in_store>
|
140 |
+
</enable>
|
141 |
+
<title translate="label">
|
142 |
+
<label>Title</label>
|
143 |
+
<frontend_type>text</frontend_type>
|
144 |
+
<sort_order>56</sort_order>
|
145 |
+
<show_in_default>1</show_in_default>
|
146 |
+
<show_in_website>1</show_in_website>
|
147 |
+
<show_in_store>1</show_in_store>
|
148 |
+
</title>
|
149 |
+
<count translate="label">
|
150 |
+
<label>Count</label>
|
151 |
+
<frontend_type>text</frontend_type>
|
152 |
+
<sort_order>62</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>1</show_in_store>
|
156 |
+
</count>
|
157 |
+
<from translate="label">
|
158 |
+
<label>New from</label>
|
159 |
+
<frontend_type>text</frontend_type>
|
160 |
+
<sort_order>63</sort_order>
|
161 |
+
<show_in_default>1</show_in_default>
|
162 |
+
<show_in_website>1</show_in_website>
|
163 |
+
<show_in_store>1</show_in_store>
|
164 |
+
</from>
|
165 |
+
</fields>
|
166 |
+
</new>
|
167 |
+
<popular translate="label">
|
168 |
+
<label>Popular Products</label>
|
169 |
+
<frontend_type>text</frontend_type>
|
170 |
+
<sort_order>4</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>1</show_in_store>
|
174 |
+
<fields>
|
175 |
+
<enable translate="label">
|
176 |
+
<label>Enable</label>
|
177 |
+
<frontend_type>select</frontend_type>
|
178 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
179 |
+
<sort_order>51</sort_order>
|
180 |
+
<show_in_default>1</show_in_default>
|
181 |
+
<show_in_website>1</show_in_website>
|
182 |
+
<show_in_store>1</show_in_store>
|
183 |
+
</enable>
|
184 |
+
<title translate="label">
|
185 |
+
<label>Title</label>
|
186 |
+
<frontend_type>text</frontend_type>
|
187 |
+
<sort_order>56</sort_order>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
+
<show_in_store>1</show_in_store>
|
191 |
+
</title>
|
192 |
+
<count translate="label">
|
193 |
+
<label>Count</label>
|
194 |
+
<frontend_type>text</frontend_type>
|
195 |
+
<sort_order>62</sort_order>
|
196 |
+
<show_in_default>1</show_in_default>
|
197 |
+
<show_in_website>1</show_in_website>
|
198 |
+
<show_in_store>1</show_in_store>
|
199 |
+
</count>
|
200 |
+
</fields>
|
201 |
+
</popular>
|
202 |
+
<toprated translate="label">
|
203 |
+
<label>Toprated Products</label>
|
204 |
+
<frontend_type>text</frontend_type>
|
205 |
+
<sort_order>4</sort_order>
|
206 |
+
<show_in_default>1</show_in_default>
|
207 |
+
<show_in_website>1</show_in_website>
|
208 |
+
<show_in_store>1</show_in_store>
|
209 |
+
<fields>
|
210 |
+
<enable translate="label">
|
211 |
+
<label>Enable</label>
|
212 |
+
<frontend_type>select</frontend_type>
|
213 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
214 |
+
<sort_order>51</sort_order>
|
215 |
+
<show_in_default>1</show_in_default>
|
216 |
+
<show_in_website>1</show_in_website>
|
217 |
+
<show_in_store>1</show_in_store>
|
218 |
+
</enable>
|
219 |
+
<title translate="label">
|
220 |
+
<label>Title</label>
|
221 |
+
<frontend_type>text</frontend_type>
|
222 |
+
<sort_order>56</sort_order>
|
223 |
+
<show_in_default>1</show_in_default>
|
224 |
+
<show_in_website>1</show_in_website>
|
225 |
+
<show_in_store>1</show_in_store>
|
226 |
+
</title>
|
227 |
+
<count translate="label">
|
228 |
+
<label>Count</label>
|
229 |
+
<frontend_type>text</frontend_type>
|
230 |
+
<sort_order>62</sort_order>
|
231 |
+
<show_in_default>1</show_in_default>
|
232 |
+
<show_in_website>1</show_in_website>
|
233 |
+
<show_in_store>1</show_in_store>
|
234 |
+
</count>
|
235 |
+
</fields>
|
236 |
+
</toprated>
|
237 |
+
<review translate="label">
|
238 |
+
<label>Reviews</label>
|
239 |
+
<frontend_type>text</frontend_type>
|
240 |
+
<sort_order>7</sort_order>
|
241 |
+
<show_in_default>1</show_in_default>
|
242 |
+
<show_in_website>1</show_in_website>
|
243 |
+
<show_in_store>1</show_in_store>
|
244 |
+
<fields>
|
245 |
+
<enable translate="label">
|
246 |
+
<label>Enable</label>
|
247 |
+
<frontend_type>select</frontend_type>
|
248 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
249 |
+
<sort_order>51</sort_order>
|
250 |
+
<show_in_default>1</show_in_default>
|
251 |
+
<show_in_website>1</show_in_website>
|
252 |
+
<show_in_store>1</show_in_store>
|
253 |
+
</enable>
|
254 |
+
<title translate="label">
|
255 |
+
<label>Title</label>
|
256 |
+
<frontend_type>text</frontend_type>
|
257 |
+
<sort_order>56</sort_order>
|
258 |
+
<show_in_default>1</show_in_default>
|
259 |
+
<show_in_website>1</show_in_website>
|
260 |
+
<show_in_store>1</show_in_store>
|
261 |
+
</title>
|
262 |
+
<count translate="label">
|
263 |
+
<label>Count</label>
|
264 |
+
<frontend_type>text</frontend_type>
|
265 |
+
<sort_order>62</sort_order>
|
266 |
+
<show_in_default>1</show_in_default>
|
267 |
+
<show_in_website>1</show_in_website>
|
268 |
+
<show_in_store>1</show_in_store>
|
269 |
+
</count>
|
270 |
+
</fields>
|
271 |
+
</review>
|
272 |
+
</groups>
|
273 |
+
</homepage>
|
274 |
+
</sections>
|
275 |
+
</config>
|
app/design/frontend/base/default/layout/ecommerceoffice_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>ecommerceoffice/homepage/style.css</stylesheet></action>
|
7 |
+
</reference>
|
8 |
+
<reference name="content">
|
9 |
+
<block type="core/template"
|
10 |
+
name="ecommerceoffice_homepage"
|
11 |
+
before="-"
|
12 |
+
template="ecommerceoffice/homepage/data.phtml"/>
|
13 |
+
</reference>
|
14 |
+
</cms_index_index>
|
15 |
+
|
16 |
+
</layout>
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
app/design/frontend/base/default/template/ecommerceoffice/homepage/data.phtml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="homepage5in1">
|
2 |
+
<?php if (Mage::getStoreConfig('homepage/topsell/enable')): ?>
|
3 |
+
<?php echo $this->getLayout()->createBlock('homepage/topsell')->setTemplate('ecommerceoffice/homepage/topsell.phtml')->toHtml(); ?>
|
4 |
+
<?php endif; ?>
|
5 |
+
|
6 |
+
<?php if (Mage::getStoreConfig('homepage/new/enable')): ?>
|
7 |
+
<?php echo $this->getLayout()->createBlock('homepage/new')->setTemplate('ecommerceoffice/homepage/new.phtml')->toHtml(); ?>
|
8 |
+
<?php endif; ?>
|
9 |
+
|
10 |
+
<?php if (Mage::getStoreConfig('homepage/popular/enable')): ?>
|
11 |
+
<?php echo $this->getLayout()->createBlock('homepage/popular')->setTemplate('ecommerceoffice/homepage/popular.phtml')->toHtml(); ?>
|
12 |
+
<?php endif; ?>
|
13 |
+
|
14 |
+
<?php if (Mage::getStoreConfig('homepage/toprated/enable')): ?>
|
15 |
+
<?php echo $this->getLayout()->createBlock('homepage/toprated')->setTemplate('ecommerceoffice/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('ecommerceoffice/homepage/review.phtml')->toHtml(); ?>
|
20 |
+
<?php endif; ?>
|
21 |
+
|
22 |
+
</div>
|
app/design/frontend/base/default/template/ecommerceoffice/homepage/new.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-new">
|
8 |
+
<span><?php echo $this->getTitle(); ?></span>
|
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/base/default/template/ecommerceoffice/homepage/popular.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-popular">
|
8 |
+
<span><?php echo $this->getTitle(); ?></span>
|
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/base/default/template/ecommerceoffice/homepage/review.phtml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_reviews = $this->getReviewsData();?>
|
2 |
+
|
3 |
+
|
4 |
+
<div class="block block-homepage">
|
5 |
+
<div class="block-title title-homepage-reviews">
|
6 |
+
<span><?php echo $this->getTitle(); ?></span>
|
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 |
+
// var_dump($ratings);
|
14 |
+
// exit();
|
15 |
+
?>
|
16 |
+
<dl>
|
17 |
+
<dt>
|
18 |
+
<a href="<?php echo $review['review_url']; ?>"><?php echo $review['title']; ?></a> <?php echo $this->__('Review by');?> <strong><?php echo $review['nickname']; ?></strong>
|
19 |
+
</dt>
|
20 |
+
<dd>
|
21 |
+
<table class="ratings-table">
|
22 |
+
<col width="1">
|
23 |
+
<col>
|
24 |
+
<tbody>
|
25 |
+
<?php foreach ($ratings as $k => $v): ?>
|
26 |
+
<tr>
|
27 |
+
<th><?php echo $k?></th>
|
28 |
+
<td>
|
29 |
+
<div class="rating-box">
|
30 |
+
<div style="width: <?php echo $v ?>%;" class="rating"></div>
|
31 |
+
</div>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<?php endforeach; ?>
|
35 |
+
</tbody>
|
36 |
+
</table>
|
37 |
+
<?php echo $review['detail']; ?>
|
38 |
+
</dd>
|
39 |
+
</dl><br/>
|
40 |
+
<!-- <p> </p>-->
|
41 |
+
<?php endforeach; ?>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
</div>
|
app/design/frontend/base/default/template/ecommerceoffice/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-toprated">
|
8 |
+
<span><?php echo $this->getTitle(); ?></span>
|
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/design/frontend/base/default/template/ecommerceoffice/homepage/topsell.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-topsellers">
|
8 |
+
<span><?php echo $this->getTitle(); ?></span>
|
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/etc/modules/Ecommerceoffice_Homepage.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ecommerceoffice_Homepage>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Ecommerceoffice_Homepage>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>ecommerceoffice_homepage</name>
|
4 |
+
<version>1.0.4</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</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. 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.
|
11 |
+
</description>
|
12 |
+
<notes>== Changelog ==
|
13 |
+

|
14 |
+
= 1.0.4 =
|
15 |
+
* Minor changes, 
|
16 |
+
* "#" comments caused problems on some webserververs, now all comments removed from .phtml files</notes>
|
17 |
+
<authors><author><name>volgodark</name><user>volgodark</user><email>volgodark@gmail.com</email></author></authors>
|
18 |
+
<date>2013-12-10</date>
|
19 |
+
<time>09:25:11</time>
|
20 |
+
<contents><target name="magecommunity"><dir name="Ecommerceoffice"><dir name="Homepage"><dir name="Block"><file name="New.php" hash="aa4b96ea82efe4a527dd7cdb29e50010"/><dir name="Page"><dir name="Html"><file name="Footer.php" hash="8f7799f3e93aa93238b7a1a580f89b9c"/></dir></dir><file name="Popular.php" hash="dc16cfa932913600130f20b4a1c00af3"/><file name="Review.php" hash="2ddb29d4c01d2dc1a40c3cb667e5572e"/><file name="Toprated.php" hash="83abfeb95ca129a455514473927874b8"/><file name="Topsell.php" hash="a2109a79a5b6ded8c7a60ede531282f3"/></dir><dir name="Helper"><file name="Data.php" hash="1a07b61a9ef5deb93479a4fca278a100"/></dir><dir name="Model"><file name="Data.php" hash="567cca5d087791668ca92a9e4d1e496c"/></dir><dir name="etc"><file name="config.xml" hash="389726b62d3add7005c0a5f03a6856c0"/><file name="system.xml" hash="602a70ebb7e874d5cd1aa7ca323bb67d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ecommerceoffice"><dir name="homepage"><file name="data.phtml" hash="33b8286f4c0c7ce6c21932d95ec8fbde"/><file name="new.phtml" hash="0bcf9fc985f4f9abad89783a401f4730"/><file name="popular.phtml" hash="6578e93b44046fac954a49d17d40c2b8"/><file name="review.phtml" hash="e2a640b9e66a009f1ca9d6c323b67d52"/><file name="toprated.phtml" hash="79428dd322e1bf5029c8bc552a7b7d5f"/><file name="topsell.phtml" hash="5f0b2229bf753e437017299a71675786"/></dir></dir></dir><dir name="layout"><file name="ecommerceoffice_homepage.xml" hash="7116dfef17c30a6ac3e9422a4333a9e5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ecommerceoffice_Homepage.xml" hash="73d46e8f24a1739e9fffae33d3c5dee7"/></dir></target></contents>
|
21 |
+
<compatible/>
|
22 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
23 |
+
</package>
|