Version Notes
Best Seller
Download this release
Release Info
Developer | Capacity Web Solutions |
Extension | Bestseller_products |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.7 to 2.0.0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller.php +19 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit.php +42 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit/Form.php +25 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit/Tab/Products.php +33 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit/Tabs.php +29 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Grid.php +179 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/DefaultDirectCode.php +17 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/DefaultTemplate.php +17 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/DefaultXML.php +20 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/RwdDirectCode.php +18 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/RwdTemplate.php +17 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/RwdXML.php +21 -0
- app/code/community/CapacityWebSolutions/Bestseller/Block/Bestseller.php +73 -25
- app/code/community/CapacityWebSolutions/Bestseller/Helper/Data.php +2 -2
- app/code/community/CapacityWebSolutions/Bestseller/Model/Bestseller.php +17 -0
- app/code/community/CapacityWebSolutions/Bestseller/Model/Mysql4/Bestseller.php +16 -0
- app/code/community/CapacityWebSolutions/Bestseller/Model/Mysql4/Bestseller/Collection.php +18 -0
- app/code/community/CapacityWebSolutions/Bestseller/Model/Mysql4/Product/Collection.php +415 -0
- app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Bundleproducts.php +1 -0
- app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Chooseproducts.php +1 -0
- app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Orderstatus.php +1 -0
- app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Sortorder.php +1 -0
- app/code/community/CapacityWebSolutions/Bestseller/controllers/Adminhtml/BestsellerController.php +142 -0
- app/code/community/CapacityWebSolutions/Bestseller/controllers/IndexController.php +0 -22
- app/code/community/CapacityWebSolutions/Bestseller/etc/config.xml +109 -40
- app/code/community/CapacityWebSolutions/Bestseller/etc/system.xml +130 -23
- app/code/community/CapacityWebSolutions/Bestseller/sql/bestseller_setup/mysql4-install-0.1.0.php +23 -0
- app/design/adminhtml/default/default/layout/bestseller.xml +13 -0
- app/design/adminhtml/default/default/template/bestseller/product.phtml +49 -0
- app/design/frontend/base/default/template/bestseller/bestseller-responsive.phtml +38 -109
- app/design/frontend/base/default/template/bestseller/bestseller.phtml +81 -154
- app/etc/modules/CapacityWebSolutions_Bestseller.xml +6 -16
- js/bestseller/product-selector.js +193 -0
- package.xml +5 -5
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_Bestseller extends Mage_Adminhtml_Block_Widget_Grid_Container
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$this->_controller = 'adminhtml_bestseller';
|
14 |
+
$this->_blockGroup = 'bestseller';
|
15 |
+
$this->_headerText = Mage::helper('bestseller')->__('Manage Products Manually');
|
16 |
+
$this->_addButtonLabel = Mage::helper('bestseller')->__('Select Products');
|
17 |
+
parent::__construct();
|
18 |
+
}
|
19 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_Bestseller_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->_objectId = 'id';
|
15 |
+
$this->_blockGroup = 'bestseller';
|
16 |
+
$this->_controller = 'adminhtml_bestseller';
|
17 |
+
$this->_updateButton('save', 'label','Save');
|
18 |
+
$this->_updateButton('delete','label','Delete');
|
19 |
+
$this->_addButton('save_and_continue', array(
|
20 |
+
'label' => Mage::helper('bestseller')->__('Save And Continue Edit'),
|
21 |
+
'onclick' => 'saveAndContinueEdit()',
|
22 |
+
'class' => 'save'
|
23 |
+
), -100);
|
24 |
+
|
25 |
+
$this->_formScripts[] = "
|
26 |
+
function saveAndContinueEdit(){
|
27 |
+
editForm.submit($('edit_form').action + 'back/edit/');
|
28 |
+
}
|
29 |
+
|
30 |
+
";
|
31 |
+
$this->setId('bestseller_edit');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getHeaderText()
|
35 |
+
{
|
36 |
+
if( Mage::registry('bestseller_data') && Mage::registry('bestseller_data')->getBestsellerId() ) {
|
37 |
+
return Mage::helper('bestseller')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('bestseller_data')->getSku()));
|
38 |
+
} else {
|
39 |
+
return Mage::helper('bestseller')->__('Select Products');
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit/Form.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_Bestseller_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
10 |
+
{
|
11 |
+
protected function _prepareForm()
|
12 |
+
{
|
13 |
+
$form = new Varien_Data_Form(
|
14 |
+
array(
|
15 |
+
'id'=>'edit_form',
|
16 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
17 |
+
'method'=>'post',
|
18 |
+
'enctype' => 'multipart/form-data'
|
19 |
+
)
|
20 |
+
);
|
21 |
+
$form->setUseContainer(true);
|
22 |
+
$this->setForm($form);
|
23 |
+
return parent::_prepareForm();
|
24 |
+
}
|
25 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit/Tab/Products.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_Bestseller_Edit_Tab_Products extends Mage_Adminhtml_Block_Widget_Form
|
10 |
+
{
|
11 |
+
public function __construct() {
|
12 |
+
parent::__construct();
|
13 |
+
$this->setTemplate('bestseller/product.phtml');
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function getProductIds() {
|
17 |
+
$data = Mage::registry('bestseller_data');
|
18 |
+
$prd_model = Mage::getModel('bestseller/bestseller')->getCollection();
|
19 |
+
|
20 |
+
$_productList = array();
|
21 |
+
|
22 |
+
foreach($prd_model as $prd_data){
|
23 |
+
$_productList[] = $prd_data->getData('sku');
|
24 |
+
}
|
25 |
+
|
26 |
+
return is_array($_productList) ? $_productList : array();
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getIdsString() {
|
30 |
+
return implode(', ', $this->getProductIds());
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Edit/Tabs.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_Bestseller_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId('bestseller_tabs');
|
15 |
+
$this->setDestElementId('edit_form');
|
16 |
+
$this->setTitle('Bestseller Information');
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _beforeToHtml()
|
20 |
+
{
|
21 |
+
$this->addTab('product_section', array(
|
22 |
+
'label' => Mage::helper('bestseller')->__('Products'),
|
23 |
+
'title' => Mage::helper('bestseller')->__('Products'),
|
24 |
+
'content' => $this->getLayout()->createBlock('bestseller/adminhtml_bestseller_edit_tab_products')->toHtml(),
|
25 |
+
));
|
26 |
+
|
27 |
+
return parent::_beforeToHtml();
|
28 |
+
}
|
29 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/Bestseller/Grid.php
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_Bestseller_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId('bestsellerGrid');
|
15 |
+
//$this->setDefaultSort('bestseller_id');
|
16 |
+
$this->setDefaultSort('entity_id');
|
17 |
+
$this->setDefaultDir('ASC');
|
18 |
+
$this->setSaveParametersInSession(true);
|
19 |
+
$this->setUseAjax(true);
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _getStore()
|
23 |
+
{
|
24 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
25 |
+
return Mage::app()->getStore($storeId);
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
protected function _prepareCollection()
|
30 |
+
{
|
31 |
+
$store = $this->_getStore();
|
32 |
+
$product_skus = $this->getProductSkus();
|
33 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
34 |
+
->addAttributeToSelect('sku')
|
35 |
+
->addAttributeToSelect('name')
|
36 |
+
->addAttributeToSelect('attribute_set_id')
|
37 |
+
->addAttributeToSelect('type_id')
|
38 |
+
->addAttributeToFilter('sku', array('in' => $product_skus));
|
39 |
+
$adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
|
40 |
+
$collection->addStoreFilter($store);
|
41 |
+
$collection->joinAttribute(
|
42 |
+
'name',
|
43 |
+
'catalog_product/name',
|
44 |
+
'entity_id',
|
45 |
+
null,
|
46 |
+
'inner',
|
47 |
+
$adminStore
|
48 |
+
);
|
49 |
+
$collection->joinAttribute(
|
50 |
+
'custom_name',
|
51 |
+
'catalog_product/name',
|
52 |
+
'entity_id',
|
53 |
+
null,
|
54 |
+
'inner',
|
55 |
+
$store->getId()
|
56 |
+
);
|
57 |
+
$collection->joinAttribute(
|
58 |
+
'status',
|
59 |
+
'catalog_product/status',
|
60 |
+
'entity_id',
|
61 |
+
null,
|
62 |
+
'inner',
|
63 |
+
$store->getId()
|
64 |
+
);
|
65 |
+
$collection->joinAttribute(
|
66 |
+
'visibility',
|
67 |
+
'catalog_product/visibility',
|
68 |
+
'entity_id',
|
69 |
+
null,
|
70 |
+
'inner',
|
71 |
+
$store->getId()
|
72 |
+
);
|
73 |
+
$collection->joinAttribute(
|
74 |
+
'price',
|
75 |
+
'catalog_product/price',
|
76 |
+
'entity_id',
|
77 |
+
null,
|
78 |
+
'left',
|
79 |
+
$store->getId()
|
80 |
+
);
|
81 |
+
|
82 |
+
$this->setCollection($collection);
|
83 |
+
return parent::_prepareCollection();
|
84 |
+
}
|
85 |
+
|
86 |
+
protected function _prepareColumns()
|
87 |
+
{
|
88 |
+
/* $this->addColumn('bestseller_id', array(
|
89 |
+
'header' => Mage::helper('bestseller')->__('ID'),
|
90 |
+
'align' => 'right',
|
91 |
+
'width' => '50px',
|
92 |
+
'index' => 'bestseller_id',
|
93 |
+
));
|
94 |
+
*/
|
95 |
+
$this->addColumn('entity_id',
|
96 |
+
array(
|
97 |
+
'header'=> Mage::helper('catalog')->__('ID'),
|
98 |
+
'width' => '50px',
|
99 |
+
'type' => 'number',
|
100 |
+
'index' => 'entity_id',
|
101 |
+
));
|
102 |
+
$this->addColumn('name',
|
103 |
+
array(
|
104 |
+
'header'=> Mage::helper('catalog')->__('Name'),
|
105 |
+
'index' => 'name',
|
106 |
+
));
|
107 |
+
|
108 |
+
$store = $this->_getStore();
|
109 |
+
if ($store->getId()) {
|
110 |
+
$this->addColumn('custom_name',
|
111 |
+
array(
|
112 |
+
'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
|
113 |
+
'index' => 'custom_name',
|
114 |
+
));
|
115 |
+
}
|
116 |
+
|
117 |
+
$this->addColumn('type',
|
118 |
+
array(
|
119 |
+
'header'=> Mage::helper('catalog')->__('Type'),
|
120 |
+
'width' => '100px',
|
121 |
+
'index' => 'type_id',
|
122 |
+
'type' => 'options',
|
123 |
+
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
|
124 |
+
));
|
125 |
+
|
126 |
+
$this->addColumn('sku',
|
127 |
+
array(
|
128 |
+
'header'=> Mage::helper('catalog')->__('SKU'),
|
129 |
+
'width' => '80px',
|
130 |
+
'index' => 'sku',
|
131 |
+
));
|
132 |
+
|
133 |
+
$store = $this->_getStore();
|
134 |
+
$this->addColumn('price',
|
135 |
+
array(
|
136 |
+
'header'=> Mage::helper('catalog')->__('Price'),
|
137 |
+
'type' => 'price',
|
138 |
+
'currency_code' => $store->getBaseCurrency()->getCode(),
|
139 |
+
'index' => 'price',
|
140 |
+
));
|
141 |
+
|
142 |
+
return parent::_prepareColumns();
|
143 |
+
}
|
144 |
+
|
145 |
+
public function getSkusArr($element){
|
146 |
+
return $element['sku'];
|
147 |
+
}
|
148 |
+
|
149 |
+
public function getProductSkus(){
|
150 |
+
$model = Mage::getModel('bestseller/bestseller')->getCollection();
|
151 |
+
$product_skus=array_map(array($this,"getSkusArr"), $model->getData());
|
152 |
+
return $product_skus;
|
153 |
+
}
|
154 |
+
|
155 |
+
//public function getRowUrl($row)
|
156 |
+
//{
|
157 |
+
//return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
158 |
+
//}
|
159 |
+
|
160 |
+
protected function _prepareMassaction()
|
161 |
+
{
|
162 |
+
$this->setMassactionIdField('bestseller_id');
|
163 |
+
$this->getMassactionBlock()->setFormFieldName('bestseller');
|
164 |
+
|
165 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
166 |
+
'label' => Mage::helper('bestseller')->__('Delete'),
|
167 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
168 |
+
'confirm' => Mage::helper('bestseller')->__('Are you sure?')
|
169 |
+
));
|
170 |
+
|
171 |
+
return $this;
|
172 |
+
}
|
173 |
+
|
174 |
+
public function getGridUrl()
|
175 |
+
{
|
176 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
177 |
+
}
|
178 |
+
|
179 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/DefaultDirectCode.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_DefaultDirectCode
|
10 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
+
{
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
return '<div style="background:#efefef;border:1px solid #d8d8d8;padding:10px;margin-bottom:10px;"><span><?php echo $this->getLayout()->createBlock("bestseller/bestseller")->setTemplate("bestseller/bestseller.phtml")->toHtml(); ?></span></div>';
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/DefaultTemplate.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_DefaultTemplate
|
10 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
+
{
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
return '<div style="background:#efefef;border:1px solid #d8d8d8;padding:10px;margin-bottom:10px; "><span>{{block type="bestseller/bestseller" name="bestseller" template="bestseller/bestseller.phtml"}}</span></div>';
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/DefaultXML.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_DefaultXML
|
10 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
+
{
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
return '<div style="background:#efefef;border:1px solid #d8d8d8;padding:10px;margin-bottom:10px;">
|
15 |
+
<span><reference name="content"> </br><block type="bestseller/bestseller" name="bestseller" template="bestseller/bestseller.phtml"/></br></reference></span>
|
16 |
+
</div>';
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/RwdDirectCode.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_RwdDirectCode
|
10 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
+
{
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
return '<div style="background:#efefef;border:1px solid #d8d8d8;padding:10px;margin-bottom:10px;">
|
15 |
+
<span><?php echo $this->getLayout()->createBlock("bestseller/bestseller")->setTemplate("bestseller/bestseller-responsive.phtml")->toHtml(); ?></span></div>';
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/RwdTemplate.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
+
( http://www.capacitywebsolutions.com )
|
6 |
+
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
+
@support : magento@capacitywebsolutions.com
|
8 |
+
***************************************************************************/
|
9 |
+
class CapacityWebSolutions_Bestseller_Block_Adminhtml_RwdTemplate
|
10 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
+
{
|
12 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
13 |
+
{
|
14 |
+
return '<div style="background:#efefef;border:1px solid #d8d8d8;padding:10px;margin-bottom:10px; "><span>{{block type="bestseller/bestseller" name="bestseller" template="bestseller/bestseller-responsive.phtml"}}</span></div>';
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Adminhtml/RwdXML.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 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_Block_Adminhtml_RwdXML
|
11 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
12 |
+
{
|
13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
14 |
+
{
|
15 |
+
return '<div style="background:#efefef;border:1px solid #d8d8d8;padding:10px;margin-bottom:10px;">
|
16 |
+
<span><reference name="content"> </br><block type="bestseller/bestseller" name="bestseller" template="bestseller/bestseller-responsive.phtml"/></br></reference></span>
|
17 |
+
</div>';
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Block/Bestseller.php
CHANGED
@@ -1,18 +1,17 @@
|
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
@extension : Bestseller Product.
|
4 |
-
@copyright : Copyright (c)
|
5 |
( http://www.capacitywebsolutions.com )
|
6 |
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
@support : magento@capacitywebsolutions.com
|
8 |
***************************************************************************/
|
9 |
-
?>
|
10 |
-
<?php
|
11 |
|
12 |
class CapacityWebSolutions_Bestseller_Block_Bestseller extends Mage_Catalog_Block_Product_Abstract // Mage_Core_Block_Template
|
13 |
{
|
14 |
-
|
15 |
-
|
|
|
16 |
$this->setHeader(Mage::getStoreConfig("bestseller/general/heading"));
|
17 |
$this->setLimit((int)Mage::getStoreConfig("bestseller/general/number_of_items"));
|
18 |
$this->setItemsPerRow((int)Mage::getStoreConfig("bestseller/general/number_of_items_per_row"));
|
@@ -23,26 +22,75 @@ class CapacityWebSolutions_Bestseller_Block_Bestseller extends Mage_Catalog_Bloc
|
|
23 |
$this->setAddToCart((bool)Mage::getStoreConfig('bestseller/general/add_to_cart'));
|
24 |
$this->setActive((bool)Mage::getStoreConfigFlag("bestseller/general/active"));
|
25 |
$this->setAddToCompare((bool)Mage::getStoreConfig("bestseller/general/add_to_compare"));
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
$
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
-
?>
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 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_Block_Bestseller extends Mage_Catalog_Block_Product_Abstract // Mage_Core_Block_Template
|
11 |
{
|
12 |
+
public function __construct()
|
13 |
+
{
|
14 |
+
$this->setEnabled((bool)Mage::getStoreConfigFlag("bestseller/general/enabled"));
|
15 |
$this->setHeader(Mage::getStoreConfig("bestseller/general/heading"));
|
16 |
$this->setLimit((int)Mage::getStoreConfig("bestseller/general/number_of_items"));
|
17 |
$this->setItemsPerRow((int)Mage::getStoreConfig("bestseller/general/number_of_items_per_row"));
|
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 |
+
$this->setProductsPrice((int)Mage::getStoreConfig('bestseller/general/products_price'));
|
26 |
+
$this->setReview((int)Mage::getStoreConfig('bestseller/general/review'));
|
27 |
+
$this->setOutofStock((int)Mage::getStoreConfig('bestseller/general/out_of_stoke'));
|
28 |
+
$this->setChooseProducts((int)Mage::getStoreConfig('bestseller/general/choose_products'));
|
29 |
+
$this->setSortOrder((int)Mage::getStoreConfig('bestseller/general/sort_order_both'));
|
30 |
+
$this->setOrderStatus(Mage::getStoreConfig('bestseller/general/order_status'));
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getBestsellerProduct() {
|
34 |
+
$o_status = $this->getOrderStatus();
|
35 |
+
if($o_status != "all"){
|
36 |
+
$order_statuses = explode(",",$o_status);
|
37 |
+
$order_status = "'" . implode("','", $order_statuses) . "'";
|
38 |
+
}
|
39 |
+
|
40 |
+
$productCount = $this->getLimit();
|
41 |
+
$timePeriod = ($this->getTimePeriod()) ? $this->getTimePeriod() : 60;
|
42 |
+
$storeId = Mage::app()->getStore()->getId();
|
43 |
+
$today = strtotime(date('Y-m-d H:i:s',Mage::getModel('core/date')->gmtTimestamp()));
|
44 |
+
$last = $today - (60*60*24*$timePeriod);
|
45 |
+
$from = date("Y-m-d H:i:s", $last);
|
46 |
+
$to = date("Y-m-d H:i:s", $today);
|
47 |
|
48 |
+
$products = Mage::getResourceModel('bestseller/product_collection')
|
49 |
+
->addAttributeToSelect('*')
|
50 |
+
->addOrderedQty($from, $to)
|
51 |
+
//->setStoreId($storeId)
|
52 |
+
//->addStoreFilter($storeId)
|
53 |
+
->setOrder('ordered_qty', 'desc')
|
54 |
+
->setPageSize($productCount);
|
55 |
+
Mage::getSingleton('catalog/product_status')
|
56 |
+
->addVisibleFilterToCollection($products);
|
57 |
+
Mage::getSingleton('catalog/product_visibility')
|
58 |
+
->addVisibleInCatalogFilterToCollection($products);
|
59 |
+
$products->getSelect()->where('order_items.store_id ='.$storeId);
|
60 |
|
61 |
+
if($o_status != "all"){
|
62 |
+
$products->getSelect()->where('order.status IN ('.$order_status.')');
|
63 |
+
}
|
64 |
+
return $products;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getProducts($productid) {
|
68 |
+
$collection = Mage::getModel('catalog/product')->load($productid);
|
69 |
+
if($collection->getVisibility()!=1){
|
70 |
+
if(!$this->getOutofStock()){
|
71 |
+
if($collection->isSalable()){
|
72 |
+
return $collection;
|
73 |
+
}
|
74 |
+
else{
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
else{
|
79 |
+
return $collection;
|
80 |
+
}
|
81 |
+
}else{
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getIdsArr($element){
|
87 |
+
return $element['product_id'];
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getProductIds(){
|
91 |
+
$model = Mage::getModel('bestseller/bestseller')->getCollection();
|
92 |
+
$product_ids=array_map(array($this,"getIdsArr"), $model->getData());
|
93 |
+
return $product_ids;
|
94 |
+
}
|
95 |
+
|
96 |
}
|
|
app/code/community/CapacityWebSolutions/Bestseller/Helper/Data.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
-
@extension :
|
4 |
-
@copyright : Copyright (c)
|
5 |
( http://www.capacitywebsolutions.com )
|
6 |
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
@support : magento@capacitywebsolutions.com
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
+
@extension : Best Seller Products.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
( http://www.capacitywebsolutions.com )
|
6 |
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
@support : magento@capacitywebsolutions.com
|
app/code/community/CapacityWebSolutions/Bestseller/Model/Bestseller.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Best Seller Products.
|
4 |
+
@copyright : Copyright (c) 2015 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_Model_Bestseller extends Mage_Core_Model_Abstract
|
11 |
+
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->_init('bestseller/bestseller');
|
16 |
+
}
|
17 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Model/Mysql4/Bestseller.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Best Seller Products.
|
4 |
+
@copyright : Copyright (c) 2015 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_Model_Mysql4_Bestseller extends Mage_Core_Model_Mysql4_Abstract
|
11 |
+
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
$this->_init('bestseller/bestseller', 'bestseller_id');
|
15 |
+
}
|
16 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Model/Mysql4/Bestseller/Collection.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Best Seller Products.
|
4 |
+
@copyright : Copyright (c) 2015 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_Model_Mysql4_Bestseller_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
+
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->_init('bestseller/bestseller');
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Model/Mysql4/Product/Collection.php
ADDED
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class CapacityWebSolutions_Bestseller_Model_Mysql4_Product_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
|
3 |
+
{
|
4 |
+
const SELECT_COUNT_SQL_TYPE_CART = 1;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Product entity identifier
|
8 |
+
*
|
9 |
+
* @var int
|
10 |
+
*/
|
11 |
+
protected $_productEntityId;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Product entity table name
|
15 |
+
*
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
protected $_productEntityTableName;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Product entity type identifier
|
22 |
+
*
|
23 |
+
* @var int
|
24 |
+
*/
|
25 |
+
protected $_productEntityTypeId;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* select count
|
29 |
+
*
|
30 |
+
* @var int
|
31 |
+
*/
|
32 |
+
protected $_selectCountSqlType = 0;
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Init main class options
|
37 |
+
*
|
38 |
+
*/
|
39 |
+
public function __construct()
|
40 |
+
{
|
41 |
+
$product = Mage::getResourceSingleton('catalog/product');
|
42 |
+
/* @var $product Mage_Catalog_Model_Entity_Product */
|
43 |
+
$this->setProductEntityId($product->getEntityIdField());
|
44 |
+
$this->setProductEntityTableName($product->getEntityTable());
|
45 |
+
$this->setProductEntityTypeId($product->getTypeId());
|
46 |
+
parent::__construct();
|
47 |
+
}
|
48 |
+
/**
|
49 |
+
* Set Type for COUNT SQL Select
|
50 |
+
*
|
51 |
+
* @param int $type
|
52 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
53 |
+
*/
|
54 |
+
public function setSelectCountSqlType($type)
|
55 |
+
{
|
56 |
+
$this->_selectCountSqlType = $type;
|
57 |
+
return $this;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Set product entity id
|
62 |
+
*
|
63 |
+
* @param int $value
|
64 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
65 |
+
*/
|
66 |
+
public function setProductEntityId($entityId)
|
67 |
+
{
|
68 |
+
$this->_productEntityId = (int)$entityId;
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Get product entity id
|
74 |
+
*
|
75 |
+
* @return int
|
76 |
+
*/
|
77 |
+
public function getProductEntityId()
|
78 |
+
{
|
79 |
+
return $this->_productEntityId;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Set product entity table name
|
84 |
+
*
|
85 |
+
* @param string $value
|
86 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
87 |
+
*/
|
88 |
+
public function setProductEntityTableName($value)
|
89 |
+
{
|
90 |
+
$this->_productEntityTableName = $value;
|
91 |
+
return $this;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Get product entity table name
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
*/
|
99 |
+
public function getProductEntityTableName()
|
100 |
+
{
|
101 |
+
return $this->_productEntityTableName;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Set product entity type id
|
106 |
+
*
|
107 |
+
* @param int $value
|
108 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
109 |
+
*/
|
110 |
+
public function setProductEntityTypeId($value)
|
111 |
+
{
|
112 |
+
$this->_productEntityTypeId = $value;
|
113 |
+
return $this;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Get product entity tyoe id
|
118 |
+
*
|
119 |
+
* @return int
|
120 |
+
*/
|
121 |
+
public function getProductEntityTypeId()
|
122 |
+
{
|
123 |
+
return $this->_productEntityTypeId;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Join fields
|
128 |
+
*
|
129 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
130 |
+
*/
|
131 |
+
protected function _joinFields()
|
132 |
+
{
|
133 |
+
$this->_totals = new Varien_Object();
|
134 |
+
|
135 |
+
$this->addAttributeToSelect('entity_id')
|
136 |
+
->addAttributeToSelect('name')
|
137 |
+
->addAttributeToSelect('price');
|
138 |
+
|
139 |
+
return $this;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get select count sql
|
144 |
+
*
|
145 |
+
* @return unknown
|
146 |
+
*/
|
147 |
+
public function getSelectCountSql()
|
148 |
+
{
|
149 |
+
if ($this->_selectCountSqlType == self::SELECT_COUNT_SQL_TYPE_CART) {
|
150 |
+
$countSelect = clone $this->getSelect();
|
151 |
+
$countSelect->reset()
|
152 |
+
->from(
|
153 |
+
array('quote_item_table' => $this->getTable('sales/quote_item')),
|
154 |
+
array('COUNT(DISTINCT quote_item_table.product_id)'))
|
155 |
+
->join(
|
156 |
+
array('quote_table' => $this->getTable('sales/quote')),
|
157 |
+
'quote_table.entity_id = quote_item_table.quote_id AND quote_table.is_active = 1',
|
158 |
+
array()
|
159 |
+
);
|
160 |
+
return $countSelect;
|
161 |
+
}
|
162 |
+
|
163 |
+
$countSelect = clone $this->getSelect();
|
164 |
+
$countSelect->reset(Zend_Db_Select::ORDER);
|
165 |
+
$countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
|
166 |
+
$countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
|
167 |
+
$countSelect->reset(Zend_Db_Select::COLUMNS);
|
168 |
+
$countSelect->reset(Zend_Db_Select::GROUP);
|
169 |
+
$countSelect->reset(Zend_Db_Select::HAVING);
|
170 |
+
$countSelect->columns("count(DISTINCT e.entity_id)");
|
171 |
+
|
172 |
+
return $countSelect;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Add carts count
|
177 |
+
*
|
178 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
179 |
+
*/
|
180 |
+
public function addCartsCount()
|
181 |
+
{
|
182 |
+
$countSelect = clone $this->getSelect();
|
183 |
+
$countSelect->reset();
|
184 |
+
|
185 |
+
$countSelect->from(array('quote_items' => $this->getTable('sales/quote_item')), 'COUNT(*)')
|
186 |
+
->join(array('quotes' => $this->getTable('sales/quote')),
|
187 |
+
'quotes.entity_id = quote_items.quote_id AND quotes.is_active = 1',
|
188 |
+
array())
|
189 |
+
->where("quote_items.product_id = e.entity_id");
|
190 |
+
|
191 |
+
$this->getSelect()
|
192 |
+
->columns(array("carts" => "({$countSelect})"))
|
193 |
+
->group("e.{$this->getProductEntityId()}")
|
194 |
+
->having('carts > ?', 0);
|
195 |
+
|
196 |
+
return $this;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Add orders count
|
201 |
+
*
|
202 |
+
* @param string $from
|
203 |
+
* @param string $to
|
204 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
205 |
+
*/
|
206 |
+
public function addOrdersCount($from = '', $to = '')
|
207 |
+
{
|
208 |
+
$orderItemTableName = $this->getTable('sales/order_item');
|
209 |
+
$productFieldName = sprintf('e.%s', $this->getProductEntityId());
|
210 |
+
|
211 |
+
$this->getSelect()
|
212 |
+
->joinLeft(
|
213 |
+
array('order_items' => $orderItemTableName),
|
214 |
+
"order_items.product_id = {$productFieldName}",
|
215 |
+
array())
|
216 |
+
->columns(array('orders' => 'COUNT(order_items2.item_id)'))
|
217 |
+
->group($productFieldName);
|
218 |
+
|
219 |
+
$dateFilter = array('order_items2.item_id = order_items.item_id');
|
220 |
+
if ($from != '' && $to != '') {
|
221 |
+
$dateFilter[] = $this->_prepareBetweenSql('order_items2.created_at', $from, $to);
|
222 |
+
}
|
223 |
+
|
224 |
+
$this->getSelect()
|
225 |
+
->joinLeft(
|
226 |
+
array('order_items2' => $orderItemTableName),
|
227 |
+
implode(' AND ', $dateFilter),
|
228 |
+
array()
|
229 |
+
);
|
230 |
+
|
231 |
+
return $this;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Add ordered qty's
|
236 |
+
*
|
237 |
+
* @param string $from
|
238 |
+
* @param string $to
|
239 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
240 |
+
*/
|
241 |
+
public function addOrderedQty($from = '', $to = '')
|
242 |
+
{
|
243 |
+
$adapter = $this->getConnection();
|
244 |
+
|
245 |
+
$config_product_option = Mage::getStoreConfig('bestseller/general/bundle_products');
|
246 |
+
//$compositeTypeIds = Mage::getSingleton('catalog/product_type')->getCompositeTypes();
|
247 |
+
|
248 |
+
if( $config_product_option == 2){
|
249 |
+
$compositeTypeIds = array ( 'grouped','configurable','bundle','simple','downloadable','virtual' );
|
250 |
+
}elseif( $config_product_option == 1){
|
251 |
+
$compositeTypeIds = array ( 'grouped','simple','downloadable','virtual' );
|
252 |
+
}else{
|
253 |
+
$compositeTypeIds = array ( 'grouped','configurable','bundle','simple','downloadable','virtual' );
|
254 |
+
}
|
255 |
+
|
256 |
+
$orderTableAliasName = $adapter->quoteIdentifier('order');
|
257 |
+
|
258 |
+
$orderJoinCondition = array(
|
259 |
+
$orderTableAliasName . '.entity_id = order_items.order_id',
|
260 |
+
$adapter->quoteInto("{$orderTableAliasName}.state <> ?", Mage_Sales_Model_Order::STATE_CANCELED),
|
261 |
+
|
262 |
+
);
|
263 |
+
|
264 |
+
$productJoinCondition = array(
|
265 |
+
$adapter->quoteInto('(e.type_id IN (?))', $compositeTypeIds),
|
266 |
+
'e.entity_id = order_items.product_id',
|
267 |
+
$adapter->quoteInto('e.entity_type_id = ?', $this->getProductEntityTypeId())
|
268 |
+
);
|
269 |
+
|
270 |
+
if ($from != '' && $to != '') {
|
271 |
+
$fieldName = $orderTableAliasName . '.created_at';
|
272 |
+
$orderJoinCondition[] = $this->_prepareBetweenSql($fieldName, $from, $to);
|
273 |
+
}
|
274 |
+
|
275 |
+
$this->getSelect()->reset()
|
276 |
+
->from(
|
277 |
+
array('order_items' => $this->getTable('sales/order_item')),
|
278 |
+
array(
|
279 |
+
'ordered_qty' => 'SUM(order_items.qty_ordered)',
|
280 |
+
'order_items_name' => 'order_items.name'
|
281 |
+
))
|
282 |
+
->joinInner(
|
283 |
+
array('order' => $this->getTable('sales/order')),
|
284 |
+
implode(' AND ', $orderJoinCondition),
|
285 |
+
array())
|
286 |
+
->joinLeft(
|
287 |
+
array('e' => $this->getProductEntityTableName()),
|
288 |
+
implode(' AND ', $productJoinCondition),
|
289 |
+
array(
|
290 |
+
'entity_id' => 'order_items.product_id',
|
291 |
+
'entity_type_id' => 'e.entity_type_id',
|
292 |
+
'attribute_set_id' => 'e.attribute_set_id',
|
293 |
+
'type_id' => 'e.type_id',
|
294 |
+
'sku' => 'e.sku',
|
295 |
+
'has_options' => 'e.has_options',
|
296 |
+
'required_options' => 'e.required_options',
|
297 |
+
'created_at' => 'e.created_at',
|
298 |
+
'updated_at' => 'e.updated_at'
|
299 |
+
))
|
300 |
+
->group('order_items.product_id')
|
301 |
+
->having('SUM(order_items.qty_ordered) > ?', 0);
|
302 |
+
if( $config_product_option == 2){
|
303 |
+
$this->getSelect()->where('parent_item_id IS NULL');
|
304 |
+
}
|
305 |
+
|
306 |
+
return $this;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Set order
|
311 |
+
*
|
312 |
+
* @param string $attribute
|
313 |
+
* @param string $dir
|
314 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
315 |
+
*/
|
316 |
+
public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
|
317 |
+
{
|
318 |
+
if (in_array($attribute, array('carts', 'orders', 'ordered_qty'))) {
|
319 |
+
$this->getSelect()->order($attribute . ' ' . $dir);
|
320 |
+
} else {
|
321 |
+
parent::setOrder($attribute, $dir);
|
322 |
+
}
|
323 |
+
|
324 |
+
return $this;
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Add views count
|
329 |
+
*
|
330 |
+
* @param string $from
|
331 |
+
* @param string $to
|
332 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
333 |
+
*/
|
334 |
+
public function addViewsCount($from = '', $to = '')
|
335 |
+
{
|
336 |
+
/**
|
337 |
+
* Getting event type id for catalog_product_view event
|
338 |
+
*/
|
339 |
+
foreach (Mage::getModel('reports/event_type')->getCollection() as $eventType) {
|
340 |
+
if ($eventType->getEventName() == 'catalog_product_view') {
|
341 |
+
$productViewEvent = (int)$eventType->getId();
|
342 |
+
break;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
$this->getSelect()->reset()
|
347 |
+
->from(
|
348 |
+
array('report_table_views' => $this->getTable('reports/event')),
|
349 |
+
array('views' => 'COUNT(report_table_views.event_id)'))
|
350 |
+
->join(array('e' => $this->getProductEntityTableName()),
|
351 |
+
$this->getConnection()->quoteInto(
|
352 |
+
"e.entity_id = report_table_views.object_id AND e.entity_type_id = ?",
|
353 |
+
$this->getProductEntityTypeId()))
|
354 |
+
->where('report_table_views.event_type_id = ?', $productViewEvent)
|
355 |
+
->group('e.entity_id')
|
356 |
+
->order('views ' . self::SORT_ORDER_DESC)
|
357 |
+
->having('COUNT(report_table_views.event_id) > ?', 0);
|
358 |
+
|
359 |
+
if ($from != '' && $to != '') {
|
360 |
+
$this->getSelect()
|
361 |
+
->where('logged_at >= ?', $from)
|
362 |
+
->where('logged_at <= ?', $to);
|
363 |
+
}
|
364 |
+
|
365 |
+
$this->_useAnalyticFunction = true;
|
366 |
+
return $this;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Prepare between sql
|
371 |
+
*
|
372 |
+
* @param string $fieldName Field name with table suffix ('created_at' or 'main_table.created_at')
|
373 |
+
* @param string $from
|
374 |
+
* @param string $to
|
375 |
+
* @return string Formatted sql string
|
376 |
+
*/
|
377 |
+
protected function _prepareBetweenSql($fieldName, $from, $to)
|
378 |
+
{
|
379 |
+
return sprintf('(%s BETWEEN %s AND %s)',
|
380 |
+
$fieldName,
|
381 |
+
$this->getConnection()->quote($from),
|
382 |
+
$this->getConnection()->quote($to)
|
383 |
+
);
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Add store restrictions to product collection
|
388 |
+
*
|
389 |
+
* @param array $storeIds
|
390 |
+
* @param array $websiteIds
|
391 |
+
* @return Mage_Reports_Model_Resource_Product_Collection
|
392 |
+
*/
|
393 |
+
public function addStoreRestrictions($storeIds, $websiteIds)
|
394 |
+
{
|
395 |
+
if (!is_array($storeIds)) {
|
396 |
+
$storeIds = array($storeIds);
|
397 |
+
}
|
398 |
+
if (!is_array($websiteIds)) {
|
399 |
+
$websiteIds = array($websiteIds);
|
400 |
+
}
|
401 |
+
|
402 |
+
$filters = $this->_productLimitationFilters;
|
403 |
+
if (isset($filters['store_id'])) {
|
404 |
+
if (!in_array($filters['store_id'], $storeIds)) {
|
405 |
+
$this->addStoreFilter($filters['store_id']);
|
406 |
+
} else {
|
407 |
+
$this->addStoreFilter($this->getStoreId());
|
408 |
+
}
|
409 |
+
} else {
|
410 |
+
$this->addWebsiteFilter($websiteIds);
|
411 |
+
}
|
412 |
+
|
413 |
+
return $this;
|
414 |
+
}
|
415 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Bundleproducts.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
{
|
1 |
}
|
1 |
+
<?php
|
2 |
{
|
3 |
}
|
app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Chooseproducts.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
{
|
1 |
}
|
1 |
+
<?php
|
2 |
{
|
3 |
}
|
app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Orderstatus.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
{
|
1 |
}
|
1 |
+
<?php
|
2 |
{
|
3 |
}
|
app/code/community/CapacityWebSolutions/Bestseller/Model/System/Config/Source/Sortorder.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
{
|
1 |
}
|
1 |
+
<?php
|
2 |
{
|
3 |
}
|
app/code/community/CapacityWebSolutions/Bestseller/controllers/Adminhtml/BestsellerController.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 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_Adminhtml_BestsellerController extends Mage_Adminhtml_Controller_Action {
|
11 |
+
|
12 |
+
protected function _initAction() {
|
13 |
+
$this->loadLayout()
|
14 |
+
->_setActiveMenu('cws');
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
|
18 |
+
public function indexAction() {
|
19 |
+
$this->_initAction()
|
20 |
+
->renderLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
public function newAction() {
|
24 |
+
$this->_forward('edit');
|
25 |
+
}
|
26 |
+
|
27 |
+
public function editAction() {
|
28 |
+
$id = $this->getRequest()->getParam('id');
|
29 |
+
$model = Mage::getModel('bestseller/bestseller')->load($id);
|
30 |
+
|
31 |
+
if ($model->getBestsellerId() || $id == 0) {
|
32 |
+
|
33 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
34 |
+
if (!empty($data)) {
|
35 |
+
$model->setData($data);
|
36 |
+
}
|
37 |
+
|
38 |
+
Mage::register('bestseller_data', $model);
|
39 |
+
|
40 |
+
$this->loadLayout();
|
41 |
+
$this->_setActiveMenu('cws');
|
42 |
+
|
43 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Best Seller Products'), Mage::helper('adminhtml')->__('Best Seller Products'));
|
44 |
+
|
45 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
46 |
+
|
47 |
+
$this->_addContent($this->getLayout()->createBlock('bestseller/adminhtml_bestseller_edit'))
|
48 |
+
->_addLeft($this->getLayout()->createBlock('bestseller/adminhtml_bestseller_edit_tabs'));
|
49 |
+
|
50 |
+
$this->renderLayout();
|
51 |
+
} else {
|
52 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bestseller')->__('Best Seller Products does not exist'));
|
53 |
+
$this->_redirect('*/*/');
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
public function saveAction() {
|
58 |
+
$product_skus = array();
|
59 |
+
$product_ids = array();
|
60 |
+
|
61 |
+
if ($data = $this->getRequest()->getPost()) {
|
62 |
+
|
63 |
+
$id = $this->getRequest()->getParam('id');
|
64 |
+
|
65 |
+
if (isset($data['product_sku'])) {
|
66 |
+
$data['product_sku'] = explode(', ',$data['product_sku']);
|
67 |
+
if (is_array($data['product_sku'])) {
|
68 |
+
$product_skus = array_unique($data['product_sku']);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
foreach($product_skus as $sku){
|
73 |
+
$product_ids[$sku] = Mage::getModel("catalog/product")->getIdBySku($sku);
|
74 |
+
}
|
75 |
+
|
76 |
+
try {
|
77 |
+
//save product skus
|
78 |
+
$model = Mage::getModel('bestseller/bestseller');
|
79 |
+
$prd_data = $model->getCollection();
|
80 |
+
$prd_data->walk('delete');
|
81 |
+
|
82 |
+
foreach($product_skus as $sku){
|
83 |
+
if($sku){
|
84 |
+
$model->setData('sku',$sku);
|
85 |
+
$model->setData('product_id',$product_ids[$sku]);
|
86 |
+
$model->save();
|
87 |
+
$model->unsetData();
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('bestseller')->__('Best Seller Products was successfully saved'));
|
92 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
93 |
+
|
94 |
+
if ($this->getRequest()->getParam('back')) {
|
95 |
+
$this->_redirect('*/*/edit', array('id' => $model->getBestsellerId()));
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
$this->_redirect('*/*/');
|
99 |
+
return;
|
100 |
+
} catch (Exception $e) {
|
101 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
102 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
103 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bestseller')->__('Unable to find Best Seller Products to save'));
|
108 |
+
$this->_redirect('*/*/');
|
109 |
+
}
|
110 |
+
|
111 |
+
public function massDeleteAction() {
|
112 |
+
$bestseller_ids = $this->getRequest()->getParam('bestseller');
|
113 |
+
|
114 |
+
if(!is_array($bestseller_ids)) {
|
115 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
116 |
+
} else {
|
117 |
+
try {
|
118 |
+
foreach ($bestseller_ids as $bestseller_id) {
|
119 |
+
$bestseller = Mage::getModel('bestseller/bestseller')->load($bestseller_id,'product_id');
|
120 |
+
$bestseller->delete();
|
121 |
+
}
|
122 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
123 |
+
Mage::helper('adminhtml')->__(
|
124 |
+
'Total of %d record(s) were successfully deleted', count($bestseller_ids)
|
125 |
+
)
|
126 |
+
);
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
}
|
130 |
+
}
|
131 |
+
$this->_redirect('*/*/index');
|
132 |
+
}
|
133 |
+
|
134 |
+
public function gridAction()
|
135 |
+
{
|
136 |
+
$this->loadLayout();
|
137 |
+
$this->getResponse()->setBody(
|
138 |
+
$this->getLayout()->createBlock('bestseller/adminhtml_bestseller_grid')->toHtml()
|
139 |
+
);
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
app/code/community/CapacityWebSolutions/Bestseller/controllers/IndexController.php
DELETED
@@ -1,22 +0,0 @@
|
|
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 |
-
|
12 |
-
class CapacityWebSolutions_Bestseller_IndexController extends Mage_Core_Controller_Front_Action
|
13 |
-
{
|
14 |
-
public function indexAction()
|
15 |
-
{
|
16 |
-
$this->loadLayout(array('default'));
|
17 |
-
$this->renderLayout();
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
|
22 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/CapacityWebSolutions/Bestseller/etc/config.xml
CHANGED
@@ -1,27 +1,55 @@
|
|
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>
|
13 |
-
<
|
14 |
-
<CapacityWebSolutions_Bestseller>
|
15 |
-
<version>1.1.7</version>
|
16 |
-
</CapacityWebSolutions_Bestseller>
|
17 |
-
</modules>
|
18 |
-
<blocks>
|
19 |
<bestseller>
|
20 |
-
<
|
21 |
-
|
22 |
-
</rewrite>
|
23 |
</bestseller>
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
</global>
|
26 |
<frontend>
|
27 |
<routers>
|
@@ -33,15 +61,53 @@
|
|
33 |
</args>
|
34 |
</bestseller>
|
35 |
</routers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
<layout>
|
37 |
<updates>
|
38 |
<bestseller>
|
39 |
-
|
40 |
</bestseller>
|
41 |
</updates>
|
42 |
-
|
43 |
-
</frontend>
|
44 |
-
<adminhtml>
|
45 |
<acl>
|
46 |
<resources>
|
47 |
<admin>
|
@@ -63,21 +129,24 @@
|
|
63 |
</acl>
|
64 |
</adminhtml>
|
65 |
<default> <!-- Default text value set from admin-->
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
</
|
|
|
|
|
|
|
83 |
</config>
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
+
<modules>
|
4 |
+
<CapacityWebSolutions_Bestseller>
|
5 |
+
<version>2.0.0</version>
|
6 |
+
</CapacityWebSolutions_Bestseller>
|
7 |
+
</modules>
|
8 |
<global>
|
9 |
+
<models>
|
|
|
|
|
|
|
|
|
|
|
10 |
<bestseller>
|
11 |
+
<class>CapacityWebSolutions_Bestseller_Model</class>
|
12 |
+
<resourceModel>bestseller_mysql4</resourceModel>
|
|
|
13 |
</bestseller>
|
14 |
+
<bestseller_mysql4>
|
15 |
+
<class>CapacityWebSolutions_Bestseller_Model_Mysql4</class>
|
16 |
+
<entities>
|
17 |
+
<bestseller>
|
18 |
+
<table>bestseller</table>
|
19 |
+
</bestseller>
|
20 |
+
</entities>
|
21 |
+
</bestseller_mysql4>
|
22 |
+
</models>
|
23 |
+
<resources>
|
24 |
+
<bestseller_setup>
|
25 |
+
<setup>
|
26 |
+
<module>CapacityWebSolutions_Bestseller</module>
|
27 |
+
</setup>
|
28 |
+
<connection>
|
29 |
+
<use>core_setup</use>
|
30 |
+
</connection>
|
31 |
+
</bestseller_setup>
|
32 |
+
<bestseller_write>
|
33 |
+
<connection>
|
34 |
+
<use>core_write</use>
|
35 |
+
</connection>
|
36 |
+
</bestseller_write>
|
37 |
+
<bestseller_read>
|
38 |
+
<connection>
|
39 |
+
<use>core_read</use>
|
40 |
+
</connection>
|
41 |
+
</bestseller_read>
|
42 |
+
</resources>
|
43 |
+
<blocks>
|
44 |
+
<bestseller>
|
45 |
+
<class>CapacityWebSolutions_Bestseller_Block</class>
|
46 |
+
</bestseller>
|
47 |
+
</blocks>
|
48 |
+
<helpers>
|
49 |
+
<bestseller>
|
50 |
+
<class>CapacityWebSolutions_Bestseller_Helper</class>
|
51 |
+
</bestseller>
|
52 |
+
</helpers>
|
53 |
</global>
|
54 |
<frontend>
|
55 |
<routers>
|
61 |
</args>
|
62 |
</bestseller>
|
63 |
</routers>
|
64 |
+
</frontend>
|
65 |
+
|
66 |
+
<admin>
|
67 |
+
<routers>
|
68 |
+
<bestseller>
|
69 |
+
<use>admin</use>
|
70 |
+
<args>
|
71 |
+
<module>CapacityWebSolutions_Bestseller</module>
|
72 |
+
<frontName>bestseller</frontName>
|
73 |
+
</args>
|
74 |
+
</bestseller>
|
75 |
+
</routers>
|
76 |
+
</admin>
|
77 |
+
|
78 |
+
<adminhtml>
|
79 |
+
<menu>
|
80 |
+
<cws module="bestseller">
|
81 |
+
<title>CWS Extensions</title>
|
82 |
+
<sort_order>70</sort_order>
|
83 |
+
<children>
|
84 |
+
<bestseller module="bestseller">
|
85 |
+
<title>Bestseller Products</title>
|
86 |
+
<sort_order>70</sort_order>
|
87 |
+
<children>
|
88 |
+
<groups module="bestseller">
|
89 |
+
<title>Manage Products Manually</title>
|
90 |
+
<sort_order>10</sort_order>
|
91 |
+
<action>bestseller/adminhtml_bestseller</action>
|
92 |
+
</groups>
|
93 |
+
<settings>
|
94 |
+
<title>Manage Settings</title>
|
95 |
+
<sort_order>20</sort_order>
|
96 |
+
<action>adminhtml/system_config/edit/section/bestseller</action>
|
97 |
+
</settings>
|
98 |
+
</children>
|
99 |
+
|
100 |
+
</bestseller>
|
101 |
+
</children>
|
102 |
+
</cws>
|
103 |
+
</menu>
|
104 |
<layout>
|
105 |
<updates>
|
106 |
<bestseller>
|
107 |
+
<file>bestseller.xml</file>
|
108 |
</bestseller>
|
109 |
</updates>
|
110 |
+
</layout>
|
|
|
|
|
111 |
<acl>
|
112 |
<resources>
|
113 |
<admin>
|
129 |
</acl>
|
130 |
</adminhtml>
|
131 |
<default> <!-- Default text value set from admin-->
|
132 |
+
<bestseller>
|
133 |
+
<general>
|
134 |
+
<enabled>1</enabled>
|
135 |
+
<heading>BESTSELLER PRODUCTS</heading>
|
136 |
+
<number_of_items>6</number_of_items>
|
137 |
+
<number_of_items_per_row>3</number_of_items_per_row>
|
138 |
+
<thumbnail_height>135</thumbnail_height>
|
139 |
+
<thumbnail_width>135</thumbnail_width>
|
140 |
+
<time_period>60</time_period>
|
141 |
+
<products_price>1</products_price>
|
142 |
+
<review>1</review>
|
143 |
+
<add_to_cart>1</add_to_cart>
|
144 |
+
<active>1</active>
|
145 |
+
<add_to_compare>1</add_to_compare>
|
146 |
+
<order_status>all</order_status>
|
147 |
+
<choose_products>1</choose_products>
|
148 |
+
<bundle_products>1</bundle_products>
|
149 |
+
</general>
|
150 |
+
</bestseller>
|
151 |
+
</default>
|
152 |
</config>
|
app/code/community/CapacityWebSolutions/Bestseller/etc/system.xml
CHANGED
@@ -1,13 +1,4 @@
|
|
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>
|
@@ -26,6 +17,75 @@
|
|
26 |
<show_in_website>1</show_in_website>
|
27 |
<show_in_store>1</show_in_store>
|
28 |
<groups>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
<general translate="label">
|
30 |
<label>General</label>
|
31 |
<frontend_type>text</frontend_type>
|
@@ -43,7 +103,7 @@
|
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
-
</enabled>
|
47 |
<heading translate="label">
|
48 |
<label>Heading</label>
|
49 |
<comment>Here, We can Set Heading.</comment>
|
@@ -53,11 +113,48 @@
|
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>1</show_in_store>
|
55 |
</heading>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
<number_of_items translate="label comment">
|
57 |
<label>Number Of Items in Main Block</label>
|
58 |
<comment>Show Number of best seller products in main block</comment>
|
59 |
<frontend_type>text</frontend_type>
|
60 |
-
<sort_order>
|
61 |
<show_in_default>1</show_in_default>
|
62 |
<show_in_website>1</show_in_website>
|
63 |
<show_in_store>1</show_in_store>
|
@@ -66,7 +163,7 @@
|
|
66 |
<label>Number Of Items per row in Main Block</label>
|
67 |
<comment>Show Number of best seller products in per row</comment>
|
68 |
<frontend_type>text</frontend_type>
|
69 |
-
<sort_order>
|
70 |
<show_in_default>1</show_in_default>
|
71 |
<show_in_website>1</show_in_website>
|
72 |
<show_in_store>1</show_in_store>
|
@@ -75,7 +172,7 @@
|
|
75 |
<label>Thumbnail Width</label>
|
76 |
<comment>Default Thumbnail Width: 135px</comment>
|
77 |
<frontend_type>text</frontend_type>
|
78 |
-
<sort_order>
|
79 |
<show_in_default>1</show_in_default>
|
80 |
<show_in_website>1</show_in_website>
|
81 |
<show_in_store>1</show_in_store>
|
@@ -84,7 +181,7 @@
|
|
84 |
<label>Thumbnail Height </label>
|
85 |
<comment>Default Thumbnail Height: 135px</comment>
|
86 |
<frontend_type>text</frontend_type>
|
87 |
-
<sort_order>
|
88 |
<show_in_default>1</show_in_default>
|
89 |
<show_in_website>1</show_in_website>
|
90 |
<show_in_store>1</show_in_store>
|
@@ -93,7 +190,7 @@
|
|
93 |
<label>Time Period</label>
|
94 |
<comment>Days bestselling product. Default 60 days.</comment>
|
95 |
<frontend_type>text</frontend_type>
|
96 |
-
<sort_order>
|
97 |
<show_in_default>1</show_in_default>
|
98 |
<show_in_website>1</show_in_website>
|
99 |
<show_in_store>1</show_in_store>
|
@@ -102,7 +199,7 @@
|
|
102 |
<label>Time Period</label>
|
103 |
<comment>Days bestselling product. Default 60 days.</comment>
|
104 |
<frontend_type>text</frontend_type>
|
105 |
-
<sort_order>
|
106 |
<show_in_default>1</show_in_default>
|
107 |
<show_in_website>1</show_in_website>
|
108 |
<show_in_store>1</show_in_store>
|
@@ -112,7 +209,7 @@
|
|
112 |
<comment>Select Yes for display the Products Price on frontend.</comment>
|
113 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
114 |
<frontend_type>select</frontend_type>
|
115 |
-
<sort_order>
|
116 |
<show_in_default>1</show_in_default>
|
117 |
<show_in_website>1</show_in_website>
|
118 |
<show_in_store>1</show_in_store>
|
@@ -122,7 +219,7 @@
|
|
122 |
<comment>Select Yes for display the Reviews Ratings on frontend.</comment>
|
123 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
124 |
<frontend_type>select</frontend_type>
|
125 |
-
<sort_order>
|
126 |
<show_in_default>1</show_in_default>
|
127 |
<show_in_website>1</show_in_website>
|
128 |
<show_in_store>1</show_in_store>
|
@@ -132,7 +229,7 @@
|
|
132 |
<comment>Select Yes for display the Add to cart button on frontend.</comment>
|
133 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
134 |
<frontend_type>select</frontend_type>
|
135 |
-
<sort_order>
|
136 |
<show_in_default>1</show_in_default>
|
137 |
<show_in_website>1</show_in_website>
|
138 |
<show_in_store>1</show_in_store>
|
@@ -142,7 +239,7 @@
|
|
142 |
<comment>Select Yes for display the Add to Wishlist Link on frontend.</comment>
|
143 |
<frontend_type>select</frontend_type>
|
144 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
145 |
-
<sort_order>
|
146 |
<show_in_default>1</show_in_default>
|
147 |
<show_in_website>1</show_in_website>
|
148 |
<show_in_store>1</show_in_store>
|
@@ -152,7 +249,7 @@
|
|
152 |
<comment>Select Yes for display the Add to Compare Link on frontend.</comment>
|
153 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
154 |
<frontend_type>select</frontend_type>
|
155 |
-
<sort_order>
|
156 |
<show_in_default>1</show_in_default>
|
157 |
<show_in_website>1</show_in_website>
|
158 |
<show_in_store>1</show_in_store>
|
@@ -162,11 +259,21 @@
|
|
162 |
<comment>Select Yes for display the out of stock items on frontend.</comment>
|
163 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
164 |
<frontend_type>select</frontend_type>
|
165 |
-
<sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
<show_in_default>1</show_in_default>
|
167 |
<show_in_website>1</show_in_website>
|
168 |
<show_in_store>1</show_in_store>
|
169 |
-
</
|
170 |
</fields>
|
171 |
</general>
|
172 |
</groups>
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<tabs>
|
4 |
<cws>
|
17 |
<show_in_website>1</show_in_website>
|
18 |
<show_in_store>1</show_in_store>
|
19 |
<groups>
|
20 |
+
<default_code translate="label">
|
21 |
+
<label>Default Package Code</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>80</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<fields>
|
28 |
+
<bsxml translate="label comment">
|
29 |
+
<comment><![CDATA[]]></comment>
|
30 |
+
<label>XML Tag Representation</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<frontend_model>CapacityWebSolutions_Bestseller_Block_Adminhtml_DefaultXML</frontend_model>
|
33 |
+
<sort_order>1</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
</bsxml>
|
36 |
+
<bstemplated translate="label comment">
|
37 |
+
<comment><![CDATA[]]></comment>
|
38 |
+
<label>Template Tag Representation</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<frontend_model>CapacityWebSolutions_Bestseller_Block_Adminhtml_DefaultTemplate</frontend_model>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
</bstemplated>
|
44 |
+
<bsdirect translate="label comment">
|
45 |
+
<comment><![CDATA[]]></comment>
|
46 |
+
<label>Call Via Frontend Template File</label>
|
47 |
+
<frontend_type>text</frontend_type>
|
48 |
+
<frontend_model>CapacityWebSolutions_Bestseller_Block_Adminhtml_DefaultDirectCode</frontend_model>
|
49 |
+
<sort_order>3</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
</bsdirect>
|
52 |
+
</fields>
|
53 |
+
</default_code>
|
54 |
+
<rwd_code translate="label">
|
55 |
+
<label>RWD Package Code</label>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<sort_order>90</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 |
+
<fields>
|
62 |
+
<bsxml translate="label comment">
|
63 |
+
<comment><![CDATA[]]></comment>
|
64 |
+
<label>XML Tag Representation</label>
|
65 |
+
<frontend_type>text</frontend_type>
|
66 |
+
<frontend_model>CapacityWebSolutions_Bestseller_Block_Adminhtml_RwdXML</frontend_model>
|
67 |
+
<sort_order>1</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
|
70 |
+
</bsxml>
|
71 |
+
<bstemplated translate="label comment">
|
72 |
+
<comment><![CDATA[]]></comment>
|
73 |
+
<label>Template Tag Representation</label>
|
74 |
+
<frontend_type>text</frontend_type>
|
75 |
+
<frontend_model>CapacityWebSolutions_Bestseller_Block_Adminhtml_RwdTemplate</frontend_model>
|
76 |
+
<sort_order>2</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
</bstemplated>
|
79 |
+
<bsdirect translate="label comment">
|
80 |
+
<comment><![CDATA[]]></comment>
|
81 |
+
<label>Call Via Frontend Template File</label>
|
82 |
+
<frontend_type>text</frontend_type>
|
83 |
+
<frontend_model>CapacityWebSolutions_Bestseller_Block_Adminhtml_RwdDirectCode</frontend_model>
|
84 |
+
<sort_order>3</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
</bsdirect>
|
87 |
+
</fields>
|
88 |
+
</rwd_code>
|
89 |
<general translate="label">
|
90 |
<label>General</label>
|
91 |
<frontend_type>text</frontend_type>
|
103 |
<show_in_default>1</show_in_default>
|
104 |
<show_in_website>1</show_in_website>
|
105 |
<show_in_store>1</show_in_store>
|
106 |
+
</enabled>
|
107 |
<heading translate="label">
|
108 |
<label>Heading</label>
|
109 |
<comment>Here, We can Set Heading.</comment>
|
113 |
<show_in_website>1</show_in_website>
|
114 |
<show_in_store>1</show_in_store>
|
115 |
</heading>
|
116 |
+
<choose_products translate="label">
|
117 |
+
<label>Best Seller Products</label>
|
118 |
+
<comment><![CDATA[Auto >> Show system generated products.<br>
|
119 |
+
Manually >> Show manually added products.<br>
|
120 |
+
Both >> Show both system generated and manually added products.]]>
|
121 |
+
</comment>
|
122 |
+
<source_model>bestseller/system_config_source_chooseproducts</source_model>
|
123 |
+
<frontend_type>select</frontend_type>
|
124 |
+
<sort_order>2</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>1</show_in_store>
|
128 |
+
</choose_products>
|
129 |
+
<sort_order_both>
|
130 |
+
<label>Sort Order for Both</label>
|
131 |
+
<comment><![CDATA[Auto >> Show System generated products first then manually added products.<br>
|
132 |
+
Manually >> Show manually added products first then system generated products.
|
133 |
+
]]></comment>
|
134 |
+
<source_model>bestseller/system_config_source_sortorder</source_model>
|
135 |
+
<frontend_type>select</frontend_type>
|
136 |
+
<sort_order>3</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 |
+
<depends><choose_products>3</choose_products></depends>
|
141 |
+
</sort_order_both>
|
142 |
+
<bundle_products>
|
143 |
+
<label>Display Bundle and Configurable Products</label>
|
144 |
+
<comment><![CDATA[Applied only if "Best Seller Products" field is set to "Auto" or "Both".]]>
|
145 |
+
</comment>
|
146 |
+
<source_model>bestseller/system_config_source_bundleproducts</source_model>
|
147 |
+
<frontend_type>select</frontend_type>
|
148 |
+
<sort_order>4</sort_order>
|
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 |
+
</bundle_products>
|
153 |
<number_of_items translate="label comment">
|
154 |
<label>Number Of Items in Main Block</label>
|
155 |
<comment>Show Number of best seller products in main block</comment>
|
156 |
<frontend_type>text</frontend_type>
|
157 |
+
<sort_order>6</sort_order>
|
158 |
<show_in_default>1</show_in_default>
|
159 |
<show_in_website>1</show_in_website>
|
160 |
<show_in_store>1</show_in_store>
|
163 |
<label>Number Of Items per row in Main Block</label>
|
164 |
<comment>Show Number of best seller products in per row</comment>
|
165 |
<frontend_type>text</frontend_type>
|
166 |
+
<sort_order>7</sort_order>
|
167 |
<show_in_default>1</show_in_default>
|
168 |
<show_in_website>1</show_in_website>
|
169 |
<show_in_store>1</show_in_store>
|
172 |
<label>Thumbnail Width</label>
|
173 |
<comment>Default Thumbnail Width: 135px</comment>
|
174 |
<frontend_type>text</frontend_type>
|
175 |
+
<sort_order>8</sort_order>
|
176 |
<show_in_default>1</show_in_default>
|
177 |
<show_in_website>1</show_in_website>
|
178 |
<show_in_store>1</show_in_store>
|
181 |
<label>Thumbnail Height </label>
|
182 |
<comment>Default Thumbnail Height: 135px</comment>
|
183 |
<frontend_type>text</frontend_type>
|
184 |
+
<sort_order>9</sort_order>
|
185 |
<show_in_default>1</show_in_default>
|
186 |
<show_in_website>1</show_in_website>
|
187 |
<show_in_store>1</show_in_store>
|
190 |
<label>Time Period</label>
|
191 |
<comment>Days bestselling product. Default 60 days.</comment>
|
192 |
<frontend_type>text</frontend_type>
|
193 |
+
<sort_order>10</sort_order>
|
194 |
<show_in_default>1</show_in_default>
|
195 |
<show_in_website>1</show_in_website>
|
196 |
<show_in_store>1</show_in_store>
|
199 |
<label>Time Period</label>
|
200 |
<comment>Days bestselling product. Default 60 days.</comment>
|
201 |
<frontend_type>text</frontend_type>
|
202 |
+
<sort_order>11</sort_order>
|
203 |
<show_in_default>1</show_in_default>
|
204 |
<show_in_website>1</show_in_website>
|
205 |
<show_in_store>1</show_in_store>
|
209 |
<comment>Select Yes for display the Products Price on frontend.</comment>
|
210 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
211 |
<frontend_type>select</frontend_type>
|
212 |
+
<sort_order>12</sort_order>
|
213 |
<show_in_default>1</show_in_default>
|
214 |
<show_in_website>1</show_in_website>
|
215 |
<show_in_store>1</show_in_store>
|
219 |
<comment>Select Yes for display the Reviews Ratings on frontend.</comment>
|
220 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
221 |
<frontend_type>select</frontend_type>
|
222 |
+
<sort_order>13</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>
|
229 |
<comment>Select Yes for display the Add to cart button on frontend.</comment>
|
230 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
231 |
<frontend_type>select</frontend_type>
|
232 |
+
<sort_order>14</sort_order>
|
233 |
<show_in_default>1</show_in_default>
|
234 |
<show_in_website>1</show_in_website>
|
235 |
<show_in_store>1</show_in_store>
|
239 |
<comment>Select Yes for display the Add to Wishlist Link on frontend.</comment>
|
240 |
<frontend_type>select</frontend_type>
|
241 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
242 |
+
<sort_order>15</sort_order>
|
243 |
<show_in_default>1</show_in_default>
|
244 |
<show_in_website>1</show_in_website>
|
245 |
<show_in_store>1</show_in_store>
|
249 |
<comment>Select Yes for display the Add to Compare Link on frontend.</comment>
|
250 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
251 |
<frontend_type>select</frontend_type>
|
252 |
+
<sort_order>16</sort_order>
|
253 |
<show_in_default>1</show_in_default>
|
254 |
<show_in_website>1</show_in_website>
|
255 |
<show_in_store>1</show_in_store>
|
259 |
<comment>Select Yes for display the out of stock items on frontend.</comment>
|
260 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
261 |
<frontend_type>select</frontend_type>
|
262 |
+
<sort_order>17</sort_order>
|
263 |
+
<show_in_default>1</show_in_default>
|
264 |
+
<show_in_website>1</show_in_website>
|
265 |
+
<show_in_store>1</show_in_store>
|
266 |
+
</out_of_stoke>
|
267 |
+
<order_status translate="label">
|
268 |
+
<label>Order Status</label>
|
269 |
+
<comment>Applied only if "Best Seller Products" field is set to "Auto" or "Both".</comment>
|
270 |
+
<source_model>bestseller/system_config_source_orderstatus</source_model>
|
271 |
+
<frontend_type>multiselect</frontend_type>
|
272 |
+
<sort_order>18</sort_order>
|
273 |
<show_in_default>1</show_in_default>
|
274 |
<show_in_website>1</show_in_website>
|
275 |
<show_in_store>1</show_in_store>
|
276 |
+
</order_status>
|
277 |
</fields>
|
278 |
</general>
|
279 |
</groups>
|
app/code/community/CapacityWebSolutions/Bestseller/sql/bestseller_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
CREATE TABLE IF NOT EXISTS `".$this->getTable('bestseller')."` (
|
10 |
+
`bestseller_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
11 |
+
`sku` varchar(32) NOT NULL DEFAULT '',
|
12 |
+
`product_id` int(11) unsigned NOT NULL,
|
13 |
+
PRIMARY KEY (`bestseller_id`),
|
14 |
+
KEY `IDX_BESTSELLER_PRODUCT_SKU` (`sku`),
|
15 |
+
KEY `IDX_BESTSELLER_PRODUCT_ID` (`product_id`)
|
16 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
17 |
+
|
18 |
+
ALTER TABLE `".$this->getTable('bestseller')."`
|
19 |
+
ADD CONSTRAINT `IDX_BESTSELLER_PRODUCT_SKU` FOREIGN KEY (`sku`) REFERENCES `".$this->getTable('catalog_product_entity')."` (`sku`) ON DELETE CASCADE ON UPDATE CASCADE,
|
20 |
+
ADD CONSTRAINT `IDX_BESTSELLER_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES `".$this->getTable('catalog_product_entity')."` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/bestseller.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<bestseller_adminhtml_bestseller_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="bestseller/adminhtml_bestseller" name="bestseller" />
|
6 |
+
</reference>
|
7 |
+
</bestseller_adminhtml_bestseller_index>
|
8 |
+
<bestseller_adminhtml_bestseller_edit>
|
9 |
+
<reference name="head">
|
10 |
+
<action method="addJs"><script>bestseller/product-selector.js</script></action>
|
11 |
+
</reference>
|
12 |
+
</bestseller_adminhtml_bestseller_edit>
|
13 |
+
</layout>
|
app/design/adminhtml/default/default/template/bestseller/product.phtml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************************
|
3 |
+
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 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 |
+
.product-param label { padding-right: 10px; }
|
12 |
+
.product-param .label { color: black; font-weight: bold; }
|
13 |
+
.product-param .label:hover { color: blue; font-weight: bold; }
|
14 |
+
.product-param .element { display: none; }
|
15 |
+
.product-param input, .product-param select { min-width: 350px; width: auto !important; }
|
16 |
+
.product-param-edit .label { display: none; }
|
17 |
+
.product-param-edit .element { display: inline; }
|
18 |
+
.product-chooser { border: 1px solid #CCC; display: none; margin: 10px 0; padding: 5px; }
|
19 |
+
</style>
|
20 |
+
|
21 |
+
<div class="entry-edit">
|
22 |
+
<div class="entry-edit-head">
|
23 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('bestseller')->__('Manually Products') ?></h4>
|
24 |
+
|
25 |
+
</div>
|
26 |
+
<fieldset id="product_fieldset">
|
27 |
+
<ul>
|
28 |
+
<li>
|
29 |
+
<span class="product-param">
|
30 |
+
<label for="product_sku"><?php echo Mage::helper('bestseller')->__('Select Best Seller Product SKUs') ?></label>
|
31 |
+
<a class="label" href="javascript:void(0)"><?php if($this->getIdsString()) { echo $this->getIdsString(); } else { echo Mage::helper('bestseller')->__('Click Here To Add Products'); } ?></a>
|
32 |
+
<span class="element">
|
33 |
+
<input id="product_sku" class="input-text element-value-changer" type="text" value="<?php echo $this->getIdsString() ?>" name="product_sku">
|
34 |
+
<a class="product-chooser-trigger" href="javascript:void(0)">
|
35 |
+
<img src="<?php echo Mage::getDesign()->getSkinUrl('images/rule_chooser_trigger.gif') ?>" alt="" class="v-middle product-chooser-trigger" title="<?php echo Mage::helper('bestseller')->__('Open Chooser') ?>" />
|
36 |
+
</a>
|
37 |
+
</span>
|
38 |
+
</span>
|
39 |
+
<div class="product-chooser" url="<?php echo Mage::getUrl('adminhtml/promo_widget/chooser/attribute/sku/form/rule_conditions_fieldset', array('_secure' => Mage::app()->getStore()->isAdminUrlSecure())); ?>">
|
40 |
+
</li>
|
41 |
+
</ul>
|
42 |
+
</fieldset>
|
43 |
+
</div>
|
44 |
+
|
45 |
+
<script type="text/javascript">
|
46 |
+
var rule_conditions_fieldset = new VarienRulesForm('product_fieldset', '<?php echo Mage::getUrl('/admin/promo_catalog/newConditionHtml/form/rule_conditions_fieldset/', array('_secure' => Mage::app()->getStore()->isAdminUrlSecure())) ?>');
|
47 |
+
|
48 |
+
|
49 |
+
</script>
|
app/design/frontend/base/default/template/bestseller/bestseller-responsive.phtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
@extension : Bestseller Product.
|
4 |
-
@copyright : Copyright (c)
|
5 |
( http://www.capacitywebsolutions.com )
|
6 |
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
@support : magento@capacitywebsolutions.com
|
@@ -13,37 +13,50 @@
|
|
13 |
.std .products-grid li { margin-left:0; padding:0; list-style:none; }
|
14 |
</style>
|
15 |
<?php
|
16 |
-
$result =
|
17 |
-
$
|
18 |
-
$
|
19 |
-
$
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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($
|
|
|
32 |
<div class="page-title category-title">
|
33 |
-
<h1><?php echo $this->getHeader(); ?></h1>
|
34 |
</div>
|
35 |
-
|
36 |
<ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
|
37 |
<?php
|
38 |
$i=0; $x = 1;
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
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; ?>">
|
@@ -103,98 +116,14 @@
|
|
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 |
-
|
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; ?>
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
( http://www.capacitywebsolutions.com )
|
6 |
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
@support : magento@capacitywebsolutions.com
|
13 |
.std .products-grid li { margin-left:0; padding:0; list-style:none; }
|
14 |
</style>
|
15 |
<?php
|
16 |
+
$result = array();
|
17 |
+
$pro = array();
|
18 |
+
$bestseller_collection = $this->getBestsellerProduct();
|
19 |
+
foreach($bestseller_collection as $collection){
|
20 |
+
$pro[] = $collection->getEntityId();
|
21 |
+
}
|
22 |
+
if($this->getChooseProducts() == "1") {
|
23 |
+
$result = $pro;
|
24 |
+
}elseif($this->getChooseProducts() == "2") {
|
25 |
+
$result = $this->getProductIds();
|
26 |
+
}else{
|
27 |
+
if($this->getSortOrder() == 1){
|
28 |
+
$result = array_unique(array_merge($pro, $this->getProductIds()));
|
29 |
+
}elseif($this->getSortOrder() == 2){
|
30 |
+
$result = array_unique(array_merge($this->getProductIds(),$pro));
|
31 |
+
}else{
|
32 |
+
$result = array_unique(array_merge($pro, $this->getProductIds()));
|
33 |
+
shuffle($result);
|
34 |
+
}
|
35 |
+
}
|
36 |
$upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
|
37 |
+
$itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
|
38 |
+
$products_price = $this->getProductsPrice();
|
39 |
+
$review = $this->getReview();
|
40 |
$_columnCount = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
?>
|
43 |
|
44 |
+
<?php if($this->getEnabled() == 1): ?>
|
45 |
+
<?php if($this->getHeader()): ?>
|
46 |
<div class="page-title category-title">
|
47 |
+
<h1><?php if(count($result) > 0) { echo $this->getHeader(); } ?></h1>
|
48 |
</div>
|
49 |
+
<?php endif; ?>
|
50 |
<ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
|
51 |
<?php
|
52 |
$i=0; $x = 1;
|
53 |
+
foreach($result as $result){
|
54 |
+
$_product = $this->getProducts($result);
|
55 |
+
if(!$_product){
|
56 |
+
continue;
|
57 |
+
}
|
58 |
+
|
59 |
+
if($x <= $upperLimit) {
|
|
|
60 |
|
61 |
?>
|
62 |
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
116 |
<?php
|
117 |
}
|
118 |
$x++;
|
119 |
+
|
120 |
+
|
121 |
}
|
122 |
?>
|
123 |
</ul>
|
124 |
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
125 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
|
129 |
<?php endif; ?>
|
app/design/frontend/base/default/template/bestseller/bestseller.phtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
@extension : Bestseller Product.
|
4 |
-
@copyright : Copyright (c)
|
5 |
( http://www.capacitywebsolutions.com )
|
6 |
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
@support : magento@capacitywebsolutions.com
|
@@ -16,189 +16,116 @@
|
|
16 |
.productList .product .addWishlist {clear:both; text-align:center; }
|
17 |
</style>
|
18 |
<?php
|
19 |
-
$result =
|
20 |
-
$
|
21 |
-
$
|
22 |
-
$
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
$upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
|
25 |
$itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
|
26 |
-
$
|
27 |
-
$
|
28 |
-
$products_price = Mage::getStoreConfig('bestseller/general/products_price');
|
29 |
-
$review = Mage::getStoreConfig('bestseller/general/review');
|
30 |
-
$out_of_stoke = Mage::getStoreConfig('bestseller/general/out_of_stoke');
|
31 |
-
|
32 |
?>
|
33 |
-
|
|
|
34 |
<div class="sectionHead"><h2><?php if(count($result) > 0) { echo $this->getHeader(); } ?></h2></div>
|
|
|
35 |
<table border="0" cellpadding="0" cellspacing="0" class="productList">
|
36 |
-
<?php if ($out_of_stoke == 0) { ?>
|
37 |
<tr>
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$
|
47 |
-
|
48 |
-
|
49 |
-
if ($is_salable == 1 )
|
50 |
-
{
|
51 |
-
if($x <= $upperLimit)
|
52 |
-
{
|
53 |
-
if($i>($itemPerRow-1))
|
54 |
-
echo '<tr valign="top">';
|
55 |
-
?>
|
56 |
<td class="product">
|
57 |
<div class="prodimage">
|
58 |
<a href="<?php echo $this->getBaseUrl().$_product['url_path']; ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
|
59 |
-
|
|
|
60 |
</div>
|
61 |
<div align="center">
|
62 |
<div class="prodDetails" align="center" style="width:150px;" >
|
63 |
-
<a href="<?php echo $this->getBaseUrl().$_product['url_path'] ?>" title="<?php echo $this->htmlEscape($_product['name']) ?>"
|
|
|
|
|
64 |
<?php
|
65 |
-
if($review == 1)
|
66 |
-
{
|
67 |
$_product = Mage::getModel('catalog/product')->load($_product->getId());
|
68 |
echo $this->getReviewsSummaryHtml($_product, 'short');
|
69 |
}
|
70 |
-
if($products_price == 1)
|
71 |
-
{
|
72 |
$_product = Mage::getModel('catalog/product')->load($_product->getId());
|
73 |
echo $this->getPriceHtml($_product, true);
|
74 |
}
|
75 |
?>
|
76 |
</div>
|
77 |
-
|
78 |
-
|
|
|
|
|
79 |
if($_product->isSaleable()): ?>
|
80 |
-
|
81 |
<?php else: ?>
|
82 |
-
|
83 |
-
<?php endif;
|
|
|
84 |
</div>
|
85 |
<div class="cl">
|
86 |
-
<?php
|
|
|
87 |
if($wishlists == 1){
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
91 |
</div>
|
92 |
<div class="cl">
|
93 |
-
<?php
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
98 |
</div>
|
99 |
</td>
|
100 |
-
|
101 |
$i++;
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
}
|
115 |
-
}
|
116 |
-
}
|
117 |
-
?>
|
118 |
</tr>
|
119 |
-
|
120 |
-
}
|
121 |
-
else
|
122 |
-
{
|
123 |
-
?>
|
124 |
-
<tr>
|
125 |
-
<?php
|
126 |
-
$i=0; $x = 1;
|
127 |
-
for($cnt = 0; $cnt<count($result); $cnt++)
|
128 |
-
{
|
129 |
-
$_product = $model->load($result[$cnt]); //getting product object for particular product id
|
130 |
-
$status = $_product->getData('status');
|
131 |
-
$visibility = $_product->getData('visibility');
|
132 |
-
if ($status == 1 && $visibility == 4)
|
133 |
-
{
|
134 |
-
if($x <= $upperLimit)
|
135 |
-
{
|
136 |
-
if($i>($itemPerRow-1))
|
137 |
-
echo '<tr valign="top">';
|
138 |
-
?>
|
139 |
-
<td class="product">
|
140 |
-
<div class="prodimage">
|
141 |
-
<a href="<?php echo $this->getBaseUrl().$_product['url_path']; ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
|
142 |
-
<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']) ?>"/></a>
|
143 |
-
</div>
|
144 |
-
<div align="center">
|
145 |
-
<div class="prodDetails" align="center" style="width:150px;" >
|
146 |
-
<a href="<?php echo $this->getBaseUrl().$_product['url_path'] ?>" title="<?php echo $this->htmlEscape($_product['name']) ?>"><?php echo $this->htmlEscape($_product['name']) ?></a>
|
147 |
-
<?php
|
148 |
-
if($review == 1)
|
149 |
-
{
|
150 |
-
$_product = Mage::getModel('catalog/product')->load($_product->getId());
|
151 |
-
echo $this->getReviewsSummaryHtml($_product, 'short');
|
152 |
-
}
|
153 |
-
if($products_price == 1)
|
154 |
-
{
|
155 |
-
$_product = Mage::getModel('catalog/product')->load($_product->getId());
|
156 |
-
echo $this->getPriceHtml($_product, true);
|
157 |
-
}
|
158 |
-
?>
|
159 |
-
</div>
|
160 |
-
<?php $addtocartval = $this->getAddToCart();
|
161 |
-
if($addtocartval == 1){
|
162 |
-
if($_product->isSaleable()): ?>
|
163 |
-
<button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
|
164 |
-
<?php else: ?>
|
165 |
-
<span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span>
|
166 |
-
<?php endif; }?>
|
167 |
-
</div>
|
168 |
-
<div class="cl">
|
169 |
-
<?php $wishlists = $this->getActive();
|
170 |
-
if($wishlists == 1){
|
171 |
-
if ($this->helper('wishlist')->isAllow()) : ?>
|
172 |
-
<a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist"><?php echo $this->__('Add to Wishlist') ?></a>
|
173 |
-
<?php endif; }?>
|
174 |
-
</div>
|
175 |
-
<div class="cl">
|
176 |
-
<?php $addtocompare = $this->getAddToCompare();
|
177 |
-
if($addtocompare==1){
|
178 |
-
if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
179 |
-
<a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a>
|
180 |
-
<?php endif; }?>
|
181 |
-
</div>
|
182 |
-
</td>
|
183 |
-
<?php
|
184 |
-
$i++;
|
185 |
-
if($i>($itemPerRow-1))
|
186 |
-
{ $i=0;
|
187 |
-
echo "</tr>";
|
188 |
-
echo '<tr><td colspan="3" class="hline"><img src="'. $this->getSkinUrl('images/spacer.gif') .'" alt="" /></td></tr>';
|
189 |
-
}
|
190 |
-
if($i==($itemPerRow))
|
191 |
-
{
|
192 |
-
echo '<td class="vline"><img src="'. $this->getSkinUrl('images/spacer.gif') .'" alt=""/></td>';
|
193 |
-
}
|
194 |
-
}
|
195 |
-
$x++;
|
196 |
-
}
|
197 |
-
}
|
198 |
-
?>
|
199 |
-
</tr>
|
200 |
-
<?php
|
201 |
-
}
|
202 |
-
?>
|
203 |
-
</table>
|
204 |
<?php endif; ?>
|
1 |
<?php
|
2 |
/***************************************************************************
|
3 |
@extension : Bestseller Product.
|
4 |
+
@copyright : Copyright (c) 2015 Capacity Web Solutions.
|
5 |
( http://www.capacitywebsolutions.com )
|
6 |
@author : Capacity Web Solutions Pvt. Ltd.
|
7 |
@support : magento@capacitywebsolutions.com
|
16 |
.productList .product .addWishlist {clear:both; text-align:center; }
|
17 |
</style>
|
18 |
<?php
|
19 |
+
$result = array();
|
20 |
+
$pro = array();
|
21 |
+
$bestseller_collection = $this->getBestsellerProduct();
|
22 |
+
foreach($bestseller_collection as $collection){
|
23 |
+
$pro[] = $collection->getEntityId();
|
24 |
+
}
|
25 |
+
if($this->getChooseProducts() == "1") {
|
26 |
+
$result = $pro;
|
27 |
+
}elseif($this->getChooseProducts() == "2") {
|
28 |
+
$result = $this->getProductIds();
|
29 |
+
}else{
|
30 |
+
if($this->getSortOrder() == 1){
|
31 |
+
$result = array_unique(array_merge($pro, $this->getProductIds()));
|
32 |
+
}elseif($this->getSortOrder() == 2){
|
33 |
+
$result = array_unique(array_merge($this->getProductIds(),$pro));
|
34 |
+
}else{
|
35 |
+
$result = array_unique(array_merge($pro, $this->getProductIds()));
|
36 |
+
shuffle($result);
|
37 |
+
}
|
38 |
+
}
|
39 |
$upperLimit = ($this->getLimit()) ? $this->getLimit() : 1;
|
40 |
$itemPerRow = ($this->getItemsPerRow()) ? $this->getItemsPerRow() : 1 ;
|
41 |
+
$products_price = $this->getProductsPrice();
|
42 |
+
$review = $this->getReview();
|
|
|
|
|
|
|
|
|
43 |
?>
|
44 |
+
<?php if($this->getEnabled()): ?>
|
45 |
+
<?php if($this->getHeader()): ?>
|
46 |
<div class="sectionHead"><h2><?php if(count($result) > 0) { echo $this->getHeader(); } ?></h2></div>
|
47 |
+
<?php endif; ?>
|
48 |
<table border="0" cellpadding="0" cellspacing="0" class="productList">
|
|
|
49 |
<tr>
|
50 |
+
<?php
|
51 |
+
$i=0; $x = 1;
|
52 |
+
foreach($result as $result){
|
53 |
+
$_product = $this->getProducts($result);
|
54 |
+
if(!$_product){
|
55 |
+
continue;
|
56 |
+
}
|
57 |
+
if($x <= $upperLimit) {
|
58 |
+
if($i>($itemPerRow-1))
|
59 |
+
echo '<tr valign="top">';
|
60 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<td class="product">
|
62 |
<div class="prodimage">
|
63 |
<a href="<?php echo $this->getBaseUrl().$_product['url_path']; ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
|
64 |
+
<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']) ?>"/>
|
65 |
+
</a>
|
66 |
</div>
|
67 |
<div align="center">
|
68 |
<div class="prodDetails" align="center" style="width:150px;" >
|
69 |
+
<a href="<?php echo $this->getBaseUrl().$_product['url_path'] ?>" title="<?php echo $this->htmlEscape($_product['name']) ?>">
|
70 |
+
<?php echo $this->htmlEscape($_product['name']) ?>
|
71 |
+
</a>
|
72 |
<?php
|
73 |
+
if($review == 1) {
|
|
|
74 |
$_product = Mage::getModel('catalog/product')->load($_product->getId());
|
75 |
echo $this->getReviewsSummaryHtml($_product, 'short');
|
76 |
}
|
77 |
+
if($products_price == 1) {
|
|
|
78 |
$_product = Mage::getModel('catalog/product')->load($_product->getId());
|
79 |
echo $this->getPriceHtml($_product, true);
|
80 |
}
|
81 |
?>
|
82 |
</div>
|
83 |
+
<?php
|
84 |
+
|
85 |
+
$addtocartval = $this->getAddToCart();
|
86 |
+
if($addtocartval == 1){
|
87 |
if($_product->isSaleable()): ?>
|
88 |
+
<button class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
|
89 |
<?php else: ?>
|
90 |
+
<span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span>
|
91 |
+
<?php endif;
|
92 |
+
} ?>
|
93 |
</div>
|
94 |
<div class="cl">
|
95 |
+
<?php
|
96 |
+
$wishlists = $this->getActive();
|
97 |
if($wishlists == 1){
|
98 |
+
if ($this->helper('wishlist')->isAllow()) : ?>
|
99 |
+
<a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="addWishlist">
|
100 |
+
<?php echo $this->__('Add to Wishlist') ?>
|
101 |
+
</a>
|
102 |
+
<?php endif;
|
103 |
+
}?>
|
104 |
</div>
|
105 |
<div class="cl">
|
106 |
+
<?php
|
107 |
+
$addtocompare = $this->getAddToCompare();
|
108 |
+
if($addtocompare==1){
|
109 |
+
if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
110 |
+
<a href="<?php echo $_compareUrl; ?>" class="addCompare"><?php echo $this->__('Add to Compare') ?></a>
|
111 |
+
<?php endif;
|
112 |
+
} ?>
|
113 |
</div>
|
114 |
</td>
|
115 |
+
<?php
|
116 |
$i++;
|
117 |
+
if($i>($itemPerRow-1)) {
|
118 |
+
$i=0;
|
119 |
+
echo "</tr>";
|
120 |
+
echo '<tr><td colspan="3" class="hline"><img src="'. $this->getSkinUrl('images/spacer.gif') .'" alt="" /></td></tr>';
|
121 |
+
}
|
122 |
+
if($i==($itemPerRow)){
|
123 |
+
echo '<td class="vline"><img src="'. $this->getSkinUrl('images/spacer.gif') .'" alt=""/></td>';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
$x++;
|
127 |
+
}
|
128 |
+
?>
|
|
|
|
|
|
|
|
|
129 |
</tr>
|
130 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
<?php endif; ?>
|
app/etc/modules/CapacityWebSolutions_Bestseller.xml
CHANGED
@@ -1,19 +1,9 @@
|
|
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 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
</config>
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
+
<modules>
|
4 |
+
<CapacityWebSolutions_Bestseller>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</CapacityWebSolutions_Bestseller>
|
8 |
+
</modules>
|
9 |
</config>
|
js/bestseller/product-selector.js
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var VarienRulesForm = new Class.create();
|
2 |
+
VarienRulesForm.prototype = {
|
3 |
+
initialize : function(parent, newChildUrl){
|
4 |
+
this.parent = $(parent);
|
5 |
+
this.newChildUrl = newChildUrl;
|
6 |
+
this.shownElement = null;
|
7 |
+
this.updateElement = null;
|
8 |
+
this.chooserSelectedItems = $H({});
|
9 |
+
|
10 |
+
var elems = this.parent.getElementsByClassName('product-param');
|
11 |
+
for (var i=0; i<elems.length; i++) {
|
12 |
+
this.initParam(elems[i]);
|
13 |
+
}
|
14 |
+
|
15 |
+
var elems = this.parent.getElementsByClassName('product-param');
|
16 |
+
for (var i=0; i<elems.length; i++) {
|
17 |
+
var container = elems[i];
|
18 |
+
}
|
19 |
+
},
|
20 |
+
|
21 |
+
initParam: function (container) {
|
22 |
+
container.rulesObject = this;
|
23 |
+
var label = Element.down(container, '.label');
|
24 |
+
if (label) {
|
25 |
+
Event.observe(label, 'click', this.showParamInputField.bind(this, container));
|
26 |
+
}
|
27 |
+
var elem = Element.down(container, '.element');
|
28 |
+
if (elem) {
|
29 |
+
var trig = elem.down('.product-chooser-trigger');
|
30 |
+
if (trig) {
|
31 |
+
Event.observe(trig, 'click', this.toggleChooser.bind(this, container));
|
32 |
+
}
|
33 |
+
}
|
34 |
+
},
|
35 |
+
|
36 |
+
showChooserElement: function (chooser) {
|
37 |
+
this.chooserSelectedItems = $H({});
|
38 |
+
var values = this.updateElement.value.split(','), s = '';
|
39 |
+
for (i=0; i<values.length; i++) {
|
40 |
+
s = values[i].strip();
|
41 |
+
if (s!='') {
|
42 |
+
this.chooserSelectedItems.set(s,1);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
new Ajax.Request(chooser.getAttribute('url'), {
|
46 |
+
evalScripts: true,
|
47 |
+
parameters: {'form_key': FORM_KEY, 'selected[]':this.chooserSelectedItems.keys() },
|
48 |
+
onSuccess: function(transport) {
|
49 |
+
if (this._processSuccess(transport)) {
|
50 |
+
$(chooser).update(transport.responseText);
|
51 |
+
this.showChooserLoaded(chooser, transport);
|
52 |
+
}
|
53 |
+
}.bind(this),
|
54 |
+
onFailure: this._processFailure.bind(this)
|
55 |
+
});
|
56 |
+
},
|
57 |
+
|
58 |
+
showChooserLoaded: function(chooser, transport) {
|
59 |
+
chooser.style.display = 'block';
|
60 |
+
},
|
61 |
+
|
62 |
+
showChooser: function (container, event) {
|
63 |
+
var chooser = container.up('li');
|
64 |
+
if (!chooser) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
chooser = chooser.down('.product-chooser');
|
68 |
+
if (!chooser) {
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
this.showChooserElement(chooser);
|
72 |
+
},
|
73 |
+
|
74 |
+
hideChooser: function (container, event) {
|
75 |
+
var chooser = container.up('li');
|
76 |
+
if (!chooser) {
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
chooser = chooser.down('.product-chooser');
|
80 |
+
if (!chooser) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
chooser.style.display = 'none';
|
84 |
+
},
|
85 |
+
|
86 |
+
toggleChooser: function (container, event) {
|
87 |
+
var chooser = container.up('li').down('.product-chooser');
|
88 |
+
if (!chooser) {
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
if (chooser.style.display=='block') {
|
92 |
+
chooser.style.display = 'none';
|
93 |
+
this.cleanChooser(container, event);
|
94 |
+
} else {
|
95 |
+
this.showChooserElement(chooser);
|
96 |
+
}
|
97 |
+
},
|
98 |
+
|
99 |
+
cleanChooser: function (container, event) {
|
100 |
+
var chooser = container.up('li').down('.product-chooser');
|
101 |
+
if (!chooser) {
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
chooser.innerHTML = '';
|
105 |
+
},
|
106 |
+
|
107 |
+
showParamInputField: function (container, event) {
|
108 |
+
if (this.shownElement) {
|
109 |
+
this.hideParamInputField(this.shownElement, event);
|
110 |
+
}
|
111 |
+
|
112 |
+
Element.addClassName(container, 'product-param-edit');
|
113 |
+
var elemContainer = Element.down(container, '.element');
|
114 |
+
|
115 |
+
var elem = Element.down(elemContainer, 'input.input-text');
|
116 |
+
if (elem) {
|
117 |
+
elem.focus();
|
118 |
+
this.updateElement = elem;
|
119 |
+
}
|
120 |
+
|
121 |
+
var elem = Element.down(elemContainer, '.element-value-changer');
|
122 |
+
if (elem) {
|
123 |
+
elem.focus();
|
124 |
+
}
|
125 |
+
|
126 |
+
this.shownElement = container;
|
127 |
+
},
|
128 |
+
|
129 |
+
hideParamInputField: function (container, event) {
|
130 |
+
Element.removeClassName(container, 'product-param-edit');
|
131 |
+
var label = Element.down(container, '.label'), elem;
|
132 |
+
|
133 |
+
elem = Element.down(container, '.element-value-changer');
|
134 |
+
if (elem.value) {
|
135 |
+
this.addRuleNewChild(elem);
|
136 |
+
}
|
137 |
+
elem.value = '';
|
138 |
+
|
139 |
+
this.hideChooser(container, event);
|
140 |
+
this.updateElement = null;
|
141 |
+
|
142 |
+
this.shownElement = null;
|
143 |
+
},
|
144 |
+
|
145 |
+
_processSuccess : function(transport) {
|
146 |
+
if (transport.responseText.isJSON()) {
|
147 |
+
var response = transport.responseText.evalJSON()
|
148 |
+
if (response.error) {
|
149 |
+
alert(response.message);
|
150 |
+
}
|
151 |
+
if(response.ajaxExpired && response.ajaxRedirect) {
|
152 |
+
setLocation(response.ajaxRedirect);
|
153 |
+
}
|
154 |
+
return false;
|
155 |
+
}
|
156 |
+
return true;
|
157 |
+
},
|
158 |
+
|
159 |
+
_processFailure : function(transport) {
|
160 |
+
location.href = BASE_URL;
|
161 |
+
},
|
162 |
+
|
163 |
+
chooserGridRowInit: function (grid, row) {
|
164 |
+
if (!grid.reloadParams) {
|
165 |
+
grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
|
166 |
+
}
|
167 |
+
},
|
168 |
+
|
169 |
+
chooserGridRowClick: function (grid, event) {
|
170 |
+
var trElement = Event.findElement(event, 'tr');
|
171 |
+
var isInput = Event.element(event).tagName == 'INPUT';
|
172 |
+
if (trElement) {
|
173 |
+
var checkbox = Element.select(trElement, 'input');
|
174 |
+
if (checkbox[0]) {
|
175 |
+
var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
|
176 |
+
grid.setCheckboxChecked(checkbox[0], checked);
|
177 |
+
}
|
178 |
+
}
|
179 |
+
},
|
180 |
+
|
181 |
+
chooserGridCheckboxCheck: function (grid, element, checked) {
|
182 |
+
if (checked) {
|
183 |
+
if (!element.up('th')) {
|
184 |
+
this.chooserSelectedItems.set(element.value,1);
|
185 |
+
}
|
186 |
+
} else {
|
187 |
+
this.chooserSelectedItems.unset(element.value);
|
188 |
+
}
|
189 |
+
grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
|
190 |
+
this.updateElement.value = this.chooserSelectedItems.keys().join(', ');
|
191 |
+
}
|
192 |
+
|
193 |
+
};
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bestseller_products</name>
|
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>
|
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><required><php><min>5.0.0</min><max>5.6.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Bestseller_products</name>
|
4 |
+
<version>2.0.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 |
<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-05-01</date>
|
14 |
+
<time>04:50:34</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="cb48d4b5d632973adef3cc4c1977ee61"/><dir name="Tab"><file name="Products.php" hash="5d82ba60dbd4346409f7e4d7c65f58b5"/></dir><file name="Tabs.php" hash="2185eb940410d6a208a1a25d7c397a78"/></dir><file name="Edit.php" hash="01c361bf05b05cbe6be0c4f817cb29e7"/><file name="Grid.php" hash="27901cb0127803454a4153c935af551f"/></dir><file name="Bestseller.php" hash="9a22009a136f98f559a1c5b555385d1c"/><file name="DefaultDirectCode.php" hash="117cd5cf59c96e5c471a284106fb0ff9"/><file name="DefaultTemplate.php" hash="03fb2856a88cfa171945151a0952f49e"/><file name="DefaultXML.php" hash="ab80f41e1a6b70384ee3ab0cee2df0d0"/><file name="RwdDirectCode.php" hash="9ac9ef43ae4dfec09c0576299927638d"/><file name="RwdTemplate.php" hash="20c81d14ce4617d1b4c3812bacf7bac5"/><file name="RwdXML.php" hash="0ec29b553282fa3c37e36bbf43d89f9e"/></dir><file name="Bestseller.php" hash="9fbac7c71e7bd7ec73d9956a6fa8d0f0"/></dir><dir name="Helper"><file name="Data.php" hash="1c8d9ac17e5d6a5b58e6ff906430a388"/></dir><dir name="Model"><file name="Bestseller.php" hash="900702c933d327b8958c59bb051f17d8"/><dir name="Mysql4"><dir name="Bestseller"><file name="Collection.php" hash="06ff624ef1f765d506f34995fc4e7833"/></dir><file name="Bestseller.php" hash="117a28a48d5c1462d02452259ef4e4d8"/><dir name="Product"><file name="Collection.php" hash="ef490c00b8b46731b10e08c8b91d9261"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Bundleproducts.php" hash="e64d069873ad87ae67400f5d7731ceff"/><file name="Chooseproducts.php" hash="a25b1db2ef0cc3899e881e1155f9451a"/><file name="Orderstatus.php" hash="7b84a4f27d0bd95f076d904359d8f078"/><file name="Sortorder.php" hash="3b9725d2195c3776ed1963a86b883a9e"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BestsellerController.php" hash="5cb3439668413b32b99516869e3c4576"/></dir></dir><dir name="etc"><file name="config.xml" hash="3fc726e8e578db552aa44e43637d5314"/><file name="system.xml" hash="43e5d59a842ea43461624c3a0caff170"/></dir><dir name="sql"><dir name="bestseller_setup"><file name="mysql4-install-0.1.0.php" hash="0ec315634a0578bb0cf80555083183e5"/></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="d1799c0929b9adb63cbb4f9c031edcf0"/><file name="bestseller.phtml" hash="c0a007c23fd210111324c2990bf63fda"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bestseller.xml" hash="83d9c1c8982eeb2553a583f4afd7a609"/></dir><dir name="template"><dir name="bestseller"><file name="product.phtml" hash="7871c823013e0fb1acb8664f050f0e8c"/></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.7</max></php></required></dependencies>
|
18 |
</package>
|