Skip to content

Commit

Permalink
Mage_Customer: add EAV grids
Browse files Browse the repository at this point in the history
Co-authored-by: Fabrizio Balliano <fabrizio.balliano@gmail.com>
  • Loading branch information
justinbeaty and fballiano committed Aug 1, 2022
1 parent 8257ad9 commit ce254ce
Show file tree
Hide file tree
Showing 8 changed files with 322 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* OpenMage
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

require_once 'Mage/Eav/controllers/Adminhtml/Attribute/AbstractController.php';

/**
* Customer address attribute controller
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/

class Mage_Adminhtml_Customer_Address_AttributeController extends Mage_Eav_Adminhtml_Attribute_AbstractController
{
/**
* Additional initialization
*
*/
protected function _construct()
{
$this->_entityCode = Mage_Customer_Model_Address::ENTITY;
}

protected function _initAction()
{
parent::_initAction();

$this->_title($this->__('Customers'))
->_title($this->__('Attributes'))
->_title($this->__('Manage Customer Address Attributes'));

$this->_setActiveMenu('customer/attributes')
->_addBreadcrumb(
$this->__('Customers'),
$this->__('Customers')
)
->_addBreadcrumb(
$this->__('Manage Customer Address Attributes'),
$this->__('Manage Customer Address Attributes')
);

return $this;
}

protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('customer/attributes/customer_address_attributes');
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* OpenMage
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

require_once 'Mage/Eav/controllers/Adminhtml/Set/AbstractController.php';

/**
* Customer address attribute sets controller
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/

class Mage_Adminhtml_Customer_Address_SetController extends Mage_Eav_Adminhtml_Set_AbstractController
{
/**
* Additional initialization
*
*/
protected function _construct()
{
$this->_entityCode = Mage_Customer_Model_Address::ENTITY;
}

protected function _initAction()
{
parent::_initAction();

$this->_title($this->__('Customers'))
->_title($this->__('Attributes'))
->_title($this->__('Manage Customer Address Attribute Sets'));

$this->_setActiveMenu('customer/attributes')
->_addBreadcrumb(
$this->__('Customers'),
$this->__('Customers')
)
->_addBreadcrumb(
$this->__('Manage Customer Address Attribute Sets'),
$this->__('Manage Customer Address Attribute Sets')
);

return $this;
}

protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('customer/attributes/customer_address_sets');
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* OpenMage
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

require_once 'Mage/Eav/controllers/Adminhtml/Attribute/AbstractController.php';

/**
* Customer attribute controller
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/

class Mage_Adminhtml_Customer_AttributeController extends Mage_Eav_Adminhtml_Attribute_AbstractController
{
/**
* Additional initialization
*
*/
protected function _construct()
{
$this->_entityCode = Mage_Customer_Model_Customer::ENTITY;
}

protected function _initAction()
{
parent::_initAction();

$this->_title($this->__('Customers'))
->_title($this->__('Attributes'))
->_title($this->__('Manage Customer Attributes'));

$this->_setActiveMenu('customer/attributes')
->_addBreadcrumb(
$this->__('Customers'),
$this->__('Customers')
)
->_addBreadcrumb(
$this->__('Manage Customer Attributes'),
$this->__('Manage Customer Attributes')
);

return $this;
}

protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('customer/attributes/customer_attributes');
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* OpenMage
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

require_once 'Mage/Eav/controllers/Adminhtml/Set/AbstractController.php';

/**
* Customer attribute sets controller
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/

class Mage_Adminhtml_Customer_SetController extends Mage_Eav_Adminhtml_Set_AbstractController
{
/**
* Additional initialization
*
*/
protected function _construct()
{
$this->_entityCode = Mage_Customer_Model_Customer::ENTITY;
}

protected function _initAction()
{
parent::_initAction();

$this->_title($this->__('Customers'))
->_title($this->__('Attributes'))
->_title($this->__('Manage Customer Attribute Sets'));

$this->_setActiveMenu('customer/attributes')
->_addBreadcrumb(
$this->__('Customers'),
$this->__('Customers')
)
->_addBreadcrumb(
$this->__('Manage Customer Attribute Sets'),
$this->__('Manage Customer Attribute Sets')
);

return $this;
}

protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('customer/attributes/customer_sets');
}

}
2 changes: 2 additions & 0 deletions app/code/core/Mage/Customer/Model/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
*/
class Mage_Customer_Model_Address extends Mage_Customer_Model_Address_Abstract
{
const ENTITY = 'customer_address';

protected $_customer;

protected function _construct()
Expand Down
8 changes: 5 additions & 3 deletions app/code/core/Mage/Customer/Model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
*/
class Mage_Customer_Model_Customer extends Mage_Core_Model_Abstract
{
const ENTITY = 'customer';

/**#@+
* Configuration pathes for email templates and identities
*/
Expand Down Expand Up @@ -155,7 +157,7 @@ class Mage_Customer_Model_Customer extends Mage_Core_Model_Abstract
const SUBSCRIBED_NO = 'no';
/**#@-*/

const CACHE_TAG = 'customer';
const CACHE_TAG = self::ENTITY;

/**
* Minimum Password Length
Expand All @@ -178,14 +180,14 @@ class Mage_Customer_Model_Customer extends Mage_Core_Model_Abstract
*
* @var string
*/
protected $_eventPrefix = 'customer';
protected $_eventPrefix = self::ENTITY;

/**
* Name of the event object
*
* @var string
*/
protected $_eventObject = 'customer';
protected $_eventObject = self::ENTITY;

/**
* List of errors
Expand Down
40 changes: 39 additions & 1 deletion app/code/core/Mage/Customer/etc/adminhtml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<customer translate="title" module="customer">
<title>Customers</title>
<sort_order>40</sort_order>
<!-- action>adminhtml/customer/</action -->
<children>
<manage translate="title" module="customer">
<title>Manage Customers</title>
Expand All @@ -42,6 +41,28 @@
<action>adminhtml/customer_group/</action>
<sort_order>10</sort_order>
</group>
<attributes translate="title" module="customer">
<title>Attributes</title>
<children>
<customer_attributes translate="title" module="customer">
<title>Manage Customer Attributes</title>
<action>adminhtml/customer_attribute/</action>
</customer_attributes>
<customer_sets translate="title" module="customer">
<title>Manage Customer Attribute Sets</title>
<action>adminhtml/customer_set/</action>
</customer_sets>
<customer_address_attributes translate="title" module="customer">
<title>Manage Customer Address Attributes</title>
<action>adminhtml/customer_address_attribute/</action>
</customer_address_attributes>
<customer_address_sets translate="title" module="customer">
<title>Manage Customer Address Attribute Sets</title>
<action>adminhtml/customer_address_set/</action>
</customer_address_sets>
</children>
<sort_order>20</sort_order>
</attributes>
<online translate="title" module="customer">
<title>Online Customers</title>
<action>adminhtml/customer_online/</action>
Expand All @@ -66,6 +87,23 @@
<title>Manage Customers</title>
<sort_order>0</sort_order>
</manage>
<attributes translate="title">
<title>Attributes</title>
<children>
<customer_attributes translate="title">
<title>Manage Customer Attributes</title>
</customer_attributes>
<customer_sets translate="title">
<title>Manage Customer Attribute Sets</title>
</customer_sets>
<customer_address_attributes translate="title">
<title>Manage Customer Address Attributes</title>
</customer_address_attributes>
<customer_address_sets translate="title">
<title>Manage Customer Address Attribute Sets</title>
</customer_address_sets>
</children>
</attributes>
<online translate="title">
<title>Online Customers</title>
<sort_order>100</sort_order>
Expand Down
4 changes: 4 additions & 0 deletions app/locale/en_US/Mage_Adminhtml.csv
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,10 @@
"Manage Content","Manage Content"
"Manage Currency Rates","Manage Currency Rates"
"Manage Customers","Manage Customers"
"Manage Customer Attributes","Manage Customer Attributes"
"Manage Customer Address Attributes","Manage Customer Address Attributes"
"Manage Customer Address Attribute Sets","Manage Customer Address Attribute Sets"
"Manage Customer Attribute Sets","Manage Customer Attribute Sets",
"Manage Options (values of your attribute)","Manage Options (values of your attribute)"
"Manage Ratings","Manage Ratings"
"Manage Stores","Manage Stores"
Expand Down

0 comments on commit ce254ce

Please sign in to comment.