Bestseller_products - Version 2.1.1

Version Notes

Best Seller

Download this release

Release Info

Developer Capacity Web Solutions
Extension Bestseller_products
Version 2.1.1
Comparing to
See all releases


Code changes from version 2.1.0 to 2.1.1

app/code/community/CapacityWebSolutions/Bestseller/Block/Bestseller.php CHANGED
@@ -29,6 +29,27 @@ class CapacityWebSolutions_Bestseller_Block_Bestseller extends Mage_Catalog_Bloc
29
  $this->setOrderStatus(Mage::getStoreConfig('bestseller/general/order_status'));
30
  }
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  public function getBestsellerProduct() {
33
  $o_status = $this->getOrderStatus();
34
  if($o_status != "all"){
@@ -63,6 +84,14 @@ class CapacityWebSolutions_Bestseller_Block_Bestseller extends Mage_Catalog_Bloc
63
  return $products;
64
  }
65
 
 
 
 
 
 
 
 
 
66
  public function getProducts($productid) {
67
  $collection = Mage::getModel('catalog/product')->load($productid);
68
  if($collection->getVisibility()!=1){
29
  $this->setOrderStatus(Mage::getStoreConfig('bestseller/general/order_status'));
30
  }
31
 
32
+
33
+ public function setWidgetOptions(){
34
+
35
+ $this->setDisplayHeader((bool)$this->getWdDisplayHeading());
36
+ $this->setHeader($this->getWdHeading());
37
+ $this->setLimit((int)$this->getWdNumberOfItems());
38
+ $this->setItemsPerRow((int)$this->getWdNumberOfItemsPerRow());
39
+ $this->setImageHeight((int)$this->getWdThumbnailHeight());
40
+ $this->setImageWidth((int)$this->getWdThumbnailWidth());
41
+ $this->setTimePeriod((int)$this->getWdTimePeriod());
42
+ $this->setAddToCart((bool)$this->getWdAddToCart());
43
+ $this->setActive((bool)$this->getWdActive());
44
+ $this->setAddToCompare((bool)$this->getWdAddToCompare());
45
+ $this->setProductsPrice((int)$this->getWdProductsPrice());
46
+ $this->setReview((int)$this->getWdReview());
47
+ $this->setOutofStock((int)$this->getWdOutOfStock());
48
+ $this->setChooseProducts((int)$this->getWdChooseProducts());
49
+ $this->setSortOrder((int)$this->getWdSortOrderBoth());
50
+ $this->setOrderStatus($this->getWdOrderStatus());
51
+ }
52
+
53
  public function getBestsellerProduct() {
54
  $o_status = $this->getOrderStatus();
55
  if($o_status != "all"){
84
  return $products;
85
  }
86
 
87
+ protected function _beforeToHtml(){
88
+ if($this->getType()=="bestseller/widget")
89
+ {
90
+ $this->setWidgetOptions();
91
+ }
92
+ // $this->setProductCollection($this->_getProductCollection());
93
+ }
94
+
95
  public function getProducts($productid) {
96
  $collection = Mage::getModel('catalog/product')->load($productid);
97
  if($collection->getVisibility()!=1){
app/code/community/CapacityWebSolutions/Bestseller/Block/Widget.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class CapacityWebSolutions_Bestseller_Block_Widget extends CapacityWebSolutions_Bestseller_Block_Bestseller // Mage_Core_Block_Template
3
+ implements Mage_Widget_Block_Interface
4
+ {
5
+ public function addData(array $arr){
6
+ $this->_data = array_merge($this->_data, $arr);
7
+ }
8
+
9
+ public function setData($key, $value = null){
10
+ $this->_data[$key] = $value;
11
+ }
12
+
13
+ public function _toHtml(){
14
+ if($this->getData('template')){
15
+ $this->setTemplate($this->getData('template'));
16
+ }
17
+ return parent::_toHtml();
18
+ }
19
+ }
app/code/community/CapacityWebSolutions/Bestseller/Block/Widget/Html/Pager.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class CapacityWebSolutions_Bestseller_Block_Widget_Html_Pager extends Mage_Page_Block_Html_Pager
3
+ {
4
+ /**
5
+ * Collection size
6
+ *
7
+ * Size of collection which may has a manual limitation
8
+ *
9
+ * @var int
10
+ */
11
+ protected $_collectionSize;
12
+
13
+ /**
14
+ * Current page
15
+ *
16
+ * @var int
17
+ */
18
+ protected $_currentPage;
19
+
20
+ /**
21
+ * Last page
22
+ *
23
+ * @var int
24
+ */
25
+ protected $_lastPage;
26
+
27
+ /**
28
+ * Return collection size
29
+ *
30
+ * It may be limited by manual
31
+ *
32
+ * @return int
33
+ */
34
+ public function getCollectionSize()
35
+ {
36
+ if (null === $this->_collectionSize) {
37
+ $this->_collectionSize = $this->getCollection()->getSize();
38
+ if ($this->getTotalLimit() && $this->_collectionSize > $this->getTotalLimit()) {
39
+ $this->_collectionSize = $this->getTotalLimit();
40
+ }
41
+ }
42
+ return $this->_collectionSize;
43
+ }
44
+
45
+ /**
46
+ * Return number of current page
47
+ *
48
+ * If current page is grate then total count of page current page will be equals total count of page
49
+ *
50
+ * @return int
51
+ */
52
+ public function getCurrentPage()
53
+ {
54
+ if (null === $this->_currentPage) {
55
+ $page = abs((int)$this->getRequest()->getParam($this->getPageVarName()));
56
+ if ($page > $this->getLastPageNum()) {
57
+ $this->_currentPage = $this->getLastPageNum();
58
+ } elseif ($page > 0) {
59
+ $this->_currentPage = $page;
60
+ } else {
61
+ $this->_currentPage = 1;
62
+ }
63
+ }
64
+ return $this->_currentPage;
65
+ }
66
+
67
+ /**
68
+ * Return items count per page
69
+ *
70
+ * @return int
71
+ */
72
+ public function getLimit()
73
+ {
74
+ if ($this->_limit > 0) {
75
+ return $this->_limit;
76
+ }
77
+ $limit = $this->getRequest()->getParam($this->getLimitVarName());
78
+ $limits = $this->getAvailableLimit();
79
+ if ($limit && isset($limits[$limit])) {
80
+ return $limit;
81
+ }
82
+ $limits = array_keys($limits);
83
+ return current($limits);
84
+ }
85
+
86
+ /**
87
+ * Connect collection to paging
88
+ *
89
+ * @param Mage_Core_Model_Resource_Db_Collection_Abstract $collection
90
+ * @return Mage_Catalog_Block_Product_Widget_Html_Pager
91
+ */
92
+ public function setCollection($collection)
93
+ {
94
+ $this->_collection = $collection;
95
+ $this->_collection->setPageSize(null)->setCurPage(null);
96
+
97
+ $collectionOffset = $this->getFirstNum() - 1;
98
+ $collectionLimit = $collectionOffset + $this->getLimit() > $this->getTotalNum()
99
+ ? $this->getTotalNum() - $collectionOffset
100
+ : $this->getLimit();
101
+
102
+ $this->_collection->getSelect()->limit($collectionLimit, $collectionOffset);
103
+ $this->_setFrameInitialized(false);
104
+ return $this;
105
+ }
106
+
107
+ /**
108
+ * Return position number in collection for first item on current page
109
+ *
110
+ * @return int
111
+ */
112
+ public function getFirstNum()
113
+ {
114
+ return $this->getLimit() * ($this->getCurrentPage() - 1) + 1;
115
+ }
116
+
117
+ /**
118
+ * Return position number in collection for last item on current page
119
+ *
120
+ * @return int
121
+ */
122
+ public function getLastNum()
123
+ {
124
+ $collection = $this->getCollection();
125
+ return $this->getLimit() * ($this->getCurrentPage() - 1) + $collection->count();
126
+ }
127
+
128
+ /**
129
+ * Return total number of collection
130
+ *
131
+ * It may be limited by manual
132
+ *
133
+ * @return int
134
+ */
135
+ public function getTotalNum()
136
+ {
137
+ return $this->getCollectionSize();
138
+ }
139
+
140
+ /**
141
+ * Return number of last page
142
+ *
143
+ * @return bool
144
+ */
145
+ public function getLastPageNum()
146
+ {
147
+ if (null === $this->_lastPage) {
148
+ $this->_lastPage = ceil($this->getCollectionSize() / $this->getLimit());
149
+ if ($this->_lastPage <= 0) {
150
+ $this->_lastPage = 1;
151
+ }
152
+ }
153
+ return $this->_lastPage;
154
+ }
155
+
156
+ /**
157
+ * Checks if current page is the first page
158
+ *
159
+ * @return bool
160
+ */
161
+ public function isFirstPage()
162
+ {
163
+ return $this->getCurrentPage() == 1;
164
+ }
165
+
166
+ /**
167
+ * Checks if current page is the last page
168
+ *
169
+ * @return bool
170
+ */
171
+ public function isLastPage()
172
+ {
173
+ return $this->getCurrentPage() >= $this->getLastPageNum();
174
+ }
175
+
176
+ /**
177
+ * Return array of pages
178
+ *
179
+ * @return array
180
+ */
181
+ public function getPages()
182
+ {
183
+ $pages = array();
184
+ if ($this->getLastPageNum() <= $this->_displayPages) {
185
+ $pages = range(1, $this->getLastPageNum());
186
+ } else {
187
+ $half = ceil($this->_displayPages / 2);
188
+ if ($this->getCurrentPage() >= $half && $this->getCurrentPage() <= $this->getLastPageNum() - $half) {
189
+ $start = ($this->getCurrentPage() - $half) + 1;
190
+ $finish = ($start + $this->_displayPages) - 1;
191
+ } elseif ($this->getCurrentPage() < $half) {
192
+ $start = 1;
193
+ $finish = $this->_displayPages;
194
+ } elseif ($this->getCurrentPage() > ($this->getLastPageNum() - $half)) {
195
+ $finish = $this->getLastPageNum();
196
+ $start = $finish - $this->_displayPages + 1;
197
+ }
198
+ $pages = range($start, $finish);
199
+ }
200
+ return $pages;
201
+ }
202
+
203
+ /**
204
+ * Retrieve url for previous page
205
+ *
206
+ * @return string
207
+ */
208
+ public function getPreviousPageUrl()
209
+ {
210
+ return $this->getPageUrl($this->getCurrentPage() - 1);
211
+ }
212
+
213
+ /**
214
+ * Retrieve url for next page
215
+ *
216
+ * @return string
217
+ */
218
+ public function getNextPageUrl()
219
+ {
220
+ return $this->getPageUrl($this->getCurrentPage() + 1);
221
+ }
222
+
223
+ /**
224
+ * Retrieve url for last page
225
+ *
226
+ * @return string
227
+ */
228
+ public function getLastPageUrl()
229
+ {
230
+ return $this->getPageUrl($this->getLastPageNum());
231
+ }
232
+
233
+ /**
234
+ * Initialize frame data, such as frame start, frame start etc.
235
+ *
236
+ * @return Mage_Catalog_Block_Product_Widget_Html_Pager
237
+ */
238
+ protected function _initFrame()
239
+ {
240
+ if (!$this->isFrameInitialized()) {
241
+ $start = 0;
242
+ $end = 0;
243
+
244
+ if ($this->getLastPageNum() <= $this->getFrameLength()) {
245
+ $start = 1;
246
+ $end = $this->getLastPageNum();
247
+ } else {
248
+ $half = ceil($this->getFrameLength() / 2);
249
+ if ($this->getCurrentPage() >= $half && $this->getCurrentPage() <= $this->getLastPageNum() - $half) {
250
+ $start = ($this->getCurrentPage() - $half) + 1;
251
+ $end = ($start + $this->getFrameLength()) - 1;
252
+ } elseif ($this->getCurrentPage() < $half) {
253
+ $start = 1;
254
+ $end = $this->getFrameLength();
255
+ } elseif ($this->getCurrentPage() > ($this->getLastPageNum() - $half)) {
256
+ $end = $this->getLastPageNum();
257
+ $start = $end - $this->getFrameLength() + 1;
258
+ }
259
+ }
260
+ $this->_frameStart = $start;
261
+ $this->_frameEnd = $end;
262
+ $this->_setFrameInitialized(true);
263
+ }
264
+
265
+ return $this;
266
+ }
267
+ }
app/code/community/CapacityWebSolutions/Bestseller/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <CapacityWebSolutions_Bestseller>
5
- <version>2.1.0</version>
6
  </CapacityWebSolutions_Bestseller>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <CapacityWebSolutions_Bestseller>
5
+ <version>2.1.1</version>
6
  </CapacityWebSolutions_Bestseller>
7
  </modules>
8
  <global>
app/code/community/CapacityWebSolutions/Bestseller/etc/system.xml CHANGED
@@ -149,7 +149,7 @@
149
  <show_in_default>1</show_in_default>
150
  <show_in_website>1</show_in_website>
151
  <show_in_store>1</show_in_store>
152
- <depends><choose_products>3</choose_products></depends>
153
  </sort_order_both>
154
  <bundle_products>
155
  <label>Display Bundle and Configurable Products</label>
149
  <show_in_default>1</show_in_default>
150
  <show_in_website>1</show_in_website>
151
  <show_in_store>1</show_in_store>
152
+ <depends><choose_products>3</choose_products></depends>
153
  </sort_order_both>
154
  <bundle_products>
155
  <label>Display Bundle and Configurable Products</label>
app/code/community/CapacityWebSolutions/Bestseller/etc/widget.xml ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <widgets>
3
+ <bestseller type="bestseller/widget">
4
+ <name>MageBees:Bestseller Products Widget</name>
5
+ <parameters>
6
+ <template>
7
+ <values>
8
+ <list_default translate="label">
9
+ <value>bestseller/column/bestseller_default_list.phtml</value>
10
+ <label>Bestseller Products Images and Names Template</label>
11
+ </list_default>
12
+ </values>
13
+ </template>
14
+ </parameters>
15
+ <supported_blocks>
16
+ <left_column>
17
+ <block_name>left</block_name>
18
+ <template>
19
+ <default>list_default</default>
20
+ </template>
21
+ </left_column>
22
+ <main_content>
23
+ <block_name>content</block_name>
24
+ <template>
25
+ <default>default_template</default>
26
+ <reponsive>responsive_template</reponsive>
27
+ </template>
28
+ </main_content>
29
+ <right_column>
30
+ <block_name>right</block_name>
31
+ <template>
32
+ <default>list_default</default>
33
+ </template>
34
+ </right_column>
35
+ </supported_blocks>
36
+ <parameters>
37
+ <wd_display_heading translate="label">
38
+ <visible>1</visible>
39
+ <label>Display Heading</label>
40
+ <source_model>adminhtml/system_config_source_yesno</source_model>
41
+ <type>select</type>
42
+ <value>1</value>
43
+ </wd_display_heading>
44
+ <wd_heading translate="label">
45
+ <visible>1</visible>
46
+ <label>Heading</label>
47
+ <type>text</type>
48
+ <value>BESTSELLER PRODUCTS</value>
49
+ <depends>
50
+ <wd_display_heading><value>1</value></wd_display_heading>
51
+ </depends>
52
+ </wd_heading>
53
+ <wd_choose_products translate="label">
54
+ <visible>1</visible>
55
+ <label>Best Seller Products</label>
56
+ <source_model>bestseller/system_config_source_chooseproducts</source_model>
57
+ <type>select</type>
58
+ <value>1</value>
59
+ </wd_choose_products>
60
+ <wd_sort_order_both>
61
+ <visible>1</visible>
62
+ <label>Sort Order for Both</label>
63
+ <source_model>bestseller/system_config_source_sortorder</source_model>
64
+ <type>select</type>
65
+ <value>1</value>
66
+ <depends>
67
+ <wd_choose_products><value>3</value></wd_choose_products>
68
+ </depends>
69
+ </wd_sort_order_both>
70
+ <wd_bundle_products>
71
+ <visible>1</visible>
72
+ <label>Display Bundle and Configurable Products</label>
73
+ <source_model>bestseller/system_config_source_bundleproducts</source_model>
74
+ <type>select</type>
75
+ <value>1</value>
76
+ </wd_bundle_products>
77
+ <wd_number_of_items translate="label comment">
78
+ <visible>1</visible>
79
+ <label>Number Of Items in Main Block</label>
80
+ <type>text</type>
81
+ <value>6</value>
82
+ </wd_number_of_items>
83
+ <wd_number_of_items_per_row translate="label comment">
84
+ <visible>1</visible>
85
+ <label>Number Of Items per row in Main Block</label>
86
+ <type>text</type>
87
+ <value>3</value>
88
+ </wd_number_of_items_per_row>
89
+ <wd_thumbnail_height translate="label">
90
+ <visible>1</visible>
91
+ <label>Thumbnail Width</label>
92
+ <type>text</type>
93
+ <value>135</value>
94
+ </wd_thumbnail_height>
95
+ <wd_thumbnail_width translate="label">
96
+ <visible>1</visible>
97
+ <label>Thumbnail Height </label>
98
+ <type>text</type>
99
+ <value>135</value>
100
+ </wd_thumbnail_width>
101
+ <wd_time_period translate="label">
102
+ <visible>1</visible>
103
+ <label>Time Period</label>
104
+ <type>text</type>
105
+ <value>60</value>
106
+ </wd_time_period>
107
+ <wd_products_price translate="label">
108
+ <visible>1</visible>
109
+ <label>Show Products Price</label>
110
+ <source_model>adminhtml/system_config_source_yesno</source_model>
111
+ <type>select</type>
112
+ <value>1</value>
113
+ </wd_products_price>
114
+ <wd_review translate="label">
115
+ <visible>1</visible>
116
+ <label>Show Reviews Ratings</label>
117
+ <source_model>adminhtml/system_config_source_yesno</source_model>
118
+ <type>select</type>
119
+ </wd_review>
120
+ <wd_add_to_cart translate="label">
121
+ <visible>1</visible>
122
+ <label>Add to Cart</label>
123
+ <source_model>adminhtml/system_config_source_yesno</source_model>
124
+ <type>select</type>
125
+ <value>1</value>
126
+ </wd_add_to_cart>
127
+ <wd_active translate="label">
128
+ <visible>1</visible>
129
+ <label>Add to Wishlist</label>
130
+ <type>select</type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ </wd_active>
133
+ <wd_add_to_compare translate="label">
134
+ <visible>1</visible>
135
+ <label>Add to Compare</label>
136
+ <source_model>adminhtml/system_config_source_yesno</source_model>
137
+ <type>select</type>
138
+ </wd_add_to_compare>
139
+ <wd_out_of_stock translate="label">
140
+ <visible>1</visible>
141
+ <label>Display out of stock items</label>
142
+ <source_model>adminhtml/system_config_source_yesno</source_model>
143
+ <type>select</type>
144
+ </wd_out_of_stock>
145
+ <wd_order_status translate="label">
146
+ <visible>1</visible>
147
+ <label>Order Status</label>
148
+ <source_model>bestseller/system_config_source_orderstatus</source_model>
149
+ <type>multiselect</type>
150
+ <value>all</value>
151
+ </wd_order_status>
152
+ <template>
153
+ <visible>1</visible>
154
+ <label>Template</label>
155
+ <type>select</type>
156
+ <value>bestseller/bestseller.phtml</value>
157
+ <values>
158
+ <default_template translate="label">
159
+ <value>bestseller/bestseller.phtml</value>
160
+ <label>Default Template</label>
161
+ </default_template>
162
+ <responsive_template translate="label">
163
+ <value>bestseller/bestseller-responsive.phtml</value>
164
+ <label>Responsive Template</label>
165
+ </responsive_template>
166
+ </values>
167
+ </template>
168
+ </parameters>
169
+ </bestseller>
170
+ </widgets>
app/design/frontend/base/default/template/bestseller/bestseller-responsive.phtml CHANGED
@@ -33,13 +33,11 @@
33
  }
34
  $upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
35
  $itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
36
- $products_price = $this->getProductsPrice();
37
- $review = $this->getReview();
38
  $_columnCount = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
39
 
40
  ?>
41
 
42
- <?php if($this->getEnabled() == 1): ?>
43
  <?php if($this->getDisplayHeader()): ?>
44
  <div class="page-title category-title">
45
  <h1><?php if(count($result) > 0) { echo $this->getHeader(); } ?></h1>
@@ -53,9 +51,7 @@
53
  if(!$_product){
54
  continue;
55
  }
56
-
57
  if($x <= $upperLimit) {
58
-
59
  ?>
60
  <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
61
  <a href="<?php echo $this->getBaseUrl().$_product['url_path']; ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image">
@@ -66,57 +62,52 @@
66
  <a href="<?php echo $this->getBaseUrl().$_product['url_path'] ?>" title="<?php echo $this->htmlEscape($_product['name']) ?>"><?php echo $this->htmlEscape($_product['name']) ?></a>
67
  </h2>
68
  <?php
69
- if($review == 1) {
70
  $_product = Mage::getModel('catalog/product')->load($_product->getId());
71
  echo $this->getReviewsSummaryHtml($_product, 'short');
72
  }
73
- if($products_price == 1) {
74
  $_product = Mage::getModel('catalog/product')->load($_product->getId());
75
  echo $this->getPriceHtml($_product, true);
76
  }
77
  ?>
78
  <div class="actions" style="display:block !important">
79
- <?php $addtocartval = $this->getAddToCart();
80
- if($addtocartval == 1){
81
- if($_product->isSaleable() && !$_product->canConfigure()): ?>
82
- <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
83
- <span><?php echo $this->__('Add to Cart') ?></span>
84
- </button>
85
- <?php elseif($_product->isSaleable()): ?>
86
- <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
87
- <span><?php echo $this->__('View Details')?></span>
88
- </button>
89
- <?php else: ?>
90
- <span class="out-of-stock">
91
- <?php echo $this->__('Out of stock') ?>
92
- </span>
93
- <?php endif; }?>
94
-
95
  <ul class="add-to-links">
96
- <?php $wishlists = $this->getActive();
97
- if($wishlists == 1){
98
- if ($this->helper('wishlist')->isAllow()) : ?>
99
- <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
100
- <?php endif; }?>
101
-
102
-
103
- <?php $addtocompare = $this->getAddToCompare();
104
- if($addtocompare==1){
105
- if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
106
  <li><a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a></li>
107
- <?php endif; }?>
108
-
109
- </ul>
110
-
111
  </div>
112
  </div>
113
  </li>
114
  <?php
115
  }
116
  $x++;
117
-
118
-
119
- }
120
  ?>
121
  </ul>
122
  <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
33
  }
34
  $upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
35
  $itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
 
 
36
  $_columnCount = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
37
 
38
  ?>
39
 
40
+ <?php if($this->getEnabled()): ?>
41
  <?php if($this->getDisplayHeader()): ?>
42
  <div class="page-title category-title">
43
  <h1><?php if(count($result) > 0) { echo $this->getHeader(); } ?></h1>
51
  if(!$_product){
52
  continue;
53
  }
 
54
  if($x <= $upperLimit) {
 
55
  ?>
56
  <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
57
  <a href="<?php echo $this->getBaseUrl().$_product['url_path']; ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image">
62
  <a href="<?php echo $this->getBaseUrl().$_product['url_path'] ?>" title="<?php echo $this->htmlEscape($_product['name']) ?>"><?php echo $this->htmlEscape($_product['name']) ?></a>
63
  </h2>
64
  <?php
65
+ if($this->getReview()) {
66
  $_product = Mage::getModel('catalog/product')->load($_product->getId());
67
  echo $this->getReviewsSummaryHtml($_product, 'short');
68
  }
69
+ if($this->getProductsPrice()) {
70
  $_product = Mage::getModel('catalog/product')->load($_product->getId());
71
  echo $this->getPriceHtml($_product, true);
72
  }
73
  ?>
74
  <div class="actions" style="display:block !important">
75
+ <?php if($this->getAddToCart()): ?>
76
+ <?php if($_product->isSaleable() && !$_product->canConfigure()): ?>
77
+ <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
78
+ <span><?php echo $this->__('Add to Cart') ?></span>
79
+ </button>
80
+ <?php elseif($_product->isSaleable()): ?>
81
+ <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
82
+ <span><?php echo $this->__('View Details')?></span>
83
+ </button>
84
+ <?php else: ?>
85
+ <span class="out-of-stock">
86
+ <?php echo $this->__('Out of stock') ?>
87
+ </span>
88
+ <?php endif; ?>
89
+ <?php endif; ?>
90
+ <?php if($this->getActive() || $this->getAddToCompare()):?>
91
  <ul class="add-to-links">
92
+ <?php if($this->getActive()):?>
93
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
94
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
95
+ <?php endif; ?>
96
+ <?php endif; ?>
97
+ <?php if($this->getAddToCompare()): ?>
98
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
 
 
 
99
  <li><a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a></li>
100
+ <?php endif; ?>
101
+ <?php endif; ?>
102
+ </ul>
103
+ <?php endif; ?>
104
  </div>
105
  </div>
106
  </li>
107
  <?php
108
  }
109
  $x++;
110
+ }
 
 
111
  ?>
112
  </ul>
113
  <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
app/design/frontend/base/default/template/bestseller/column/bestseller_default_list.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $result = array();
3
+ $pro = array();
4
+ $bestseller_collection = $this->getBestsellerProduct();
5
+ foreach($bestseller_collection as $collection){
6
+ $pro[] = $collection->getEntityId();
7
+ }
8
+ if($this->getChooseProducts() == "1") {
9
+ $result = $pro;
10
+ }elseif($this->getChooseProducts() == "2") {
11
+ $result = $this->getProductIds();
12
+ }else{
13
+ if($this->getSortOrder() == 1){
14
+ $result = array_unique(array_merge($pro, $this->getProductIds()));
15
+ }elseif($this->getSortOrder() == 2){
16
+ $result = array_unique(array_merge($this->getProductIds(),$pro));
17
+ }else{
18
+ $result = array_unique(array_merge($pro,$this->getProductIds()));
19
+ shuffle($result);
20
+ }
21
+ }
22
+ $upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
23
+ $itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
24
+ $_columnCount = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
25
+
26
+ if (!empty($result)): ?>
27
+ <div class="widget widget-new-products">
28
+ <div class="block block-products">
29
+ <?php if($this->getDisplayHeader()): ?>
30
+ <div class="block-title">
31
+ <strong><span><?php echo $this->__($this->getHeader()) ?></span></strong>
32
+ </div>
33
+ <?php endif; ?>
34
+ <div class="block-content">
35
+ <?php $suffix = $this->getNameInLayout(); ?>
36
+ <ol class="mini-products-list" id="widget-new-products-<?php echo $suffix; ?>">
37
+ <?php foreach ($result as $result): ?>
38
+ <?php
39
+ $_product = $this->getProducts($result);
40
+ if(!$_product){
41
+ continue;
42
+ }
43
+ ?>
44
+ <li class="item">
45
+ <a class="product-image" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize($this->getImageWidth(),$this->getImageHeight()) ?>" width="<?php echo $this->getImageWidth() ?>" height="<?php echo $this->getImageHeight() ?>" alt="<?php echo $this->stripTags($_product->getName(), null, true) ?>" /></a>
46
+ <div class="product-details">
47
+ <p class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>)"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></a></p>
48
+ </div>
49
+ </li>
50
+ <?php endforeach; ?>
51
+ </ol>
52
+ <script type="text/javascript">decorateList('widget-new-products-<?php echo $suffix; ?>', 'none-recursive')</script>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bestseller_products</name>
4
- <version>2.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>This extension is display best seller product.</description>
11
  <notes>Best Seller</notes>
