Bestseller_products - Version 1.1.5

Version Notes

Best Seller

Download this release

Release Info

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


Code changes from version 1.1.4 to 1.1.5

app/code/community/CapacityWebSolutions/Bestseller/Block/Bestseller.php CHANGED
@@ -1,8 +1,11 @@
1
<?php
2
- /**
3
- * @copyright Copyright (c) 2011 Capacity Web Solutions Pvt. Ltd (http://www.capacitywebsolutions.com)
4
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
- */
6
?>
7
<?php
8
1
<?php
2
+ /***************************************************************************
3
+ @extension : Bestseller Product.
4
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
5
+ ( http://www.capacitywebsolutions.com )
6
+ @author : Capacity Web Solutions Pvt. Ltd.
7
+ @support : magento@capacitywebsolutions.com
8
+ ***************************************************************************/
9
?>
10
<?php
11
app/code/community/CapacityWebSolutions/Bestseller/Helper/Data.php CHANGED
@@ -1,9 +1,11 @@
1
<?php
2
-
3
- /**
4
- * @copyright Copyright (c) 2011 Capacity Web Solutions Pvt. Ltd (http://www.capacitywebsolutions.com)
5
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
- */
7
8
class CapacityWebSolutions_Bestseller_Helper_Data extends Mage_Core_Helper_Abstract
9
{
1
<?php
2
+ /***************************************************************************
3
+ @extension : Bestseller Product.
4
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
5
+ ( http://www.capacitywebsolutions.com )
6
+ @author : Capacity Web Solutions Pvt. Ltd.
7
+ @support : magento@capacitywebsolutions.com
8
+ ***************************************************************************/
9
10
class CapacityWebSolutions_Bestseller_Helper_Data extends Mage_Core_Helper_Abstract
11
{
app/code/community/CapacityWebSolutions/Bestseller/controllers/IndexController.php CHANGED
@@ -1,8 +1,11 @@
1
<?php
2
- /**
3
- * @copyright Copyright (c) 2011 Capacity Web Solutions Pvt. Ltd (http://www.capacitywebsolutions.com)
4
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
- */
6
?>
7
<?php
8
1
<?php
2
+ /***************************************************************************
3
+ @extension : Bestseller Product.
4
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
5
+ ( http://www.capacitywebsolutions.com )
6
+ @author : Capacity Web Solutions Pvt. Ltd.
7
+ @support : magento@capacitywebsolutions.com
8
+ ***************************************************************************/
9
?>
10
<?php
11
app/code/community/CapacityWebSolutions/Bestseller/etc/config.xml CHANGED
@@ -1,9 +1,12 @@
1
<?xml version="1.0"?>
2
<!--
3
- /**
4
- * @copyright Copyright (c) 2011 Capacity Web Solutions Pvt. Ltd (http://www.capacitywebsolutions.com)
5
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
- */
7
-->
8
<config>
9
<global>
1
<?xml version="1.0"?>
2
<!--
3
+ /***************************************************************************
4
+ @extension : Bestseller Product.
5
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
6
+ ( http://www.capacitywebsolutions.com )
7
+ @author : Capacity Web Solutions Pvt. Ltd.
8
+ @support : magento@capacitywebsolutions.com
9
+ ***************************************************************************/
10
-->
11
<config>
12
<global>
app/code/community/CapacityWebSolutions/Bestseller/etc/system.xml CHANGED
@@ -1,22 +1,25 @@
1
<?xml version="1.0"?>
2
<!--
3
- /**
4
- * @copyright Copyright (c) 2011 Capacity Web Solutions Pvt. Ltd (http://www.capacitywebsolutions.com)
5
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
- */
7
-->
8
<config>
9
<tabs>
10
- <bestseller>
11
<label>Capacity Web Solutions</label>
12
<sort_order>100</sort_order>
13
- </bestseller>
14
</tabs>
15
<sections>
16
<bestseller translate="label">
17
<class>separator-top</class>
18
<label>Best Seller Products</label>
19
- <tab>bestseller</tab>
20
<frontend_type>text</frontend_type>
21
<sort_order>40</sort_order>
22
<show_in_default>1</show_in_default>
1
<?xml version="1.0"?>
2
<!--
3
+ /***************************************************************************
4
+ @extension : Bestseller Product.
5
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
6
+ ( http://www.capacitywebsolutions.com )
7
+ @author : Capacity Web Solutions Pvt. Ltd.
8
+ @support : magento@capacitywebsolutions.com
9
+ ***************************************************************************/
10
-->
11
<config>
12
<tabs>
13
+ <cws>
14
<label>Capacity Web Solutions</label>
15
<sort_order>100</sort_order>
16
+ </cws>
17
</tabs>
18
<sections>
19
<bestseller translate="label">
20
<class>separator-top</class>
21
<label>Best Seller Products</label>
22
+ <tab>cws</tab>
23
<frontend_type>text</frontend_type>
24
<sort_order>40</sort_order>
25
<show_in_default>1</show_in_default>
app/design/frontend/base/default/template/bestseller/bestseller-responsive.phtml ADDED
@@ -0,0 +1,200 @@
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Bestseller Product.
4
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
5
+ ( http://www.capacitywebsolutions.com )
6
+ @author : Capacity Web Solutions Pvt. Ltd.
7
+ @support : magento@capacitywebsolutions.com
8
+ ***************************************************************************/
9
+
10
+ ?>
11
+ <style>
12
+ .std .products-grid { margin:0 auto; padding:0; list-style:none; }
13
+ .std .products-grid li { margin-left:0; padding:0; list-style:none; }
14
+ </style>
15
+ <?php
16
+ $result = $this->getBestsellerProduct();
17
+ $collection = Mage::getResourceModel('catalog/product_collection');
18
+ $collection->addFieldToFilter('entity_id',array('in'=>$result))->load();
19
+ $foundIds = array_intersect($result,array_keys($collection->toArray()));
20
+ $result = array_values($foundIds);
21
+ $upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
22
+ $_columnCount = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
23
+ $model = Mage::getModel('catalog/product');
24
+ $enabled = Mage::getStoreConfig('bestseller/general/enabled');
25
+ $products_price = Mage::getStoreConfig('bestseller/general/products_price');
26
+ $review = Mage::getStoreConfig('bestseller/general/review');
27
+ $out_of_stoke = Mage::getStoreConfig('bestseller/general/out_of_stoke');
28
+
29
+ ?>
30
+
31
+ <?php if($enabled == 1): ?>
32
+ <div class="page-title category-title">
33
+ <h1><?php echo $this->getHeader(); ?></h1>
34
+ </div>
35
+ <?php if ($out_of_stoke == 0) { ?>
36
+ <ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
37
+ <?php
38
+ $i=0; $x = 1;
39
+ for($cnt = 0; $cnt<count($result); $cnt++) {
40
+ $_product = $model->load($result[$cnt]);
41
+ $visibility = $_product->getData('visibility');
42
+ $status = $_product->getData('status');
43
+ $is_salable = $_product->getData('is_salable');
44
+ if($status == 1 && $visibility == 4) {
45
+ if ($is_salable == 1 ){
46
+ if($x <= $upperLimit) {
47
+
48
+ ?>
49
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
50
+ <a href="<?php echo $this->getBaseUrl().$_product['url_path']; ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image">
51
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(($this->getImageHeight()) ? $this->getImageHeight() : 135,($this->getImageWidth()) ? $this->getImageWidth() : 135); ?>" alt="<?php echo $this->htmlEscape($_product['name']) ?>"/>
52
+ </a>
53
+ <div class="product-info">
54
+ <h2 class="product-name">
55
+ <a href="<?php echo $this->getBaseUrl().$_product['url_path'] ?>" title="<?php echo $this->htmlEscape($_product['name']) ?>"><?php echo $this->htmlEscape($_product['name']) ?></a>
56
+ </h2>
57
+ <?php
58
+ if($review == 1) {
59
+ $_product = Mage::getModel('catalog/product')->load($_product->getId());
60
+ echo $this->getReviewsSummaryHtml($_product, 'short');
61
+ }
62
+ if($products_price == 1) {
63
+ $_product = Mage::getModel('catalog/product')->load($_product->getId());
64
+ echo $this->getPriceHtml($_product, true);
65
+ }
66
+ ?>
67
+ <div class="actions" style="display:block !important">
68
+ <?php $addtocartval = $this->getAddToCart();
69
+ if($addtocartval == 1){
70
+ if($_product->isSaleable() && !$_product->canConfigure()): ?>
71
+ <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
72
+ <span><?php echo $this->__('Add to Cart') ?></span>
73
+ </button>
74
+ <?php elseif($_product->isSaleable()): ?>
75
+ <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
76
+ <span><?php echo $this->__('View Details')?></span>
77
+ </button>
78
+ <?php else: ?>
79
+ <span class="out-of-stock">
80
+ <?php echo $this->__('Out of stock') ?>
81
+ </span>
82
+ <?php endif; }?>
83
+
84
+ <ul class="add-to-links">
85
+ <?php $wishlists = $this->getActive();
86
+ if($wishlists == 1){
87
+ if ($this->helper('wishlist')->isAllow()) : ?>
88
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
89
+ <?php endif; }?>
90
+
91
+
92
+ <?php $addtocompare = $this->getAddToCompare();
93
+ if($addtocompare==1){
94
+ if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
95
+ <li><a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a></li>
96
+ <?php endif; }?>
97
+
98
+ </ul>
99
+
100
+ </div>
101
+ </div>
102
+ </li>
103
+ <?php
104
+ }
105
+ $x++;
106
+ }
107
+ }
108
+ }
109
+ ?>
110
+ </ul>
111
+ <script type="text/javascript">decorateGeneric($('ul.products-grid'), ['odd','even','first','last'])</script>
112
+ <?php
113
+ }
114
+ else
115
+ {
116
+ ?>
117
+ <ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
118
+ <?php
119
+ $i=0; $x = 1;
120
+ for($cnt = 0; $cnt<count($result); $cnt++){
121
+ $_product = $model->load($result[$cnt]);
122
+ $visibility = $_product->getData('visibility');
123
+
124
+ $status = $_product->getData('status');
125
+ if ($status == 1 && $visibility == 4){
126
+ if($x <= $upperLimit) {
127
+
128
+ ?>
129
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
130
+ <a href="<?php echo $this->getBaseUrl().$_product['url_path']; ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image">
131
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(($this->getImageHeight()) ? $this->getImageHeight() : 135,($this->getImageWidth()) ? $this->getImageWidth() : 135); ?>" alt="<?php echo $this->htmlEscape($_product['name']) ?>"/>
132
+ </a>
133
+
134
+ <div class="product-info">
135
+
136
+ <h2 class="product-name"><a href="<?php echo $this->getBaseUrl().$_product['url_path'] ?>" title="<?php echo $this->htmlEscape($_product['name']) ?>"><?php echo $this->htmlEscape($_product['name']) ?></a></h2>
137
+
138
+ <?php
139
+ if($review == 1) {
140
+ $_product = Mage::getModel('catalog/product')->load($_product->getId());
141
+ echo $this->getReviewsSummaryHtml($_product, 'short');
142
+ }
143
+ if($products_price == 1) {
144
+ $_product = Mage::getModel('catalog/product')->load($_product->getId());
145
+ echo $this->getPriceHtml($_product, true);
146
+ }
147
+ ?>
148
+ <div class="actions" style="display:block !important">
149
+ <?php $addtocartval = $this->getAddToCart();
150
+ if($addtocartval == 1){
151
+ if($_product->isSaleable() && !$_product->canConfigure()): ?>
152
+ <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
153
+ <span><?php echo $this->__('Add to Cart') ?></span>
154
+ </button>
155
+ <?php elseif($_product->isSaleable()): ?>
156
+ <button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
157
+ <span><?php echo $this->__('View Details')?></span>
158
+ </button>
159
+ <?php else: ?>
160
+ <span class="out-of-stock">
161
+ <?php echo $this->__('Out of stock') ?>
162
+ </span>
163
+ <?php endif; }?>
164
+
165
+ <ul class="add-to-links">
166
+ <?php $wishlists = $this->getActive();
167
+ if($wishlists == 1){
168
+ if ($this->helper('wishlist')->isAllow()) : ?>
169
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
170
+ <?php endif; }?>
171
+
172
+
173
+ <?php $addtocompare = $this->getAddToCompare();
174
+ if($addtocompare==1){
175
+ if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
176
+ <li><a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a></li>
177
+ <?php endif; }?>
178
+
179
+ </ul>
180
+
181
+ </div>
182
+
183
+ </div>
184
+
185
+ </li>
186
+ <?php
187
+
188
+ }
189
+ $x++;
190
+ }
191
+ }
192
+ ?>
193
+ </ul>
194
+ <script type="text/javascript">decorateGeneric($('ul.products-grid'), ['odd','even','first','last'])</script>
195
+ <?php
196
+ }
197
+ ?>
198
+
199
+
200
+ <?php endif; ?>
app/design/frontend/{default → base}/default/template/bestseller/bestseller.phtml RENAMED
@@ -1,8 +1,11 @@
1
<?php
2
- /**
3
- * @copyright Copyright (c) 2011 Capacity Web Solutions Pvt. Ltd (http://www.capacitywebsolutions.com)
4
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
- */
6
?>
7
<style>
8
.productList { float:left; width:720px; }
@@ -14,6 +17,10 @@
14
</style>
15
<?php
16
$result = $this->getBestsellerProduct();
17
$upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
18
$itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
19
$model = Mage::getModel('catalog/product');
@@ -32,9 +39,11 @@
32
for($cnt = 0; $cnt<count($result); $cnt++)
33
{
34
$_product = $model->load($result[$cnt]); //getting product object for particular product id
35
$status = $_product->getData('status');
36
$is_salable = $_product->getData('is_salable');
37
- if($status == 1)
38
{
39
if ($is_salable == 1 )
40
{
@@ -118,7 +127,8 @@
118
{
119
$_product = $model->load($result[$cnt]); //getting product object for particular product id
120
$status = $_product->getData('status');
121
- if ($status == 1)
122
{
123
if($x <= $upperLimit)
124
{
1
<?php
2
+ /***************************************************************************
3
+ @extension : Bestseller Product.
4
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
5
+ ( http://www.capacitywebsolutions.com )
6
+ @author : Capacity Web Solutions Pvt. Ltd.
7
+ @support : magento@capacitywebsolutions.com
8
+ ***************************************************************************/
9
?>
10
<style>
11
.productList { float:left; width:720px; }
17
</style>
18
<?php
19
$result = $this->getBestsellerProduct();
20
+ $collection = Mage::getResourceModel('catalog/product_collection');
21
+ $collection->addFieldToFilter('entity_id',array('in'=>$result))->load();
22
+ $foundIds = array_intersect($result,array_keys($collection->toArray()));
23
+ $result = array_values($foundIds);
24
$upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
25
$itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
26
$model = Mage::getModel('catalog/product');
39
for($cnt = 0; $cnt<count($result); $cnt++)
40
{
41
$_product = $model->load($result[$cnt]); //getting product object for particular product id
42
+
43
+ $visibility = $_product->getData('visibility');
44
$status = $_product->getData('status');
45
$is_salable = $_product->getData('is_salable');
46
+ if($status == 1 && $visibility == 4)
47
{
48
if ($is_salable == 1 )
49
{
127
{
128
$_product = $model->load($result[$cnt]); //getting product object for particular product id
129
$status = $_product->getData('status');
130
+ $visibility = $_product->getData('visibility');
131
+ if ($status == 1 && $visibility == 4)
132
{
133
if($x <= $upperLimit)
134
{
app/etc/modules/CapacityWebSolutions_Bestseller.xml CHANGED
@@ -1,4 +1,14 @@
1
<?xml version="1.0"?>
2
<config>
3
<modules>
4
<CapacityWebSolutions_Bestseller>
1
<?xml version="1.0"?>
2
+ <!--
3
+ /***************************************************************************
4
+ @extension : Bestseller Product.
5
+ @copyright : Copyright (c) 2014 Capacity Web Solutions.
6
+ ( http://www.capacitywebsolutions.com )
7
+ @author : Capacity Web Solutions Pvt. Ltd.
8
+ @support : magento@capacitywebsolutions.com
9
+ ***************************************************************************/
10
+ -->
11
+
12
<config>
13
<modules>
14
<CapacityWebSolutions_Bestseller>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Bestseller_products</name>
4
- <version>1.1.4</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>2014-01-30</date>
14
- <time>07:01:52</time>
15
- <contents><target name="magecommunity"><dir name="CapacityWebSolutions"><dir name="Bestseller"><dir name="Block"><file name="Bestseller.php" hash="f093834ec19c9d52cad2e1894510c539"/></dir><dir name="Helper"><file name="Data.php" hash="4f32df17e74aa95c488782c3d6cf0286"/></dir><dir name="controllers"><file name="IndexController.php" hash="a9d5c5fde53e96b28272fbb59a6fefe9"/></dir><dir name="etc"><file name="config.xml" hash="c8d09a7c20b23f329d41be5e1d89d367"/><file name="system.xml" hash="094abb0a44915e9c3bac76cf1cae06a6"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="bestseller"><file name="bestseller.phtml" hash="2a4ca03121d0e3445758117244e6f9ad"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CapacityWebSolutions_Bestseller.xml" hash="2da8de0fa3abb8b91292f66ceb23bc33"/></dir></target></contents>
16
<compatible/>
17
<dependencies><required><php><min>5.0.0</min><max>5.5.5</max></php></required></dependencies>
18
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Bestseller_products</name>
4
+ <version>1.1.5</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>2014-07-01</date>
14
+ <time>10:14:08</time>
15
+ <contents><target name="magecommunity"><dir name="CapacityWebSolutions"><dir name="Bestseller"><dir name="Block"><file name="Bestseller.php" hash="16f2ac58e88e7fb1752f2c37cceebf8b"/></dir><dir name="Helper"><file name="Data.php" hash="bc0bf539b64b2e6e709df40983cdd3dc"/></dir><dir name="controllers"><file name="IndexController.php" hash="e7348683b15be235f0d1756eccd5b755"/></dir><dir name="etc"><file name="config.xml" hash="6a8f9c14d67ebc4c35db34d1d782a32a"/><file name="system.xml" hash="b863b228c2ba0f4a0b7772a196b2e3ba"/></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="6b4494d9f833df62bce7b9ffae96523c"/><file name="bestseller.phtml" hash="3fdd7ffc2fec984ff939488d2777c855"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CapacityWebSolutions_Bestseller.xml" hash="78f9e48e2abe50655fca24708da017c3"/></dir></target></contents>
16
<compatible/>
17
<dependencies><required><php><min>5.0.0</min><max>5.5.5</max></php></required></dependencies>
18
</package>