Clarion_Customerattribute - Version 1.0.2

Version Notes

Fixed Options.php not found issue.

Download this release

Release Info

Developer Clarion Tech
Extension Clarion_Customerattribute
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Clarion/Customerattribute/Block/Adminhtml/Customerattribute/Edit/Options/Options.php DELETED
@@ -1,198 +0,0 @@
1
- <?php
2
- /**
3
- *Product attribute add/edit form options tab
4
- *
5
- * @category Clarion
6
- * @package Clarion_Customerattribute
7
- * @author Clarion Magento Team
8
- *
9
- */
10
- class Clarion_Customerattribute_Block_Adminhtml_Customerattribute_Edit_Options_Options
11
- extends Mage_Adminhtml_Block_Widget
12
- {
13
-
14
- public function __construct()
15
- {
16
- parent::__construct();
17
- $this->setTemplate('clarion_customerattribute/attribute/options.phtml');
18
- }
19
-
20
- /**
21
- * Preparing layout, adding buttons
22
- *
23
- * @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
24
- */
25
- protected function _prepareLayout()
26
- {
27
- $this->setChild('delete_button',
28
- $this->getLayout()->createBlock('adminhtml/widget_button')
29
- ->setData(array(
30
- 'label' => Mage::helper('eav')->__('Delete'),
31
- 'class' => 'delete delete-option'
32
- )));
33
-
34
- $this->setChild('add_button',
35
- $this->getLayout()->createBlock('adminhtml/widget_button')
36
- ->setData(array(
37
- 'label' => Mage::helper('eav')->__('Add Option'),
38
- 'class' => 'add',
39
- 'id' => 'add_new_option_button'
40
- )));
41
- return parent::_prepareLayout();
42
- }
43
-
44
- /**
45
- * Retrieve HTML of delete button
46
- *
47
- * @return string
48
- */
49
- public function getDeleteButtonHtml()
50
- {
51
- return $this->getChildHtml('delete_button');
52
- }
53
-
54
- /**
55
- * Retrieve HTML of add button
56
- *
57
- * @return string
58
- */
59
- public function getAddNewButtonHtml()
60
- {
61
- return $this->getChildHtml('add_button');
62
- }
63
-
64
- /**
65
- * Retrieve stores collection with default store
66
- *
67
- * @return Mage_Core_Model_Mysql4_Store_Collection
68
- */
69
- public function getStores()
70
- {
71
- $stores = $this->getData('stores');
72
- if (is_null($stores)) {
73
- $stores = Mage::getModel('core/store')
74
- ->getResourceCollection()
75
- ->setLoadDefault(true)
76
- ->load();
77
- $this->setData('stores', $stores);
78
- }
79
- return $stores;
80
- }
81
-
82
- /**
83
- * Retrieve attribute option values if attribute input type select or multiselect
84
- *
85
- * @return array
86
- */
87
- public function getOptionValues()
88
- {
89
- $attributeType = $this->getAttributeObject()->getFrontendInput();
90
- $defaultValues = $this->getAttributeObject()->getDefaultValue();
91
- if ($attributeType == 'select' || $attributeType == 'multiselect') {
92
- $defaultValues = explode(',', $defaultValues);
93
- } else {
94
- $defaultValues = array();
95
- }
96
-
97
- switch ($attributeType) {
98
- case 'select':
99
- $inputType = 'radio';
100
- break;
101
- case 'multiselect':
102
- $inputType = 'checkbox';
103
- break;
104
- default:
105
- $inputType = '';
106
- break;
107
- }
108
-
109
- $values = $this->getData('option_values');
110
- if (is_null($values)) {
111
- $values = array();
112
- $optionCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
113
- ->setAttributeFilter($this->getAttributeObject()->getId())
114
- ->setPositionOrder('desc', true)
115
- ->load();
116
-
117
- $helper = Mage::helper('core');
118
- foreach ($optionCollection as $option) {
119
- $value = array();
120
- if (in_array($option->getId(), $defaultValues)) {
121
- $value['checked'] = 'checked="checked"';
122
- } else {
123
- $value['checked'] = '';
124
- }
125
-
126
- $value['intype'] = $inputType;
127
- $value['id'] = $option->getId();
128
- $value['sort_order'] = $option->getSortOrder();
129
- foreach ($this->getStores() as $store) {
130
- $storeValues = $this->getStoreOptionValues($store->getId());
131
- $value['store' . $store->getId()] = isset($storeValues[$option->getId()])
132
- ? $helper->escapeHtml($storeValues[$option->getId()]) : '';
133
- }
134
- $values[] = new Varien_Object($value);
135
- }
136
- $this->setData('option_values', $values);
137
- }
138
-
139
- return $values;
140
- }
141
-
142
- /**
143
- * Retrieve frontend labels of attribute for each store
144
- *
145
- * @return array
146
- */
147
- public function getLabelValues()
148
- {
149
- $values = array();
150
- $values[0] = $this->getAttributeObject()->getFrontend()->getLabel();
151
- // it can be array and cause bug
152
- $frontendLabel = $this->getAttributeObject()->getFrontend()->getLabel();
153
- if (is_array($frontendLabel)) {
154
- $frontendLabel = array_shift($frontendLabel);
155
- }
156
- $storeLabels = $this->getAttributeObject()->getStoreLabels();
157
- foreach ($this->getStores() as $store) {
158
- if ($store->getId() != 0) {
159
- $values[$store->getId()] = isset($storeLabels[$store->getId()]) ? $storeLabels[$store->getId()] : '';
160
- }
161
- }
162
- return $values;
163
- }
164
-
165
- /**
166
- * Retrieve attribute option values for given store id
167
- *
168
- * @param integer $storeId
169
- * @return array
170
- */
171
- public function getStoreOptionValues($storeId)
172
- {
173
- $values = $this->getData('store_option_values_'.$storeId);
174
- if (is_null($values)) {
175
- $values = array();
176
- $valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
177
- ->setAttributeFilter($this->getAttributeObject()->getId())
178
- ->setStoreFilter($storeId, false)
179
- ->load();
180
- foreach ($valuesCollection as $item) {
181
- $values[$item->getId()] = $item->getValue();
182
- }
183
- $this->setData('store_option_values_'.$storeId, $values);
184
- }
185
- return $values;
186
- }
187
-
188
- /**
189
- * Retrieve attribute object from registry
190
- *
191
- * @return Mage_Eav_Model_Entity_Attribute_Abstract
192
- */
193
- public function getAttributeObject()
194
- {
195
- return Mage::registry('customerattribute_data');
196
- }
197
-
198
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Clarion/Customerattribute/Block/Adminhtml/Customerattribute/Edit/Tab/Options.php CHANGED
@@ -6,7 +6,190 @@
6
  * @package Clarion_Customerattribute
7
  * @author Clarion Magento Team
8
  */
9
- class Clarion_Customerattribute_Block_Adminhtml_Customerattribute_Edit_Tab_Options
10
- extends Clarion_Customerattribute_Block_Adminhtml_Customerattribute_Edit_Options_Options
11
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
6
  * @package Clarion_Customerattribute
7
  * @author Clarion Magento Team
8
  */
9
+ class Clarion_Customerattribute_Block_Adminhtml_Customerattribute_Edit_Tab_Options extends Mage_Adminhtml_Block_Widget
 
10
  {
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setTemplate('clarion_customerattribute/attribute/options.phtml');
15
+ }
16
+
17
+ /**
18
+ * Preparing layout, adding buttons
19
+ *
20
+ * @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
21
+ */
22
+ protected function _prepareLayout()
23
+ {
24
+ $this->setChild('delete_button',
25
+ $this->getLayout()->createBlock('adminhtml/widget_button')
26
+ ->setData(array(
27
+ 'label' => Mage::helper('eav')->__('Delete'),
28
+ 'class' => 'delete delete-option'
29
+ )));
30
+
31
+ $this->setChild('add_button',
32
+ $this->getLayout()->createBlock('adminhtml/widget_button')
33
+ ->setData(array(
34
+ 'label' => Mage::helper('eav')->__('Add Option'),
35
+ 'class' => 'add',
36
+ 'id' => 'add_new_option_button'
37
+ )));
38
+ return parent::_prepareLayout();
39
+ }
40
+
41
+ /**
42
+ * Retrieve HTML of delete button
43
+ *
44
+ * @return string
45
+ */
46
+ public function getDeleteButtonHtml()
47
+ {
48
+ return $this->getChildHtml('delete_button');
49
+ }
50
+
51
+ /**
52
+ * Retrieve HTML of add button
53
+ *
54
+ * @return string
55
+ */
56
+ public function getAddNewButtonHtml()
57
+ {
58
+ return $this->getChildHtml('add_button');
59
+ }
60
+
61
+ /**
62
+ * Retrieve stores collection with default store
63
+ *
64
+ * @return Mage_Core_Model_Mysql4_Store_Collection
65
+ */
66
+ public function getStores()
67
+ {
68
+ $stores = $this->getData('stores');
69
+ if (is_null($stores)) {
70
+ $stores = Mage::getModel('core/store')
71
+ ->getResourceCollection()
72
+ ->setLoadDefault(true)
73
+ ->load();
74
+ $this->setData('stores', $stores);
75
+ }
76
+ return $stores;
77
+ }
78
+
79
+ /**
80
+ * Retrieve attribute option values if attribute input type select or multiselect
81
+ *
82
+ * @return array
83
+ */
84
+ public function getOptionValues()
85
+ {
86
+ $attributeType = $this->getAttributeObject()->getFrontendInput();
87
+ $defaultValues = $this->getAttributeObject()->getDefaultValue();
88
+ if ($attributeType == 'select' || $attributeType == 'multiselect') {
89
+ $defaultValues = explode(',', $defaultValues);
90
+ } else {
91
+ $defaultValues = array();
92
+ }
93
+
94
+ switch ($attributeType) {
95
+ case 'select':
96
+ $inputType = 'radio';
97
+ break;
98
+ case 'multiselect':
99
+ $inputType = 'checkbox';
100
+ break;
101
+ default:
102
+ $inputType = '';
103
+ break;
104
+ }
105
+
106
+ $values = $this->getData('option_values');
107
+ if (is_null($values)) {
108
+ $values = array();
109
+ $optionCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
110
+ ->setAttributeFilter($this->getAttributeObject()->getId())
111
+ ->setPositionOrder('desc', true)
112
+ ->load();
113
+
114
+ $helper = Mage::helper('core');
115
+ foreach ($optionCollection as $option) {
116
+ $value = array();
117
+ if (in_array($option->getId(), $defaultValues)) {
118
+ $value['checked'] = 'checked="checked"';
119
+ } else {
120
+ $value['checked'] = '';
121
+ }
122
+
123
+ $value['intype'] = $inputType;
124
+ $value['id'] = $option->getId();
125
+ $value['sort_order'] = $option->getSortOrder();
126
+ foreach ($this->getStores() as $store) {
127
+ $storeValues = $this->getStoreOptionValues($store->getId());
128
+ $value['store' . $store->getId()] = isset($storeValues[$option->getId()])
129
+ ? $helper->escapeHtml($storeValues[$option->getId()]) : '';
130
+ }
131
+ $values[] = new Varien_Object($value);
132
+ }
133
+ $this->setData('option_values', $values);
134
+ }
135
+
136
+ return $values;
137
+ }
138
+
139
+ /**
140
+ * Retrieve frontend labels of attribute for each store
141
+ *
142
+ * @return array
143
+ */
144
+ public function getLabelValues()
145
+ {
146
+ $values = array();
147
+ $values[0] = $this->getAttributeObject()->getFrontend()->getLabel();
148
+ // it can be array and cause bug
149
+ $frontendLabel = $this->getAttributeObject()->getFrontend()->getLabel();
150
+ if (is_array($frontendLabel)) {
151
+ $frontendLabel = array_shift($frontendLabel);
152
+ }
153
+ $storeLabels = $this->getAttributeObject()->getStoreLabels();
154
+ foreach ($this->getStores() as $store) {
155
+ if ($store->getId() != 0) {
156
+ $values[$store->getId()] = isset($storeLabels[$store->getId()]) ? $storeLabels[$store->getId()] : '';
157
+ }
158
+ }
159
+ return $values;
160
+ }
161
+
162
+ /**
163
+ * Retrieve attribute option values for given store id
164
+ *
165
+ * @param integer $storeId
166
+ * @return array
167
+ */
168
+ public function getStoreOptionValues($storeId)
169
+ {
170
+ $values = $this->getData('store_option_values_'.$storeId);
171
+ if (is_null($values)) {
172
+ $values = array();
173
+ $valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
174
+ ->setAttributeFilter($this->getAttributeObject()->getId())
175
+ ->setStoreFilter($storeId, false)
176
+ ->load();
177
+ foreach ($valuesCollection as $item) {
178
+ $values[$item->getId()] = $item->getValue();
179
+ }
180
+ $this->setData('store_option_values_'.$storeId, $values);
181
+ }
182
+ return $values;
183
+ }
184
+
185
+ /**
186
+ * Retrieve attribute object from registry
187
+ *
188
+ * @return Mage_Eav_Model_Entity_Attribute_Abstract
189
+ */
190
+ public function getAttributeObject()
191
+ {
192
+ return Mage::registry('customerattribute_data');
193
+ }
194
+
195
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clarion_Customerattribute</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -10,11 +10,11 @@
10
  <description>By using Customer attributes extension we can create additional fields on the customer&#xD;
11
  account create page, customer account edit page and admin manage customers. So the we &#xD;
12
  can collect business-related and personal information needed from the customers.</description>
13
- <notes>Fixed Abstract.php not found issue.</notes>
14
  <authors><author><name>Clarion Tech</name><user>Clariontech</user><email>magento@clariontechnologies.co.in</email></author></authors>
15
  <date>2014-11-20</date>
16
- <time>12:32:22</time>
17
- <contents><target name="magecommunity"><dir name="Clarion"><dir name="Customerattribute"><dir name="Block"><dir name="Adminhtml"><dir name="Customerattribute"><dir name="Edit"><file name="Form.php" hash="c6bd2ea2aa06a01edd37728aeb529bda"/><dir name="Main"><file name="Main.php" hash="dad7a24bf1cb9515d367d8555dd86cb8"/></dir><dir name="Options"><file name="Options.php" hash="79c0592ec1abdc21fa2c8ecba37f2a79"/></dir><dir name="Tab"><file name="Main.php" hash="f180b77bfc2ed6ff46f368e35f3c80ff"/><file name="Options.php" hash="67ddadfb823fb2c6e3a2ab69442d78d7"/></dir><file name="Tabs.php" hash="dcc8f3ff46ed6ae664354c60eb0d2d88"/></dir><file name="Edit.php" hash="836646be9ab4f4bfa03677cbb8dd4508"/><file name="Grid.php" hash="d1a1a997c3e4d934c9414d2c00c32946"/></dir><file name="Customerattribute.php" hash="0ded2a954d9a1b4e8f2aba494fc25b21"/></dir></dir><dir name="Helper"><file name="Customerattribute.php" hash="2869c8d8ae5a8c646bcef6c7eac11648"/><file name="Data.php" hash="80b69f61049d6d3239145dbe097c886f"/></dir><dir name="Model"><file name="Customerattribute.php" hash="beb54d45f64cefd2f9f116d11a7b7660"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerattributeController.php" hash="c0d925f6792aa6eaf472d7d61210c65b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="78912661cc9744715913c485f27e04d0"/><file name="config.xml" hash="8d9a595d9763d4f52535540ae227f333"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="clarion_customerattribute.xml" hash="4806a3e68728cecee221a2e478867db8"/></dir><dir name="template"><dir name="clarion_customerattribute"><dir name="attribute"><dir name="edit"><file name="js.phtml" hash="c2bb9abf760078323856c16d98227fe0"/></dir><file name="js.phtml" hash="57f2621a2f0bb947c2513c8502a5d34c"/><file name="options.phtml" hash="2b9079749dd8338ffadf9f71dd1c3864"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="clarion_customerattribute.xml" hash="f739a94ef200cb88e70ffb99e8cced16"/></dir><dir name="template"><dir name="clarion"><dir name="customerattribute"><dir name="form"><file name="edit.phtml" hash="66572d4984083351e4a3a822d5fc60bc"/><file name="register.phtml" hash="24dec78ec3fb77c7153f9aba122d83bb"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clarion_Customerattribute.xml" hash="3ada0a4914bfa2d418ce81613bd9f2d8"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="clarion"><dir name="customerattribute"><file name="grid-cal.gif" hash="b1468e5239504974c689eea5d93f86d4"/></dir></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clarion_Customerattribute</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
10
  <description>By using Customer attributes extension we can create additional fields on the customer&#xD;
11
  account create page, customer account edit page and admin manage customers. So the we &#xD;
12
  can collect business-related and personal information needed from the customers.</description>
13
+ <notes>Fixed Options.php not found issue.</notes>
14
  <authors><author><name>Clarion Tech</name><user>Clariontech</user><email>magento@clariontechnologies.co.in</email></author></authors>
15
  <date>2014-11-20</date>
16
+ <time>13:05:07</time>
17
+ <contents><target name="magecommunity"><dir name="Clarion"><dir name="Customerattribute"><dir name="Block"><dir name="Adminhtml"><dir name="Customerattribute"><dir name="Edit"><file name="Form.php" hash="c6bd2ea2aa06a01edd37728aeb529bda"/><dir name="Main"><file name="Main.php" hash="dad7a24bf1cb9515d367d8555dd86cb8"/></dir><dir name="Tab"><file name="Main.php" hash="f180b77bfc2ed6ff46f368e35f3c80ff"/><file name="Options.php" hash="1328328f8b010a6ddd07c7a7993397e2"/></dir><file name="Tabs.php" hash="dcc8f3ff46ed6ae664354c60eb0d2d88"/></dir><file name="Edit.php" hash="836646be9ab4f4bfa03677cbb8dd4508"/><file name="Grid.php" hash="d1a1a997c3e4d934c9414d2c00c32946"/></dir><file name="Customerattribute.php" hash="0ded2a954d9a1b4e8f2aba494fc25b21"/></dir></dir><dir name="Helper"><file name="Customerattribute.php" hash="2869c8d8ae5a8c646bcef6c7eac11648"/><file name="Data.php" hash="80b69f61049d6d3239145dbe097c886f"/></dir><dir name="Model"><file name="Customerattribute.php" hash="beb54d45f64cefd2f9f116d11a7b7660"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerattributeController.php" hash="c0d925f6792aa6eaf472d7d61210c65b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="78912661cc9744715913c485f27e04d0"/><file name="config.xml" hash="8d9a595d9763d4f52535540ae227f333"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="clarion_customerattribute.xml" hash="4806a3e68728cecee221a2e478867db8"/></dir><dir name="template"><dir name="clarion_customerattribute"><dir name="attribute"><dir name="edit"><file name="js.phtml" hash="c2bb9abf760078323856c16d98227fe0"/></dir><file name="js.phtml" hash="57f2621a2f0bb947c2513c8502a5d34c"/><file name="options.phtml" hash="2b9079749dd8338ffadf9f71dd1c3864"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="clarion_customerattribute.xml" hash="f739a94ef200cb88e70ffb99e8cced16"/></dir><dir name="template"><dir name="clarion"><dir name="customerattribute"><dir name="form"><file name="edit.phtml" hash="66572d4984083351e4a3a822d5fc60bc"/><file name="register.phtml" hash="24dec78ec3fb77c7153f9aba122d83bb"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clarion_Customerattribute.xml" hash="3ada0a4914bfa2d418ce81613bd9f2d8"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="clarion"><dir name="customerattribute"><file name="grid-cal.gif" hash="b1468e5239504974c689eea5d93f86d4"/></dir></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>