12
  <authors><author><name>Capacity Web Solutions</name><user>capacitywebsolutions</user><email>magento@capacitywebsolutions.com</email></author></authors>
13
- <date>2015-10-30</date>
14
- <time>12:06:04</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="CapacityWebSolutions_Bestseller.xml" hash="0ec798abaa7b1d97993c2a70b0c688ed"/></dir></target><target name="magecommunity"><dir name="CapacityWebSolutions"><dir name="Bestseller"><dir name="Block"><dir name="Adminhtml"><dir name="Bestseller"><dir name="Edit"><file name="Form.php" hash="96c2990e0fc6018210ff513908802fa1"/><dir name="Tab"><file name="Products.php" hash="ff05708c96bee8853549c83ce760e8e4"/></dir><file name="Tabs.php" hash="e918ba6ced636bd6d91be01f167c234c"/></dir><file name="Edit.php" hash="36c0622ba379052b175e90e8d6b44912"/><file name="Grid.php" hash="3598eed71e1de56a44c1641b360eca45"/></dir><file name="Bestseller.php" hash="7fee446569c019c7093de6b713a74713"/><file name="DefaultDirectCode.php" hash="a1d79c5dafa94258da0fe0d3e3dccfcf"/><file name="DefaultTemplate.php" hash="f2dd624669fe6fd9dd7e50cef8debea9"/><file name="DefaultXML.php" hash="8ec74558d35c8edf394d5b14b9c570bc"/><file name="RwdDirectCode.php" hash="655707ef0edf0a828a003c2ac1819212"/><file name="RwdTemplate.php" hash="414b1a9822094c5656639b006d32fb9f"/><file name="RwdXML.php" hash="86d2b2983d687390cf9762798ba9d650"/></dir><file name="Bestseller.php" hash="27a571c30ac41aa7db3e8aa6bc4c2c01"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BestsellerController.php" hash="fd3fbe2abb43949b3f657c8f01ba0569"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d9ccb018cc47e3174783cba99f53f4f7"/><file name="config.xml" hash="1da288e7ac2e9d0efdc3b3c3b87fc7d5"/><file name="system.xml" hash="1451de36c7858f1ead832d78c013acaf"/></dir><dir name="Helper"><file name="Data.php" hash="d0b72aa56c274fdff5a4dc8cf26ff2d1"/></dir><dir name="Model"><file name="Bestseller.php" hash="3c7febbd15329ac0d893058621457dda"/><dir name="Mysql4"><dir name="Bestseller"><file name="Collection.php" hash="3642116bbc5c91b27a7f6555736706d9"/></dir><file name="Bestseller.php" hash="427a76699f52007eb8464c1c73e23b5c"/><dir name="Product"><file name="Collection.php" hash="7490fb33a3dab971c3f316011022576b"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Bundleproducts.php" hash="789f8c43b7a7a475a80f789c68a66610"/><file name="Chooseproducts.php" hash="c001cbf71d633b3b4c65c3c8353d55a2"/><file name="Orderstatus.php" hash="4b2aef8626569db8a469828a3f2d4351"/><file name="Sortorder.php" hash="1b22301daa70404f0bc70b2c05aca0bc"/></dir></dir></dir></dir><dir name="sql"><dir name="bestseller_setup"><file name="mysql4-install-0.1.0.php" hash="6df36ee8f2b1aadb70dc8ae3a62358cb"/><file name="mysql4-upgrade-0.1.0-1.1.7.php" hash="4f361399480c3ec052a5f19fcc0dd688"/><file name="mysql4-upgrade-1.1.7-2.0.0.php" hash="a9271bfc2176e5d49d77f112e8e8f613"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="8297a5384c85c45876a95fc460cda434"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="bestseller"><file name="bestseller.phtml" hash="800aceccef9744d9881467af978194c0"/><file name="bestseller-responsive.phtml" hash="559862c2edb03658838d4d825279289f"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bestseller.xml" hash="1cd5d7df2796941b5e6708a5ae683010"/></dir><dir name="template"><dir name="bestseller"><file name="product.phtml" hash="335115ea4c0f855f7a9f6d0a6df3a40b"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="bestseller"><file name="product-selector.js" hash="18edba645290825072641d0c032b0a0f"/></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.0.0</min><max>5.6.14</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bestseller_products</name>
4
+ <version>2.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
10
  <description>This extension is display best seller product.</description>
