Version Notes
Fixed Minor Bugs
Download this release
Release Info
Developer | Zestard |
Extension | customerattributes |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.4
- app/code/community/Zestard/Customerattribute/Block/Adminhtml/Customerattribute/Edit/Main/Main.php +16 -0
- app/code/community/Zestard/Customerattribute/Block/Data.php +11 -0
- app/code/community/Zestard/Customerattribute/Block/OrderData.php +14 -0
- app/code/community/Zestard/Customerattribute/Model/Customer.php +92 -0
- app/code/community/Zestard/Customerattribute/Model/Order.php +133 -0
- app/code/community/Zestard/Customerattribute/controllers/Adminhtml/CustomerattributeController.php +422 -423
- app/code/community/Zestard/Customerattribute/etc/adminhtml.xml +11 -0
- app/code/community/Zestard/Customerattribute/etc/config.xml +41 -3
- app/code/community/Zestard/Customerattribute/etc/system.xml +85 -0
- app/code/community/Zestard/Customerattribute/sql/zestard_customerattribute_setup/mysql4-install-1.0.2.php +27 -0
- app/design/frontend/base/default/layout/zestard_customerattribute.xml +9 -5
- app/locale/en_US/Zestard_Customerattribute.csv +1 -0
- package.xml +4 -4
- skin/adminhtml/default/default/images/customerattribute/zestard-logo.png +0 -0
app/code/community/Zestard/Customerattribute/Block/Adminhtml/Customerattribute/Edit/Main/Main.php
CHANGED
@@ -88,6 +88,22 @@ class Zestard_Customerattribute_Block_Adminhtml_Customerattribute_Edit_Main_Mai
|
|
88 |
'value' => $attributeObject->getDefaultValue(),
|
89 |
));
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
92 |
$fieldset->addField('default_value_date', 'date', array(
|
93 |
'name' => 'default_value_date',
|
88 |
'value' => $attributeObject->getDefaultValue(),
|
89 |
));
|
90 |
|
91 |
+
$fieldset->addField('send_register_email', 'select', array(
|
92 |
+
'name' => 'send_register_email',
|
93 |
+
'label' => Mage::helper('eav')->__('Send with Register Email'),
|
94 |
+
'title' => Mage::helper('eav')->__('Send with Register Email'),
|
95 |
+
'note' => Mage::helper('eav')->__('Send attribute value with register user email'),
|
96 |
+
'values' => $yesno,
|
97 |
+
));
|
98 |
+
|
99 |
+
$fieldset->addField('send_order_email', 'select', array(
|
100 |
+
'name' => 'send_order_email',
|
101 |
+
'label' => Mage::helper('eav')->__('Send with Order Email'),
|
102 |
+
'title' => Mage::helper('eav')->__('Send with Order Email'),
|
103 |
+
'note' => Mage::helper('eav')->__('Send attribute value with Order email'),
|
104 |
+
'values' => $yesno,
|
105 |
+
));
|
106 |
+
|
107 |
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
108 |
$fieldset->addField('default_value_date', 'date', array(
|
109 |
'name' => 'default_value_date',
|
app/code/community/Zestard/Customerattribute/Block/Data.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zestard_Customerattribute_Block_Data extends Varien_Object {
|
3 |
+
public function arrayToHtml() {
|
4 |
+
$result = '<br /><b>Information :</b> <br />';
|
5 |
+
foreach ($this->getData() as $key => $value) {
|
6 |
+
$result .= '<b>'.ucfirst($key) . '</b> : ' . ((trim($value) != "") ? $value : 'N/A') . '<br />';
|
7 |
+
}
|
8 |
+
return $result;
|
9 |
+
}
|
10 |
+
}
|
11 |
+
?>
|
app/code/community/Zestard/Customerattribute/Block/OrderData.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zestard_Customerattribute_Block_OrderData extends Varien_Object {
|
3 |
+
public function arrayToHtml() {
|
4 |
+
if($this->getData() != NULL)
|
5 |
+
{
|
6 |
+
$result = '<h6>Information</h6>';
|
7 |
+
foreach ($this->getData() as $key => $value) {
|
8 |
+
$result .= '<span>'.ucfirst($key) . ' : ' . ((trim($value) != "") ? $value : 'N/A') . '</span><br />';
|
9 |
+
}
|
10 |
+
}
|
11 |
+
return $result;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
?>
|
app/code/community/Zestard/Customerattribute/Model/Customer.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zestard_Customerattribute_Model_Customer extends Mage_Customer_Model_Customer
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Send email with new account related information
|
6 |
+
*
|
7 |
+
* @param string $type
|
8 |
+
* @param string $backUrl
|
9 |
+
* @param string $storeId
|
10 |
+
* @throws Mage_Core_Exception
|
11 |
+
* @return Mage_Customer_Model_Customer
|
12 |
+
*/
|
13 |
+
public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0')
|
14 |
+
{
|
15 |
+
$types = array(
|
16 |
+
'registered' => self::XML_PATH_REGISTER_EMAIL_TEMPLATE, // welcome email, when confirmation is disabled
|
17 |
+
'confirmed' => self::XML_PATH_CONFIRMED_EMAIL_TEMPLATE, // welcome email, when confirmation is enabled
|
18 |
+
'confirmation' => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, // email with confirmation link
|
19 |
+
);
|
20 |
+
if (!isset($types[$type])) {
|
21 |
+
Mage::throwException(Mage::helper('customer')->__('Wrong transactional account email type'));
|
22 |
+
}
|
23 |
+
|
24 |
+
if (!$storeId) {
|
25 |
+
$storeId = $this->_getWebsiteStoreId($this->getSendemailStoreId());
|
26 |
+
}
|
27 |
+
|
28 |
+
$this->_sendEmailTemplateCustom($types[$type], self::XML_PATH_REGISTER_EMAIL_IDENTITY,
|
29 |
+
array('customer' => $this, 'back_url' => $backUrl), $storeId);
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Send corresponding email template
|
36 |
+
*
|
37 |
+
* @param string $emailTemplate configuration path of email template
|
38 |
+
* @param string $emailSender configuration path of email identity
|
39 |
+
* @param array $templateParams
|
40 |
+
* @param int|null $storeId
|
41 |
+
* @return Mage_Customer_Model_Customer
|
42 |
+
*/
|
43 |
+
protected function _sendEmailTemplateCustom($template, $sender, $templateParams = array(), $storeId = null)
|
44 |
+
{
|
45 |
+
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
|
46 |
+
$mailer = Mage::getModel('core/email_template_mailer');
|
47 |
+
$emailInfo = Mage::getModel('core/email_info');
|
48 |
+
$emailInfo->addTo($this->getEmail(), $this->getName());
|
49 |
+
$mailer->addEmailInfo($emailInfo);
|
50 |
+
|
51 |
+
//---------- code for add template variables in email -----------
|
52 |
+
|
53 |
+
$add_in_customer_registration = Mage::getStoreConfig('zestard_customerattribute/customerattribute_group/add_in_customer_registration');
|
54 |
+
|
55 |
+
$customerAddressAttribute = array();
|
56 |
+
$Addressattributes = Mage::getModel('zestard_customerattribute/customerattribute')->getCollection();
|
57 |
+
|
58 |
+
foreach ($Addressattributes->getData() as $key => $value) {
|
59 |
+
$customerAddressAttribute[] = $value['attribute_code'];
|
60 |
+
}
|
61 |
+
|
62 |
+
$data = array();
|
63 |
+
$postObject = new Zestard_Customerattribute_Block_Data();
|
64 |
+
|
65 |
+
if($add_in_customer_registration == 1) {
|
66 |
+
foreach($this->getData() as $key => $value) {
|
67 |
+
if(in_array($key,$customerAddressAttribute)) {
|
68 |
+
|
69 |
+
$attributeCollection = Mage::getModel('zestard_customerattribute/customerattribute')->getCollection()
|
70 |
+
->addFieldToFilter('attribute_code',$key);
|
71 |
+
$attr = $attributeCollection->getData();
|
72 |
+
if($attr[0]['send_register_email'] == 1 && $attr[0]['is_user_defined'] == 1) {
|
73 |
+
$label = $attr[0]['frontend_label'];
|
74 |
+
$data[$label] = $value;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
$postObject->setData($data);
|
80 |
+
|
81 |
+
// -------------code end -------------------------------
|
82 |
+
// Set all required params and send emails
|
83 |
+
$mailer->setSender(Mage::getStoreConfig($sender, $storeId));
|
84 |
+
$mailer->setStoreId($storeId);
|
85 |
+
$mailer->setTemplateId(Mage::getStoreConfig($template, $storeId));
|
86 |
+
$mailer->setTemplateParams(array_merge(array('CustomerAttribute' => $postObject),$templateParams));
|
87 |
+
//$mailer->setTemplateParams($templateParams);
|
88 |
+
$mailer->send();
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
?>
|
app/code/community/Zestard/Customerattribute/Model/Order.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zestard_Customerattribute_Model_Order extends Mage_Sales_Model_Order
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Queue email with new order data
|
6 |
+
*
|
7 |
+
* @param bool $forceMode if true then email will be sent regardless of the fact that it was already sent previously
|
8 |
+
*
|
9 |
+
* @return Mage_Sales_Model_Order
|
10 |
+
* @throws Exception
|
11 |
+
*/
|
12 |
+
public function queueNewOrderEmail($forceMode = false)
|
13 |
+
{
|
14 |
+
//die('dioed');
|
15 |
+
$storeId = $this->getStore()->getId();
|
16 |
+
|
17 |
+
if (!Mage::helper('sales')->canSendNewOrderEmail($storeId)) {
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
+
|
21 |
+
// Get the destination email addresses to send copies to
|
22 |
+
$copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
|
23 |
+
$copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
|
24 |
+
|
25 |
+
// Start store emulation process
|
26 |
+
/** @var $appEmulation Mage_Core_Model_App_Emulation */
|
27 |
+
$appEmulation = Mage::getSingleton('core/app_emulation');
|
28 |
+
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
|
29 |
+
|
30 |
+
try {
|
31 |
+
// Retrieve specified view block from appropriate design package (depends on emulated store)
|
32 |
+
$paymentBlock = Mage::helper('payment')->getInfoBlock($this->getPayment())
|
33 |
+
->setIsSecureMode(true);
|
34 |
+
$paymentBlock->getMethod()->setStore($storeId);
|
35 |
+
$paymentBlockHtml = $paymentBlock->toHtml();
|
36 |
+
} catch (Exception $exception) {
|
37 |
+
// Stop store emulation process
|
38 |
+
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
|
39 |
+
throw $exception;
|
40 |
+
}
|
41 |
+
|
42 |
+
// Stop store emulation process
|
43 |
+
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
|
44 |
+
|
45 |
+
// Retrieve corresponding email template id and customer name
|
46 |
+
if ($this->getCustomerIsGuest()) {
|
47 |
+
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
|
48 |
+
$customerName = $this->getBillingAddress()->getName();
|
49 |
+
} else {
|
50 |
+
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
|
51 |
+
$customerName = $this->getCustomerName();
|
52 |
+
}
|
53 |
+
|
54 |
+
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
|
55 |
+
$mailer = Mage::getModel('core/email_template_mailer');
|
56 |
+
/** @var $emailInfo Mage_Core_Model_Email_Info */
|
57 |
+
$emailInfo = Mage::getModel('core/email_info');
|
58 |
+
$emailInfo->addTo($this->getCustomerEmail(), $customerName);
|
59 |
+
if ($copyTo && $copyMethod == 'bcc') {
|
60 |
+
// Add bcc to customer email
|
61 |
+
foreach ($copyTo as $email) {
|
62 |
+
$emailInfo->addBcc($email);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
$mailer->addEmailInfo($emailInfo);
|
66 |
+
|
67 |
+
// Email copies are sent as separated emails if their copy method is 'copy'
|
68 |
+
if ($copyTo && $copyMethod == 'copy') {
|
69 |
+
foreach ($copyTo as $email) {
|
70 |
+
$emailInfo = Mage::getModel('core/email_info');
|
71 |
+
$emailInfo->addTo($email);
|
72 |
+
$mailer->addEmailInfo($emailInfo);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
// ----------------------- CODE for set variable in new order template---------
|
77 |
+
$add_in_order_confirmation = Mage::getStoreConfig('zestard_customerattribute/customerattribute_group/add_in_order_confirmation');
|
78 |
+
|
79 |
+
$customer = Mage::getModel('customer/customer')->load($this->getCustomerId());
|
80 |
+
|
81 |
+
$customerAddressAttribute = array();
|
82 |
+
$Addressattributes = Mage::getModel('zestard_customerattribute/customerattribute')->getCollection();
|
83 |
+
|
84 |
+
foreach($Addressattributes->getData() as $key => $value)
|
85 |
+
{
|
86 |
+
$customerAddressAttribute[] = $value['attribute_code'];
|
87 |
+
}
|
88 |
+
|
89 |
+
$data = array();
|
90 |
+
$postObject = new Zestard_Customerattribute_Block_OrderData();
|
91 |
+
if($add_in_order_confirmation == 1) {
|
92 |
+
foreach($customer->getData() as $key => $value) {
|
93 |
+
if(in_array($key,$customerAddressAttribute)) {
|
94 |
+
|
95 |
+
$attributeCollection = Mage::getModel('zestard_customerattribute/customerattribute')->getCollection()
|
96 |
+
->addFieldToFilter('attribute_code',$key);
|
97 |
+
$attr = $attributeCollection->getData();
|
98 |
+
if($attr[0]['send_order_email'] == 1 && $attr[0]['is_user_defined'] == 1) {
|
99 |
+
$label = $attr[0]['frontend_label'];
|
100 |
+
$data[$label] = $value;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
$postObject->setData($data);
|
106 |
+
// ---------------- code end -----------------
|
107 |
+
|
108 |
+
// Set all required params and send emails
|
109 |
+
$mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
|
110 |
+
$mailer->setStoreId($storeId);
|
111 |
+
$mailer->setTemplateId($templateId);
|
112 |
+
$mailer->setTemplateParams(array(
|
113 |
+
'order' => $this,
|
114 |
+
'billing' => $this->getBillingAddress(),
|
115 |
+
'payment_html' => $paymentBlockHtml,
|
116 |
+
'CustomerAttribute' => $postObject
|
117 |
+
));
|
118 |
+
|
119 |
+
/** @var $emailQueue Mage_Core_Model_Email_Queue */
|
120 |
+
$emailQueue = Mage::getModel('core/email_queue');
|
121 |
+
$emailQueue->setEntityId($this->getId())
|
122 |
+
->setEntityType(self::ENTITY)
|
123 |
+
->setEventType(self::EMAIL_EVENT_NAME_NEW_ORDER)
|
124 |
+
->setIsForceCheck(!$forceMode);
|
125 |
+
|
126 |
+
$mailer->setQueue($emailQueue)->send();
|
127 |
+
|
128 |
+
$this->setEmailSent(true);
|
129 |
+
$this->_getResource()->saveAttribute($this, 'email_sent');
|
130 |
+
|
131 |
+
return $this;
|
132 |
+
}
|
133 |
+
}
|
app/code/community/Zestard/Customerattribute/controllers/Adminhtml/CustomerattributeController.php
CHANGED
@@ -1,423 +1,422 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Manage Customer Attribute controller file
|
4 |
-
*
|
5 |
-
* @category Zestard
|
6 |
-
* @package Zestard_Customerattribute
|
7 |
-
* @author Zestard Magento Team
|
8 |
-
*/
|
9 |
-
class Zestard_Customerattribute_Adminhtml_CustomerattributeController extends Mage_Adminhtml_Controller_Action
|
10 |
-
{
|
11 |
-
protected $_entityTypeId;
|
12 |
-
|
13 |
-
public function preDispatch()
|
14 |
-
{
|
15 |
-
parent::preDispatch();
|
16 |
-
$this->_entityTypeId = Mage::getModel('eav/entity')->setType(Mage::getModel('eav/config')->getEntityType('customer'))->getTypeId();
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Init actions
|
21 |
-
*
|
22 |
-
*/
|
23 |
-
protected function _initAction()
|
24 |
-
{
|
25 |
-
// load layout, set active menu and breadcrumbs
|
26 |
-
$this->_title($this->__('Customer'))
|
27 |
-
->_title($this->__('Attributes'))
|
28 |
-
->_title($this->__('Manage Attributes'));
|
29 |
-
|
30 |
-
if($this->getRequest()->getParam('popup')) {
|
31 |
-
$this->loadLayout('popup');
|
32 |
-
} else {
|
33 |
-
$this->loadLayout()
|
34 |
-
->_setActiveMenu('customer/customer_attribure')
|
35 |
-
->_addBreadcrumb(Mage::helper('zestard_customerattribute')->__('Customer'), Mage::helper('zestard_customerattribute')->__('Customer'))
|
36 |
-
->_addBreadcrumb(
|
37 |
-
Mage::helper('zestard_customerattribute')->__('Manage Customer Attributes'),
|
38 |
-
Mage::helper('zestard_customerattribute')->__('Manage Customer Attributes'))
|
39 |
-
;
|
40 |
-
}
|
41 |
-
return $this;
|
42 |
-
}
|
43 |
-
/**
|
44 |
-
* Index action method
|
45 |
-
*/
|
46 |
-
public function indexAction()
|
47 |
-
{
|
48 |
-
|
49 |
-
$this->_initAction()
|
50 |
-
->renderLayout();
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Code to display the form
|
55 |
-
*
|
56 |
-
* The main form container gets added to the content and the tabs block gets added to left.
|
57 |
-
*/
|
58 |
-
public function newAction()
|
59 |
-
{
|
60 |
-
// the same form is used to create and edit
|
61 |
-
$this->_forward('edit');
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Edit Customer Attribute
|
66 |
-
*/
|
67 |
-
public function editAction()
|
68 |
-
{
|
69 |
-
$id = $this->getRequest()->getParam('attribute_id');
|
70 |
-
$model = Mage::getModel('zestard_customerattribute/customerattribute')
|
71 |
-
->setEntityTypeId($this->_entityTypeId);
|
72 |
-
|
73 |
-
// 2. Initial checking
|
74 |
-
if ($id) {
|
75 |
-
$model->load($id);
|
76 |
-
if (! $model->getId()) {
|
77 |
-
Mage::getSingleton('adminhtml/session')->addError(
|
78 |
-
Mage::helper('zestard_customerattribute')->__('This employee no longer exists.'));
|
79 |
-
$this->_redirect('*/*/');
|
80 |
-
return;
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
// entity type check
|
85 |
-
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
86 |
-
Mage::getSingleton('adminhtml/session')->addError(
|
87 |
-
Mage::helper('catalog')->__('This attribute cannot be edited.'));
|
88 |
-
$this->_redirect('*/*/');
|
89 |
-
return;
|
90 |
-
}
|
91 |
-
|
92 |
-
// Sets the window title
|
93 |
-
$this->_title($id ? $model->getFrontendLabel() : $this->__('New Attribute'));
|
94 |
-
|
95 |
-
// 3. Set entered data if was error when we do save
|
96 |
-
$data = Mage::getSingleton('adminhtml/session')->getCustomerattributeData(true);
|
97 |
-
if (! empty($data)) {
|
98 |
-
$model->setData($data);
|
99 |
-
}
|
100 |
-
|
101 |
-
// 4. Register model to use later in blocks
|
102 |
-
Mage::register('customerattribute_data', $model);
|
103 |
-
|
104 |
-
// 5. Build edit form
|
105 |
-
$this->_initAction()
|
106 |
-
->_addBreadcrumb(
|
107 |
-
$id ? Mage::helper('zestard_customerattribute')->__('Edit Customer Attribute')
|
108 |
-
: Mage::helper('zestard_customerattribute')->__('New Customer Attribute'),
|
109 |
-
$id ? Mage::helper('zestard_customerattribute')->__('Edit Customer Attribute')
|
110 |
-
: Mage::helper('zestard_customerattribute')->__('New Customer Attribute'));
|
111 |
-
|
112 |
-
$this->_addContent($this->getLayout()->createBlock('zestard_customerattribute/adminhtml_customerattribute_edit'))
|
113 |
-
->_addLeft($this->getLayout()->createBlock('zestard_customerattribute/adminhtml_customerattribute_edit_tabs'));
|
114 |
-
|
115 |
-
$this->getLayout()->getBlock('zestard_customerattribute_edit_js')
|
116 |
-
->setIsPopup((bool)$this->getRequest()->getParam('popup'));
|
117 |
-
|
118 |
-
$this->renderLayout();
|
119 |
-
}
|
120 |
-
|
121 |
-
public function validateAction()
|
122 |
-
{
|
123 |
-
$response = new Varien_Object();
|
124 |
-
$response->setError(false);
|
125 |
-
|
126 |
-
$attributeCode = $this->getRequest()->getParam('attribute_code');
|
127 |
-
$attributeId = $this->getRequest()->getParam('attribute_id');
|
128 |
-
$attribute = Mage::getModel('zestard_customerattribute/customerattribute')
|
129 |
-
->loadByCode($this->_entityTypeId, $attributeCode);
|
130 |
-
|
131 |
-
if ($attribute->getId() && !$attributeId) {
|
132 |
-
Mage::getSingleton('adminhtml/session')->addError(
|
133 |
-
Mage::helper('zestard_customerattribute')->__('Attribute with the same code already exists'));
|
134 |
-
$this->_initLayoutMessages('adminhtml/session');
|
135 |
-
$response->setError(true);
|
136 |
-
$response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
|
137 |
-
}
|
138 |
-
|
139 |
-
$this->getResponse()->setBody($response->toJson());
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Filter post data
|
144 |
-
*
|
145 |
-
* @param array $data
|
146 |
-
* @return array
|
147 |
-
*/
|
148 |
-
protected function _filterPostData($data)
|
149 |
-
{
|
150 |
-
if ($data) {
|
151 |
-
/** @var $helperCustomerattribute Zestard_Customerattribute_Helper_Data */
|
152 |
-
$helperCustomerattribute = Mage::helper('zestard_customerattribute');
|
153 |
-
//labels
|
154 |
-
foreach ($data['frontend_label'] as & $value) {
|
155 |
-
if ($value) {
|
156 |
-
$value = $helperCustomerattribute->stripTags($value);
|
157 |
-
}
|
158 |
-
}
|
159 |
-
}
|
160 |
-
return $data;
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
*
|
165 |
-
* Save customer attributes
|
166 |
-
*/
|
167 |
-
public function saveAction()
|
168 |
-
{
|
169 |
-
$data = $this->getRequest()->getPost();
|
170 |
-
if ($data) {
|
171 |
-
/** @var $session Mage_Admin_Model_Session */
|
172 |
-
$session = Mage::getSingleton('adminhtml/session');
|
173 |
-
|
174 |
-
$redirectBack = $this->getRequest()->getParam('back', false);
|
175 |
-
/* @var $model Zestard_Customerattribute_Model_Customerattribute */
|
176 |
-
$model = Mage::getModel('zestard_customerattribute/customerattribute');
|
177 |
-
/* @var $helper Mage_Catalog_Helper_Product */
|
178 |
-
$helper = Mage::helper('zestard_customerattribute/customerattribute');
|
179 |
-
|
180 |
-
$id = $this->getRequest()->getParam('attribute_id');
|
181 |
-
|
182 |
-
//validate attribute_code
|
183 |
-
if (isset($data['attribute_code'])) {
|
184 |
-
$validatorAttrCode = new Zend_Validate_Regex(array('pattern' => '/^[a-z][a-z_0-9]{1,254}$/'));
|
185 |
-
if (!$validatorAttrCode->isValid($data['attribute_code'])) {
|
186 |
-
$session->addError(
|
187 |
-
Mage::helper('zestard_customerattribute')->__('Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.')
|
188 |
-
);
|
189 |
-
$this->_redirect('*/*/edit', array('attribute_id' => $id, '_current' => true));
|
190 |
-
return;
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
//validate frontend_input
|
195 |
-
if (isset($data['frontend_input'])) {
|
196 |
-
/** @var $validatorInputType Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype_Validator */
|
197 |
-
$validatorInputType = Mage::getModel('eav/adminhtml_system_config_source_inputtype_validator');
|
198 |
-
if (!$validatorInputType->isValid($data['frontend_input'])) {
|
199 |
-
foreach ($validatorInputType->getMessages() as $message) {
|
200 |
-
$session->addError($message);
|
201 |
-
}
|
202 |
-
$this->_redirect('*/*/edit', array('attribute_id' => $id, '_current' => true));
|
203 |
-
return;
|
204 |
-
}
|
205 |
-
}
|
206 |
-
|
207 |
-
if ($id) {
|
208 |
-
$model->load($id);
|
209 |
-
|
210 |
-
if (!$model->getId()) {
|
211 |
-
$session->addError(
|
212 |
-
Mage::helper('zestard_customerattribute')->__('This Attribute no longer exists'));
|
213 |
-
$this->_redirect('*/*/');
|
214 |
-
return;
|
215 |
-
}
|
216 |
-
|
217 |
-
// entity type check
|
218 |
-
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
219 |
-
$session->addError(
|
220 |
-
Mage::helper('zestard_customerattribute')->__('This attribute cannot be updated.'));
|
221 |
-
$session->setCustomerattributeData($data);
|
222 |
-
$this->_redirect('*/*/');
|
223 |
-
return;
|
224 |
-
}
|
225 |
-
|
226 |
-
$data['attribute_code'] = $model->getAttributeCode();
|
227 |
-
$data['is_user_defined'] = $model->getIsUserDefined();
|
228 |
-
$data['frontend_input'] = $model->getFrontendInput();
|
229 |
-
} else {
|
230 |
-
/**
|
231 |
-
* @todo add to helper and specify all relations for properties
|
232 |
-
*/
|
233 |
-
$data['source_model'] = $helper->getAttributeSourceModelByInputType($data['frontend_input']);
|
234 |
-
$data['backend_model'] = $helper->getAttributeBackendModelByInputType($data['frontend_input']);
|
235 |
-
}
|
236 |
-
|
237 |
-
$usedInForms = array();
|
238 |
-
|
239 |
-
|
240 |
-
if (isset($data['customer_account_create'])&& $data['customer_account_create'] == 1) {
|
241 |
-
$usedInForms[] = 'customer_account_create';
|
242 |
-
}
|
243 |
-
|
244 |
-
if (isset($data['customer_account_edit'])&& $data['customer_account_edit'] == 1) {
|
245 |
-
$usedInForms[] = 'customer_account_edit';
|
246 |
-
}
|
247 |
-
|
248 |
-
if (isset($data['adminhtml_customer'])&& $data['adminhtml_customer'] == 1) {
|
249 |
-
$usedInForms[] = 'adminhtml_customer';
|
250 |
-
}
|
251 |
-
|
252 |
-
if (isset($data['checkout_register'])&& $data['checkout_register'] == 1) {
|
253 |
-
$usedInForms[] = 'checkout_register';
|
254 |
-
}
|
255 |
-
|
256 |
-
if(in_array('checkout_register', $usedInForms)) {
|
257 |
-
$xmlPath = Mage::getBaseDir().DS.'app'.DS.'code'.DS.'community'.DS.'Zestard'.DS.'Customerattribute'.DS.'etc'.DS.'config.xml';
|
258 |
-
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
259 |
-
$att = $data['attribute_code'];
|
260 |
-
$xmlObj->setNode('global/fieldsets/checkout_onepage_quote/customer_'.$att.'/to_customer',$att);
|
261 |
-
$xmlObj->setNode('global/fieldsets/customer_account/'.$att.'/to_quote','customer_'.$att);
|
262 |
-
$xmlData = $xmlObj->getNode()->asNiceXml();
|
263 |
-
@file_put_contents($xmlPath, $xmlData);
|
264 |
-
} else if ($id != '' && !in_array('checkout_register', $usedInForms)) {
|
265 |
-
$modelCloned = $model;
|
266 |
-
$modelCloned->load($id);
|
267 |
-
$xmlPath = Mage::getBaseDir().DS.'app'.DS.'code'.DS.'community'.DS.'Zestard'.DS.'Customerattribute'.DS.'etc'.DS.'config.xml';
|
268 |
-
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
269 |
-
$att = $modelCloned->getAttributeCode();
|
270 |
-
$xmlObj->setNode('global/fieldsets/checkout_onepage_quote/customer_'.$att,NULL);
|
271 |
-
$xmlObj->setNode('global/fieldsets/customer_account/'.$att,NULL);
|
272 |
-
$xmlData = $xmlObj->getNode()->asNiceXml();
|
273 |
-
@file_put_contents($xmlPath, $xmlData);
|
274 |
-
}
|
275 |
-
|
276 |
-
|
277 |
-
/*$usedInForms[] = 'checkout_register';
|
278 |
-
$usedInForms[] = 'customer_register_address';
|
279 |
-
$usedInForms[] = 'checkout_index_index';
|
280 |
-
$usedInForms[] = 'customer_address_edit';
|
281 |
-
$usedInForms[] = 'adminhtml_customer_address';*/
|
282 |
-
$data['used_in_forms'] = $usedInForms;
|
283 |
-
$resource = Mage::getSingleton('core/resource');
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Retrieve the write connection
|
287 |
-
*/
|
288 |
-
$writeConnection = $resource->getConnection('core_write');
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Retrieve our table name
|
292 |
-
*/
|
293 |
-
$table = $resource->getTableName('sales/quote');
|
294 |
-
$attributeDataType = ($data['frontend_input'] == 'date' ? 'date' : 'varchar(255)');
|
295 |
-
/**
|
296 |
-
* Set the new SKU
|
297 |
-
* It is assumed that you are hard coding the new SKU in
|
298 |
-
* If the input is not dynamic, consider using the
|
299 |
-
* Varien_Db_Select object to insert data
|
300 |
-
*/
|
301 |
-
|
302 |
-
$query = "ALTER TABLE `{$table}` ADD `customer_".$data['attribute_code']."` ".$attributeDataType." NOT NULL";
|
303 |
-
|
304 |
-
$ColumnName = "customer_".$data['attribute_code']."";
|
305 |
-
$collection1 = Mage::getModel('sales/quote')->getCollection();
|
306 |
-
if (!array_key_exists($ColumnName,$collection1->getFirstitem()->getData()))
|
307 |
-
{
|
308 |
-
$writeConnection->query($query);
|
309 |
-
}
|
310 |
-
|
311 |
-
if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
|
312 |
-
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
|
313 |
-
}
|
314 |
-
|
315 |
-
$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
|
316 |
-
if ($defaultValueField) {
|
317 |
-
$data['default_value'] = $this->getRequest()->getParam($defaultValueField);
|
318 |
-
}
|
319 |
-
|
320 |
-
//filter
|
321 |
-
$data = $this->_filterPostData($data);
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
$
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
$
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
$session->
|
349 |
-
$
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
*
|
359 |
-
*
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
$
|
379 |
-
$
|
380 |
-
$
|
381 |
-
$
|
382 |
-
$xmlObj->setNode('global/fieldsets/
|
383 |
-
$xmlObj->
|
384 |
-
$
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
*
|
405 |
-
*
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
case '
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Manage Customer Attribute controller file
|
4 |
+
*
|
5 |
+
* @category Zestard
|
6 |
+
* @package Zestard_Customerattribute
|
7 |
+
* @author Zestard Magento Team
|
8 |
+
*/
|
9 |
+
class Zestard_Customerattribute_Adminhtml_CustomerattributeController extends Mage_Adminhtml_Controller_Action
|
10 |
+
{
|
11 |
+
protected $_entityTypeId;
|
12 |
+
|
13 |
+
public function preDispatch()
|
14 |
+
{
|
15 |
+
parent::preDispatch();
|
16 |
+
$this->_entityTypeId = Mage::getModel('eav/entity')->setType(Mage::getModel('eav/config')->getEntityType('customer'))->getTypeId();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Init actions
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
protected function _initAction()
|
24 |
+
{
|
25 |
+
// load layout, set active menu and breadcrumbs
|
26 |
+
$this->_title($this->__('Customer'))
|
27 |
+
->_title($this->__('Attributes'))
|
28 |
+
->_title($this->__('Manage Attributes'));
|
29 |
+
|
30 |
+
if($this->getRequest()->getParam('popup')) {
|
31 |
+
$this->loadLayout('popup');
|
32 |
+
} else {
|
33 |
+
$this->loadLayout()
|
34 |
+
->_setActiveMenu('customer/customer_attribure')
|
35 |
+
->_addBreadcrumb(Mage::helper('zestard_customerattribute')->__('Customer'), Mage::helper('zestard_customerattribute')->__('Customer'))
|
36 |
+
->_addBreadcrumb(
|
37 |
+
Mage::helper('zestard_customerattribute')->__('Manage Customer Attributes'),
|
38 |
+
Mage::helper('zestard_customerattribute')->__('Manage Customer Attributes'))
|
39 |
+
;
|
40 |
+
}
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Index action method
|
45 |
+
*/
|
46 |
+
public function indexAction()
|
47 |
+
{
|
48 |
+
|
49 |
+
$this->_initAction()
|
50 |
+
->renderLayout();
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Code to display the form
|
55 |
+
*
|
56 |
+
* The main form container gets added to the content and the tabs block gets added to left.
|
57 |
+
*/
|
58 |
+
public function newAction()
|
59 |
+
{
|
60 |
+
// the same form is used to create and edit
|
61 |
+
$this->_forward('edit');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Edit Customer Attribute
|
66 |
+
*/
|
67 |
+
public function editAction()
|
68 |
+
{
|
69 |
+
$id = $this->getRequest()->getParam('attribute_id');
|
70 |
+
$model = Mage::getModel('zestard_customerattribute/customerattribute')
|
71 |
+
->setEntityTypeId($this->_entityTypeId);
|
72 |
+
|
73 |
+
// 2. Initial checking
|
74 |
+
if ($id) {
|
75 |
+
$model->load($id);
|
76 |
+
if (! $model->getId()) {
|
77 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
78 |
+
Mage::helper('zestard_customerattribute')->__('This employee no longer exists.'));
|
79 |
+
$this->_redirect('*/*/');
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
// entity type check
|
85 |
+
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
86 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
87 |
+
Mage::helper('catalog')->__('This attribute cannot be edited.'));
|
88 |
+
$this->_redirect('*/*/');
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
// Sets the window title
|
93 |
+
$this->_title($id ? $model->getFrontendLabel() : $this->__('New Attribute'));
|
94 |
+
|
95 |
+
// 3. Set entered data if was error when we do save
|
96 |
+
$data = Mage::getSingleton('adminhtml/session')->getCustomerattributeData(true);
|
97 |
+
if (! empty($data)) {
|
98 |
+
$model->setData($data);
|
99 |
+
}
|
100 |
+
|
101 |
+
// 4. Register model to use later in blocks
|
102 |
+
Mage::register('customerattribute_data', $model);
|
103 |
+
|
104 |
+
// 5. Build edit form
|
105 |
+
$this->_initAction()
|
106 |
+
->_addBreadcrumb(
|
107 |
+
$id ? Mage::helper('zestard_customerattribute')->__('Edit Customer Attribute')
|
108 |
+
: Mage::helper('zestard_customerattribute')->__('New Customer Attribute'),
|
109 |
+
$id ? Mage::helper('zestard_customerattribute')->__('Edit Customer Attribute')
|
110 |
+
: Mage::helper('zestard_customerattribute')->__('New Customer Attribute'));
|
111 |
+
|
112 |
+
$this->_addContent($this->getLayout()->createBlock('zestard_customerattribute/adminhtml_customerattribute_edit'))
|
113 |
+
->_addLeft($this->getLayout()->createBlock('zestard_customerattribute/adminhtml_customerattribute_edit_tabs'));
|
114 |
+
|
115 |
+
$this->getLayout()->getBlock('zestard_customerattribute_edit_js')
|
116 |
+
->setIsPopup((bool)$this->getRequest()->getParam('popup'));
|
117 |
+
|
118 |
+
$this->renderLayout();
|
119 |
+
}
|
120 |
+
|
121 |
+
public function validateAction()
|
122 |
+
{
|
123 |
+
$response = new Varien_Object();
|
124 |
+
$response->setError(false);
|
125 |
+
|
126 |
+
$attributeCode = $this->getRequest()->getParam('attribute_code');
|
127 |
+
$attributeId = $this->getRequest()->getParam('attribute_id');
|
128 |
+
$attribute = Mage::getModel('zestard_customerattribute/customerattribute')
|
129 |
+
->loadByCode($this->_entityTypeId, $attributeCode);
|
130 |
+
|
131 |
+
if ($attribute->getId() && !$attributeId) {
|
132 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
133 |
+
Mage::helper('zestard_customerattribute')->__('Attribute with the same code already exists'));
|
134 |
+
$this->_initLayoutMessages('adminhtml/session');
|
135 |
+
$response->setError(true);
|
136 |
+
$response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
|
137 |
+
}
|
138 |
+
|
139 |
+
$this->getResponse()->setBody($response->toJson());
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Filter post data
|
144 |
+
*
|
145 |
+
* @param array $data
|
146 |
+
* @return array
|
147 |
+
*/
|
148 |
+
protected function _filterPostData($data)
|
149 |
+
{
|
150 |
+
if ($data) {
|
151 |
+
/** @var $helperCustomerattribute Zestard_Customerattribute_Helper_Data */
|
152 |
+
$helperCustomerattribute = Mage::helper('zestard_customerattribute');
|
153 |
+
//labels
|
154 |
+
foreach ($data['frontend_label'] as & $value) {
|
155 |
+
if ($value) {
|
156 |
+
$value = $helperCustomerattribute->stripTags($value);
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
return $data;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
*
|
165 |
+
* Save customer attributes
|
166 |
+
*/
|
167 |
+
public function saveAction()
|
168 |
+
{
|
169 |
+
$data = $this->getRequest()->getPost();
|
170 |
+
if ($data) {
|
171 |
+
/** @var $session Mage_Admin_Model_Session */
|
172 |
+
$session = Mage::getSingleton('adminhtml/session');
|
173 |
+
|
174 |
+
$redirectBack = $this->getRequest()->getParam('back', false);
|
175 |
+
/* @var $model Zestard_Customerattribute_Model_Customerattribute */
|
176 |
+
$model = Mage::getModel('zestard_customerattribute/customerattribute');
|
177 |
+
/* @var $helper Mage_Catalog_Helper_Product */
|
178 |
+
$helper = Mage::helper('zestard_customerattribute/customerattribute');
|
179 |
+
|
180 |
+
$id = $this->getRequest()->getParam('attribute_id');
|
181 |
+
|
182 |
+
//validate attribute_code
|
183 |
+
if (isset($data['attribute_code'])) {
|
184 |
+
$validatorAttrCode = new Zend_Validate_Regex(array('pattern' => '/^[a-z][a-z_0-9]{1,254}$/'));
|
185 |
+
if (!$validatorAttrCode->isValid($data['attribute_code'])) {
|
186 |
+
$session->addError(
|
187 |
+
Mage::helper('zestard_customerattribute')->__('Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.')
|
188 |
+
);
|
189 |
+
$this->_redirect('*/*/edit', array('attribute_id' => $id, '_current' => true));
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
//validate frontend_input
|
195 |
+
if (isset($data['frontend_input'])) {
|
196 |
+
/** @var $validatorInputType Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype_Validator */
|
197 |
+
$validatorInputType = Mage::getModel('eav/adminhtml_system_config_source_inputtype_validator');
|
198 |
+
if (!$validatorInputType->isValid($data['frontend_input'])) {
|
199 |
+
foreach ($validatorInputType->getMessages() as $message) {
|
200 |
+
$session->addError($message);
|
201 |
+
}
|
202 |
+
$this->_redirect('*/*/edit', array('attribute_id' => $id, '_current' => true));
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
if ($id) {
|
208 |
+
$model->load($id);
|
209 |
+
|
210 |
+
if (!$model->getId()) {
|
211 |
+
$session->addError(
|
212 |
+
Mage::helper('zestard_customerattribute')->__('This Attribute no longer exists'));
|
213 |
+
$this->_redirect('*/*/');
|
214 |
+
return;
|
215 |
+
}
|
216 |
+
|
217 |
+
// entity type check
|
218 |
+
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
219 |
+
$session->addError(
|
220 |
+
Mage::helper('zestard_customerattribute')->__('This attribute cannot be updated.'));
|
221 |
+
$session->setCustomerattributeData($data);
|
222 |
+
$this->_redirect('*/*/');
|
223 |
+
return;
|
224 |
+
}
|
225 |
+
|
226 |
+
$data['attribute_code'] = $model->getAttributeCode();
|
227 |
+
$data['is_user_defined'] = $model->getIsUserDefined();
|
228 |
+
$data['frontend_input'] = $model->getFrontendInput();
|
229 |
+
} else {
|
230 |
+
/**
|
231 |
+
* @todo add to helper and specify all relations for properties
|
232 |
+
*/
|
233 |
+
$data['source_model'] = $helper->getAttributeSourceModelByInputType($data['frontend_input']);
|
234 |
+
$data['backend_model'] = $helper->getAttributeBackendModelByInputType($data['frontend_input']);
|
235 |
+
}
|
236 |
+
|
237 |
+
$usedInForms = array();
|
238 |
+
|
239 |
+
|
240 |
+
if (isset($data['customer_account_create'])&& $data['customer_account_create'] == 1) {
|
241 |
+
$usedInForms[] = 'customer_account_create';
|
242 |
+
}
|
243 |
+
|
244 |
+
if (isset($data['customer_account_edit'])&& $data['customer_account_edit'] == 1) {
|
245 |
+
$usedInForms[] = 'customer_account_edit';
|
246 |
+
}
|
247 |
+
|
248 |
+
if (isset($data['adminhtml_customer'])&& $data['adminhtml_customer'] == 1) {
|
249 |
+
$usedInForms[] = 'adminhtml_customer';
|
250 |
+
}
|
251 |
+
|
252 |
+
if (isset($data['checkout_register'])&& $data['checkout_register'] == 1) {
|
253 |
+
$usedInForms[] = 'checkout_register';
|
254 |
+
}
|
255 |
+
|
256 |
+
if(in_array('checkout_register', $usedInForms)) {
|
257 |
+
$xmlPath = Mage::getBaseDir().DS.'app'.DS.'code'.DS.'community'.DS.'Zestard'.DS.'Customerattribute'.DS.'etc'.DS.'config.xml';
|
258 |
+
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
259 |
+
$att = $data['attribute_code'];
|
260 |
+
$xmlObj->setNode('global/fieldsets/checkout_onepage_quote/customer_'.$att.'/to_customer',$att);
|
261 |
+
$xmlObj->setNode('global/fieldsets/customer_account/'.$att.'/to_quote','customer_'.$att);
|
262 |
+
$xmlData = $xmlObj->getNode()->asNiceXml();
|
263 |
+
@file_put_contents($xmlPath, $xmlData);
|
264 |
+
} else if ($id != '' && !in_array('checkout_register', $usedInForms)) {
|
265 |
+
$modelCloned = $model;
|
266 |
+
$modelCloned->load($id);
|
267 |
+
$xmlPath = Mage::getBaseDir().DS.'app'.DS.'code'.DS.'community'.DS.'Zestard'.DS.'Customerattribute'.DS.'etc'.DS.'config.xml';
|
268 |
+
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
269 |
+
$att = $modelCloned->getAttributeCode();
|
270 |
+
$xmlObj->setNode('global/fieldsets/checkout_onepage_quote/customer_'.$att,NULL);
|
271 |
+
$xmlObj->setNode('global/fieldsets/customer_account/'.$att,NULL);
|
272 |
+
$xmlData = $xmlObj->getNode()->asNiceXml();
|
273 |
+
@file_put_contents($xmlPath, $xmlData);
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
/*$usedInForms[] = 'checkout_register';
|
278 |
+
$usedInForms[] = 'customer_register_address';
|
279 |
+
$usedInForms[] = 'checkout_index_index';
|
280 |
+
$usedInForms[] = 'customer_address_edit';
|
281 |
+
$usedInForms[] = 'adminhtml_customer_address';*/
|
282 |
+
$data['used_in_forms'] = $usedInForms;
|
283 |
+
$resource = Mage::getSingleton('core/resource');
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Retrieve the write connection
|
287 |
+
*/
|
288 |
+
$writeConnection = $resource->getConnection('core_write');
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Retrieve our table name
|
292 |
+
*/
|
293 |
+
$table = $resource->getTableName('sales/quote');
|
294 |
+
$attributeDataType = ($data['frontend_input'] == 'date' ? 'date' : 'varchar(255)');
|
295 |
+
/**
|
296 |
+
* Set the new SKU
|
297 |
+
* It is assumed that you are hard coding the new SKU in
|
298 |
+
* If the input is not dynamic, consider using the
|
299 |
+
* Varien_Db_Select object to insert data
|
300 |
+
*/
|
301 |
+
|
302 |
+
$query = "ALTER TABLE `{$table}` ADD `customer_".$data['attribute_code']."` ".$attributeDataType." NOT NULL";
|
303 |
+
|
304 |
+
$ColumnName = "customer_".$data['attribute_code']."";
|
305 |
+
$collection1 = Mage::getModel('sales/quote')->getCollection();
|
306 |
+
if (!array_key_exists($ColumnName,$collection1->getFirstitem()->getData()))
|
307 |
+
{
|
308 |
+
$writeConnection->query($query);
|
309 |
+
}
|
310 |
+
|
311 |
+
if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
|
312 |
+
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
|
313 |
+
}
|
314 |
+
|
315 |
+
$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
|
316 |
+
if ($defaultValueField) {
|
317 |
+
$data['default_value'] = $this->getRequest()->getParam($defaultValueField);
|
318 |
+
}
|
319 |
+
|
320 |
+
//filter
|
321 |
+
$data = $this->_filterPostData($data);
|
322 |
+
$model->addData($data);
|
323 |
+
|
324 |
+
if (!$id) {
|
325 |
+
$model->setEntityTypeId($this->_entityTypeId);
|
326 |
+
$model->setIsUserDefined(1);
|
327 |
+
}
|
328 |
+
|
329 |
+
try {
|
330 |
+
$model->save();
|
331 |
+
//echo '<pre>';print_r($model->getData());die();
|
332 |
+
$session->addSuccess(
|
333 |
+
Mage::helper('zestard_customerattribute')->__('The customer attribute has been saved.'));
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Clear translation cache because attribute labels are stored in translation
|
337 |
+
*/
|
338 |
+
Mage::app()->cleanCache(array(Mage_Core_Model_Translate::CACHE_TAG));
|
339 |
+
$session->setCustomerattributeData(false);
|
340 |
+
if ($redirectBack) {
|
341 |
+
$this->_redirect('*/*/edit', array('attribute_id' => $model->getId(),'_current'=>true));
|
342 |
+
} else {
|
343 |
+
$this->_redirect('*/*/', array());
|
344 |
+
}
|
345 |
+
return;
|
346 |
+
} catch (Exception $e) {
|
347 |
+
$session->addError($e->getMessage());
|
348 |
+
$session->setCustomerattributeData($data);
|
349 |
+
$this->_redirect('*/*/edit', array('attribute_id' => $id, '_current' => true));
|
350 |
+
return;
|
351 |
+
}
|
352 |
+
}
|
353 |
+
$this->_redirect('*/*/');
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Delete customer attribute
|
358 |
+
*
|
359 |
+
* @return null
|
360 |
+
*/
|
361 |
+
public function deleteAction()
|
362 |
+
{
|
363 |
+
if ($id = $this->getRequest()->getParam('attribute_id')) {
|
364 |
+
$model = Mage::getModel('zestard_customerattribute/customerattribute');
|
365 |
+
|
366 |
+
// entity type check
|
367 |
+
$model->load($id);
|
368 |
+
|
369 |
+
if ($model->getEntityTypeId() != $this->_entityTypeId) {
|
370 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
371 |
+
Mage::helper('zestard_customerattribute')->__('This attribute cannot be deleted.'));
|
372 |
+
$this->_redirect('*/*/');
|
373 |
+
return;
|
374 |
+
}
|
375 |
+
|
376 |
+
try {
|
377 |
+
$model->delete();
|
378 |
+
$xmlPath = Mage::getBaseDir().DS.'app'.DS.'code'.DS.'community'.DS.'Zestard'.DS.'Customerattribute'.DS.'etc'.DS.'config.xml';
|
379 |
+
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
380 |
+
$att = $model->getAttributeCode();
|
381 |
+
$xmlObj->setNode('global/fieldsets/checkout_onepage_quote/customer_'.$att,NULL);
|
382 |
+
$xmlObj->setNode('global/fieldsets/customer_account/'.$att,NULL);
|
383 |
+
$xmlData = $xmlObj->getNode()->asNiceXml();
|
384 |
+
@file_put_contents($xmlPath, $xmlData);
|
385 |
+
|
386 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
387 |
+
Mage::helper('zestard_customerattribute')->__('The customer attribute has been deleted.'));
|
388 |
+
$this->_redirect('*/*/');
|
389 |
+
return;
|
390 |
+
}
|
391 |
+
catch (Exception $e) {
|
392 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
393 |
+
$this->_redirect('*/*/edit', array('attribute_id' => $this->getRequest()->getParam('attribute_id')));
|
394 |
+
return;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
398 |
+
Mage::helper('zestard_customerattribute')->__('Unable to find an attribute to delete.'));
|
399 |
+
$this->_redirect('*/*/');
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Check the permission to run it
|
404 |
+
*
|
405 |
+
* @return boolean
|
406 |
+
*/
|
407 |
+
protected function _isAllowed()
|
408 |
+
{
|
409 |
+
switch ($this->getRequest()->getActionName()) {
|
410 |
+
case 'new':
|
411 |
+
case 'save':
|
412 |
+
return Mage::getSingleton('admin/session')->isAllowed('customer/customer_attribute/save');
|
413 |
+
break;
|
414 |
+
case 'delete':
|
415 |
+
return Mage::getSingleton('admin/session')->isAllowed('customer/customer_attribute/delete');
|
416 |
+
break;
|
417 |
+
default:
|
418 |
+
return Mage::getSingleton('admin/session')->isAllowed('customer/customer_attribute');
|
419 |
+
break;
|
420 |
+
}
|
421 |
+
}
|
422 |
+
}
|
|
app/code/community/Zestard/Customerattribute/etc/adminhtml.xml
CHANGED
@@ -28,6 +28,17 @@
|
|
28 |
</all>
|
29 |
<admin>
|
30 |
<children>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
<customer>
|
32 |
<children>
|
33 |
<customer_attribute translate="title" module="zestard_customerattribute">
|
28 |
</all>
|
29 |
<admin>
|
30 |
<children>
|
31 |
+
<system>
|
32 |
+
<children>
|
33 |
+
<config>
|
34 |
+
<children>
|
35 |
+
<zestard_customerattribute translate="title" module="zestard_customerattribute">
|
36 |
+
<title>Customer Attribute</title>
|
37 |
+
</zestard_customerattribute>
|
38 |
+
</children>
|
39 |
+
</config>
|
40 |
+
</children>
|
41 |
+
</system>
|
42 |
<customer>
|
43 |
<children>
|
44 |
<customer_attribute translate="title" module="zestard_customerattribute">
|
app/code/community/Zestard/Customerattribute/etc/config.xml
CHANGED
@@ -9,7 +9,25 @@
|
|
9 |
<zestard_customerattribute>
|
10 |
<class>Zestard_Customerattribute_Model</class>
|
11 |
</zestard_customerattribute>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
</models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<helpers>
|
14 |
<zestard_customerattribute>
|
15 |
<class>Zestard_Customerattribute_Helper</class>
|
@@ -21,11 +39,23 @@
|
|
21 |
</zestard_customerattribute>
|
22 |
</blocks>
|
23 |
<fieldsets>
|
24 |
-
<checkout_onepage_quote>
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
</checkout_onepage_quote>
|
26 |
-
<customer_account>
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
</customer_account>
|
28 |
-
</fieldsets>
|
29 |
</global>
|
30 |
<frontend>
|
31 |
<layout>
|
@@ -75,6 +105,14 @@
|
|
75 |
</routers>
|
76 |
</admin>
|
77 |
<default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
<general>
|
79 |
<validator_data>
|
80 |
<input_types>
|
9 |
<zestard_customerattribute>
|
10 |
<class>Zestard_Customerattribute_Model</class>
|
11 |
</zestard_customerattribute>
|
12 |
+
<customer>
|
13 |
+
<rewrite>
|
14 |
+
<customer>Zestard_Customerattribute_Model_Customer</customer>
|
15 |
+
</rewrite>
|
16 |
+
</customer>
|
17 |
+
<sales>
|
18 |
+
<rewrite>
|
19 |
+
<order>Zestard_Customerattribute_Model_Order</order>
|
20 |
+
</rewrite>
|
21 |
+
</sales>
|
22 |
</models>
|
23 |
+
<resources>
|
24 |
+
<zestard_customerattribute_setup>
|
25 |
+
<setup>
|
26 |
+
<module>Zestard_Customerattribute</module>
|
27 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
28 |
+
</setup>
|
29 |
+
</zestard_customerattribute_setup>
|
30 |
+
</resources>
|
31 |
<helpers>
|
32 |
<zestard_customerattribute>
|
33 |
<class>Zestard_Customerattribute_Helper</class>
|
39 |
</zestard_customerattribute>
|
40 |
</blocks>
|
41 |
<fieldsets>
|
42 |
+
<checkout_onepage_quote>
|
43 |
+
<customer_referral>
|
44 |
+
<to_customer>referral</to_customer>
|
45 |
+
</customer_referral>
|
46 |
+
<customer_company_url>
|
47 |
+
<to_customer>company_url</to_customer>
|
48 |
+
</customer_company_url>
|
49 |
</checkout_onepage_quote>
|
50 |
+
<customer_account>
|
51 |
+
<referral>
|
52 |
+
<to_quote>customer_referral</to_quote>
|
53 |
+
</referral>
|
54 |
+
<company_url>
|
55 |
+
<to_quote>customer_company_url</to_quote>
|
56 |
+
</company_url>
|
57 |
</customer_account>
|
58 |
+
</fieldsets>
|
59 |
</global>
|
60 |
<frontend>
|
61 |
<layout>
|
105 |
</routers>
|
106 |
</admin>
|
107 |
<default>
|
108 |
+
<zestard_customerattribute>
|
109 |
+
<customerattribute_group>
|
110 |
+
<enable>1</enable>
|
111 |
+
<add_in_customer_registration>1</add_in_customer_registration>
|
112 |
+
<add_in_order_confirmation>1</add_in_order_confirmation>
|
113 |
+
<note> {{var CustomerAttribute.arrayToHtml()}} </note>
|
114 |
+
</customerattribute_group>
|
115 |
+
</zestard_customerattribute>
|
116 |
<general>
|
117 |
<validator_data>
|
118 |
<input_types>
|
app/code/community/Zestard/Customerattribute/etc/system.xml
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<zestard translate="label" module="zestard_customerattribute">
|
5 |
+
<label>
|
6 |
+
<![CDATA[
|
7 |
+
<div style="margin-left: -10px;position: absolute;width: 200px;display: inline-block;">
|
8 |
+
<a style="background:transparent;text-align:left;" onclick="redirectSite(event,this)"><img id="zestard_block" src="" alt="ZESTARD" style="float:left;height: 25px;margin-top: -5px;width: 55%;" border="0"/> Extensions</a>
|
9 |
+
</div>
|
10 |
+
<script>
|
11 |
+
function redirectSite(event,obj){
|
12 |
+
event.preventDefault();
|
13 |
+
event.stopPropagation();
|
14 |
+
window.open("http://www.zestard.com/", '_blank');
|
15 |
+
}
|
16 |
+
document.observe('dom:loaded', function() {
|
17 |
+
var n = SKIN_URL.indexOf("adminhtml");
|
18 |
+
$('zestard_block').src = SKIN_URL.substring(0, n) + "adminhtml/default/default/images/customerattribute/zestard-logo.png";
|
19 |
+
});
|
20 |
+
</script>
|
21 |
+
]]>
|
22 |
+
</label>
|
23 |
+
<sort_order>0</sort_order>
|
24 |
+
</zestard>
|
25 |
+
</tabs>
|
26 |
+
<sections>
|
27 |
+
<zestard_customerattribute translate="label" module="zestard_customerattribute">
|
28 |
+
<label>Customer Attribute</label>
|
29 |
+
<tab>zestard</tab>
|
30 |
+
<sort_order>120</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<groups>
|
35 |
+
<customerattribute_group translate="label" module="zestard_customerattribute">
|
36 |
+
<label>General</label>
|
37 |
+
<frontend_type>text</frontend_type>
|
38 |
+
<sort_order>1000</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
<fields>
|
43 |
+
<enable translate="label">
|
44 |
+
<label>Enabled </label>
|
45 |
+
<comment>Module Enable or Disable</comment>
|
46 |
+
<frontend_type>select</frontend_type>
|
47 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
48 |
+
<sort_order>10</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</enable>
|
53 |
+
<add_in_customer_registration translate="label">
|
54 |
+
<label>Add Extra Attributes under Customer Registration Email </label>
|
55 |
+
<frontend_type>select</frontend_type>
|
56 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
57 |
+
<sort_order>20</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</add_in_customer_registration>
|
62 |
+
<add_in_order_confirmation translate="label">
|
63 |
+
<label>Add Extra Attributes under Order Confirmation Email </label>
|
64 |
+
<frontend_type>select</frontend_type>
|
65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
66 |
+
<sort_order>30</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</add_in_order_confirmation>
|
71 |
+
<note translate="label">
|
72 |
+
<label>Note </label>
|
73 |
+
<frontend_type>label</frontend_type>
|
74 |
+
<comment>Place this shortcode in your custom email template</comment>
|
75 |
+
<sort_order>40</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
</note>
|
80 |
+
</fields>
|
81 |
+
</customerattribute_group>
|
82 |
+
</groups>
|
83 |
+
</zestard_customerattribute>
|
84 |
+
</sections>
|
85 |
+
</config>
|
app/code/community/Zestard/Customerattribute/sql/zestard_customerattribute_setup/mysql4-install-1.0.2.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$installer->getConnection()->addColumn(
|
6 |
+
$this->getTable('eav_attribute'),
|
7 |
+
'send_order_email',
|
8 |
+
array(
|
9 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
10 |
+
'nullable' => false,
|
11 |
+
'default' => 0,
|
12 |
+
'comment' => 'Send Order Email'
|
13 |
+
)
|
14 |
+
);
|
15 |
+
|
16 |
+
$installer->getConnection()->addColumn(
|
17 |
+
$this->getTable('eav_attribute'),
|
18 |
+
'send_register_email',
|
19 |
+
array(
|
20 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
21 |
+
'nullable' => false,
|
22 |
+
'default' => 0,
|
23 |
+
'comment' => 'Send Register Email'
|
24 |
+
)
|
25 |
+
);
|
26 |
+
|
27 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/zestard_customerattribute.xml
CHANGED
@@ -18,11 +18,13 @@
|
|
18 |
</reference>
|
19 |
|
20 |
<reference name="customer_form_register">
|
21 |
-
<action method="setTemplate"
|
|
|
|
|
22 |
</reference>
|
23 |
|
24 |
<reference name="before_body_end">
|
25 |
-
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
26 |
</reference>
|
27 |
</customer_account_create>
|
28 |
|
@@ -34,16 +36,18 @@
|
|
34 |
</reference>
|
35 |
|
36 |
<block name="customer_edit">
|
37 |
-
<action method="setTemplate"
|
|
|
|
|
38 |
</block>
|
39 |
|
40 |
<reference name="before_body_end">
|
41 |
-
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
42 |
</reference>
|
43 |
</customer_account_edit>
|
44 |
<checkout_onepage_index>
|
45 |
<reference name="checkout.onepage.billing">
|
46 |
-
<action method="setTemplate">
|
47 |
<template>zestard/customerattribute/checkout/onepage/billing.phtml</template>
|
48 |
</action>
|
49 |
</reference>
|
18 |
</reference>
|
19 |
|
20 |
<reference name="customer_form_register">
|
21 |
+
<action method="setTemplate" ifconfig="zestard_customerattribute/customerattribute_group/enable">
|
22 |
+
<template>zestard/customerattribute/form/register.phtml</template>
|
23 |
+
</action>
|
24 |
</reference>
|
25 |
|
26 |
<reference name="before_body_end">
|
27 |
+
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml" ifconfig="zestard_customerattribute/customerattribute_group/enable"/>
|
28 |
</reference>
|
29 |
</customer_account_create>
|
30 |
|
36 |
</reference>
|
37 |
|
38 |
<block name="customer_edit">
|
39 |
+
<action method="setTemplate" ifconfig="zestard_customerattribute/customerattribute_group/enable">
|
40 |
+
<template>zestard/customerattribute/form/edit.phtml</template>
|
41 |
+
</action>
|
42 |
</block>
|
43 |
|
44 |
<reference name="before_body_end">
|
45 |
+
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml" ifconfig="zestard_customerattribute/customerattribute_group/enable"/>
|
46 |
</reference>
|
47 |
</customer_account_edit>
|
48 |
<checkout_onepage_index>
|
49 |
<reference name="checkout.onepage.billing">
|
50 |
+
<action method="setTemplate" ifconfig="zestard_customerattribute/customerattribute_group/enable">
|
51 |
<template>zestard/customerattribute/checkout/onepage/billing.phtml</template>
|
52 |
</action>
|
53 |
</reference>
|
app/locale/en_US/Zestard_Customerattribute.csv
CHANGED
@@ -21,5 +21,6 @@
|
|
21 |
"Newsletter","Newsletter"
|
22 |
"Subscribe","Subscribe"
|
23 |
"Additional Information","Additional Information"
|
|
|
24 |
|
25 |
|
21 |
"Newsletter","Newsletter"
|
22 |
"Subscribe","Subscribe"
|
23 |
"Additional Information","Additional Information"
|
24 |
+
"Information", "Information"
|
25 |
|
26 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>customerattributes</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Customer Attributes Extension enables new attributes / fields for user account and registration form.</description>
|
11 |
<notes>Fixed Minor Bugs</notes>
|
12 |
<authors><author><name>Zestard</name><user>ZestardTech</user><email>support@zestard.com</email></author></authors>
|
13 |
-
<date>2016-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Zestard"><dir name="Customerattribute"><dir name="Block"><dir name="Adminhtml"><dir name="Customerattribute"><dir name="Edit"><file name="Form.php" hash="0e5df55f204957f826ba6f1542d6e8f5"/><dir name="Main"><file name="Main.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>customerattributes</name>
|
4 |
+
<version>1.0.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Customer Attributes Extension enables new attributes / fields for user account and registration form.</description>
|
11 |
<notes>Fixed Minor Bugs</notes>
|
12 |
<authors><author><name>Zestard</name><user>ZestardTech</user><email>support@zestard.com</email></author></authors>
|
13 |
+
<date>2016-06-24</date>
|
14 |
+
<time>05:36:37</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Zestard"><dir name="Customerattribute"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Customerattribute"><dir name="Edit"><file name="Form.php" hash="0e5df55f204957f826ba6f1542d6e8f5"/><dir name="Main"><file name="Main.php" hash="a54d38db76637b8029c364530f460fcf"/></dir><dir name="Tab"><file name="Main.php" hash="ea31e80ad7f74bd72c4c66b9e904ce09"/><file name="Options.php" hash="5135192c7f2b702852af3fe1ae9fc2c8"/></dir><file name="Tabs.php" hash="d6023d7e956decafeb04c56f0666988e"/></dir><file name="Edit.php" hash="b3f246bc7593c40553f76f9beddaa668"/><file name="Grid.php" hash="c1417d3f42174887587af34bac4e3a5a"/></dir><file name="Customerattribute.php" hash="6df15f8555dacef3f6cc6abf0f3bdef7"/></dir><file name="Data.php" hash="c60dfa1068ea838b429f079d76726c01"/><file name="OrderData.php" hash="b0f1c39d4befe47d4599fcd2fcc880ba"/></dir><dir name="Helper"><file name="Customerattribute.php" hash="ed31548ab01e55961f6fac11f23e71b8"/><file name="Data.php" hash="6e894c0ad40f395c28fb5b3e07982d45"/></dir><dir name="Model"><file name="Customer.php" hash="5734b87297733960575abf7f9221662f"/><file name="Customerattribute.php" hash="0564fc37e6f7d5f2c5231bce6bbc1058"/><file name="Order.php" hash="5137bf571704209de2a0fdcdc54b3cd8"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerattributeController.php" hash="5850973e7e440737aa0bcb86c13420cc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="198c3163718db0bc326572f52722f261"/><file name="config.xml" hash="271d798c2b670abf95e7e2195f2d5bde"/><file name="system.xml" hash="a7ccab5a34c1b32efa12d769938c6800"/></dir><dir name="sql"><dir name="zestard_customerattribute_setup"><file name="mysql4-install-1.0.2.php" hash="c6e633f0726351ca132e65e6851151b0"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zestard_Customerattribute.xml" hash="066a819f703f18cea5927597da5a7ca0"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Zestard_Customerattribute.csv" hash="272e30482cc82b8bd5e8a62e12d0ab85"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="zestard_customerattribute.xml" hash="9de70754c0090431b17733b91229fb67"/></dir><dir name="template"><dir name="zestard_customerattribute"><dir name="attribute"><dir name="edit"><file name="js.phtml" hash="fff761885c2abceed7b877995f134ed3"/></dir><file name="js.phtml" hash="c9575f8311bfb04b82da374d0c18f3a9"/><file name="options.phtml" hash="59270f751fdf85875a9fb7d42b5e9fba"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="zestard_customerattribute.xml" hash="e0a9f48996a5eff83651f85cc87528e9"/></dir><dir name="template"><dir name="zestard"><dir><dir name="customerattribute"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="c92d384f8fa322efe1108c9bd2a981b9"/></dir></dir><dir name="form"><file name="edit.phtml" hash="4f585c75c6fd261624524ff88ee5a5b4"/><file name="register.phtml" hash="523dbff5d4184a7bc7df684c34ca40b2"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="customerattribute"><file name="zestard-logo.png" hash="fbf51108e5c6f796c5d2a6294690c352"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/adminhtml/default/default/images/customerattribute/zestard-logo.png
ADDED
Binary file
|