Version Notes
Second version
Download this release
Release Info
| Developer | Sanjay Modasia |
| Extension | Hwg_Attributemanager |
| Version | 0.2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 0.1.0 to 0.2.0
- app/code/local/Hwg/Attributemanager/Block/Adminhtml/Address/Edit.php +0 -10
- app/code/local/Hwg/Attributemanager/Block/Adminhtml/Category/Edit.php +0 -10
- app/code/local/Hwg/Attributemanager/Block/Adminhtml/Customer/Edit.php +0 -10
- app/code/local/Hwg/Attributemanager/controllers/Adminhtml/AddressController.php +25 -2
- app/code/local/Hwg/Attributemanager/controllers/Adminhtml/CategoryController.php +25 -2
- app/code/local/Hwg/Attributemanager/controllers/Adminhtml/CustomerController.php +24 -1
- app/code/local/Hwg/Attributemanager/controllers/Adminhtml/IndexController.php +0 -264
- package.xml +5 -5
app/code/local/Hwg/Attributemanager/Block/Adminhtml/Address/Edit.php
CHANGED
|
@@ -86,14 +86,4 @@ class Hwg_Attributemanager_Block_Adminhtml_Address_Edit extends Mage_Adminhtml_B
|
|
| 86 |
}
|
| 87 |
|
| 88 |
}
|
| 89 |
-
|
| 90 |
-
public function getValidationUrl()
|
| 91 |
-
{
|
| 92 |
-
return $this->getUrl('*/*/validate', array('_current'=>true));
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
public function getSaveUrl()
|
| 96 |
-
{
|
| 97 |
-
return $this->getUrl('*/*/save', array('_current'=>true, 'back'=>null));
|
| 98 |
-
}
|
| 99 |
}
|
| 86 |
}
|
| 87 |
|
| 88 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
}
|
app/code/local/Hwg/Attributemanager/Block/Adminhtml/Category/Edit.php
CHANGED
|
@@ -78,14 +78,4 @@ class Hwg_Attributemanager_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_
|
|
| 78 |
}
|
| 79 |
|
| 80 |
}
|
| 81 |
-
|
| 82 |
-
public function getValidationUrl()
|
| 83 |
-
{
|
| 84 |
-
return $this->getUrl('*/*/validate', array('_current'=>true));
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
public function getSaveUrl()
|
| 88 |
-
{
|
| 89 |
-
return $this->getUrl('*/*/save', array('_current'=>true, 'back'=>null));
|
| 90 |
-
}
|
| 91 |
}
|
| 78 |
}
|
| 79 |
|
| 80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
app/code/local/Hwg/Attributemanager/Block/Adminhtml/Customer/Edit.php
CHANGED
|
@@ -78,14 +78,4 @@ class Hwg_Attributemanager_Block_Adminhtml_Customer_Edit extends Mage_Adminhtml_
|
|
| 78 |
}
|
| 79 |
|
| 80 |
}
|
| 81 |
-
|
| 82 |
-
public function getValidationUrl()
|
| 83 |
-
{
|
| 84 |
-
return $this->getUrl('*/*/validate', array('_current'=>true));
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
public function getSaveUrl()
|
| 88 |
-
{
|
| 89 |
-
return $this->getUrl('*/*/save', array('_current'=>true, 'back'=>null));
|
| 90 |
-
}
|
| 91 |
}
|
| 78 |
}
|
| 79 |
|
| 80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
app/code/local/Hwg/Attributemanager/controllers/Adminhtml/AddressController.php
CHANGED
|
@@ -64,7 +64,30 @@ class Hwg_Attributemanager_Adminhtml_AddressController extends Mage_Adminhtml_Co
|
|
| 64 |
$this->_redirect('*/*/');
|
| 65 |
}
|
| 66 |
}
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
public function newAction() {
|
| 69 |
$this->_forward('edit');
|
| 70 |
}
|
|
@@ -104,7 +127,7 @@ class Hwg_Attributemanager_Adminhtml_AddressController extends Mage_Adminhtml_Co
|
|
| 104 |
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 105 |
|
| 106 |
if ($this->getRequest()->getParam('back')) {
|
| 107 |
-
$this->_redirect('*/*/edit', array('type'
|
| 108 |
return;
|
| 109 |
}
|
| 110 |
|
| 64 |
$this->_redirect('*/*/');
|
| 65 |
}
|
| 66 |
}
|
| 67 |
+
|
| 68 |
+
public function validateAction()
|
| 69 |
+
{
|
| 70 |
+
$response = new Varien_Object();
|
| 71 |
+
$response->setError(false);
|
| 72 |
+
|
| 73 |
+
$attributeCode = $this->getRequest()->getParam('type');
|
| 74 |
+
$attributeId = $this->getRequest()->getParam('attribute_id');
|
| 75 |
+
|
| 76 |
+
$this->_entityTypeId=$this->_customer_addressTypeId;
|
| 77 |
+
|
| 78 |
+
$attribute = Mage::getModel('eav/entity_attribute')
|
| 79 |
+
->loadByCode($this->_entityTypeId, $attributeCode);
|
| 80 |
+
|
| 81 |
+
if ($attribute->getId() && !$attributeId) {
|
| 82 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Attribute with the same code already exists'));
|
| 83 |
+
$this->_initLayoutMessages('adminhtml/session');
|
| 84 |
+
$response->setError(true);
|
| 85 |
+
$response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
$this->getResponse()->setBody($response->toJson());
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
public function newAction() {
|
| 92 |
$this->_forward('edit');
|
| 93 |
}
|
| 127 |
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 128 |
|
| 129 |
if ($this->getRequest()->getParam('back')) {
|
| 130 |
+
$this->_redirect('*/*/edit', array('type'=>'customer_address', 'attribute_id' => $id));
|
| 131 |
return;
|
| 132 |
}
|
| 133 |
|
app/code/local/Hwg/Attributemanager/controllers/Adminhtml/CategoryController.php
CHANGED
|
@@ -103,7 +103,7 @@ class Hwg_Attributemanager_Adminhtml_CategoryController extends Mage_Adminhtml_C
|
|
| 103 |
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 104 |
|
| 105 |
if ($this->getRequest()->getParam('back')) {
|
| 106 |
-
$this->_redirect('*/*/edit', array('type'
|
| 107 |
return;
|
| 108 |
}
|
| 109 |
|
|
@@ -119,7 +119,30 @@ class Hwg_Attributemanager_Adminhtml_CategoryController extends Mage_Adminhtml_C
|
|
| 119 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('attributemanager')->__('Unable to find item to save'));
|
| 120 |
$this->_redirect('*/*/'.$this->_block);
|
| 121 |
}
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
public function deleteAction() {
|
| 124 |
if( $this->getRequest()->getParam('attribute_id') > 0 ) {
|
| 125 |
try {
|
| 103 |
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 104 |
|
| 105 |
if ($this->getRequest()->getParam('back')) {
|
| 106 |
+
$this->_redirect('*/*/edit', array('type'=>'catalog_category', 'attribute_id' => $id));
|
| 107 |
return;
|
| 108 |
}
|
| 109 |
|
| 119 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('attributemanager')->__('Unable to find item to save'));
|
| 120 |
$this->_redirect('*/*/'.$this->_block);
|
| 121 |
}
|
| 122 |
+
|
| 123 |
+
public function validateAction()
|
| 124 |
+
{
|
| 125 |
+
$response = new Varien_Object();
|
| 126 |
+
$response->setError(false);
|
| 127 |
+
|
| 128 |
+
$attributeCode = $this->getRequest()->getParam('type');
|
| 129 |
+
$attributeId = $this->getRequest()->getParam('attribute_id');
|
| 130 |
+
|
| 131 |
+
$this->_entityTypeId=$this->_categoryTypeId;
|
| 132 |
+
|
| 133 |
+
$attribute = Mage::getModel('eav/entity_attribute')
|
| 134 |
+
->loadByCode($this->_entityTypeId, $attributeCode);
|
| 135 |
+
|
| 136 |
+
if ($attribute->getId() && !$attributeId) {
|
| 137 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Attribute with the same code already exists'));
|
| 138 |
+
$this->_initLayoutMessages('adminhtml/session');
|
| 139 |
+
$response->setError(true);
|
| 140 |
+
$response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
$this->getResponse()->setBody($response->toJson());
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
public function deleteAction() {
|
| 147 |
if( $this->getRequest()->getParam('attribute_id') > 0 ) {
|
| 148 |
try {
|
app/code/local/Hwg/Attributemanager/controllers/Adminhtml/CustomerController.php
CHANGED
|
@@ -61,6 +61,29 @@ class Hwg_Attributemanager_Adminhtml_CustomerController extends Mage_Adminhtml_C
|
|
| 61 |
$this->_redirect('*/*/');
|
| 62 |
}
|
| 63 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
public function newAction() {
|
| 66 |
$this->_forward('edit');
|
|
@@ -101,7 +124,7 @@ class Hwg_Attributemanager_Adminhtml_CustomerController extends Mage_Adminhtml_C
|
|
| 101 |
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 102 |
|
| 103 |
if ($this->getRequest()->getParam('back')) {
|
| 104 |
-
$this->_redirect('*/*/edit', array('type'
|
| 105 |
return;
|
| 106 |
}
|
| 107 |
|
| 61 |
$this->_redirect('*/*/');
|
| 62 |
}
|
| 63 |
}
|
| 64 |
+
|
| 65 |
+
public function validateAction()
|
| 66 |
+
{
|
| 67 |
+
$response = new Varien_Object();
|
| 68 |
+
$response->setError(false);
|
| 69 |
+
|
| 70 |
+
$attributeCode = $this->getRequest()->getParam('type');
|
| 71 |
+
$attributeId = $this->getRequest()->getParam('attribute_id');
|
| 72 |
+
|
| 73 |
+
$this->_entityTypeId=$this->_customerTypeId;
|
| 74 |
+
|
| 75 |
+
$attribute = Mage::getModel('eav/entity_attribute')
|
| 76 |
+
->loadByCode($this->_entityTypeId, $attributeCode);
|
| 77 |
+
|
| 78 |
+
if ($attribute->getId() && !$attributeId) {
|
| 79 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Attribute with the same code already exists'));
|
| 80 |
+
$this->_initLayoutMessages('adminhtml/session');
|
| 81 |
+
$response->setError(true);
|
| 82 |
+
$response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
$this->getResponse()->setBody($response->toJson());
|
| 86 |
+
}
|
| 87 |
|
| 88 |
public function newAction() {
|
| 89 |
$this->_forward('edit');
|
| 124 |
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 125 |
|
| 126 |
if ($this->getRequest()->getParam('back')) {
|
| 127 |
+
$this->_redirect('*/*/edit', array('type'=>'customer', 'attribute_id' => $id));
|
| 128 |
return;
|
| 129 |
}
|
| 130 |
|
app/code/local/Hwg/Attributemanager/controllers/Adminhtml/IndexController.php
DELETED
|
@@ -1,264 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Hwg_Attributemanager_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
| 3 |
-
{
|
| 4 |
-
protected $_customerTypeId;
|
| 5 |
-
protected $_categoryTypeId;
|
| 6 |
-
protected $_customer_addressTypeId;
|
| 7 |
-
protected $_type;
|
| 8 |
-
protected $_block;
|
| 9 |
-
|
| 10 |
-
public function preDispatch()
|
| 11 |
-
{
|
| 12 |
-
parent::preDispatch();
|
| 13 |
-
$this->_customerTypeId = Mage::getModel('eav/entity')->setType('customer')->getTypeId();
|
| 14 |
-
$this->_categoryTypeId = Mage::getModel('eav/entity')->setType('catalog_category')->getTypeId();
|
| 15 |
-
$this->_customer_addressTypeId = Mage::getModel('eav/entity')->setType('customer_address')->getTypeId();
|
| 16 |
-
|
| 17 |
-
if ($this->getRequest ()->getParam ( 'type' ))
|
| 18 |
-
{
|
| 19 |
-
switch ($this->getRequest ()->getParam ( 'type' ))
|
| 20 |
-
{
|
| 21 |
-
case "catalog_category" :
|
| 22 |
-
$this->_block = 'category';
|
| 23 |
-
$this->_type = 'catalog_category';
|
| 24 |
-
break;
|
| 25 |
-
|
| 26 |
-
case "customer" :
|
| 27 |
-
$this->_block = 'customer';
|
| 28 |
-
$this->_type = 'customer';
|
| 29 |
-
break;
|
| 30 |
-
|
| 31 |
-
case "customer_address" :
|
| 32 |
-
$this->_block = 'address';
|
| 33 |
-
$this->_type = 'customer_address';
|
| 34 |
-
break;
|
| 35 |
-
}
|
| 36 |
-
}
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
protected function _initAction() {
|
| 40 |
-
$this->loadLayout()
|
| 41 |
-
->_setActiveMenu('attributemanager/attributemanager')
|
| 42 |
-
->_addBreadcrumb(Mage::helper('adminhtml')->__('Attribute Manager'), Mage::helper('adminhtml')->__('Attribute Manager'));
|
| 43 |
-
return $this;
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
public function categoryAction() {
|
| 47 |
-
$this->_initAction()->renderLayout();
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
public function customerAction()
|
| 51 |
-
{
|
| 52 |
-
$this->_initAction()->renderLayout();
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
-
public function addressAction()
|
| 56 |
-
{
|
| 57 |
-
$this->_initAction()->renderLayout();
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
public function editAction()
|
| 61 |
-
{
|
| 62 |
-
$id = $this->getRequest()->getParam('attribute_id');
|
| 63 |
-
$model = Mage::getModel('eav/entity_attribute')->load($id);
|
| 64 |
-
|
| 65 |
-
if(0!==$id){
|
| 66 |
-
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 67 |
-
$model->setData("sort_order",$db->fetchOne("select sort_order from eav_entity_attribute where attribute_id=$id"));
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
if ($model->getId() || $id == 0) {
|
| 72 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
| 73 |
-
if (!empty($data)) {
|
| 74 |
-
$model->setData($data);
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
Mage::register('attributemanager_data', $model);
|
| 78 |
-
|
| 79 |
-
$this->loadLayout();
|
| 80 |
-
$this->_setActiveMenu('attributemanager/attributemanager');
|
| 81 |
-
|
| 82 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
| 83 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
| 84 |
-
|
| 85 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 86 |
-
|
| 87 |
-
$this
|
| 88 |
-
->_addContent($this->getLayout()->createBlock('attributemanager/adminhtml_'.$this->_block.'_edit'))
|
| 89 |
-
->_addLeft($this->getLayout()->createBlock('attributemanager/adminhtml_'.$this->_block.'_edit_tabs'))
|
| 90 |
-
;
|
| 91 |
-
|
| 92 |
-
$this->renderLayout();
|
| 93 |
-
} else {
|
| 94 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('attributemanager')->__('Item does not exist'));
|
| 95 |
-
$this->_redirect('*/*/');
|
| 96 |
-
}
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
public function newAction() {
|
| 100 |
-
$this->_forward('edit');
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
public function validateAction()
|
| 104 |
-
{
|
| 105 |
-
$response = new Varien_Object();
|
| 106 |
-
$response->setError(false);
|
| 107 |
-
|
| 108 |
-
$attributeCode = $this->getRequest()->getParam('type');
|
| 109 |
-
$attributeId = $this->getRequest()->getParam('attribute_id');
|
| 110 |
-
switch ($attributeCode){
|
| 111 |
-
case "catalog_category":
|
| 112 |
-
$this->_entityTypeId=$this->_categoryTypeId;
|
| 113 |
-
break;
|
| 114 |
-
|
| 115 |
-
case "customer":
|
| 116 |
-
$this->_entityTypeId=$this->_customerTypeId;
|
| 117 |
-
break;
|
| 118 |
-
|
| 119 |
-
case "customer_address":
|
| 120 |
-
$this->_entityTypeId=$this->_customer_addressTypeId;
|
| 121 |
-
break;
|
| 122 |
-
}
|
| 123 |
-
$attribute = Mage::getModel('eav/entity_attribute')
|
| 124 |
-
->loadByCode($this->_entityTypeId, $attributeCode);
|
| 125 |
-
|
| 126 |
-
if ($attribute->getId() && !$attributeId) {
|
| 127 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Attribute with the same code already exists'));
|
| 128 |
-
$this->_initLayoutMessages('adminhtml/session');
|
| 129 |
-
$response->setError(true);
|
| 130 |
-
$response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
$this->getResponse()->setBody($response->toJson());
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
public function saveAction() {
|
| 137 |
-
if ($data = $this->getRequest()->getPost()) {
|
| 138 |
-
|
| 139 |
-
$model = Mage::getModel('attributemanager/attributemanager');
|
| 140 |
-
$model->setData($data);
|
| 141 |
-
if( $this->getRequest()->getParam('attribute_id') > 0 ) {
|
| 142 |
-
|
| 143 |
-
$model->setId($this->getRequest()->getParam('attribute_id'));
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
try {
|
| 147 |
-
|
| 148 |
-
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
| 149 |
-
$model->setCreatedTime(now())
|
| 150 |
-
->setUpdateTime(now());
|
| 151 |
-
} else {
|
| 152 |
-
$model->setUpdateTime(now());
|
| 153 |
-
}
|
| 154 |
-
|
| 155 |
-
$model->save();
|
| 156 |
-
$id=$model->getId();
|
| 157 |
-
|
| 158 |
-
if($this->_block == 'customer' || $this->_block == 'address')
|
| 159 |
-
{
|
| 160 |
-
$attribute = Mage::getModel('eav/entity_attribute')->load($id);
|
| 161 |
-
|
| 162 |
-
Mage::getSingleton('eav/config')
|
| 163 |
-
->getAttribute($this->_type, $attribute->getAttributeCode())
|
| 164 |
-
->setData('used_in_forms', $data['customer_form'])
|
| 165 |
-
->save();
|
| 166 |
-
}
|
| 167 |
-
|
| 168 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('attributemanager')->__('Item was successfully saved'));
|
| 169 |
-
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 170 |
-
|
| 171 |
-
if ($this->getRequest()->getParam('back')) {
|
| 172 |
-
$this->_redirect('*/*/edit', array('type'=>$this->getRequest()->getParam('type'), 'attribute_id' => $id));
|
| 173 |
-
return;
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
$this->_redirect('*/*/'.$this->_block);
|
| 177 |
-
return;
|
| 178 |
-
} catch (Exception $e) {
|
| 179 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 180 |
-
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 181 |
-
$this->_redirect('*/*/edit', array('type'=>$this->getRequest()->getParam('type'),'attribute_id' => $this->getRequest()->getParam('attribute_id')));
|
| 182 |
-
return;
|
| 183 |
-
}
|
| 184 |
-
}
|
| 185 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('attributemanager')->__('Unable to find item to save'));
|
| 186 |
-
$this->_redirect('*/*/'.$this->_block);
|
| 187 |
-
}
|
| 188 |
-
|
| 189 |
-
public function deleteAction() {
|
| 190 |
-
if( $this->getRequest()->getParam('attribute_id') > 0 ) {
|
| 191 |
-
try {
|
| 192 |
-
$model = Mage::getModel('eav/entity_attribute');
|
| 193 |
-
|
| 194 |
-
$model->setId($this->getRequest()->getParam('attribute_id'))
|
| 195 |
-
->delete();
|
| 196 |
-
|
| 197 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
| 198 |
-
$this->_redirect('*/*/'.$this->_type.'/filter//');
|
| 199 |
-
} catch (Exception $e) {
|
| 200 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 201 |
-
$this->_redirect('*/*/edit', array('type'=>$this->getRequest()->getParam('type'),'attribute_id' => $this->getRequest()->getParam('attribute_id')));
|
| 202 |
-
}
|
| 203 |
-
}
|
| 204 |
-
$this->_redirect('*/*/'.$this->_type.'/filter//');
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
public function massDeleteAction() {
|
| 208 |
-
$categoriesattributesIds = $this->getRequest()->getParam('attributemanager');
|
| 209 |
-
if(!is_array($categoriesattributesIds)) {
|
| 210 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
| 211 |
-
} else {
|
| 212 |
-
try {
|
| 213 |
-
foreach ($categoriesattributesIds as $categoriesattributesId) {
|
| 214 |
-
$categoriesattributes = Mage::getModel('eav/entity_attribute')->load($categoriesattributesId);
|
| 215 |
-
$categoriesattributes->delete();
|
| 216 |
-
}
|
| 217 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 218 |
-
Mage::helper('adminhtml')->__(
|
| 219 |
-
'Total of %d record(s) were successfully deleted', count($categoriesattributesIds)
|
| 220 |
-
)
|
| 221 |
-
);
|
| 222 |
-
} catch (Exception $e) {
|
| 223 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 224 |
-
}
|
| 225 |
-
}
|
| 226 |
-
$this->_redirect('*/*/'.$this->_type.'/filter//');
|
| 227 |
-
}
|
| 228 |
-
|
| 229 |
-
public function exportCsvAction()
|
| 230 |
-
{
|
| 231 |
-
$fileName = $this->_type.'attributes.csv';
|
| 232 |
-
$content = $this->getLayout()->createBlock('attributemanager/grid')
|
| 233 |
-
->getCsv();
|
| 234 |
-
|
| 235 |
-
$this->_sendUploadResponse($fileName, $content);
|
| 236 |
-
}
|
| 237 |
-
|
| 238 |
-
public function exportXmlAction()
|
| 239 |
-
{
|
| 240 |
-
$fileName = $this->_type.'attributes.xml';
|
| 241 |
-
$content = $this->getLayout()->createBlock('attributemanager/grid')
|
| 242 |
-
->getXml();
|
| 243 |
-
|
| 244 |
-
$this->_sendUploadResponse($fileName, $content);
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
| 248 |
-
{
|
| 249 |
-
$response = $this->getResponse();
|
| 250 |
-
$response->setHeader('HTTP/1.1 200 OK','');
|
| 251 |
-
$response->setHeader('Pragma', 'public', true);
|
| 252 |
-
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 253 |
-
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
| 254 |
-
$response->setHeader('Last-Modified', date('r'));
|
| 255 |
-
$response->setHeader('Accept-Ranges', 'bytes');
|
| 256 |
-
$response->setHeader('Content-Length', strlen($content));
|
| 257 |
-
$response->setHeader('Content-type', $contentType);
|
| 258 |
-
$response->setBody($content);
|
| 259 |
-
$response->sendResponse();
|
| 260 |
-
die;
|
| 261 |
-
}
|
| 262 |
-
}
|
| 263 |
-
|
| 264 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Hwg_Attributemanager</name>
|
| 4 |
-
<version>0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">GPL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Create custom attribute for customer, category, customer address</summary>
|
| 10 |
<description>Using this extension you can create custom attributes for customer, category, customer address.</description>
|
| 11 |
-
<notes>
|
| 12 |
<authors><author><name>Sanjay Modasia</name><user>sanjaymodasia</user><email>sanjaymodasia@gmail.com</email></author></authors>
|
| 13 |
-
<date>2012-05-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magelocal"><dir name="Hwg"><dir name="Attributemanager"><dir name="Block"><dir name="Adminhtml"><dir name="Address"><dir name="Edit"><file name="Form.php" hash="b6cd8384a5380850d810adfebdd9f714"/><dir name="Tab"><file name="Main.php" hash="98fb53f1ac8315077891829ea76c6732"/><file name="Options.php" hash="9b802dbcf80251e45a5f77ece9895033"/></dir><file name="Tabs.php" hash="b010124cc527cc0bda16b062e0ec12d9"/></dir><file name="Edit.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Hwg_Attributemanager</name>
|
| 4 |
+
<version>0.2.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">GPL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Create custom attribute for customer, category, customer address</summary>
|
| 10 |
<description>Using this extension you can create custom attributes for customer, category, customer address.</description>
|
| 11 |
+
<notes>Second version</notes>
|
| 12 |
<authors><author><name>Sanjay Modasia</name><user>sanjaymodasia</user><email>sanjaymodasia@gmail.com</email></author></authors>
|
| 13 |
+
<date>2012-05-31</date>
|
| 14 |
+
<time>15:09:38</time>
|
| 15 |
+
<contents><target name="magelocal"><dir name="Hwg"><dir name="Attributemanager"><dir name="Block"><dir name="Adminhtml"><dir name="Address"><dir name="Edit"><file name="Form.php" hash="b6cd8384a5380850d810adfebdd9f714"/><dir name="Tab"><file name="Main.php" hash="98fb53f1ac8315077891829ea76c6732"/><file name="Options.php" hash="9b802dbcf80251e45a5f77ece9895033"/></dir><file name="Tabs.php" hash="b010124cc527cc0bda16b062e0ec12d9"/></dir><file name="Edit.php" hash="ce2bd494cc16ebd29e5aa1fab4e910ba"/><file name="Grid.php" hash="3d6b4941dcfe3acdf8612ec18797d1a9"/></dir><file name="Address.php" hash="0ee9142d47a055ce80b9abba1edd2a10"/><dir name="Category"><dir name="Edit"><file name="Form.php" hash="117173cba42eb72725c2bac6717eaae4"/><dir name="Tab"><file name="Front.php" hash="1adeab8c8bbf9c45f8d81d5453a9fa63"/><file name="Main.php" hash="7065c6806abba244b42c8533b5328f45"/><file name="Options.php" hash="f54573f629266fb215ca2a2ff79690b1"/><file name="System.php" hash="a0297869e9aa6df54611e61946764606"/></dir><file name="Tabs.php" hash="175dc93f524d62fac852a3c88d5cd3fa"/></dir><file name="Edit.php" hash="2b660b032771be68fd9bb05f968161fa"/><file name="Grid.php" hash="5e5fea8d4ed79f3712708198c53d41dc"/></dir><file name="Category.php" hash="103e8d55704b9237af218c18eec51359"/><dir name="Customer"><dir name="Edit"><file name="Form.php" hash="518c24ba092cb60841db93b6a9b33658"/><dir name="Tab"><file name="Front.php" hash="29754c79c4b9fdf247fc4be78bb762f8"/><file name="Main.php" hash="20fac1539bce94c150d606f36700a474"/><file name="Options.php" hash="cc77c662c69e297eb53f6bc9abb446b9"/><file name="System.php" hash="133a65f79ced3e244347a4c0d6495854"/></dir><file name="Tabs.php" hash="2b4a7cea518b27bc46135dbc3bfce96d"/></dir><file name="Edit.php" hash="69ac4ca2976ef8cfb2d867ef05ec89ef"/><file name="Grid.php" hash="d86c4c106a8660b2481a2a9e613a8154"/></dir><file name="Customer.php" hash="fdbe66aa1b6cbbaaa92239bf5cfb92b7"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b3ac459c1fcaa696433aeafede13747e"/></dir><dir name="Model"><file name="Attributemanager.php" hash="e54514153c723943ceb0835bdf18000d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AddressController.php" hash="fd18f78f1502d14c075510ab04c9f603"/><file name="CategoryController.php" hash="180043881072ec31a75c669e20bf1872"/><file name="CustomerController.php" hash="2b65650f1d3686fd2e9194510f0ec234"/></dir></dir><dir name="etc"><file name="config.xml" hash="fc071f2cfae029187dce63f728192b6a"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="attributemanager.xml" hash="616f27b876b35df290befde732c98638"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hwg_Attributemanager.xml" hash="c88f9e812a4f29ebf61e76602792c539"/></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
