Version Notes
Best Seller
Download this release
Release Info
Developer | Capacity Web Solutions |
Extension | Bestseller_products |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.1
app/code/community/CapacityWebSolutions/Bestseller/Block/Bestseller.php
CHANGED
@@ -19,6 +19,9 @@ class CapacityWebSolutions_Bestseller_Block_Bestseller extends Mage_Catalog_Bloc
|
|
19 |
$this->setImageHeight((int)Mage::getStoreConfig("bestseller/general/thumbnail_height"));
|
20 |
$this->setImageWidth((int)Mage::getStoreConfig("bestseller/general/thumbnail_width"));
|
21 |
$this->setTimePeriod((int)Mage::getStoreConfig("bestseller/general/time_period"));
|
|
|
|
|
|
|
22 |
}
|
23 |
function getBestsellerProduct()
|
24 |
{
|
@@ -28,16 +31,25 @@ class CapacityWebSolutions_Bestseller_Block_Bestseller extends Mage_Catalog_Bloc
|
|
28 |
$newdate = strtotime ( '-'.$timePeriod.' day' , strtotime ( $date ) ) ;
|
29 |
$newdate = date ( 'Y-m-j' , $newdate );
|
30 |
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
|
|
31 |
$table_prefixx = Mage::getConfig()->getTablePrefix();
|
32 |
$upperLimit = ($this->getLimit()) ? $this->getLimit() : 4;
|
33 |
-
$res = $write->query("select max(qo) as des_qty,`product_id` FROM (select sum(`qty_ordered`) AS qo,`product_id`,created_at,store_id from ".$table_prefixx."sales_flat_order_item Group By `product_id`) AS t1 where store_id = ".$this->getStoreId()."
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
-
|
39 |
return $maxQty;
|
40 |
-
|
41 |
}
|
42 |
}
|
43 |
|
19 |
$this->setImageHeight((int)Mage::getStoreConfig("bestseller/general/thumbnail_height"));
|
20 |
$this->setImageWidth((int)Mage::getStoreConfig("bestseller/general/thumbnail_width"));
|
21 |
$this->setTimePeriod((int)Mage::getStoreConfig("bestseller/general/time_period"));
|
22 |
+
$this->setAddToCart((bool)Mage::getStoreConfig('bestseller/general/add_to_cart'));
|
23 |
+
$this->setActive((bool)Mage::getStoreConfigFlag("bestseller/general/active"));
|
24 |
+
$this->setAddToCompare((bool)Mage::getStoreConfig("bestseller/general/add_to_compare"));
|
25 |
}
|
26 |
function getBestsellerProduct()
|
27 |
{
|
31 |
$newdate = strtotime ( '-'.$timePeriod.' day' , strtotime ( $date ) ) ;
|
32 |
$newdate = date ( 'Y-m-j' , $newdate );
|
33 |
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
34 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
35 |
$table_prefixx = Mage::getConfig()->getTablePrefix();
|
36 |
$upperLimit = ($this->getLimit()) ? $this->getLimit() : 4;
|
37 |
+
/* $res = $write->query("select max(qo) as des_qty,`product_id` FROM (select sum(`qty_ordered`) AS qo,`product_id`,created_at,store_id from ".$table_prefixx."sales_flat_order_item Group By `product_id`) AS t1 where store_id = ".$this->getStoreId()." Group By `product_id` order By des_qty desc LIMIT 0, ".$upperLimit."");
|
38 |
+
*/
|
39 |
+
// echo "select max(qo) as des_qty,`product_id` FROM (select sum(`qty_ordered`) AS qo,`product_id`,created_at,store_id from ".$table_prefixx."sales_flat_order_item Group By `product_id`) AS t1 where store_id = ".$this->getStoreId()." AND created_at between'".$newdate."' AND '".$date."' Group By `product_id` order By des_qty desc LIMIT 0, ".$upperLimit."";
|
40 |
+
|
41 |
+
$res = $write->query("select max(qo) as des_qty,`product_id` FROM (select sum(`qty_ordered`) AS qo,`product_id`,created_at,store_id from ".$table_prefixx."sales_flat_order_item Group By `product_id`) AS t1 where store_id = ".$this->getStoreId()." AND created_at between'".$newdate."' AND '".$date."' Group By `product_id` order By des_qty desc LIMIT 0, ".$upperLimit."");
|
42 |
+
//echo "<pre>";
|
43 |
+
//print_r($res);
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
while ($row = $res->fetch())
|
48 |
+
{
|
49 |
+
$maxQty[]=$row['product_id'];
|
50 |
}
|
51 |
+
|
52 |
return $maxQty;
|
|
|
53 |
}
|
54 |
}
|
55 |
|
app/code/community/CapacityWebSolutions/Bestseller/etc/system.xml
CHANGED
@@ -88,6 +88,50 @@
|
|
88 |
<show_in_website>1</show_in_website>
|
89 |
<show_in_store>1</show_in_store>
|
90 |
</time_period>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
</fields>
|
92 |
</general>
|
93 |
</groups>
|
88 |
<show_in_website>1</show_in_website>
|
89 |
<show_in_store>1</show_in_store>
|
90 |
</time_period>
|
91 |
+
<time_period translate="label">
|
92 |
+
<label>Time Period</label>
|
93 |
+
<comment>Days bestselling product. Default 60 days.</comment>
|
94 |
+
<frontend_type>text</frontend_type>
|
95 |
+
<sort_order>5</sort_order>
|
96 |
+
<show_in_default>1</show_in_default>
|
97 |
+
<show_in_website>1</show_in_website>
|
98 |
+
<show_in_store>1</show_in_store>
|
99 |
+
</time_period>
|
100 |
+
|
101 |
+
|
102 |
+
<add_to_cart translate="label">
|
103 |
+
<label>Add to Cart</label>
|
104 |
+
<comment>Select Yes for display the Add to cart button on frontend.</comment>
|
105 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
106 |
+
<frontend_type>select</frontend_type>
|
107 |
+
<sort_order>6</sort_order>
|
108 |
+
<show_in_default>1</show_in_default>
|
109 |
+
<show_in_website>1</show_in_website>
|
110 |
+
<show_in_store>1</show_in_store>
|
111 |
+
</add_to_cart>
|
112 |
+
|
113 |
+
<active translate="label">
|
114 |
+
<label>Add to Wishlist</label>
|
115 |
+
<comment>Select Yes for display the Add to Wishlist Link on frontend.</comment>
|
116 |
+
<frontend_type>select</frontend_type>
|
117 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
118 |
+
<sort_order>7</sort_order>
|
119 |
+
<show_in_default>1</show_in_default>
|
120 |
+
<show_in_website>1</show_in_website>
|
121 |
+
<show_in_store>1</show_in_store>
|
122 |
+
</active>
|
123 |
+
|
124 |
+
<add_to_compare translate="label">
|
125 |
+
<label>Add to Compare</label>
|
126 |
+
<comment>Select Yes for display the Add to Compare Link on frontend.</comment>
|
127 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
128 |
+
<frontend_type>select</frontend_type>
|
129 |
+
<sort_order>8</sort_order>
|
130 |
+
<show_in_default>1</show_in_default>
|
131 |
+
<show_in_website>1</show_in_website>
|
132 |
+
<show_in_store>1</show_in_store>
|
133 |
+
</add_to_compare>
|
134 |
+
|
135 |
</fields>
|
136 |
</general>
|
137 |
</groups>
|
app/design/frontend/default/default/template/bestseller/bestseller.phtml
CHANGED
@@ -4,9 +4,18 @@
|
|
4 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
5 |
*/
|
6 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
<?php
|
8 |
|
9 |
-
|
|
|
10 |
$itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 2 ;
|
11 |
//getting product model
|
12 |
|
@@ -39,20 +48,26 @@ for($cnt = 0; $cnt<count($result); $cnt++){
|
|
39 |
<span class="price-box"><?php echo Mage::helper('core')->currency(number_format($_product->getPrice(),2)); ?></span>
|
40 |
<?php //echo $this->getPriceHtml($_product, true) ?>
|
41 |
</div>
|
42 |
-
<?php
|
|
|
|
|
43 |
|
44 |
<button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
|
45 |
<?php else: ?>
|
46 |
<span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span>
|
47 |
-
<?php endif; ?>
|
48 |
</div>
|
49 |
<div class="cl">
|
50 |
-
<?php
|
|
|
|
|
51 |
<a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist"><?php echo $this->__('Add to Wishlist') ?></a>
|
52 |
-
<?php endif; ?>
|
53 |
-
<?php
|
|
|
|
|
54 |
<a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a>
|
55 |
-
<?php endif; ?>
|
56 |
</div>
|
57 |
</td>
|
58 |
<?php
|
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; }
|
9 |
+
.productList .product { background:#fff; border:1px solid #ccc; padding:5px; width:150px; float:left; margin:10px 8px 10px 0; text-align:center; }
|
10 |
+
.productList .product .cl { padding:0 0 0 30px; }
|
11 |
+
.productList .product .addCompare { float:left; clear:both; }
|
12 |
+
.productList .product .addWishlist { float:left; clear:both; }
|
13 |
+
|
14 |
+
</style>
|
15 |
<?php
|
16 |
|
17 |
+
|
18 |
+
$result = $this->getBestsellerProduct();
|
19 |
$itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 2 ;
|
20 |
//getting product model
|
21 |
|
48 |
<span class="price-box"><?php echo Mage::helper('core')->currency(number_format($_product->getPrice(),2)); ?></span>
|
49 |
<?php //echo $this->getPriceHtml($_product, true) ?>
|
50 |
</div>
|
51 |
+
<?php $addtocartval = $this->getAddToCart();
|
52 |
+
if($addtocartval == 1){
|
53 |
+
if($_product->isSaleable()): ?>
|
54 |
|
55 |
<button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
|
56 |
<?php else: ?>
|
57 |
<span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span>
|
58 |
+
<?php endif; }?>
|
59 |
</div>
|
60 |
<div class="cl">
|
61 |
+
<?php $wishlists = $this->getActive();
|
62 |
+
if($wishlists == 1){
|
63 |
+
if ($this->helper('wishlist')->isAllow()) : ?>
|
64 |
<a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist"><?php echo $this->__('Add to Wishlist') ?></a>
|
65 |
+
<?php endif; }?>
|
66 |
+
<?php $addtocompare = $this->getAddToCompare();
|
67 |
+
if($addtocompare==1){
|
68 |
+
if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
69 |
<a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a>
|
70 |
+
<?php endif; }?>
|
71 |
</div>
|
72 |
</td>
|
73 |
<?php
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bestseller_products</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>This extension is display best
|
10 |
-
<description>This extension is display best
|
11 |
-
<notes>Best Seller
|
12 |
-
<authors><author><name>Capacity
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="CapacityWebSolutions"><dir name="Bestseller"><dir name="Block"><file name="Bestseller.php" hash="
|
16 |
<compatible/>
|
17 |
-
<dependencies
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bestseller_products</name>
|
4 |
+
<version>1.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>This extension is display best seller product.</summary>
|
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>2012-07-21</date>
|
14 |
+
<time>06:16:05</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="CapacityWebSolutions_Bestseller.xml" hash="2da8de0fa3abb8b91292f66ceb23bc33"/></dir></target><target name="magecommunity"><dir name="CapacityWebSolutions"><dir name="Bestseller"><dir name="Block"><file name="Bestseller.php" hash="1177dde36ac5bda8586521f47f6ab4cb"/></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="4442fe49feb8c2d85f47dca490416d81"/><file name="system.xml" hash="124d754fd64c8eeed33e99b7b5f3bf47"/></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="0737bc1a1c1c273316e12b30e42ca7e5"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>5.5.2</max></php></required></dependencies>
|
18 |
</package>
|