Version Notes
This is an attribute manager for the cateogories. you can add attributes to the cateogories
Download this release
Release Info
Developer | Magento Core Team |
Extension | Santhosh_CategoryAttribute |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute.php +34 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit.php +89 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Form.php +33 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Tab/Main.php +233 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Tab/Options.php +30 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Tabs.php +53 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Grid.php +120 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Grid.php +58 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Main.php +390 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Main/Formset.php +76 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Main/Tree/Group.php +28 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Toolbar/Add.php +76 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Toolbar/Main.php +58 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Helper/Form/Apply.php +59 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Tab/Attributes.php +39 -0
- app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Tab/General.php +32 -0
- app/code/local/Santhosh/CategoryAttribute/Helper/Category.php +88 -0
- app/code/local/Santhosh/CategoryAttribute/Helper/Data.php +25 -0
- app/code/local/Santhosh/CategoryAttribute/Model/Mysql4/Category/Attribute/Collection.php +35 -0
- app/code/local/Santhosh/CategoryAttribute/controllers/Adminhtml/Catalog/Category/AttributeController.php +264 -0
- app/code/local/Santhosh/CategoryAttribute/controllers/Adminhtml/Catalog/Category/SetController.php +206 -0
- app/code/local/Santhosh/CategoryAttribute/etc/adminhtml.xml +72 -0
- app/code/local/Santhosh/CategoryAttribute/etc/config.xml +106 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Catalog/Category/Tab/Attributes.php +25 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Catalog/Category/Tab/General.php +25 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Template.php +25 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Form.php +25 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Form/Container.php +25 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Grid.php +25 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Grid/Container.php +25 -0
- app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Tabs.php +25 -0
- app/code/local/Santhosh/Core/Block/Eav/Adminhtml/Attribute/Edit/Main/Abstract.php +25 -0
- app/code/local/Santhosh/Core/Block/Eav/Adminhtml/Attribute/Edit/Options/Abstract.php +25 -0
- app/code/local/Santhosh/Core/Block/Eav/Adminhtml/Attribute/Grid/Abstract.php +25 -0
- app/code/local/Santhosh/Core/Helper/Abstract.php +25 -0
- app/code/local/Santhosh/Core/Helper/Data.php +25 -0
- app/code/local/Santhosh/Core/Model/Mysql4/Catalog/Category/Attribute/Collection.php +25 -0
- app/code/local/Santhosh/Core/etc/adminhtml.xml +42 -0
- app/code/local/Santhosh/Core/etc/config.xml +51 -0
- app/design/adminhtml/default/santhosh/layout/categoryattribute.xml +36 -0
- app/design/adminhtml/default/santhosh/template/catalog/category/attribute/js.phtml +312 -0
- app/design/adminhtml/default/santhosh/template/catalog/category/attribute/options.phtml +207 -0
- app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/main.phtml +433 -0
- app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/main/tree/attribute.phtml +26 -0
- app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/main/tree/group.phtml +22 -0
- app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/toolbar/add.phtml +36 -0
- app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/toolbar/main.phtml +31 -0
- package.xml +18 -0
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute extends Santhosh_Core_Block_Adminhtml_Widget_Grid_Container
|
23 |
+
{
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
$this->_controller = 'adminhtml_catalog_category_attribute';
|
28 |
+
$this->_blockGroup = 'category_attribute';
|
29 |
+
$this->_headerText = Mage::helper('category_attribute')->__('Manage Attributes');
|
30 |
+
$this->_addButtonLabel = Mage::helper('category_attribute')->__('Add New Attribute');
|
31 |
+
parent::__construct();
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Edit extends Santhosh_Core_Block_Adminhtml_Widget_Form_Container
|
23 |
+
{
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
$this->_objectId = 'attribute_id';
|
28 |
+
$this->_controller = 'adminhtml_catalog_category_attribute';
|
29 |
+
$this->_blockGroup = 'category_attribute';
|
30 |
+
|
31 |
+
parent::__construct();
|
32 |
+
|
33 |
+
if($this->getRequest()->getParam('popup')) {
|
34 |
+
$this->_removeButton('back');
|
35 |
+
$this->_addButton(
|
36 |
+
'close',
|
37 |
+
array(
|
38 |
+
'label' => Mage::helper('category_attribute')->__('Close Window'),
|
39 |
+
'class' => 'cancel',
|
40 |
+
'onclick' => 'window.close()',
|
41 |
+
'level' => -1
|
42 |
+
)
|
43 |
+
);
|
44 |
+
} else {
|
45 |
+
$this->_addButton(
|
46 |
+
'save_and_edit_button',
|
47 |
+
array(
|
48 |
+
'label' => Mage::helper('category_attribute')->__('Save and Continue Edit'),
|
49 |
+
'onclick' => 'saveAndContinueEdit()',
|
50 |
+
'class' => 'save'
|
51 |
+
),
|
52 |
+
100
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
$this->_updateButton('save', 'label', Mage::helper('category_attribute')->__('Save Attribute'));
|
57 |
+
$this->_updateButton('save', 'onclick', 'saveAttribute()');
|
58 |
+
|
59 |
+
if (! Mage::registry('entity_attribute')->getIsUserDefined()) {
|
60 |
+
$this->_removeButton('delete');
|
61 |
+
} else {
|
62 |
+
$this->_updateButton('delete', 'label', Mage::helper('category_attribute')->__('Delete Attribute'));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getHeaderText()
|
67 |
+
{
|
68 |
+
if (Mage::registry('entity_attribute')->getId()) {
|
69 |
+
$frontendLabel = Mage::registry('entity_attribute')->getFrontendLabel();
|
70 |
+
if (is_array($frontendLabel)) {
|
71 |
+
$frontendLabel = $frontendLabel[0];
|
72 |
+
}
|
73 |
+
return Mage::helper('category_attribute')->__('Edit Category Attribute "%s"', $this->htmlEscape($frontendLabel));
|
74 |
+
}
|
75 |
+
else {
|
76 |
+
return Mage::helper('category_attribute')->__('New Category Attribute');
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getValidationUrl()
|
81 |
+
{
|
82 |
+
return $this->getUrl('*/*/validate', array('_current'=>true));
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getSaveUrl()
|
86 |
+
{
|
87 |
+
return $this->getUrl('*/'.$this->_controller.'/save', array('_current'=>true, 'back'=>null));
|
88 |
+
}
|
89 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Form.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Edit_Form extends Santhosh_Core_Block_Adminhtml_Widget_Form
|
23 |
+
{
|
24 |
+
|
25 |
+
protected function _prepareForm()
|
26 |
+
{
|
27 |
+
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post'));
|
28 |
+
$form->setUseContainer(true);
|
29 |
+
$this->setForm($form);
|
30 |
+
return parent::_prepareForm();
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Tab/Main.php
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Edit_Tab_Main extends Santhosh_Core_Block_Eav_Adminhtml_Attribute_Edit_Main_Abstract
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Adding category form elements for editing attribute
|
26 |
+
*
|
27 |
+
* @return Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Edit_Tab_Main
|
28 |
+
*/
|
29 |
+
protected function _prepareForm()
|
30 |
+
{
|
31 |
+
parent::_prepareForm();
|
32 |
+
$attributeObject = $this->getAttributeObject();
|
33 |
+
/* @var $form Varien_Data_Form */
|
34 |
+
$form = $this->getForm();
|
35 |
+
/* @var $fieldset Varien_Data_Form_Element_Fieldset */
|
36 |
+
$fieldset = $form->getElement('base_fieldset');
|
37 |
+
|
38 |
+
$frontendInputElm = $form->getElement('frontend_input');
|
39 |
+
$additionalTypes = array();
|
40 |
+
$additionalTypes[] = array(
|
41 |
+
'value' => 'image',
|
42 |
+
'label' => Mage::helper('category_attribute')->__('Image')
|
43 |
+
);
|
44 |
+
|
45 |
+
$response = new Varien_Object();
|
46 |
+
$response->setTypes(array());
|
47 |
+
Mage::dispatchEvent('adminhtml_category_attribute_types', array('response'=>$response));
|
48 |
+
$_disabledTypes = array();
|
49 |
+
$_hiddenFields = array();
|
50 |
+
foreach ($response->getTypes() as $type) {
|
51 |
+
$additionalTypes[] = $type;
|
52 |
+
if (isset($type['hide_fields'])) {
|
53 |
+
$_hiddenFields[$type['value']] = $type['hide_fields'];
|
54 |
+
}
|
55 |
+
if (isset($type['disabled_types'])) {
|
56 |
+
$_disabledTypes[$type['value']] = $type['disabled_types'];
|
57 |
+
}
|
58 |
+
}
|
59 |
+
Mage::register('attribute_type_hidden_fields', $_hiddenFields);
|
60 |
+
Mage::register('attribute_type_disabled_types', $_disabledTypes);
|
61 |
+
|
62 |
+
$frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
|
63 |
+
$frontendInputElm->setValues($frontendInputValues);
|
64 |
+
|
65 |
+
$yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
|
66 |
+
|
67 |
+
$scopes = array(
|
68 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('category_attribute')->__('Store View'),
|
69 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('category_attribute')->__('Website'),
|
70 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('category_attribute')->__('Global'),
|
71 |
+
);
|
72 |
+
|
73 |
+
$fieldset->addField('is_global', 'select', array(
|
74 |
+
'name' => 'is_global',
|
75 |
+
'label' => Mage::helper('category_attribute')->__('Scope'),
|
76 |
+
'title' => Mage::helper('category_attribute')->__('Scope'),
|
77 |
+
'note' => Mage::helper('category_attribute')->__('Declare attribute value saving scope'),
|
78 |
+
'values'=> $scopes
|
79 |
+
), 'attribute_code');
|
80 |
+
|
81 |
+
$fieldset->addField('apply_to', 'apply', array(
|
82 |
+
'name' => 'apply_to[]',
|
83 |
+
'label' => Mage::helper('category_attribute')->__('Apply To'),
|
84 |
+
'values' => Mage_Catalog_Model_Product_Type::getOptions(),
|
85 |
+
'mode_labels' => array(
|
86 |
+
'all' => Mage::helper('category_attribute')->__('All Product Types'),
|
87 |
+
'custom' => Mage::helper('category_attribute')->__('Selected Product Types')
|
88 |
+
),
|
89 |
+
'required' => true
|
90 |
+
), 'frontend_class');
|
91 |
+
|
92 |
+
$fieldset->addField('is_configurable', 'select', array(
|
93 |
+
'name' => 'is_configurable',
|
94 |
+
'label' => Mage::helper('category_attribute')->__('Use To Create Configurable Product'),
|
95 |
+
'values' => $yesnoSource,
|
96 |
+
), 'apply_to');
|
97 |
+
|
98 |
+
// frontend properties fieldset
|
99 |
+
$fieldset = $form->addFieldset('front_fieldset', array('legend'=>Mage::helper('category_attribute')->__('Frontend Properties')));
|
100 |
+
|
101 |
+
$fieldset->addField('is_searchable', 'select', array(
|
102 |
+
'name' => 'is_searchable',
|
103 |
+
'label' => Mage::helper('category_attribute')->__('Use in Quick Search'),
|
104 |
+
'title' => Mage::helper('category_attribute')->__('Use in Quick Search'),
|
105 |
+
'values' => $yesnoSource,
|
106 |
+
));
|
107 |
+
|
108 |
+
$fieldset->addField('is_visible_in_advanced_search', 'select', array(
|
109 |
+
'name' => 'is_visible_in_advanced_search',
|
110 |
+
'label' => Mage::helper('category_attribute')->__('Use in Advanced Search'),
|
111 |
+
'title' => Mage::helper('category_attribute')->__('Use in Advanced Search'),
|
112 |
+
'values' => $yesnoSource,
|
113 |
+
));
|
114 |
+
|
115 |
+
$fieldset->addField('is_comparable', 'select', array(
|
116 |
+
'name' => 'is_comparable',
|
117 |
+
'label' => Mage::helper('category_attribute')->__('Comparable on Front-end'),
|
118 |
+
'title' => Mage::helper('category_attribute')->__('Comparable on Front-end'),
|
119 |
+
'values' => $yesnoSource,
|
120 |
+
));
|
121 |
+
|
122 |
+
$fieldset->addField('is_filterable', 'select', array(
|
123 |
+
'name' => 'is_filterable',
|
124 |
+
'label' => Mage::helper('category_attribute')->__("Use In Layered Navigation"),
|
125 |
+
'title' => Mage::helper('category_attribute')->__('Can be used only with catalog input type Dropdown and Multiple Select'),
|
126 |
+
'note' => Mage::helper('category_attribute')->__('Can be used only with catalog input type Dropdown and Multiple Select'),
|
127 |
+
'values' => array(
|
128 |
+
array('value' => '0', 'label' => Mage::helper('category_attribute')->__('No')),
|
129 |
+
array('value' => '1', 'label' => Mage::helper('category_attribute')->__('Filterable (with results)')),
|
130 |
+
array('value' => '2', 'label' => Mage::helper('category_attribute')->__('Filterable (no results)')),
|
131 |
+
),
|
132 |
+
));
|
133 |
+
|
134 |
+
$fieldset->addField('is_filterable_in_search', 'select', array(
|
135 |
+
'name' => 'is_filterable_in_search',
|
136 |
+
'label' => Mage::helper('category_attribute')->__("Use In Search Results Layered Navigation"),
|
137 |
+
'title' => Mage::helper('category_attribute')->__('Can be used only with catalog input type Dropdown and Multiple Select'),
|
138 |
+
'note' => Mage::helper('category_attribute')->__('Can be used only with catalog input type Dropdown and Multiple Select'),
|
139 |
+
'values' => $yesnoSource,
|
140 |
+
));
|
141 |
+
|
142 |
+
$fieldset->addField('is_used_for_promo_rules', 'select', array(
|
143 |
+
'name' => 'is_used_for_promo_rules',
|
144 |
+
'label' => Mage::helper('category_attribute')->__('Use for Promo Rule Conditions'),
|
145 |
+
'title' => Mage::helper('category_attribute')->__('Use for Promo Rule Conditions'),
|
146 |
+
'values' => $yesnoSource,
|
147 |
+
));
|
148 |
+
|
149 |
+
$fieldset->addField('position', 'text', array(
|
150 |
+
'name' => 'position',
|
151 |
+
'label' => Mage::helper('category_attribute')->__('Position'),
|
152 |
+
'title' => Mage::helper('category_attribute')->__('Position in Layered Navigation'),
|
153 |
+
'note' => Mage::helper('category_attribute')->__('Position of attribute in layered navigation block'),
|
154 |
+
'class' => 'validate-digits',
|
155 |
+
));
|
156 |
+
|
157 |
+
$fieldset->addField('is_wysiwyg_enabled', 'select', array(
|
158 |
+
'name' => 'is_wysiwyg_enabled',
|
159 |
+
'label' => Mage::helper('category_attribute')->__('Enable WYSIWYG'),
|
160 |
+
'title' => Mage::helper('category_attribute')->__('Enable WYSIWYG'),
|
161 |
+
'values' => $yesnoSource,
|
162 |
+
));
|
163 |
+
|
164 |
+
$htmlAllowed = $fieldset->addField('is_html_allowed_on_front', 'select', array(
|
165 |
+
'name' => 'is_html_allowed_on_front',
|
166 |
+
'label' => Mage::helper('category_attribute')->__('Allow HTML Tags on Frontend'),
|
167 |
+
'title' => Mage::helper('category_attribute')->__('Allow HTML Tags on Frontend'),
|
168 |
+
'values' => $yesnoSource,
|
169 |
+
));
|
170 |
+
if (!$attributeObject->getId() || $attributeObject->getIsWysiwygEnabled()) {
|
171 |
+
$attributeObject->setIsHtmlAllowedOnFront(1);
|
172 |
+
}
|
173 |
+
|
174 |
+
$fieldset->addField('is_visible_on_front', 'select', array(
|
175 |
+
'name' => 'is_visible_on_front',
|
176 |
+
'label' => Mage::helper('category_attribute')->__('Visible on Product View Page on Front-end'),
|
177 |
+
'title' => Mage::helper('category_attribute')->__('Visible on Product View Page on Front-end'),
|
178 |
+
'values' => $yesnoSource,
|
179 |
+
));
|
180 |
+
|
181 |
+
$fieldset->addField('used_in_product_listing', 'select', array(
|
182 |
+
'name' => 'used_in_product_listing',
|
183 |
+
'label' => Mage::helper('category_attribute')->__('Used in Product Listing'),
|
184 |
+
'title' => Mage::helper('category_attribute')->__('Used in Product Listing'),
|
185 |
+
'note' => Mage::helper('category_attribute')->__('Depends on design theme'),
|
186 |
+
'values' => $yesnoSource,
|
187 |
+
));
|
188 |
+
$fieldset->addField('used_for_sort_by', 'select', array(
|
189 |
+
'name' => 'used_for_sort_by',
|
190 |
+
'label' => Mage::helper('category_attribute')->__('Used for Sorting in Product Listing'),
|
191 |
+
'title' => Mage::helper('category_attribute')->__('Used for Sorting in Product Listing'),
|
192 |
+
'note' => Mage::helper('category_attribute')->__('Depends on design theme'),
|
193 |
+
'values' => $yesnoSource,
|
194 |
+
));
|
195 |
+
|
196 |
+
$form->getElement('apply_to')->setSize(5);
|
197 |
+
|
198 |
+
if ($applyTo = $attributeObject->getApplyTo()) {
|
199 |
+
$applyTo = is_array($applyTo) ? $applyTo : explode(',', $applyTo);
|
200 |
+
$form->getElement('apply_to')->setValue($applyTo);
|
201 |
+
} else {
|
202 |
+
$form->getElement('apply_to')->addClass('no-display ignore-validate');
|
203 |
+
}
|
204 |
+
|
205 |
+
// define field dependencies
|
206 |
+
$this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
|
207 |
+
->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')
|
208 |
+
->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')
|
209 |
+
->addFieldMap("frontend_input", 'frontend_input_type')
|
210 |
+
->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')
|
211 |
+
->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0')
|
212 |
+
);
|
213 |
+
|
214 |
+
Mage::dispatchEvent('adminhtml_catalog_category_attribute_edit_prepare_form', array(
|
215 |
+
'form' => $form,
|
216 |
+
'attribute' => $attributeObject
|
217 |
+
));
|
218 |
+
|
219 |
+
return $this;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Retrieve additional element types for category attributes
|
224 |
+
*
|
225 |
+
* @return array
|
226 |
+
*/
|
227 |
+
protected function _getAdditionalElementTypes()
|
228 |
+
{
|
229 |
+
return array(
|
230 |
+
'apply' => Mage::getConfig()->getBlockClassName('category_attribute/adminhtml_catalog_category_helper_form_apply'),
|
231 |
+
);
|
232 |
+
}
|
233 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Tab/Options.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Edit_Tab_Options extends Santhosh_Core_Block_Eav_Adminhtml_Attribute_Edit_Options_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$this->setTemplate('catalog/category/attribute/options.phtml');
|
29 |
+
}
|
30 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Edit/Tabs.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Edit_Tabs extends Santhosh_Core_Block_Adminhtml_Widget_Tabs
|
23 |
+
{
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$this->setId('category_attribute_tabs');
|
29 |
+
$this->setDestElementId('edit_form');
|
30 |
+
$this->setTitle(Mage::helper('category_attribute')->__('Attribute Information'));
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _beforeToHtml()
|
34 |
+
{
|
35 |
+
$this->addTab('main', array(
|
36 |
+
'label' => Mage::helper('category_attribute')->__('Properties'),
|
37 |
+
'title' => Mage::helper('category_attribute')->__('Properties'),
|
38 |
+
'content' => $this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_edit_tab_main')->toHtml(),
|
39 |
+
'active' => true
|
40 |
+
));
|
41 |
+
|
42 |
+
$model = Mage::registry('entity_attribute');
|
43 |
+
|
44 |
+
$this->addTab('labels', array(
|
45 |
+
'label' => Mage::helper('category_attribute')->__('Manage Label / Options'),
|
46 |
+
'title' => Mage::helper('category_attribute')->__('Manage Label / Options'),
|
47 |
+
'content' => $this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_edit_tab_options')->toHtml(),
|
48 |
+
));
|
49 |
+
|
50 |
+
return parent::_beforeToHtml();
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Grid.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Grid extends Santhosh_Core_Block_Eav_Adminhtml_Attribute_Grid_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$this->setId('attributeCategoryGrid');
|
29 |
+
$this->setDefaultSort('attribute_code');
|
30 |
+
$this->setDefaultDir('ASC');
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Prepare category attributes grid collection object
|
35 |
+
*
|
36 |
+
* @return Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Grid
|
37 |
+
*/
|
38 |
+
protected function _prepareCollection()
|
39 |
+
{
|
40 |
+
$collection = Mage::getResourceModel('catalog/category_attribute_collection')
|
41 |
+
->addVisibleFilter();
|
42 |
+
$this->setCollection($collection);
|
43 |
+
|
44 |
+
return parent::_prepareCollection();
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Prepare category attributes grid columns
|
49 |
+
*
|
50 |
+
* @return Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Grid
|
51 |
+
*/
|
52 |
+
protected function _prepareColumns()
|
53 |
+
{
|
54 |
+
parent::_prepareColumns();
|
55 |
+
|
56 |
+
$this->addColumnAfter('is_visible', array(
|
57 |
+
'header'=>Mage::helper('category_attribute')->__('Visible'),
|
58 |
+
'sortable'=>true,
|
59 |
+
'index'=>'is_visible_on_front',
|
60 |
+
'type' => 'options',
|
61 |
+
'options' => array(
|
62 |
+
'1' => Mage::helper('category_attribute')->__('Yes'),
|
63 |
+
'0' => Mage::helper('category_attribute')->__('No'),
|
64 |
+
),
|
65 |
+
'align' => 'center',
|
66 |
+
), 'frontend_label');
|
67 |
+
|
68 |
+
$this->addColumnAfter('is_global', array(
|
69 |
+
'header'=>Mage::helper('category_attribute')->__('Scope'),
|
70 |
+
'sortable'=>true,
|
71 |
+
'index'=>'is_global',
|
72 |
+
'type' => 'options',
|
73 |
+
'options' => array(
|
74 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('category_attribute')->__('Store View'),
|
75 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('category_attribute')->__('Website'),
|
76 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('category_attribute')->__('Global'),
|
77 |
+
),
|
78 |
+
'align' => 'center',
|
79 |
+
), 'is_visible');
|
80 |
+
|
81 |
+
$this->addColumn('is_searchable', array(
|
82 |
+
'header'=>Mage::helper('category_attribute')->__('Searchable'),
|
83 |
+
'sortable'=>true,
|
84 |
+
'index'=>'is_searchable',
|
85 |
+
'type' => 'options',
|
86 |
+
'options' => array(
|
87 |
+
'1' => Mage::helper('category_attribute')->__('Yes'),
|
88 |
+
'0' => Mage::helper('category_attribute')->__('No'),
|
89 |
+
),
|
90 |
+
'align' => 'center',
|
91 |
+
), 'is_user_defined');
|
92 |
+
|
93 |
+
$this->addColumnAfter('is_filterable', array(
|
94 |
+
'header'=>Mage::helper('category_attribute')->__('Use in Layered Navigation'),
|
95 |
+
'sortable'=>true,
|
96 |
+
'index'=>'is_filterable',
|
97 |
+
'type' => 'options',
|
98 |
+
'options' => array(
|
99 |
+
'1' => Mage::helper('category_attribute')->__('Filterable (with results)'),
|
100 |
+
'2' => Mage::helper('category_attribute')->__('Filterable (no results)'),
|
101 |
+
'0' => Mage::helper('category_attribute')->__('No'),
|
102 |
+
),
|
103 |
+
'align' => 'center',
|
104 |
+
), 'is_searchable');
|
105 |
+
|
106 |
+
$this->addColumnAfter('is_comparable', array(
|
107 |
+
'header'=>Mage::helper('category_attribute')->__('Comparable'),
|
108 |
+
'sortable'=>true,
|
109 |
+
'index'=>'is_comparable',
|
110 |
+
'type' => 'options',
|
111 |
+
'options' => array(
|
112 |
+
'1' => Mage::helper('category_attribute')->__('Yes'),
|
113 |
+
'0' => Mage::helper('category_attribute')->__('No'),
|
114 |
+
),
|
115 |
+
'align' => 'center',
|
116 |
+
), 'is_filterable');
|
117 |
+
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Grid.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Set_Grid extends Santhosh_Core_Block_Adminhtml_Widget_Grid
|
23 |
+
{
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$this->setId('categorySetGrid');
|
29 |
+
$this->setDefaultSort('set_id');
|
30 |
+
$this->setDefaultDir('asc');
|
31 |
+
$this->setSaveParametersInSession(true);
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function _prepareCollection()
|
35 |
+
{
|
36 |
+
$collection = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
37 |
+
->setEntityTypeFilter(Mage::registry('entityType'));
|
38 |
+
|
39 |
+
$this->setCollection($collection);
|
40 |
+
return parent::_prepareCollection();
|
41 |
+
}
|
42 |
+
|
43 |
+
protected function _prepareColumns()
|
44 |
+
{
|
45 |
+
|
46 |
+
$this->addColumn('set_name', array(
|
47 |
+
'header' => Mage::helper('category_attribute')->__('Set Name'),
|
48 |
+
'align' => 'left',
|
49 |
+
'sortable' => true,
|
50 |
+
'index' => 'attribute_set_name',
|
51 |
+
));
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getRowUrl($row)
|
55 |
+
{
|
56 |
+
return $this->getUrl('*/*/edit', array('id'=>$row->getAttributeSetId()));
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Main.php
ADDED
@@ -0,0 +1,390 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Set_Main extends Santhosh_Core_Block_Adminhtml_Template
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Initialize template
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
protected function _construct()
|
29 |
+
{
|
30 |
+
$this->setTemplate('catalog/category/attribute/set/main.phtml');
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Prepare Global Layout
|
35 |
+
*
|
36 |
+
* @return Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Set_Main
|
37 |
+
*/
|
38 |
+
protected function _prepareLayout()
|
39 |
+
{
|
40 |
+
$setId = $this->_getSetId();
|
41 |
+
|
42 |
+
$this->setChild('group_tree',
|
43 |
+
$this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_main_tree_group')
|
44 |
+
);
|
45 |
+
|
46 |
+
$this->setChild('edit_set_form',
|
47 |
+
$this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_main_formset')
|
48 |
+
);
|
49 |
+
|
50 |
+
$this->setChild('delete_group_button',
|
51 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
52 |
+
'label' => Mage::helper('category_attribute')->__('Delete Selected Group'),
|
53 |
+
'onclick' => 'editSet.submit();',
|
54 |
+
'class' => 'delete'
|
55 |
+
)));
|
56 |
+
|
57 |
+
$this->setChild('add_group_button',
|
58 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
59 |
+
'label' => Mage::helper('category_attribute')->__('Add New'),
|
60 |
+
'onclick' => 'editSet.addGroup();',
|
61 |
+
'class' => 'add'
|
62 |
+
)));
|
63 |
+
|
64 |
+
$this->setChild('back_button',
|
65 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
66 |
+
'label' => Mage::helper('category_attribute')->__('Back'),
|
67 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/').'\')',
|
68 |
+
'class' => 'back'
|
69 |
+
)));
|
70 |
+
|
71 |
+
$this->setChild('reset_button',
|
72 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
73 |
+
'label' => Mage::helper('category_attribute')->__('Reset'),
|
74 |
+
'onclick' => 'window.location.reload()'
|
75 |
+
)));
|
76 |
+
|
77 |
+
$this->setChild('save_button',
|
78 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
79 |
+
'label' => Mage::helper('category_attribute')->__('Save Attribute Set'),
|
80 |
+
'onclick' => 'editSet.save();',
|
81 |
+
'class' => 'save'
|
82 |
+
)));
|
83 |
+
|
84 |
+
$this->setChild('delete_button',
|
85 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
86 |
+
'label' => Mage::helper('category_attribute')->__('Delete Attribute Set'),
|
87 |
+
'onclick' => 'deleteConfirm(\''. $this->jsQuoteEscape(Mage::helper('category_attribute')->__('All categories of this set will be deleted! Are you sure you want to delete this attribute set?')) . '\', \'' . $this->getUrl('*/*/delete', array('id' => $setId)) . '\')',
|
88 |
+
'class' => 'delete'
|
89 |
+
)));
|
90 |
+
|
91 |
+
$this->setChild('rename_button',
|
92 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
93 |
+
'label' => Mage::helper('category_attribute')->__('New Set Name'),
|
94 |
+
'onclick' => 'editSet.rename()'
|
95 |
+
)));
|
96 |
+
|
97 |
+
return parent::_prepareLayout();
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Retrieve Attribute Set Group Tree HTML
|
102 |
+
*
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function getGroupTreeHtml()
|
106 |
+
{
|
107 |
+
return $this->getChildHtml('group_tree');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Retrieve Attribute Set Edit Form HTML
|
112 |
+
*
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
public function getSetFormHtml()
|
116 |
+
{
|
117 |
+
return $this->getChildHtml('edit_set_form');
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Retrieve Block Header Text
|
122 |
+
*
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
+
protected function _getHeader()
|
126 |
+
{
|
127 |
+
return Mage::helper('category_attribute')->__("Edit Attribute Set '%s'", $this->_getAttributeSet()->getAttributeSetName());
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Retrieve Attribute Set Save URL
|
132 |
+
*
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
public function getMoveUrl()
|
136 |
+
{
|
137 |
+
return $this->getUrl('*/catalog_category_set/save', array('id' => $this->_getSetId()));
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Retrieve Attribute Set Group Save URL
|
142 |
+
*
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
+
public function getGroupUrl()
|
146 |
+
{
|
147 |
+
return $this->getUrl('*/catalog_category_group/save', array('id' => $this->_getSetId()));
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Retrieve Attribute Set Group Tree as JSON format
|
152 |
+
*
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
public function getGroupTreeJson()
|
156 |
+
{
|
157 |
+
$items = array();
|
158 |
+
$setId = $this->_getSetId();
|
159 |
+
|
160 |
+
/* @var $groups Mage_Eav_Model_Mysql4_Entity_Attribute_Group_Collection */
|
161 |
+
$groups = Mage::getModel('eav/entity_attribute_group')
|
162 |
+
->getResourceCollection()
|
163 |
+
->setAttributeSetFilter($setId)
|
164 |
+
->load();
|
165 |
+
|
166 |
+
/* @var $node Mage_Eav_Model_Entity_Attribute_Group */
|
167 |
+
foreach ($groups as $node) {
|
168 |
+
$item = array();
|
169 |
+
$item['text'] = $node->getAttributeGroupName();
|
170 |
+
$item['id'] = $node->getAttributeGroupId();
|
171 |
+
$item['cls'] = 'folder';
|
172 |
+
$item['allowDrop'] = true;
|
173 |
+
$item['allowDrag'] = true;
|
174 |
+
|
175 |
+
$nodeChildren = Mage::getResourceModel('category_attribute/category_attribute_collection')
|
176 |
+
->setAttributeGroupFilter($node->getId())
|
177 |
+
->addVisibleFilter()
|
178 |
+
->load();
|
179 |
+
|
180 |
+
if ($nodeChildren->getSize() > 0) {
|
181 |
+
$item['children'] = array();
|
182 |
+
foreach ($nodeChildren->getItems() as $child) {
|
183 |
+
/* @var $child Mage_Eav_Model_Entity_Attribute */
|
184 |
+
$attr = array(
|
185 |
+
'text' => $child->getAttributeCode(),
|
186 |
+
'id' => $child->getAttributeId(),
|
187 |
+
'cls' => (!$child->getIsUserDefined()) ? 'system-leaf' : 'leaf',
|
188 |
+
'allowDrop' => false,
|
189 |
+
'allowDrag' => true,
|
190 |
+
'leaf' => true,
|
191 |
+
'is_user_defined' => $child->getIsUserDefined(),
|
192 |
+
'entity_id' => $child->getEntityAttributeId()
|
193 |
+
);
|
194 |
+
|
195 |
+
$item['children'][] = $attr;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
$items[] = $item;
|
200 |
+
}
|
201 |
+
|
202 |
+
return Mage::helper('core')->jsonEncode($items);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Retrieve Unused in Attribute Set Attribute Tree as JSON
|
207 |
+
*
|
208 |
+
* @return string
|
209 |
+
*/
|
210 |
+
public function getAttributeTreeJson()
|
211 |
+
{
|
212 |
+
$items = array();
|
213 |
+
$setId = $this->_getSetId();
|
214 |
+
|
215 |
+
$collection = Mage::getResourceModel('category_attribute/category_attribute_collection')
|
216 |
+
->setAttributeSetFilter($setId)
|
217 |
+
->load();
|
218 |
+
|
219 |
+
$attributesIds = array('0');
|
220 |
+
/* @var $item Mage_Eav_Model_Entity_Attribute */
|
221 |
+
foreach ($collection->getItems() as $item) {
|
222 |
+
$attributesIds[] = $item->getAttributeId();
|
223 |
+
}
|
224 |
+
|
225 |
+
$attributes = Mage::getResourceModel('category_attribute/category_attribute_collection')
|
226 |
+
->setAttributesExcludeFilter($attributesIds)
|
227 |
+
->addVisibleFilter()
|
228 |
+
->load();
|
229 |
+
|
230 |
+
foreach ($attributes as $child) {
|
231 |
+
$attr = array(
|
232 |
+
'text' => $child->getAttributeCode(),
|
233 |
+
'id' => $child->getAttributeId(),
|
234 |
+
'cls' => 'leaf',
|
235 |
+
'allowDrop' => false,
|
236 |
+
'allowDrag' => true,
|
237 |
+
'leaf' => true,
|
238 |
+
'is_user_defined' => $child->getIsUserDefined(),
|
239 |
+
'entity_id' => $child->getEntityId()
|
240 |
+
);
|
241 |
+
|
242 |
+
$items[] = $attr;
|
243 |
+
}
|
244 |
+
|
245 |
+
if (count($items) == 0) {
|
246 |
+
$items[] = array(
|
247 |
+
'text' => Mage::helper('category_attribute')->__('Empty'),
|
248 |
+
'id' => 'empty',
|
249 |
+
'cls' => 'folder',
|
250 |
+
'allowDrop' => false,
|
251 |
+
'allowDrag' => false,
|
252 |
+
);
|
253 |
+
}
|
254 |
+
|
255 |
+
return Mage::helper('core')->jsonEncode($items);
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Retrieve Back Button HTML
|
260 |
+
*
|
261 |
+
* @return string
|
262 |
+
*/
|
263 |
+
public function getBackButtonHtml()
|
264 |
+
{
|
265 |
+
return $this->getChildHtml('back_button');
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Retrieve Reset Button HTML
|
270 |
+
*
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
public function getResetButtonHtml()
|
274 |
+
{
|
275 |
+
return $this->getChildHtml('reset_button');
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Retrieve Save Button HTML
|
280 |
+
*
|
281 |
+
* @return string
|
282 |
+
*/
|
283 |
+
public function getSaveButtonHtml()
|
284 |
+
{
|
285 |
+
return $this->getChildHtml('save_button');
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Retrieve Delete Button HTML
|
290 |
+
*
|
291 |
+
* @return string
|
292 |
+
*/
|
293 |
+
public function getDeleteButtonHtml()
|
294 |
+
{
|
295 |
+
if ($this->getIsCurrentSetDefault()) {
|
296 |
+
return '';
|
297 |
+
}
|
298 |
+
return $this->getChildHtml('delete_button');
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Retrieve Delete Group Button HTML
|
303 |
+
*
|
304 |
+
* @return string
|
305 |
+
*/
|
306 |
+
public function getDeleteGroupButton()
|
307 |
+
{
|
308 |
+
return $this->getChildHtml('delete_group_button');
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Retrieve Add New Group Button HTML
|
313 |
+
*
|
314 |
+
* @return string
|
315 |
+
*/
|
316 |
+
public function getAddGroupButton()
|
317 |
+
{
|
318 |
+
return $this->getChildHtml('add_group_button');
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Retrieve Rename Button HTML
|
323 |
+
*
|
324 |
+
* @return string
|
325 |
+
*/
|
326 |
+
public function getRenameButton()
|
327 |
+
{
|
328 |
+
return $this->getChildHtml('rename_button');
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Retrieve current Attribute Set object
|
333 |
+
*
|
334 |
+
* @return Mage_Eav_Model_Entity_Attribute_Set
|
335 |
+
*/
|
336 |
+
protected function _getAttributeSet()
|
337 |
+
{
|
338 |
+
return Mage::registry('current_attribute_set');
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Retrieve current attribute set Id
|
343 |
+
*
|
344 |
+
* @return int
|
345 |
+
*/
|
346 |
+
protected function _getSetId()
|
347 |
+
{
|
348 |
+
return $this->_getAttributeSet()->getId();
|
349 |
+
}
|
350 |
+
|
351 |
+
/**
|
352 |
+
* Check Current Attribute Set is a default
|
353 |
+
*
|
354 |
+
* @return bool
|
355 |
+
*/
|
356 |
+
public function getIsCurrentSetDefault()
|
357 |
+
{
|
358 |
+
$isDefault = $this->getData('is_current_set_default');
|
359 |
+
if (is_null($isDefault)) {
|
360 |
+
$defaultSetId = Mage::getModel('eav/entity_type')
|
361 |
+
->load(Mage::registry('entityType'))
|
362 |
+
->getDefaultAttributeSetId();
|
363 |
+
$isDefault = $this->_getSetId() == $defaultSetId;
|
364 |
+
$this->setData('is_current_set_default', $isDefault);
|
365 |
+
}
|
366 |
+
return $isDefault;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Retrieve current Attribute Set object
|
371 |
+
*
|
372 |
+
* @deprecated use _getAttributeSet
|
373 |
+
* @return Mage_Eav_Model_Entity_Attribute_Set
|
374 |
+
*/
|
375 |
+
protected function _getSetData()
|
376 |
+
{
|
377 |
+
return $this->_getAttributeSet();
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Prepare HTML
|
382 |
+
*
|
383 |
+
* @return string
|
384 |
+
*/
|
385 |
+
protected function _toHtml()
|
386 |
+
{
|
387 |
+
Mage::dispatchEvent('adminhtml_catalog_category_attribute_set_main_html_before', array('block' => $this));
|
388 |
+
return parent::_toHtml();
|
389 |
+
}
|
390 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Main/Formset.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Set_Main_Formset extends Santhosh_Core_Block_Adminhtml_Widget_Form
|
23 |
+
{
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
parent::__construct();
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _prepareForm()
|
30 |
+
{
|
31 |
+
$data = Mage::getModel('eav/entity_attribute_set')
|
32 |
+
->load($this->getRequest()->getParam('id'));
|
33 |
+
|
34 |
+
$form = new Varien_Data_Form();
|
35 |
+
$fieldset = $form->addFieldset('set_name', array('legend'=> Mage::helper('category_attribute')->__('Edit Set Name')));
|
36 |
+
$fieldset->addField('attribute_set_name', 'text',
|
37 |
+
array(
|
38 |
+
'label' => Mage::helper('category_attribute')->__('Name'),
|
39 |
+
'note' => Mage::helper('category_attribute')->__('For internal use.'),
|
40 |
+
'name' => 'attribute_set_name',
|
41 |
+
'required' => true,
|
42 |
+
'class' => 'required-entry',
|
43 |
+
'value' => $data->getAttributeSetName()
|
44 |
+
));
|
45 |
+
|
46 |
+
if( !$this->getRequest()->getParam('id', false) ) {
|
47 |
+
$fieldset->addField('gotoEdit', 'hidden',
|
48 |
+
array(
|
49 |
+
'name' => 'gotoEdit',
|
50 |
+
'value' => '1'
|
51 |
+
));
|
52 |
+
|
53 |
+
$sets = Mage::getModel('eav/entity_attribute_set')
|
54 |
+
->getResourceCollection()
|
55 |
+
->setEntityTypeFilter(Mage::registry('entityType'))
|
56 |
+
->load()
|
57 |
+
->toOptionArray();
|
58 |
+
|
59 |
+
$fieldset->addField('skeleton_set', 'select',
|
60 |
+
array(
|
61 |
+
'label' => Mage::helper('category_attribute')->__('Based On'),
|
62 |
+
'name' => 'skeleton_set',
|
63 |
+
'required' => true,
|
64 |
+
'class' => 'required-entry',
|
65 |
+
'values' => $sets,
|
66 |
+
));
|
67 |
+
}
|
68 |
+
|
69 |
+
$form->setMethod('post');
|
70 |
+
$form->setUseContainer(true);
|
71 |
+
$form->setId('set_prop_form');
|
72 |
+
$form->setAction($this->getUrl('*/*/save'));
|
73 |
+
$form->setOnsubmit('return false;');
|
74 |
+
$this->setForm($form);
|
75 |
+
}
|
76 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Main/Tree/Group.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Set_Main_Tree_Group extends Santhosh_Core_Block_Adminhtml_Template
|
23 |
+
{
|
24 |
+
protected function _construct()
|
25 |
+
{
|
26 |
+
$this->setTemplate('catalog/category/attribute/set/main/tree/group.phtml');
|
27 |
+
}
|
28 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Toolbar/Add.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Set_Toolbar_Add extends Santhosh_Core_Block_Adminhtml_Template
|
23 |
+
{
|
24 |
+
protected function _construct()
|
25 |
+
{
|
26 |
+
$this->setTemplate('catalog/category/attribute/set/toolbar/add.phtml');
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _prepareLayout()
|
30 |
+
{
|
31 |
+
$this->setChild('save_button',
|
32 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
33 |
+
->setData(array(
|
34 |
+
'label' => Mage::helper('category_attribute')->__('Save Attribute Set'),
|
35 |
+
'onclick' => 'addSet.submit();',
|
36 |
+
'class' => 'save'
|
37 |
+
)));
|
38 |
+
$this->setChild('back_button',
|
39 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
40 |
+
->setData(array(
|
41 |
+
'label' => Mage::helper('category_attribute')->__('Back'),
|
42 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/').'\')',
|
43 |
+
'class' => 'back'
|
44 |
+
)));
|
45 |
+
|
46 |
+
$this->setChild('setForm',
|
47 |
+
$this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_main_formset')
|
48 |
+
);
|
49 |
+
return parent::_prepareLayout();
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _getHeader()
|
53 |
+
{
|
54 |
+
return Mage::helper('category_attribute')->__('Add New Attribute Set');
|
55 |
+
}
|
56 |
+
|
57 |
+
protected function getSaveButtonHtml()
|
58 |
+
{
|
59 |
+
return $this->getChildHtml('save_button');
|
60 |
+
}
|
61 |
+
|
62 |
+
protected function getBackButtonHtml()
|
63 |
+
{
|
64 |
+
return $this->getChildHtml('back_button');
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function getFormHtml()
|
68 |
+
{
|
69 |
+
return $this->getChildHtml('setForm');
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function getFormId()
|
73 |
+
{
|
74 |
+
return $this->getChild('setForm')->getForm()->getId();
|
75 |
+
}
|
76 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Attribute/Set/Toolbar/Main.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Set_Toolbar_Main extends Santhosh_Core_Block_Adminhtml_Widget_Form_Container
|
23 |
+
{
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
parent::__construct();
|
27 |
+
$this->setTemplate('catalog/category/attribute/set/toolbar/main.phtml');
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareLayout()
|
31 |
+
{
|
32 |
+
$this->setChild('addButton',
|
33 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
34 |
+
->setData(array(
|
35 |
+
'label' => Mage::helper('category_attribute')->__('Add New Set'),
|
36 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/add') . '\')',
|
37 |
+
'class' => 'add',
|
38 |
+
))
|
39 |
+
);
|
40 |
+
return parent::_prepareLayout();
|
41 |
+
}
|
42 |
+
|
43 |
+
protected function getNewButtonHtml()
|
44 |
+
{
|
45 |
+
return $this->getChildHtml('addButton');
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function _getHeader()
|
49 |
+
{
|
50 |
+
return Mage::helper('category_attribute')->__('Manage Attribute Sets');
|
51 |
+
}
|
52 |
+
|
53 |
+
protected function _toHtml()
|
54 |
+
{
|
55 |
+
Mage::dispatchEvent('adminhtml_catalog_category_attribute_set_toolbar_main_html_before', array('block' => $this));
|
56 |
+
return parent::_toHtml();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Helper/Form/Apply.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Helper_Form_Apply extends Varien_Data_Form_Element_Multiselect
|
23 |
+
{
|
24 |
+
public function getElementHtml()
|
25 |
+
{
|
26 |
+
$elementAttributeHtml = '';
|
27 |
+
|
28 |
+
if ($this->getReadonly()) {
|
29 |
+
$elementAttributeHtml = $elementAttributeHtml . ' readonly="readonly"';
|
30 |
+
}
|
31 |
+
|
32 |
+
if ($this->getDisabled()) {
|
33 |
+
$elementAttributeHtml = $elementAttributeHtml . ' disabled="disabled"';
|
34 |
+
}
|
35 |
+
|
36 |
+
$html = '<select onchange="toggleApplyVisibility(this)"' . $elementAttributeHtml . '>'
|
37 |
+
. '<option value="0">' . $this->getModeLabels('all'). '</option>'
|
38 |
+
. '<option value="1" ' . ($this->getValue()==null ? '' : 'selected') . '>' . $this->getModeLabels('custom'). '</option>'
|
39 |
+
. '</select><br /><br />';
|
40 |
+
|
41 |
+
$html .= parent::getElementHtml();
|
42 |
+
return $html;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Dublicate interface of Varien_Data_Form_Element_Abstract::setReadonly
|
47 |
+
*
|
48 |
+
* @param bool $readonly
|
49 |
+
* @param bool $useDisabled
|
50 |
+
* @return Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Helper_Form_Apply
|
51 |
+
*/
|
52 |
+
public function setReadonly($readonly, $useDisabled = false)
|
53 |
+
{
|
54 |
+
$this->setData('readonly', $readonly);
|
55 |
+
$this->setData('disabled', $useDisabled);
|
56 |
+
return $this;
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Tab/Attributes.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Tab_Attributes extends Santhosh_Core_Block_Adminhtml_Catalog_Category_Tab_Attributes
|
23 |
+
{
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retrieve Additional Element Types
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
protected function _getAdditionalElementTypes()
|
31 |
+
{
|
32 |
+
return array(
|
33 |
+
'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_category_helper_image'),
|
34 |
+
'textarea' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_helper_form_wysiwyg'),
|
35 |
+
'boolean' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_boolean')
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Block/Adminhtml/Catalog/Category/Tab/General.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Tab_General extends Santhosh_Core_Block_Adminhtml_Catalog_Category_Tab_General
|
23 |
+
{
|
24 |
+
|
25 |
+
protected function _getAdditionalElementTypes()
|
26 |
+
{
|
27 |
+
return array(
|
28 |
+
'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_category_helper_image'),
|
29 |
+
'boolean' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_boolean')
|
30 |
+
);
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Helper/Category.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Helper_Category extends Santhosh_Core_Helper_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Return information array of category attribute input types
|
27 |
+
* Only a small number of settings returned, so we won't break anything in current dataflow
|
28 |
+
* As soon as development process goes on we need to add there all possible settings
|
29 |
+
*
|
30 |
+
* @param string $inputType
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
public function getAttributeInputTypes($inputType = null)
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* @todo specify there all relations for properties depending on input type
|
37 |
+
*/
|
38 |
+
$inputTypes = array(
|
39 |
+
'multiselect' => array(
|
40 |
+
'backend_model' => 'eav/entity_attribute_backend_array'
|
41 |
+
),
|
42 |
+
'boolean' => array(
|
43 |
+
'source_model' => 'eav/entity_attribute_source_boolean'
|
44 |
+
),
|
45 |
+
'image' => array (
|
46 |
+
'backend_model' => 'catalog/category_attribute_backend_image'
|
47 |
+
)
|
48 |
+
);
|
49 |
+
|
50 |
+
if (is_null($inputType)) {
|
51 |
+
return $inputTypes;
|
52 |
+
} else if (isset($inputTypes[$inputType])) {
|
53 |
+
return $inputTypes[$inputType];
|
54 |
+
}
|
55 |
+
return array();
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Return default attribute backend model by input type
|
60 |
+
*
|
61 |
+
* @param string $inputType
|
62 |
+
* @return string|null
|
63 |
+
*/
|
64 |
+
public function getAttributeBackendModelByInputType($inputType)
|
65 |
+
{
|
66 |
+
$inputTypes = $this->getAttributeInputTypes();
|
67 |
+
if (!empty($inputTypes[$inputType]['backend_model'])) {
|
68 |
+
return $inputTypes[$inputType]['backend_model'];
|
69 |
+
}
|
70 |
+
return null;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Return default attribute source model by input type
|
75 |
+
*
|
76 |
+
* @param string $inputType
|
77 |
+
* @return string|null
|
78 |
+
*/
|
79 |
+
public function getAttributeSourceModelByInputType($inputType)
|
80 |
+
{
|
81 |
+
$inputTypes = $this->getAttributeInputTypes();
|
82 |
+
if (!empty($inputTypes[$inputType]['source_model'])) {
|
83 |
+
return $inputTypes[$inputType]['source_model'];
|
84 |
+
}
|
85 |
+
return null;
|
86 |
+
}
|
87 |
+
|
88 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Helper/Data.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Helper_Data extends Santhosh_Core_Helper_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/Model/Mysql4/Category/Attribute/Collection.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Model_Mysql4_Category_Attribute_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Collection
|
23 |
+
{
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Specify filter by "is_visible" field
|
27 |
+
*
|
28 |
+
* @return Santhosh_CategoryAttribute_Model_Mysql4_Category_Attribute_Collection
|
29 |
+
*/
|
30 |
+
public function addVisibleFilter()
|
31 |
+
{
|
32 |
+
$this->getSelect()->where('additional_table.is_visible = ?', 1);
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/controllers/Adminhtml/Catalog/Category/AttributeController.php
ADDED
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Adminhtml_Catalog_Category_AttributeController extends Mage_Adminhtml_Controller_Action
|
23 |
+
{
|
24 |
+
|
25 |
+
protected $_entityTypeId;
|
26 |
+
|
27 |
+
public function getHelper() {
|
28 |
+
return Mage::helper('category_attribute');
|
29 |
+
}
|
30 |
+
|
31 |
+
public function preDispatch()
|
32 |
+
{
|
33 |
+
parent::preDispatch();
|
34 |
+
$this->_entityTypeId = Mage::getModel('eav/entity')->setType('catalog_category')->getTypeId();
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function _initAction()
|
38 |
+
{
|
39 |
+
$this->_title($this->getHelper()->__('Category Attributes'))
|
40 |
+
->_title($this->getHelper()->__('Manage Attributes'));
|
41 |
+
|
42 |
+
if($this->getRequest()->getParam('popup')) {
|
43 |
+
$this->loadLayout('popup');
|
44 |
+
} else {
|
45 |
+
$this->loadLayout()
|
46 |
+
->_setActiveMenu('santhosh_core/category_attribute')
|
47 |
+
->_addBreadcrumb($this->getHelper()->__('Category Attributes'), $this->getHelper()->__('Category Attributes'))
|
48 |
+
->_addBreadcrumb($this->getHelper()->__('Manage Category Attributes'), $this->getHelper()->__('Manage Category Attributes'));
|
49 |
+
}
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function indexAction()
|
54 |
+
{
|
55 |
+
$this->_initAction()
|
56 |
+
->_addContent($this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute'))
|
57 |
+
->renderLayout();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function newAction()
|
61 |
+
{
|
62 |
+
$this->_forward('edit');
|
63 |
+
}
|
64 |
+
|
65 |
+
public function editAction()
|
66 |
+
{
|
67 |
+
$id = $this->getRequest()->getParam('attribute_id');
|
68 |
+
$model = Mage::getModel('catalog/resource_eav_attribute')
|
69 |
+
->setEntityTypeId($this->_entityTypeId);
|
70 |
+
if ($id) {
|
71 |
+
$model->load($id);
|
72 |
+
|
73 |
+
if (! $model->getId()) {
|
74 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getHelper()->__('This attribute no longer exists'));
|
75 |
+
$this->_redirect('*/*/');
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
// entity type check
|
80 |
+
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
81 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getHelper()->__('This attribute cannot be edited.'));
|
82 |
+
$this->_redirect('*/*/');
|
83 |
+
return;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
// set entered data if was error when we do save
|
88 |
+
$data = Mage::getSingleton('adminhtml/session')->getCategoryAttributeData(true);
|
89 |
+
if (! empty($data)) {
|
90 |
+
$model->addData($data);
|
91 |
+
}
|
92 |
+
|
93 |
+
Mage::register('entity_attribute', $model);
|
94 |
+
|
95 |
+
$this->_initAction();
|
96 |
+
|
97 |
+
$this->_title($id ? $model->getName() : $this->getHelper()->__('New Attribute'));
|
98 |
+
|
99 |
+
$item = $id ? $this->getHelper()->__('Edit Category Attribute') : $this->getHelper()->__('New Category Attribute');
|
100 |
+
|
101 |
+
$this->_addBreadcrumb($item, $item);
|
102 |
+
|
103 |
+
$this->getLayout()->getBlock('attribute_edit_js')
|
104 |
+
->setIsPopup((bool)$this->getRequest()->getParam('popup'));
|
105 |
+
|
106 |
+
$this->renderLayout();
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
public function validateAction()
|
111 |
+
{
|
112 |
+
$response = new Varien_Object();
|
113 |
+
$response->setError(false);
|
114 |
+
|
115 |
+
$attributeCode = $this->getRequest()->getParam('attribute_code');
|
116 |
+
$attributeId = $this->getRequest()->getParam('attribute_id');
|
117 |
+
$attribute = Mage::getModel('catalog/resource_eav_attribute')
|
118 |
+
->loadByCode($this->_entityTypeId, $attributeCode);
|
119 |
+
|
120 |
+
if ($attribute->getId() && !$attributeId) {
|
121 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getHelper()->__('Attribute with the same code already exists'));
|
122 |
+
$this->_initLayoutMessages('adminhtml/session');
|
123 |
+
$response->setError(true);
|
124 |
+
$response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
|
125 |
+
}
|
126 |
+
|
127 |
+
$this->getResponse()->setBody($response->toJson());
|
128 |
+
}
|
129 |
+
|
130 |
+
public function saveAction()
|
131 |
+
{
|
132 |
+
if ($data = $this->getRequest()->getPost()) {
|
133 |
+
$redirectBack = $this->getRequest()->getParam('back', false);
|
134 |
+
/* @var $model Mage_Catalog_Model_Entity_Attribute */
|
135 |
+
$model = Mage::getModel('catalog/resource_eav_attribute');
|
136 |
+
/* @var $helper Santhosh_CategoryAttribute_Helper_Category */
|
137 |
+
$helper = Mage::helper('category_attribute/category');
|
138 |
+
|
139 |
+
if ($id = $this->getRequest()->getParam('attribute_id')) {
|
140 |
+
$model->load($id);
|
141 |
+
|
142 |
+
if (!$model->getId()) {
|
143 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getHelper()->__('This Attribute no longer exists'));
|
144 |
+
$this->_redirect('*/*/');
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
// entity type check
|
149 |
+
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
150 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getHelper()->__('This attribute cannot be updated.'));
|
151 |
+
Mage::getSingleton('adminhtml/session')->setAttributeData($data);
|
152 |
+
$this->_redirect('*/*/');
|
153 |
+
return;
|
154 |
+
}
|
155 |
+
|
156 |
+
$data['attribute_code'] = $model->getAttributeCode();
|
157 |
+
$data['is_user_defined'] = $model->getIsUserDefined();
|
158 |
+
$data['frontend_input'] = $model->getFrontendInput();
|
159 |
+
} else {
|
160 |
+
/**
|
161 |
+
* @todo add to helper and specify all relations for properties
|
162 |
+
*/
|
163 |
+
$data['source_model'] = $helper->getAttributeSourceModelByInputType($data['frontend_input']);
|
164 |
+
$data['backend_model'] = $helper->getAttributeBackendModelByInputType($data['frontend_input']);
|
165 |
+
}
|
166 |
+
|
167 |
+
if (!isset($data['is_configurable'])) {
|
168 |
+
$data['is_configurable'] = 0;
|
169 |
+
}
|
170 |
+
if (!isset($data['is_filterable'])) {
|
171 |
+
$data['is_filterable'] = 0;
|
172 |
+
}
|
173 |
+
if (!isset($data['is_filterable_in_search'])) {
|
174 |
+
$data['is_filterable_in_search'] = 0;
|
175 |
+
}
|
176 |
+
|
177 |
+
if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
|
178 |
+
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
|
179 |
+
}
|
180 |
+
|
181 |
+
$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
|
182 |
+
if ($defaultValueField) {
|
183 |
+
$data['default_value'] = $this->getRequest()->getParam($defaultValueField);
|
184 |
+
}
|
185 |
+
|
186 |
+
if(!isset($data['apply_to'])) {
|
187 |
+
$data['apply_to'] = array();
|
188 |
+
}
|
189 |
+
|
190 |
+
$model->addData($data);
|
191 |
+
|
192 |
+
if (!$id) {
|
193 |
+
$model->setEntityTypeId($this->_entityTypeId);
|
194 |
+
$model->setIsUserDefined(1);
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
if($this->getRequest()->getParam('set') && $this->getRequest()->getParam('group')) {
|
199 |
+
// For creating category attribute on category page we need specify attribute set and group
|
200 |
+
$model->setAttributeSetId($this->getRequest()->getParam('set'));
|
201 |
+
$model->setAttributeGroupId($this->getRequest()->getParam('group'));
|
202 |
+
}
|
203 |
+
|
204 |
+
try {
|
205 |
+
$model->save();
|
206 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->getHelper()->__('The category attribute has been saved.'));
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Clear translation cache because attribute labels are stored in translation
|
210 |
+
*/
|
211 |
+
Mage::app()->cleanCache(array(Mage_Core_Model_Translate::CACHE_TAG));
|
212 |
+
Mage::getSingleton('adminhtml/session')->setAttributeData(false);
|
213 |
+
if ($this->getRequest()->getParam('popup')) {
|
214 |
+
$this->_redirect('adminhtml/catalog_category/addAttribute', array(
|
215 |
+
'id' => $this->getRequest()->getParam('category'),
|
216 |
+
'attribute'=> $model->getId(),
|
217 |
+
'_current' => true
|
218 |
+
));
|
219 |
+
} elseif ($redirectBack) {
|
220 |
+
$this->_redirect('*/*/edit', array('attribute_id' => $model->getId(),'_current'=>true));
|
221 |
+
} else {
|
222 |
+
$this->_redirect('*/*/', array());
|
223 |
+
}
|
224 |
+
return;
|
225 |
+
} catch (Exception $e) {
|
226 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
227 |
+
Mage::getSingleton('adminhtml/session')->setAttributeData($data);
|
228 |
+
$this->_redirect('*/*/edit', array('_current' => true));
|
229 |
+
return;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
$this->_redirect('*/*/');
|
233 |
+
}
|
234 |
+
|
235 |
+
public function deleteAction()
|
236 |
+
{
|
237 |
+
if ($id = $this->getRequest()->getParam('attribute_id')) {
|
238 |
+
$model = Mage::getModel('catalog/resource_eav_attribute');
|
239 |
+
|
240 |
+
// entity type check
|
241 |
+
$model->load($id);
|
242 |
+
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
243 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getHelper()->__('This attribute cannot be deleted.'));
|
244 |
+
$this->_redirect('*/*/');
|
245 |
+
return;
|
246 |
+
}
|
247 |
+
|
248 |
+
try {
|
249 |
+
$model->delete();
|
250 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->getHelper()->__('The category attribute has been deleted.'));
|
251 |
+
$this->_redirect('*/*/');
|
252 |
+
return;
|
253 |
+
}
|
254 |
+
catch (Exception $e) {
|
255 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
256 |
+
$this->_redirect('*/*/edit', array('attribute_id' => $this->getRequest()->getParam('attribute_id')));
|
257 |
+
return;
|
258 |
+
}
|
259 |
+
}
|
260 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getHelper()->__('Unable to find an attribute to delete.'));
|
261 |
+
$this->_redirect('*/*/');
|
262 |
+
}
|
263 |
+
|
264 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/controllers/Adminhtml/Catalog/Category/SetController.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_CategoryAttribute
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_CategoryAttribute_Adminhtml_Catalog_Category_SetController extends Mage_Adminhtml_Controller_Action
|
23 |
+
{
|
24 |
+
|
25 |
+
public function getHelper() {
|
26 |
+
return Mage::helper('category_attribute');
|
27 |
+
}
|
28 |
+
|
29 |
+
public function indexAction()
|
30 |
+
{
|
31 |
+
$this->_title($this->getHelper()->__('Category Attributes'))
|
32 |
+
->_title($this->getHelper()->__('Manage Attribute Sets'));
|
33 |
+
|
34 |
+
$this->_setTypeId();
|
35 |
+
|
36 |
+
$this->loadLayout();
|
37 |
+
$this->_setActiveMenu('santhosh_core/category_attribute/atrribute_set');
|
38 |
+
|
39 |
+
$this->_addBreadcrumb($this->getHelper()->__('Category Attributes'), $this->getHelper()->__('Category Attributes'));
|
40 |
+
$this->_addBreadcrumb($this->getHelper()->__('Manage Attribute Sets'), $this->getHelper()->__('Manage Attribute Sets'));
|
41 |
+
|
42 |
+
$this->_addContent($this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_toolbar_main'));
|
43 |
+
$this->_addContent($this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_grid'));
|
44 |
+
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
|
48 |
+
public function editAction()
|
49 |
+
{
|
50 |
+
$this->_title($this->getHelper()->__('Category Attributes'))
|
51 |
+
->_title($this->getHelper()->__('Manage Attribute Sets'));
|
52 |
+
|
53 |
+
$this->_setTypeId();
|
54 |
+
$attributeSet = Mage::getModel('eav/entity_attribute_set')
|
55 |
+
->load($this->getRequest()->getParam('id'));
|
56 |
+
|
57 |
+
if (!$attributeSet->getId()) {
|
58 |
+
$this->_redirect('*/*/index');
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
|
62 |
+
$this->_title($attributeSet->getId() ? $attributeSet->getAttributeSetName() : $this->getHelper()->__('New Set'));
|
63 |
+
|
64 |
+
Mage::register('current_attribute_set', $attributeSet);
|
65 |
+
|
66 |
+
$this->loadLayout();
|
67 |
+
$this->_setActiveMenu('santhosh_core/category_attribute/atrribute_set');
|
68 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
69 |
+
|
70 |
+
$this->_addBreadcrumb($this->getHelper()->__('Category Attributes'), $this->getHelper()->__('Category Attributes'));
|
71 |
+
$this->_addBreadcrumb($this->getHelper()->__('Manage Category Sets'), $this->getHelper()->__('Manage Category Sets'));
|
72 |
+
|
73 |
+
$this->_addContent($this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_main'));
|
74 |
+
|
75 |
+
$this->renderLayout();
|
76 |
+
}
|
77 |
+
|
78 |
+
public function setGridAction()
|
79 |
+
{
|
80 |
+
$this->_setTypeId();
|
81 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_grid')->toHtml());
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Save attribute set action
|
86 |
+
*
|
87 |
+
* [POST] Create attribute set from another set and redirect to edit page
|
88 |
+
* [AJAX] Save attribute set data
|
89 |
+
*
|
90 |
+
*/
|
91 |
+
public function saveAction()
|
92 |
+
{
|
93 |
+
$entityTypeId = $this->_getEntityTypeId();
|
94 |
+
$hasError = false;
|
95 |
+
$attributeSetId = $this->getRequest()->getParam('id', false);
|
96 |
+
$isNewSet = $this->getRequest()->getParam('gotoEdit', false) == '1';
|
97 |
+
|
98 |
+
/* @var $model Mage_Eav_Model_Entity_Attribute_Set */
|
99 |
+
$model = Mage::getModel('eav/entity_attribute_set')
|
100 |
+
->setEntityTypeId($entityTypeId);
|
101 |
+
|
102 |
+
try {
|
103 |
+
if ($isNewSet) {
|
104 |
+
$model->setAttributeSetName($this->getRequest()->getParam('attribute_set_name'));
|
105 |
+
} else {
|
106 |
+
if ($attributeSetId) {
|
107 |
+
$model->load($attributeSetId);
|
108 |
+
}
|
109 |
+
if (!$model->getId()) {
|
110 |
+
Mage::throwException($this->getHelper()->__('This attribute set no longer exists.'));
|
111 |
+
}
|
112 |
+
$data = Mage::helper('core')->jsonDecode($this->getRequest()->getPost('data'));
|
113 |
+
$model->organizeData($data);
|
114 |
+
}
|
115 |
+
|
116 |
+
$model->validate();
|
117 |
+
if ($isNewSet) {
|
118 |
+
$model->save();
|
119 |
+
$model->initFromSkeleton($this->getRequest()->getParam('skeleton_set'));
|
120 |
+
}
|
121 |
+
$model->save();
|
122 |
+
$this->_getSession()->addSuccess($this->getHelper()->__('The attribute set has been saved.'));
|
123 |
+
} catch (Mage_Core_Exception $e) {
|
124 |
+
$this->_getSession()->addError($e->getMessage());
|
125 |
+
$hasError = true;
|
126 |
+
} catch (Exception $e) {
|
127 |
+
$this->_getSession()->addException($e, $this->getHelper()->__('An error occurred while saving the attribute set.'));
|
128 |
+
$hasError = true;
|
129 |
+
}
|
130 |
+
|
131 |
+
if ($isNewSet) {
|
132 |
+
if ($hasError) {
|
133 |
+
$this->_redirect('*/*/add');
|
134 |
+
} else {
|
135 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
136 |
+
}
|
137 |
+
} else {
|
138 |
+
$response = array();
|
139 |
+
if ($hasError) {
|
140 |
+
$this->_initLayoutMessages('adminhtml/session');
|
141 |
+
$response['error'] = 1;
|
142 |
+
$response['message'] = $this->getLayout()->getMessagesBlock()->getGroupedHtml();
|
143 |
+
} else {
|
144 |
+
$response['error'] = 0;
|
145 |
+
$response['url'] = $this->getUrl('*/*/');
|
146 |
+
}
|
147 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
public function addAction()
|
152 |
+
{
|
153 |
+
$this->_title($this->getHelper()->__('Category Attributes'))
|
154 |
+
->_title($this->getHelper()->__('Manage Attribute Sets'))
|
155 |
+
->_title($this->getHelper()->__('New Set'));
|
156 |
+
|
157 |
+
$this->_setTypeId();
|
158 |
+
|
159 |
+
$this->loadLayout();
|
160 |
+
$this->_setActiveMenu('santhosh_core/category_attribute/atrribute_set');
|
161 |
+
|
162 |
+
$this->_addContent($this->getLayout()->createBlock('category_attribute/adminhtml_catalog_category_attribute_set_toolbar_add'));
|
163 |
+
|
164 |
+
$this->renderLayout();
|
165 |
+
}
|
166 |
+
|
167 |
+
public function deleteAction()
|
168 |
+
{
|
169 |
+
$setId = $this->getRequest()->getParam('id');
|
170 |
+
try {
|
171 |
+
Mage::getModel('eav/entity_attribute_set')
|
172 |
+
->setId($setId)
|
173 |
+
->delete();
|
174 |
+
|
175 |
+
$this->_getSession()->addSuccess($this->getHelper()->__('The attribute set has been removed.'));
|
176 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/'));
|
177 |
+
} catch (Exception $e) {
|
178 |
+
$this->_getSession()->addError($this->getHelper()->__('An error occurred while deleting this set.'));
|
179 |
+
$this->_redirectReferer();
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Define in register catalog_product entity type code as entityType
|
185 |
+
*
|
186 |
+
*/
|
187 |
+
protected function _setTypeId()
|
188 |
+
{
|
189 |
+
Mage::register('entityType',
|
190 |
+
Mage::getModel('catalog/category')->getResource()->getTypeId());
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Retrieve catalog category entity type id
|
195 |
+
*
|
196 |
+
* @return int
|
197 |
+
*/
|
198 |
+
protected function _getEntityTypeId()
|
199 |
+
{
|
200 |
+
if (is_null(Mage::registry('entityType'))) {
|
201 |
+
$this->_setTypeId();
|
202 |
+
}
|
203 |
+
return Mage::registry('entityType');
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
app/code/local/Santhosh/CategoryAttribute/etc/adminhtml.xml
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Santhosh
|
17 |
+
* @package Santhosh_CategoryAttribute
|
18 |
+
* @copyright Copyright (c) 2011 completemagento
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
|
25 |
+
<menu>
|
26 |
+
<santhosh_core>
|
27 |
+
<children>
|
28 |
+
<category_attribute translate="title" module="category_attribute">
|
29 |
+
<title>Category Attributes</title>
|
30 |
+
|
31 |
+
<children>
|
32 |
+
<atrribute translate="title">
|
33 |
+
<title>Manage Attributes</title>
|
34 |
+
<action>adminhtml/catalog_category_attribute</action>
|
35 |
+
</atrribute>
|
36 |
+
|
37 |
+
<atrribute_set translate="title">
|
38 |
+
<title>Manage Attribute Sets</title>
|
39 |
+
<action>adminhtml/catalog_category_set</action>
|
40 |
+
</atrribute_set>
|
41 |
+
</children>
|
42 |
+
</category_attribute>
|
43 |
+
</children>
|
44 |
+
</santhosh_core>
|
45 |
+
</menu>
|
46 |
+
|
47 |
+
<acl>
|
48 |
+
<resources>
|
49 |
+
<admin>
|
50 |
+
<children>
|
51 |
+
<santhosh_core>
|
52 |
+
<children>
|
53 |
+
<category_attribute translate="title" module="category_attribute">
|
54 |
+
<title>Category Attributes</title>
|
55 |
+
|
56 |
+
<children>
|
57 |
+
<atrribute translate="title">
|
58 |
+
<title>Manage Attributes</title>
|
59 |
+
</atrribute>
|
60 |
+
|
61 |
+
<atrribute_set translate="title">
|
62 |
+
<title>Manage Attribute Sets</title>
|
63 |
+
</atrribute_set>
|
64 |
+
</children>
|
65 |
+
</category_attribute>
|
66 |
+
</children>
|
67 |
+
</santhosh_core>
|
68 |
+
</children>
|
69 |
+
</admin>
|
70 |
+
</resources>
|
71 |
+
</acl>
|
72 |
+
</config>
|
app/code/local/Santhosh/CategoryAttribute/etc/config.xml
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Santhosh
|
17 |
+
* @package Santhosh_CategoryAttribute
|
18 |
+
* @copyright Copyright (c) 2011 completemagento
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<modules>
|
25 |
+
<Santhosh_CategoryAttribute>
|
26 |
+
<version>0.0.1</version>
|
27 |
+
</Santhosh_CategoryAttribute>
|
28 |
+
</modules>
|
29 |
+
|
30 |
+
<global>
|
31 |
+
<models>
|
32 |
+
<category_attribute>
|
33 |
+
<class>Santhosh_CategoryAttribute_Model</class>
|
34 |
+
<resourceModel>category_attribute_mysql4</resourceModel>
|
35 |
+
</category_attribute>
|
36 |
+
<category_attribute_mysql4>
|
37 |
+
<class>Santhosh_CategoryAttribute_Model_Mysql4</class>
|
38 |
+
</category_attribute_mysql4>
|
39 |
+
|
40 |
+
<catalog_resource_eav_mysql4>
|
41 |
+
<rewrite>
|
42 |
+
<category_attribute_collection>Santhosh_CategoryAttribute_Model_Mysql4_Category_Attribute_Collection</category_attribute_collection>
|
43 |
+
</rewrite>
|
44 |
+
</catalog_resource_eav_mysql4>
|
45 |
+
</models>
|
46 |
+
<helpers>
|
47 |
+
<category_attribute>
|
48 |
+
<class>Santhosh_CategoryAttribute_Helper</class>
|
49 |
+
</category_attribute>
|
50 |
+
</helpers>
|
51 |
+
<blocks>
|
52 |
+
<category_attribute>
|
53 |
+
<class>Santhosh_CategoryAttribute_Block</class>
|
54 |
+
</category_attribute>
|
55 |
+
|
56 |
+
<adminhtml>
|
57 |
+
<rewrite>
|
58 |
+
<catalog_category_tab_attributes>Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Tab_Attributes</catalog_category_tab_attributes>
|
59 |
+
<catalog_category_tab_general>Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Tab_General</catalog_category_tab_general>
|
60 |
+
</rewrite>
|
61 |
+
</adminhtml>
|
62 |
+
</blocks>
|
63 |
+
</global>
|
64 |
+
|
65 |
+
<admin>
|
66 |
+
<routers>
|
67 |
+
<adminhtml>
|
68 |
+
<args>
|
69 |
+
<modules>
|
70 |
+
<category_attribute after="Mage_Adminhtml">Santhosh_CategoryAttribute_Adminhtml</category_attribute>
|
71 |
+
</modules>
|
72 |
+
</args>
|
73 |
+
</adminhtml>
|
74 |
+
</routers>
|
75 |
+
</admin>
|
76 |
+
|
77 |
+
<adminhtml>
|
78 |
+
<layout>
|
79 |
+
<updates>
|
80 |
+
<category_attribute>
|
81 |
+
<file>categoryattribute.xml</file>
|
82 |
+
</category_attribute>
|
83 |
+
</updates>
|
84 |
+
</layout>
|
85 |
+
|
86 |
+
<translate>
|
87 |
+
<modules>
|
88 |
+
<Santhosh_CategoryAttribute>
|
89 |
+
<files>
|
90 |
+
<default>Santhosh_CategoryAttribute.csv</default>
|
91 |
+
</files>
|
92 |
+
</Santhosh_CategoryAttribute>
|
93 |
+
</modules>
|
94 |
+
</translate>
|
95 |
+
</adminhtml>
|
96 |
+
|
97 |
+
<stores>
|
98 |
+
<admin>
|
99 |
+
<design>
|
100 |
+
<theme>
|
101 |
+
<default>santhosh</default>
|
102 |
+
</theme>
|
103 |
+
</design>
|
104 |
+
</admin>
|
105 |
+
</stores>
|
106 |
+
</config>
|
app/code/local/Santhosh/Core/Block/Adminhtml/Catalog/Category/Tab/Attributes.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Catalog_Category_Tab_Attributes extends Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Adminhtml/Catalog/Category/Tab/General.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Catalog_Category_Tab_General extends Mage_Adminhtml_Block_Catalog_Category_Tab_General
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Adminhtml/Template.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Template extends Mage_Adminhtml_Block_Template
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Form.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Widget_Form extends Mage_Adminhtml_Block_Widget_Form
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Form/Container.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Widget_Form_Container extends Mage_Adminhtml_Block_Widget_Form_Container
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Grid.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Widget_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Grid/Container.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Widget_Grid_Container extends Mage_Adminhtml_Block_Widget_Grid_Container
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Adminhtml/Widget/Tabs.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Adminhtml_Widget_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Eav/Adminhtml/Attribute/Edit/Main/Abstract.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Eav_Adminhtml_Attribute_Edit_Main_Abstract extends Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Eav/Adminhtml/Attribute/Edit/Options/Abstract.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Eav_Adminhtml_Attribute_Edit_Options_Abstract extends Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Block/Eav/Adminhtml/Attribute/Grid/Abstract.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Block_Eav_Adminhtml_Attribute_Grid_Abstract extends Mage_Eav_Block_Adminhtml_Attribute_Grid_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Helper/Abstract.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Helper_Abstract extends Mage_Core_Helper_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Helper/Data.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Helper_Data extends Mage_Core_Helper_Abstract
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/Model/Mysql4/Catalog/Category/Attribute/Collection.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Santhosh_Core_Model_Mysql4_Catalog_Category_Attribute_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Collection
|
23 |
+
{
|
24 |
+
|
25 |
+
}
|
app/code/local/Santhosh/Core/etc/adminhtml.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Santhosh
|
17 |
+
* @package Santhosh_Core
|
18 |
+
* @copyright Copyright (c) 2011 completemagento
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<menu>
|
25 |
+
<santhosh_core translate="title" module="santhosh_core">
|
26 |
+
<title>Santhosh</title>
|
27 |
+
<sort_order>71</sort_order>
|
28 |
+
</santhosh_core>
|
29 |
+
</menu>
|
30 |
+
|
31 |
+
<acl>
|
32 |
+
<resources>
|
33 |
+
<admin>
|
34 |
+
<children>
|
35 |
+
<santhosh_core translate="title" module="santhosh_core">
|
36 |
+
<title>Santhosh</title>
|
37 |
+
</santhosh_core>
|
38 |
+
</children>
|
39 |
+
</admin>
|
40 |
+
</resources>
|
41 |
+
</acl>
|
42 |
+
</config>
|
app/code/local/Santhosh/Core/etc/config.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Santhosh
|
17 |
+
* @package Santhosh_Core
|
18 |
+
* @copyright Copyright (c) 2011 completemagento
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<modules>
|
25 |
+
<Santhosh_Core>
|
26 |
+
<version>0.0.1</version>
|
27 |
+
</Santhosh_Core>
|
28 |
+
</modules>
|
29 |
+
|
30 |
+
<global>
|
31 |
+
<models>
|
32 |
+
<santhosh_core>
|
33 |
+
<class>Santhosh_Core_Model</class>
|
34 |
+
<resourceModel>santhosh_core_mysql4</resourceModel>
|
35 |
+
</santhosh_core>
|
36 |
+
<santhosh_core_mysql4>
|
37 |
+
<class>Santhosh_Core_Model_Mysql4</class>
|
38 |
+
</santhosh_core_mysql4>
|
39 |
+
</models>
|
40 |
+
<helpers>
|
41 |
+
<santhosh_core>
|
42 |
+
<class>Santhosh_Core_Helper</class>
|
43 |
+
</santhosh_core>
|
44 |
+
</helpers>
|
45 |
+
<blocks>
|
46 |
+
<santhosh_core>
|
47 |
+
<class>Santhosh_Core_Block</class>
|
48 |
+
</santhosh_core>
|
49 |
+
</blocks>
|
50 |
+
</global>
|
51 |
+
</config>
|
app/design/adminhtml/default/santhosh/layout/categoryattribute.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category_attribute Santhosh
|
17 |
+
* @package Santhosh_CategoryAttribute
|
18 |
+
* @copyright Copyright (c) 2011 completemagento
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
|
24 |
+
<layout>
|
25 |
+
<adminhtml_catalog_category_attribute_edit>
|
26 |
+
<reference name="left">
|
27 |
+
<block type="category_attribute/adminhtml_catalog_category_attribute_edit_tabs" name="attribute_edit_tabs"></block>
|
28 |
+
</reference>
|
29 |
+
<reference name="content">
|
30 |
+
<block type="category_attribute/adminhtml_catalog_category_attribute_edit" name="attribute_edit_content"></block>
|
31 |
+
</reference>
|
32 |
+
<reference name="js">
|
33 |
+
<block type="adminhtml/template" name="attribute_edit_js" template="catalog/category/attribute/js.phtml"></block>
|
34 |
+
</reference>
|
35 |
+
</adminhtml_catalog_category_attribute_edit>
|
36 |
+
</layout>
|
app/design/adminhtml/default/santhosh/template/catalog/category/attribute/js.phtml
ADDED
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<script type="text/javascript">
|
23 |
+
//<![CDATA[
|
24 |
+
function saveAndContinueEdit(){
|
25 |
+
disableElements('save');
|
26 |
+
var activeTab = product_attribute_tabsJsTabs.activeTab.id;
|
27 |
+
if (editForm.submit($('edit_form').action+'back/edit/tab/' + activeTab) == false) {
|
28 |
+
enableElements('save');
|
29 |
+
}
|
30 |
+
varienGlobalEvents.attachEventHandler('formValidateAjaxComplete', function (){
|
31 |
+
enableElements('save');
|
32 |
+
});
|
33 |
+
}
|
34 |
+
|
35 |
+
function saveAttribute(){
|
36 |
+
disableElements('save');
|
37 |
+
if (editForm.submit() == false){
|
38 |
+
enableElements('save');
|
39 |
+
}
|
40 |
+
varienGlobalEvents.attachEventHandler('formValidateAjaxComplete', function (){
|
41 |
+
enableElements('save');
|
42 |
+
});
|
43 |
+
}
|
44 |
+
|
45 |
+
function toggleApplyVisibility(select) {
|
46 |
+
if ($(select).value == 1) {
|
47 |
+
$(select).next('select').removeClassName('no-display');
|
48 |
+
$(select).next('select').removeClassName('ignore-validate');
|
49 |
+
|
50 |
+
} else {
|
51 |
+
$(select).next('select').addClassName('no-display');
|
52 |
+
$(select).next('select').addClassName('ignore-validate');
|
53 |
+
var options = $(select).next('select').options;
|
54 |
+
for( var i=0; i < options.length; i++) {
|
55 |
+
options[i].selected = false;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
function checkOptionsPanelVisibility(){
|
61 |
+
if($('matage-options-panel')){
|
62 |
+
var panel = $('matage-options-panel');
|
63 |
+
if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect')){
|
64 |
+
panel.show();
|
65 |
+
}
|
66 |
+
else {
|
67 |
+
panel.hide();
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
function bindAttributeInputType()
|
73 |
+
{
|
74 |
+
checkOptionsPanelVisibility();
|
75 |
+
switchDefaultValueField();
|
76 |
+
checkIsConfigurableVisibility();
|
77 |
+
if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect')){
|
78 |
+
if($('is_filterable') && !$('is_filterable').getAttribute('readonly')){
|
79 |
+
$('is_filterable').disabled = false;
|
80 |
+
}
|
81 |
+
if($('is_filterable_in_search') && !$('is_filterable_in_search').getAttribute('readonly')){
|
82 |
+
$('is_filterable_in_search').disabled = false;
|
83 |
+
}
|
84 |
+
if($('backend_type') && $('backend_type').options){
|
85 |
+
for(var i=0;i<$('backend_type').options.length;i++){
|
86 |
+
if($('backend_type').options[i].value=='int') $('backend_type').selectedIndex = i;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
else {
|
91 |
+
if($('is_filterable')){
|
92 |
+
$('is_filterable').selectedIndex=0;
|
93 |
+
$('is_filterable').disabled = true;
|
94 |
+
}
|
95 |
+
if($('is_filterable_in_search')){
|
96 |
+
$('is_filterable_in_search').disabled = true;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
if ($('frontend_input') && ($('frontend_input').value=='multiselect'
|
101 |
+
|| $('frontend_input').value=='textarea')) {
|
102 |
+
if ($('used_for_sort_by')) {
|
103 |
+
$('used_for_sort_by').disabled = true;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
else {
|
107 |
+
if ($('used_for_sort_by') && !$('used_for_sort_by').getAttribute('readonly')) {
|
108 |
+
$('used_for_sort_by').disabled = false;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
setRowVisibility('is_wysiwyg_enabled', false);
|
113 |
+
setRowVisibility('is_html_allowed_on_front', false);
|
114 |
+
if ($('frontend_input').value=='textarea') {
|
115 |
+
setRowVisibility('is_wysiwyg_enabled', true);
|
116 |
+
if($('is_wysiwyg_enabled').value == '0'){
|
117 |
+
setRowVisibility('is_html_allowed_on_front', true);
|
118 |
+
$('is_html_allowed_on_front').disabled = false;
|
119 |
+
}
|
120 |
+
$('frontend_class').value = '';
|
121 |
+
$('frontend_class').disabled = true;
|
122 |
+
}
|
123 |
+
else if($('frontend_input').value=='text'){
|
124 |
+
setRowVisibility('is_html_allowed_on_front', true);
|
125 |
+
$('is_html_allowed_on_front').disabled = false;
|
126 |
+
|
127 |
+
if (!$('frontend_class').getAttribute('readonly')) {
|
128 |
+
$('frontend_class').disabled = false;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
else{
|
132 |
+
$('frontend_class').value = '';
|
133 |
+
$('frontend_class').disabled = true;
|
134 |
+
}
|
135 |
+
|
136 |
+
switchIsFilterable();
|
137 |
+
}
|
138 |
+
|
139 |
+
function switchIsFilterable()
|
140 |
+
{
|
141 |
+
if ($('is_filterable')) {
|
142 |
+
if ($('is_filterable').selectedIndex == 0) {
|
143 |
+
$('position').disabled = true;
|
144 |
+
} else {
|
145 |
+
if (!$('position').getAttribute('readonly')){
|
146 |
+
$('position').disabled = false;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
function disableApplyToValue(value)
|
153 |
+
{
|
154 |
+
var applyToSelect = $('apply_to');
|
155 |
+
for (i=0;i<applyToSelect.options.length;i++) {
|
156 |
+
if (value == applyToSelect.options[i].value) {
|
157 |
+
applyToSelect.options[i].disabled = true;
|
158 |
+
applyToSelect.options[i].selected = false;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
function switchDefaultValueField()
|
164 |
+
{
|
165 |
+
if (!$('frontend_input')) {
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
|
169 |
+
var currentValue = $('frontend_input').value;
|
170 |
+
|
171 |
+
var defaultValueTextVisibility = false;
|
172 |
+
var defaultValueTextareaVisibility = false;
|
173 |
+
var defaultValueDateVisibility = false;
|
174 |
+
var defaultValueYesnoVisibility = false;
|
175 |
+
var scopeVisibility = true;
|
176 |
+
|
177 |
+
switch (currentValue) {
|
178 |
+
case 'select':
|
179 |
+
optionDefaultInputType = 'radio';
|
180 |
+
break;
|
181 |
+
|
182 |
+
case 'multiselect':
|
183 |
+
optionDefaultInputType = 'checkbox';
|
184 |
+
break;
|
185 |
+
|
186 |
+
case 'date':
|
187 |
+
defaultValueDateVisibility = true;
|
188 |
+
break;
|
189 |
+
|
190 |
+
case 'boolean':
|
191 |
+
defaultValueYesnoVisibility = true;
|
192 |
+
break;
|
193 |
+
|
194 |
+
case 'textarea':
|
195 |
+
defaultValueTextareaVisibility = true;
|
196 |
+
break;
|
197 |
+
|
198 |
+
default:
|
199 |
+
defaultValueTextVisibility = true;
|
200 |
+
break;
|
201 |
+
}
|
202 |
+
|
203 |
+
var applyToSelect = $('apply_to');
|
204 |
+
switch (currentValue) {
|
205 |
+
<?php foreach (Mage::helper('catalog')->getAttributeDisabledTypes() as $type=>$disabled): ?>
|
206 |
+
case '<?php echo $type; ?>':
|
207 |
+
<?php foreach ($disabled as $one): ?>
|
208 |
+
disableApplyToValue('<?php echo $one; ?>');
|
209 |
+
<?php endforeach; ?>
|
210 |
+
break;
|
211 |
+
<?php endforeach; ?>
|
212 |
+
default:
|
213 |
+
for (i=0;i<applyToSelect.options.length;i++) {
|
214 |
+
applyToSelect.options[i].disabled = false;
|
215 |
+
}
|
216 |
+
break;
|
217 |
+
}
|
218 |
+
|
219 |
+
switch (currentValue) {
|
220 |
+
|
221 |
+
<?php foreach (Mage::helper('catalog')->getAttributeHiddenFields() as $type=>$fields): ?>
|
222 |
+
case '<?php echo $type; ?>':
|
223 |
+
<?php foreach ($fields as $one): ?>
|
224 |
+
<?php if ($one == '_front_fieldset'): ?>
|
225 |
+
$('front_fieldset').previous().hide();
|
226 |
+
$('front_fieldset').hide();
|
227 |
+
<?php elseif ($one == '_default_value'): ?>
|
228 |
+
defaultValueTextVisibility =
|
229 |
+
defaultValueTextareaVisibility =
|
230 |
+
defaultValueDateVisibility =
|
231 |
+
defaultValueYesnoVisibility = false;
|
232 |
+
<?php elseif ($one == '_scope'): ?>
|
233 |
+
scopeVisibility = false;
|
234 |
+
<?php else: ?>
|
235 |
+
setRowVisibility('<?php echo $one; ?>', false);
|
236 |
+
<?php endif; ?>
|
237 |
+
<?php endforeach; ?>
|
238 |
+
break;
|
239 |
+
<?php endforeach; ?>
|
240 |
+
|
241 |
+
default:
|
242 |
+
$('front_fieldset').previous().show();
|
243 |
+
$('front_fieldset').show();
|
244 |
+
setRowVisibility('is_required', true);
|
245 |
+
setRowVisibility('is_unique', true);
|
246 |
+
setRowVisibility('frontend_class', true);
|
247 |
+
setRowVisibility('is_configurable', true);
|
248 |
+
break;
|
249 |
+
}
|
250 |
+
|
251 |
+
setRowVisibility('default_value_text', defaultValueTextVisibility);
|
252 |
+
setRowVisibility('default_value_textarea', defaultValueTextareaVisibility);
|
253 |
+
setRowVisibility('default_value_date', defaultValueDateVisibility);
|
254 |
+
setRowVisibility('default_value_yesno', defaultValueYesnoVisibility);
|
255 |
+
setRowVisibility('is_global', scopeVisibility);
|
256 |
+
|
257 |
+
var elems = document.getElementsByName('default[]');
|
258 |
+
for (var i = 0; i < elems.length; i++) {
|
259 |
+
elems[i].type = optionDefaultInputType;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
function setRowVisibility(id, isVisible)
|
264 |
+
{
|
265 |
+
if ($(id)) {
|
266 |
+
var td = $(id).parentNode;
|
267 |
+
var tr = $(td.parentNode);
|
268 |
+
|
269 |
+
if (isVisible) {
|
270 |
+
tr.show();
|
271 |
+
} else {
|
272 |
+
tr.blur();
|
273 |
+
tr.hide();
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
function checkIsConfigurableVisibility()
|
279 |
+
{
|
280 |
+
if (!$('is_configurable') || !$('is_global') || !$('frontend_input')) return;
|
281 |
+
if ($F('is_global')==1 && $F('frontend_input')=='select') {
|
282 |
+
setRowVisibility('is_configurable', true);
|
283 |
+
} else {
|
284 |
+
setRowVisibility('is_configurable', false);
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
function updateRequriedOptions()
|
289 |
+
{
|
290 |
+
if ($F('frontend_input')=='select' && $F('is_required')==1) {
|
291 |
+
$('option-count-check').addClassName('required-options-count');
|
292 |
+
} else {
|
293 |
+
$('option-count-check').removeClassName('required-options-count');
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
if($('frontend_input')){
|
298 |
+
Event.observe($('frontend_input'), 'change', updateRequriedOptions);
|
299 |
+
Event.observe($('frontend_input'), 'change', bindAttributeInputType);
|
300 |
+
Event.observe($('is_global'), 'change', checkIsConfigurableVisibility);
|
301 |
+
}
|
302 |
+
|
303 |
+
if ($('is_filterable')) {
|
304 |
+
Event.observe($('is_filterable'), 'change', switchIsFilterable);
|
305 |
+
}
|
306 |
+
|
307 |
+
if ($('is_required')) {
|
308 |
+
Event.observe($('is_required'), 'change', updateRequriedOptions);
|
309 |
+
}
|
310 |
+
bindAttributeInputType();
|
311 |
+
//]]>
|
312 |
+
</script>
|
app/design/adminhtml/default/santhosh/template/catalog/category/attribute/options.phtml
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<?php
|
23 |
+
/**
|
24 |
+
* Attribute otions control
|
25 |
+
*
|
26 |
+
* @see Santhosh_CategoryAttribute_Block_Adminhtml_Catalog_Category_Attribute_Edit_Tab_Options
|
27 |
+
*/
|
28 |
+
?>
|
29 |
+
<div>
|
30 |
+
<ul class="messages">
|
31 |
+
<li class="notice-msg">
|
32 |
+
<ul>
|
33 |
+
<li><?php echo Mage::helper('category_attribute')->__('If you do not specify an option value for a specific store view then the default (Admin) value will be used.') ?></li>
|
34 |
+
</ul>
|
35 |
+
</li>
|
36 |
+
</ul>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<div class="entity-edit">
|
40 |
+
<div class="entry-edit-head">
|
41 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('category_attribute')->__('Manage Titles (Name, Description, etc.)') ?></h4>
|
42 |
+
</div>
|
43 |
+
<div class="box">
|
44 |
+
<div class="hor-scroll">
|
45 |
+
<table class="dynamic-grid" cellspacing="0" id="attribute-labels-table">
|
46 |
+
<tr>
|
47 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
48 |
+
<th><?php echo $_store->getName() ?></th>
|
49 |
+
<?php endforeach; ?>
|
50 |
+
</tr>
|
51 |
+
<tr>
|
52 |
+
<?php $_labels = $this->getLabelValues() ?>
|
53 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
54 |
+
<td>
|
55 |
+
<input class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php echo $_store->getId() ?>]" value="<?php echo $this->htmlEscape($_labels[$_store->getId()]) ?>"<?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/>
|
56 |
+
</td>
|
57 |
+
<?php endforeach; ?>
|
58 |
+
</tr>
|
59 |
+
</table>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
<br/>
|
64 |
+
<div class="entity-edit" id="matage-options-panel">
|
65 |
+
<div class="entry-edit-head">
|
66 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('category_attribute')->__('Manage Options (values of your attribute)') ?></h4>
|
67 |
+
</div>
|
68 |
+
<div class="box">
|
69 |
+
<div class="hor-scroll">
|
70 |
+
<table class="dynamic-grid" cellspacing="0" cellpadding="0">
|
71 |
+
<tr id="attribute-options-table">
|
72 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
73 |
+
<th><?php echo $_store->getName() ?></th>
|
74 |
+
<?php endforeach; ?>
|
75 |
+
<th><?php echo Mage::helper('category_attribute')->__('Position') ?></th>
|
76 |
+
<th class="nobr a-center"><?php echo Mage::helper('category_attribute')->__('Is Default') ?></th>
|
77 |
+
<th>
|
78 |
+
<?php if (!$this->getReadOnly()):?>
|
79 |
+
<?php echo $this->getAddNewButtonHtml() ?>
|
80 |
+
<?php endif;?>
|
81 |
+
</th>
|
82 |
+
</tr>
|
83 |
+
<tr class="no-display template" id="row-template">
|
84 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
85 |
+
<td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/></td>
|
86 |
+
<?php endforeach; ?>
|
87 |
+
<td class="a-center"><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/></td>
|
88 |
+
<td><input class="input-radio" type="radio" name="default[]" value="{{id}}" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/></td>
|
89 |
+
<td class="a-left">
|
90 |
+
<input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" />
|
91 |
+
<?php if (!$this->getReadOnly()):?>
|
92 |
+
<?php echo $this->getDeleteButtonHtml() ?>
|
93 |
+
<?php endif;?>
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
</table>
|
97 |
+
</div>
|
98 |
+
<input type="hidden" id="option-count-check" value="" />
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
<script type="text/javascript">
|
102 |
+
//<![CDATA[
|
103 |
+
var optionDefaultInputType = 'radio';
|
104 |
+
|
105 |
+
// IE removes quotes from element.innerHTML whenever it thinks they're not needed, which breaks html.
|
106 |
+
var templateText =
|
107 |
+
'<tr class="option-row">'+
|
108 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
109 |
+
'<td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/><\/td>'+
|
110 |
+
<?php endforeach; ?>
|
111 |
+
'<td><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/><\/td>'+
|
112 |
+
'<td class="a-center"><input class="input-radio" type="{{intype}}" name="default[]" value="{{id}}" {{checked}} <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/><\/td>'+
|
113 |
+
'<td class="a-left">'+
|
114 |
+
'<input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" />'+
|
115 |
+
<?php if (!$this->getReadOnly()):?>
|
116 |
+
'<?php echo $this->getDeleteButtonHtml() ?>'+
|
117 |
+
<?php endif;?>
|
118 |
+
'<\/td>'+
|
119 |
+
'<\/tr>';
|
120 |
+
|
121 |
+
var attributeOption = {
|
122 |
+
table : $('attribute-options-table'),
|
123 |
+
templateSyntax : /(^|.|\r|\n)({{(\w+)}})/,
|
124 |
+
templateText : templateText,
|
125 |
+
itemCount : 0,
|
126 |
+
totalItems : 0,
|
127 |
+
add : function(data) {
|
128 |
+
this.template = new Template(this.templateText, this.templateSyntax);
|
129 |
+
if(!data.id){
|
130 |
+
data = {};
|
131 |
+
data.id = 'option_'+this.itemCount;
|
132 |
+
}
|
133 |
+
if (!data.intype)
|
134 |
+
data.intype = optionDefaultInputType;
|
135 |
+
|
136 |
+
Element.insert(this.table, {after: this.template.evaluate(data)});
|
137 |
+
this.bindRemoveButtons();
|
138 |
+
this.itemCount++;
|
139 |
+
this.totalItems++;
|
140 |
+
this.updateItemsCountField();
|
141 |
+
},
|
142 |
+
remove : function(event){
|
143 |
+
var element = $(Event.findElement(event, 'tr')); // !!! Button already
|
144 |
+
// have table parent in safari
|
145 |
+
// Safari workaround
|
146 |
+
element.ancestors().each(function(parentItem){
|
147 |
+
if (parentItem.hasClassName('option-row')) {
|
148 |
+
element = parentItem;
|
149 |
+
throw $break;
|
150 |
+
} else if (parentItem.hasClassName('box')) {
|
151 |
+
throw $break;
|
152 |
+
}
|
153 |
+
});
|
154 |
+
|
155 |
+
|
156 |
+
if(element){
|
157 |
+
var elementFlags = element.getElementsByClassName('delete-flag');
|
158 |
+
if(elementFlags[0]){
|
159 |
+
elementFlags[0].value=1;
|
160 |
+
}
|
161 |
+
|
162 |
+
element.addClassName('no-display');
|
163 |
+
element.addClassName('template');
|
164 |
+
element.hide();
|
165 |
+
this.totalItems--;
|
166 |
+
this.updateItemsCountField();
|
167 |
+
}
|
168 |
+
},
|
169 |
+
updateItemsCountField: function() {
|
170 |
+
if (this.totalItems > 0) {
|
171 |
+
$('option-count-check').value = '1';
|
172 |
+
} else {
|
173 |
+
$('option-count-check').value = '';
|
174 |
+
}
|
175 |
+
},
|
176 |
+
bindRemoveButtons : function(){
|
177 |
+
var buttons = $$('.delete-option');
|
178 |
+
for(var i=0;i<buttons.length;i++){
|
179 |
+
if(!$(buttons[i]).binded){
|
180 |
+
$(buttons[i]).binded = true;
|
181 |
+
Event.observe(buttons[i], 'click', this.remove.bind(this));
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|
187 |
+
if($('row-template')){
|
188 |
+
$('row-template').remove();
|
189 |
+
}
|
190 |
+
attributeOption.bindRemoveButtons();
|
191 |
+
|
192 |
+
if($('add_new_option_button')){
|
193 |
+
Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption));
|
194 |
+
}
|
195 |
+
Validation.addAllThese([
|
196 |
+
['required-option', '<?php echo Mage::helper('category_attribute')->__('Failed') ?>', function(v) {
|
197 |
+
return !Validation.get('IsEmpty').test(v);
|
198 |
+
}]]);
|
199 |
+
Validation.addAllThese([
|
200 |
+
['required-options-count', '<?php echo Mage::helper('category_attribute')->__('Options is required') ?>', function(v) {
|
201 |
+
return !Validation.get('IsEmpty').test(v);
|
202 |
+
}]]);
|
203 |
+
<?php foreach ($this->getOptionValues() as $_value): ?>
|
204 |
+
attributeOption.add(<?php echo $_value->toJson() ?>);
|
205 |
+
<?php endforeach; ?>
|
206 |
+
//]]>
|
207 |
+
</script>
|
app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/main.phtml
ADDED
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<div class="content-header">
|
23 |
+
<table cellspacing="0">
|
24 |
+
<tr>
|
25 |
+
<td style="width:50%;"><h3 class="icon-head head-category-attribute-sets"><?php echo $this->htmlEscape($this->_getHeader()) ?></h3></td>
|
26 |
+
<td class="form-buttons">
|
27 |
+
<?php echo $this->getBackButtonHtml() ?>
|
28 |
+
<?php echo $this->getResetButtonHtml() ?>
|
29 |
+
<?php echo $this->getDeleteButtonHtml() ?>
|
30 |
+
<?php echo $this->getSaveButtonHtml() ?>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
</table>
|
34 |
+
</div>
|
35 |
+
<table cellspacing="0" width="100%">
|
36 |
+
<tr>
|
37 |
+
<td width="360" style="border-right:1px solid #ddd; padding:0 23px 23px 0;" class="edit-attribute-set">
|
38 |
+
<?php echo $this->getSetFormHtml() ?>
|
39 |
+
</td>
|
40 |
+
<td width="320" style="border-right:1px solid #ddd; padding:0 23px 23px 23px;">
|
41 |
+
<div class="content-header skip-header">
|
42 |
+
<table cellspacing="0">
|
43 |
+
<tbody>
|
44 |
+
<tr>
|
45 |
+
<td><h3><?php echo Mage::helper('category_attribute')->__('Groups') ?></h3></td>
|
46 |
+
</tr>
|
47 |
+
</tbody>
|
48 |
+
</table>
|
49 |
+
</div>
|
50 |
+
|
51 |
+
<?php if (!$this->getIsReadOnly()): ?>
|
52 |
+
<p><?php echo $this->getAddGroupButton() ?> <?php echo $this->getDeleteGroupButton() ?></p>
|
53 |
+
<p class="note-block"><?php echo Mage::helper('category_attribute')->__('Double click on a group to rename it') ?></p>
|
54 |
+
<?php endif; ?>
|
55 |
+
|
56 |
+
<?php echo $this->getSetsFilterHtml() ?>
|
57 |
+
<?php echo $this->getGroupTreeHtml() ?>
|
58 |
+
</td>
|
59 |
+
<td style="padding:0 0 23px 23px;">
|
60 |
+
<div class="content-header skip-header">
|
61 |
+
<table cellspacing="0">
|
62 |
+
<tbody>
|
63 |
+
<tr>
|
64 |
+
<td><h3><?php echo Mage::helper('category_attribute')->__('Unassigned Attributes') ?></h3></td>
|
65 |
+
</tr>
|
66 |
+
</tbody>
|
67 |
+
</table>
|
68 |
+
</div>
|
69 |
+
<div id="tree-div2" style="height:400px; margin-top:5px;overflow:auto"></div>
|
70 |
+
<script type="text/javascript">
|
71 |
+
//<![CDATA[
|
72 |
+
var allowDragAndDrop = <?php echo ($this->getIsReadOnly() ? 'false' : 'true'); ?>;
|
73 |
+
var canEditGroups = <?php echo ($this->getIsReadOnly() ? 'false' : 'true'); ?>;
|
74 |
+
|
75 |
+
var TreePanels = function() {
|
76 |
+
// shorthand
|
77 |
+
var Tree = Ext.tree;
|
78 |
+
|
79 |
+
return {
|
80 |
+
init : function(){
|
81 |
+
// yui-ext tree
|
82 |
+
|
83 |
+
var tree = new Ext.tree.TreePanel('tree-div1', {
|
84 |
+
animate:false,
|
85 |
+
loader: false,
|
86 |
+
enableDD:allowDragAndDrop,
|
87 |
+
containerScroll: true,
|
88 |
+
rootVisible: false
|
89 |
+
});
|
90 |
+
|
91 |
+
// set the root node
|
92 |
+
this.root = new Ext.tree.TreeNode({
|
93 |
+
text: 'ROOT',
|
94 |
+
allowDrug:false,
|
95 |
+
allowDrop:true,
|
96 |
+
id:'1'
|
97 |
+
});
|
98 |
+
|
99 |
+
tree.setRootNode(this.root);
|
100 |
+
buildCategoryTree(this.root, <?php echo $this->getGroupTreeJson() ?>);
|
101 |
+
// render the tree
|
102 |
+
tree.render();
|
103 |
+
this.root.expand(false, false);
|
104 |
+
tree.expandAll();
|
105 |
+
|
106 |
+
this.ge = new Ext.tree.TreeEditor(tree, {
|
107 |
+
allowBlank:false,
|
108 |
+
blankText:'<?php echo Mage::helper('category_attribute')->__('A name is required') ?>',
|
109 |
+
selectOnFocus:true,
|
110 |
+
cls:'folder'
|
111 |
+
});
|
112 |
+
|
113 |
+
this.root.addListener('beforeinsert', editSet.leftBeforeInsert);
|
114 |
+
this.root.addListener('beforeappend', editSet.leftBeforeInsert);
|
115 |
+
|
116 |
+
//this.ge.addListener('beforerender', editSet.editGroup);
|
117 |
+
this.ge.addListener('beforeshow', editSet.editGroup);
|
118 |
+
this.ge.addListener('beforecomplete', editSet.beforeRenameGroup);
|
119 |
+
//this.ge.addListener('startedit', editSet.editGroup);
|
120 |
+
|
121 |
+
//-------------------------------------------------------------
|
122 |
+
|
123 |
+
var tree2 = new Ext.tree.TreePanel('tree-div2', {
|
124 |
+
animate:false,
|
125 |
+
loader: false,
|
126 |
+
enableDD:allowDragAndDrop,
|
127 |
+
containerScroll: true,
|
128 |
+
rootVisible: false,
|
129 |
+
lines:false
|
130 |
+
});
|
131 |
+
|
132 |
+
// set the root node
|
133 |
+
this.root2 = new Ext.tree.TreeNode({
|
134 |
+
text: 'ROOT',
|
135 |
+
draggable:false,
|
136 |
+
id:'free'
|
137 |
+
});
|
138 |
+
tree2.setRootNode(this.root2);
|
139 |
+
buildCategoryTree(this.root2, <?php echo $this->getAttributeTreeJson() ?>);
|
140 |
+
|
141 |
+
this.root2.addListener('beforeinsert', editSet.rightBeforeInsert);
|
142 |
+
this.root2.addListener('beforeappend', editSet.rightBeforeAppend);
|
143 |
+
|
144 |
+
this.root2.addListener('append', editSet.rightAppend);
|
145 |
+
this.root2.addListener('remove', editSet.rightRemove);
|
146 |
+
// render the tree
|
147 |
+
tree2.render();
|
148 |
+
this.root2.expand(false, false);
|
149 |
+
tree2.expandAll();
|
150 |
+
},
|
151 |
+
|
152 |
+
rebuildTrees : function(){
|
153 |
+
editSet.req.attributes = new Array();
|
154 |
+
rootNode = TreePanels.root;
|
155 |
+
var gIterator = 0;
|
156 |
+
for( i in rootNode.childNodes ) {
|
157 |
+
if(rootNode.childNodes[i].id) {
|
158 |
+
var group = rootNode.childNodes[i];
|
159 |
+
editSet.req.groups[gIterator] = new Array(group.id, group.attributes.text.strip(), (gIterator+1));
|
160 |
+
var iterator = 0
|
161 |
+
for( j in group.childNodes ) {
|
162 |
+
iterator ++;
|
163 |
+
if( group.childNodes[j].id > 0 ) {
|
164 |
+
editSet.req.attributes[group.childNodes[j].id] = new Array(group.childNodes[j].id, group.id, iterator, group.childNodes[j].attributes.entity_id);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
iterator = 0;
|
168 |
+
}
|
169 |
+
gIterator ++;
|
170 |
+
}
|
171 |
+
|
172 |
+
editSet.req.not_attributes = new Array();
|
173 |
+
rootNode = TreePanels.root2;
|
174 |
+
|
175 |
+
var iterator = 0;
|
176 |
+
for( i in rootNode.childNodes ) {
|
177 |
+
if(rootNode.childNodes[i].id) {
|
178 |
+
if( rootNode.childNodes[i].id > 0 ) {
|
179 |
+
editSet.req.not_attributes[iterator] = rootNode.childNodes[i].attributes.entity_id;
|
180 |
+
}
|
181 |
+
iterator ++;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
185 |
+
};
|
186 |
+
}();
|
187 |
+
|
188 |
+
function buildCategoryTree(parent, config){
|
189 |
+
if (!config) return null;
|
190 |
+
if (parent && config && config.length){
|
191 |
+
for (var i = 0; i < config.length; i++) {
|
192 |
+
var node = new Ext.tree.TreeNode(config[i]);
|
193 |
+
parent.appendChild(node);
|
194 |
+
node.addListener('click', editSet.register);
|
195 |
+
node.addListener('beforemove', editSet.groupBeforeMove);
|
196 |
+
node.addListener('beforeinsert', editSet.groupBeforeInsert);
|
197 |
+
node.addListener('beforeappend', editSet.groupBeforeInsert);
|
198 |
+
if( config[i].children ) {
|
199 |
+
for( j in config[i].children ) {
|
200 |
+
if(config[i].children[j].id) {
|
201 |
+
newNode = new Ext.tree.TreeNode(config[i].children[j]);
|
202 |
+
node.appendChild(newNode);
|
203 |
+
newNode.addListener('click', editSet.unregister);
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
var editSet = function() {
|
212 |
+
return {
|
213 |
+
register : function(node) {
|
214 |
+
editSet.currentNode = node;
|
215 |
+
},
|
216 |
+
|
217 |
+
unregister : function() {
|
218 |
+
editSet.currentNode = false;
|
219 |
+
},
|
220 |
+
|
221 |
+
submit : function() {
|
222 |
+
if( TreePanels.root.firstChild == TreePanels.root.lastChild ) {
|
223 |
+
return;
|
224 |
+
}
|
225 |
+
|
226 |
+
if( editSet.SystemNodesExists(editSet.currentNode) ) {
|
227 |
+
alert('<?php echo Mage::helper('category_attribute')->__('This group contains system attributes. Please move system attributes to another group and try again.') ?>');
|
228 |
+
return;
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
if( editSet.currentNode && editSet.currentNode.attributes.cls == 'folder' ) {
|
233 |
+
TreePanels.root.removeChild(editSet.currentNode);
|
234 |
+
for( i in editSet.currentNode.childNodes ) {
|
235 |
+
if( editSet.currentNode.childNodes[i].id ) {
|
236 |
+
child = editSet.currentNode.childNodes[i];
|
237 |
+
newNode = new Ext.tree.TreeNode(child.attributes);
|
238 |
+
|
239 |
+
if( child.attributes.is_user_defined == 1 ) {
|
240 |
+
TreePanels.root2.appendChild(newNode);
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
editSet.req.removeGroups[editSet.currentNode.id] = editSet.currentNode.id;
|
245 |
+
editSet.currentNode = false;
|
246 |
+
}
|
247 |
+
},
|
248 |
+
|
249 |
+
SystemNodesExists : function(currentNode) {
|
250 |
+
for( i in currentNode.childNodes ) {
|
251 |
+
if( currentNode.childNodes[i].id ) {
|
252 |
+
child = editSet.currentNode.childNodes[i];
|
253 |
+
if( child.attributes.is_user_defined != 1 ) {
|
254 |
+
return true;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
}
|
258 |
+
},
|
259 |
+
|
260 |
+
|
261 |
+
rightAppend : function(node) {
|
262 |
+
return;
|
263 |
+
},
|
264 |
+
|
265 |
+
addGroup : function() {
|
266 |
+
var group_name = prompt("<?php echo Mage::helper('category_attribute')->__('Please enter a new group name') ?>","");
|
267 |
+
group_name = group_name.strip();
|
268 |
+
if( group_name == '' ) {
|
269 |
+
this.addGroup();
|
270 |
+
} else if( group_name != false && group_name != null && group_name != '' ) {
|
271 |
+
|
272 |
+
if (!editSet.validateGroupName(group_name, 0)) {
|
273 |
+
return;
|
274 |
+
}
|
275 |
+
|
276 |
+
var newNode = new Ext.tree.TreeNode({
|
277 |
+
text : group_name.escapeHTML(),
|
278 |
+
cls : 'folder',
|
279 |
+
allowDrop : true,
|
280 |
+
allowDrag : true
|
281 |
+
});
|
282 |
+
TreePanels.root.appendChild(newNode);
|
283 |
+
newNode.addListener('beforemove', editSet.groupBeforeMove);
|
284 |
+
newNode.addListener('beforeinsert', editSet.groupBeforeInsert);
|
285 |
+
newNode.addListener('beforeappend', editSet.groupBeforeInsert);
|
286 |
+
newNode.addListener('click', editSet.register);
|
287 |
+
}
|
288 |
+
},
|
289 |
+
|
290 |
+
editGroup : function(obj) {
|
291 |
+
if( obj.editNode.attributes.cls != 'folder' || !canEditGroups) {
|
292 |
+
TreePanels.ge.cancelEdit();
|
293 |
+
return false;
|
294 |
+
}
|
295 |
+
},
|
296 |
+
|
297 |
+
beforeRenameGroup : function(obj, after, before) {
|
298 |
+
return editSet.validateGroupName(after, obj.editNode.id);
|
299 |
+
},
|
300 |
+
|
301 |
+
validateGroupName : function(name, exceptNodeId) {
|
302 |
+
name = name.strip();
|
303 |
+
if (name === '') {
|
304 |
+
return false;
|
305 |
+
}
|
306 |
+
for (var i=0; i < TreePanels.root.childNodes.length; i++) {
|
307 |
+
if (TreePanels.root.childNodes[i].text.toLowerCase() == name.toLowerCase() && TreePanels.root.childNodes[i].id != exceptNodeId) {
|
308 |
+
errorText = "<?php echo Mage::helper('category_attribute')->__('Attribute group with the \"/name/\" name already exists') ?>";
|
309 |
+
alert(errorText.replace("/name/",name));
|
310 |
+
return false;
|
311 |
+
}
|
312 |
+
}
|
313 |
+
return true;
|
314 |
+
},
|
315 |
+
|
316 |
+
save : function() {
|
317 |
+
$('messages').update();
|
318 |
+
TreePanels.rebuildTrees();
|
319 |
+
var _validator = new Validation('set_prop_form', {onSubmit:false});
|
320 |
+
if( !_validator.validate() ) {
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
editSet.req.attribute_set_name = $('attribute_set_name').value;
|
324 |
+
if (!editSet.req.form_key) {
|
325 |
+
editSet.req.form_key = FORM_KEY;
|
326 |
+
}
|
327 |
+
var req = {data : Ext.util.JSON.encode(editSet.req)};
|
328 |
+
var con = new Ext.lib.Ajax.request('POST', '<?php echo $this->getMoveUrl() ?>', {success:editSet.success,failure:editSet.failure}, req);
|
329 |
+
},
|
330 |
+
|
331 |
+
success : function(o) {
|
332 |
+
var response = Ext.util.JSON.decode(o.responseText);
|
333 |
+
if( response.error ) {
|
334 |
+
$('messages').update(response.message);
|
335 |
+
} else if( response.ajaxExpired && response.ajaxRedirect ){
|
336 |
+
setLocation(response.ajaxRedirect);
|
337 |
+
} else if( response.url ){
|
338 |
+
setLocation(response.url);
|
339 |
+
} else if( response.message ) {
|
340 |
+
$('messages').update(response.message);
|
341 |
+
}
|
342 |
+
},
|
343 |
+
|
344 |
+
failure : function(o) {
|
345 |
+
alert('<?php echo Mage::helper('category_attribute')->__('Unable to complete this request.') ?>');
|
346 |
+
},
|
347 |
+
|
348 |
+
groupBeforeMove : function(tree, nodeThis, oldParent, newParent) {
|
349 |
+
if( newParent.attributes.cls == 'folder' && nodeThis.attributes.cls == 'folder' ) {
|
350 |
+
return false;
|
351 |
+
}
|
352 |
+
|
353 |
+
if( newParent == TreePanels.root && nodeThis.attributes.cls != 'folder' ) {
|
354 |
+
return false;
|
355 |
+
}
|
356 |
+
},
|
357 |
+
|
358 |
+
rightBeforeAppend : function(tree, nodeThis, node, newParent) {
|
359 |
+
if (node.attributes.is_user_defined == 0) {
|
360 |
+
alert('<?php echo Mage::helper('category_attribute')->__('You cannot remove system attribute from this set.') ?>');
|
361 |
+
return false;
|
362 |
+
}
|
363 |
+
else {
|
364 |
+
return true;
|
365 |
+
}
|
366 |
+
},
|
367 |
+
|
368 |
+
rightBeforeInsert : function(tree, nodeThis, node, newParent) {
|
369 |
+
var empty = TreePanels.root2.findChild('id', 'empty');
|
370 |
+
if( empty ) {
|
371 |
+
return false;
|
372 |
+
}
|
373 |
+
|
374 |
+
if (node.attributes.is_user_defined == 0) {
|
375 |
+
alert('<?php echo Mage::helper('category_attribute')->__('You cannot remove system attribute from this set.') ?>');
|
376 |
+
return false;
|
377 |
+
}
|
378 |
+
else {
|
379 |
+
return true;
|
380 |
+
}
|
381 |
+
},
|
382 |
+
|
383 |
+
groupBeforeInsert : function(tree, nodeThis, node, newParent) {
|
384 |
+
if( node.allowChildren ) {
|
385 |
+
return false;
|
386 |
+
}
|
387 |
+
},
|
388 |
+
|
389 |
+
rightAppend : function(tree, nodeThis, node) {
|
390 |
+
var empty = TreePanels.root2.findChild('id', 'empty');
|
391 |
+
if( empty && node.id != 'empty' ) {
|
392 |
+
TreePanels.root2.removeChild(empty);
|
393 |
+
}
|
394 |
+
},
|
395 |
+
|
396 |
+
rightRemove : function(tree, nodeThis, node) {
|
397 |
+
if( nodeThis.firstChild == null && node.id != 'empty' ) {
|
398 |
+
var newNode = new Ext.tree.TreeNode({
|
399 |
+
text : '<?php echo Mage::helper('category_attribute')->__('Empty') ?>',
|
400 |
+
id : 'empty',
|
401 |
+
cls : 'folder',
|
402 |
+
is_user_defined : 1,
|
403 |
+
allowDrop : false,
|
404 |
+
allowDrag : false
|
405 |
+
});
|
406 |
+
TreePanels.root2.appendChild(newNode);
|
407 |
+
}
|
408 |
+
},
|
409 |
+
|
410 |
+
leftBeforeInsert : function(tree, nodeThis, node, newParent) {
|
411 |
+
if( node.allowChildren == false ) {
|
412 |
+
return false;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
}
|
416 |
+
}();
|
417 |
+
|
418 |
+
function initVars() {
|
419 |
+
editSet.req = {};
|
420 |
+
editSet.req.attributes = false;
|
421 |
+
editSet.req.groups = new Array();
|
422 |
+
editSet.req.not_attributes = false;
|
423 |
+
editSet.req.attribute_set_name = false;
|
424 |
+
editSet.req.removeGroups = new Array();
|
425 |
+
}
|
426 |
+
|
427 |
+
initVars();
|
428 |
+
Ext.EventManager.onDocumentReady(TreePanels.init, TreePanels, true);
|
429 |
+
//]]>
|
430 |
+
</script>
|
431 |
+
</td>
|
432 |
+
</tr>
|
433 |
+
</table>
|
app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/main/tree/attribute.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/main/tree/group.phtml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<div id="tree-div1" style="width:320px;height:400px;margin-top:5px;overflow:auto"></div>
|
app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/toolbar/add.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<div class="content-header">
|
23 |
+
<table cellspacing="0">
|
24 |
+
<tr>
|
25 |
+
<td style="width:50%;"><h3 class="icon-head head-category-attribute-sets"><?php echo $this->_getHeader() ?></h3></td>
|
26 |
+
<td class="form-buttons">
|
27 |
+
<?php echo $this->getBackButtonHtml() ?>
|
28 |
+
<?php echo $this->getSaveButtonHtml() ?>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
</div>
|
33 |
+
<?php echo $this->getFormHtml() ?>
|
34 |
+
<script type="text/javascript">
|
35 |
+
var addSet = new varienForm('<?php echo $this->getFormId() ?>');
|
36 |
+
</script>
|
app/design/adminhtml/default/santhosh/template/catalog/category/attribute/set/toolbar/main.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @category Santhosh
|
16 |
+
* @package Santhosh_Core
|
17 |
+
* @copyright Copyright (c) 2011 completemagento
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author santhosh kumar <completemagento@gmail.com>
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<div class="content-header">
|
23 |
+
<table cellspacing="0">
|
24 |
+
<tr>
|
25 |
+
<td style="width:50%;"><h3 class="icon-head head-product-attribute-sets"><?php echo $this->_getHeader() ?></h3></td>
|
26 |
+
<td class="form-buttons">
|
27 |
+
<?php //echo $this->getNewButtonHtml() ?>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
</table>
|
31 |
+
</div>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Santhosh_CategoryAttribute</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This is an attribute manager for the categories.</summary>
|
10 |
+
<description>This is an attribute manager for the cateogories. you can add attributes to the cateogories</description>
|
11 |
+
<notes>This is an attribute manager for the cateogories. you can add attributes to the cateogories</notes>
|
12 |
+
<authors><author><name>santhosh kumar</name><user>auto-converted</user><email>completemagento@gmail.com</email></author></authors>
|
13 |
+
<date>2011-04-23</date>
|
14 |
+
<time>07:40:48</time>
|
15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="santhosh"><dir name="layout"><file name="categoryattribute.xml" hash="0b5d66b56fd0108e2d142003ed1663f5"/></dir><dir name="template"><dir name="catalog"><dir name="category"><dir name="attribute"><dir name="set"><dir name="main"><dir name="tree"><file name="attribute.phtml" hash="4688ac6279e12f6a354de033c096fc6b"/><file name="group.phtml" hash="3527350126b6cae3bbaa58f347efdf38"/></dir></dir><dir name="toolbar"><file name="add.phtml" hash="04e0b83e06ab58998841ac8036f44366"/><file name="main.phtml" hash="7b0741b45ad7c0a5359cf1b03c47bb73"/></dir><file name="main.phtml" hash="8ed027b92e86a76b3c6db5b55849c638"/></dir><file name="js.phtml" hash="0ec757eac7d379fe388e0a27472532e0"/><file name="options.phtml" hash="428357e0ac326fcb5a4e542277afe4d5"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Santhosh"><dir name="CategoryAttribute"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Category"><dir name="Attribute"><dir name="Edit"><dir name="Tab"><file name="Main.php" hash="9e0a72e4c1cc61dc98923250623d2840"/><file name="Options.php" hash="75573fdc9b9a2bd96ed6ed0e04bfe5b5"/></dir><file name="Form.php" hash="6694849c9a99f16fade43fc141d59f41"/><file name="Tabs.php" hash="e393b8cbae984236e7d4ace737b39640"/></dir><dir name="Set"><dir name="Main"><dir name="Tree"><file name="Group.php" hash="296353d457ab9e77cbc6ebe7a81395bf"/></dir><file name="Formset.php" hash="4089902fdbeea190c8ca82ec6a13f09e"/></dir><dir name="Toolbar"><file name="Add.php" hash="231aeac6addbb28cebc70c11efec0f1d"/><file name="Main.php" hash="7a193d2f9d6258030d3ea35290572b85"/></dir><file name="Grid.php" hash="efd928bb0b0f3a3bff94ec5d46577b62"/><file name="Main.php" hash="0d097fa7181d5e48c8f1e7936a56cafd"/></dir><file name="Edit.php" hash="b5be58285b8dd95712c6478913ecd48e"/><file name="Grid.php" hash="6557c8eb4c37a81ca94febcb7345470d"/></dir><dir name="Helper"><dir name="Form"><file name="Apply.php" hash="5f999471ccb7b9e2a1a8e15e354de9b2"/></dir></dir><dir name="Tab"><file name="Attributes.php" hash="60d92c349692dffc4f5a490112d45ed5"/><file name="General.php" hash="cecdc4cf9f0d6344a57bb7c16cd55517"/></dir><file name="Attribute.php" hash="fd0276c5b7763a7174914bf650305a7d"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Catalog"><dir name="Category"><file name="AttributeController.php" hash="1ddb365f3374cea330f02ee0ec1cacd1"/><file name="SetController.php" hash="df10367a64f175a300fa779dbc2ce2e1"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6c2c9773ee4bc11ae6e7eee8331fca7f"/><file name="config.xml" hash="709a42934be2dd5be3e4d4aba01be260"/></dir><dir name="Helper"><file name="Category.php" hash="73cf1049471f4901b90f5bbb431efaf4"/><file name="Data.php" hash="c2f6f5b71ac2c61d402dafbbdc12f003"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Category"><dir name="Attribute"><file name="Collection.php" hash="e22705da101fe0e22478f06f35bcd899"/></dir></dir></dir></dir></dir><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Category"><dir name="Tab"><file name="Attributes.php" hash="913f90019ff8cd8e3b3017f18a675157"/><file name="General.php" hash="88a95f4fac5586c775175d72b4690854"/></dir></dir></dir><dir name="Widget"><dir name="Form"><file name="Container.php" hash="c2a4a645c5052c0cad05e6d70e83606f"/></dir><dir name="Grid"><file name="Container.php" hash="ed244a95f2170b5adda24f2ac591df7c"/></dir><file name="Form.php" hash="d3a52d9010ed320e43077279418e8282"/><file name="Grid.php" hash="61c2598d71df768f2b1bdcc21d46f8f6"/><file name="Tabs.php" hash="0e4a6ce685cac9da2c7d4051c65e563a"/></dir><file name="Template.php" hash="3106bf171b6eec8e759df50aaefb9da6"/></dir><dir name="Eav"><dir name="Adminhtml"><dir name="Attribute"><dir name="Edit"><dir name="Main"><file name="Abstract.php" hash="e67ad3a0d6f496bebd07559522d53fd6"/></dir><dir name="Options"><file name="Abstract.php" hash="e95c02bcea260f21140abc9238ddd6bb"/></dir></dir><dir name="Grid"><file name="Abstract.php" hash="6f726cc78c6ff455e813246bf64c9690"/></dir></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c928eca36812e019bc22d35075f3650b"/><file name="config.xml" hash="46ff3a2d14bf5e0808c04314ee7d8dac"/></dir><dir name="Helper"><file name="Abstract.php" hash="867af320afc053f2606ae03922a1b309"/><file name="Data.php" hash="a3d7dcf1fe163dada6120cba4189fb4a"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Catalog"><dir name="Category"><dir name="Attribute"><file name="Collection.php" hash="02cae7f7170fcc6cf6b22161432b7330"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><package><name>Santhosh_Core</name><channel>community</channel><min>0.0.1</min><max></max></package></required></dependencies>
|
18 |
+
</package>
|