11
  <notes>Best Seller</notes>
12
  <authors><author><name>Capacity Web Solutions</name><user>capacitywebsolutions</user><email>magento@capacitywebsolutions.com</email></author></authors>
13
+ <date>2016-02-15</date>
14
+ <time>05:28:26</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="CapacityWebSolutions_Bestseller.xml" hash="0ec798abaa7b1d97993c2a70b0c688ed"/></dir></target><target name="magecommunity"><dir name="CapacityWebSolutions"><dir name="Bestseller"><dir name="Block"><dir name="Adminhtml"><dir name="Bestseller"><dir name="Edit"><file name="Form.php" hash="96c2990e0fc6018210ff513908802fa1"/><dir name="Tab"><file name="Products.php" hash="ff05708c96bee8853549c83ce760e8e4"/></dir><file name="Tabs.php" hash="e918ba6ced636bd6d91be01f167c234c"/></dir><file name="Edit.php" hash="36c0622ba379052b175e90e8d6b44912"/><file name="Grid.php" hash="3598eed71e1de56a44c1641b360eca45"/></dir><file name="Bestseller.php" hash="7fee446569c019c7093de6b713a74713"/><file name="DefaultDirectCode.php" hash="a1d79c5dafa94258da0fe0d3e3dccfcf"/><file name="DefaultTemplate.php" hash="f2dd624669fe6fd9dd7e50cef8debea9"/><file name="DefaultXML.php" hash="8ec74558d35c8edf394d5b14b9c570bc"/><file name="RwdDirectCode.php" hash="655707ef0edf0a828a003c2ac1819212"/><file name="RwdTemplate.php" hash="414b1a9822094c5656639b006d32fb9f"/><file name="RwdXML.php" hash="86d2b2983d687390cf9762798ba9d650"/></dir><file name="Bestseller.php" hash="3394917e7d7132fce7d5be94328edf9f"/><dir name="Widget"><dir name="Html"><file name="Pager.php" hash="339084529816f9175639839b0b9591e5"/></dir></dir><file name="Widget.php" hash="e30b691ed8b045d59ff556498824bd11"/></dir><dir name="Helper"><file name="Data.php" hash="d0b72aa56c274fdff5a4dc8cf26ff2d1"/></dir><dir name="Model"><file name="Bestseller.php" hash="3c7febbd15329ac0d893058621457dda"/><dir name="Mysql4"><dir name="Bestseller"><file name="Collection.php" hash="3642116bbc5c91b27a7f6555736706d9"/></dir><file name="Bestseller.php" hash="427a76699f52007eb8464c1c73e23b5c"/><dir name="Product"><file name="Collection.php" hash="7490fb33a3dab971c3f316011022576b"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Bundleproducts.php" hash="789f8c43b7a7a475a80f789c68a66610"/><file name="Chooseproducts.php" hash="c001cbf71d633b3b4c65c3c8353d55a2"/><file name="Orderstatus.php" hash="4b2aef8626569db8a469828a3f2d4351"/><file name="Sortorder.php" hash="1b22301daa70404f0bc70b2c05aca0bc"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BestsellerController.php" hash="fd3fbe2abb43949b3f657c8f01ba0569"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d9ccb018cc47e3174783cba99f53f4f7"/><file name="config.xml" hash="ca711ffd9e9aa77411c953b4a68664af"/><file name="system.xml" hash="4616f6a7a2db9b41dfb0eefb8f82e3ea"/><file name="widget.xml" hash="a8019b19bd36b1a71f6926c12a69b952"/></dir><dir name="sql"><dir name="bestseller_setup"><file name="mysql4-install-0.1.0.php" hash="6df36ee8f2b1aadb70dc8ae3a62358cb"/><file name="mysql4-upgrade-0.1.0-1.1.7.php" hash="4f361399480c3ec052a5f19fcc0dd688"/><file name="mysql4-upgrade-1.1.7-2.0.0.php" hash="a9271bfc2176e5d49d77f112e8e8f613"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="8297a5384c85c45876a95fc460cda434"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="bestseller"><file name="bestseller-responsive.phtml" hash="2afbcfb4dedeba384935b78b5393b54a"/><file name="bestseller.phtml" hash="800aceccef9744d9881467af978194c0"/><dir name="column"><file name="bestseller_default_list.phtml" hash="f633f84a5eec60f3cd6f1d9f169f9ac7"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bestseller.xml" hash="1cd5d7df2796941b5e6708a5ae683010"/></dir><dir name="template"><dir name="bestseller"><file name="product.phtml" hash="335115ea4c0f855f7a9f6d0a6df3a40b"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="bestseller"><file name="product-selector.js" hash="18edba645290825072641d0c032b0a0f"/></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>7.0.3</max></php></required></dependencies>
18
  </package>