SharpShippingByCustomerGroup - Version 0.1.0

Version Notes

Selectable Payments for Customer Groups

Download this release

Release Info

Developer Magento Core Team
Extension SharpShippingByCustomerGroup
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Sharpdot/SharpShippingByCustomerGroup/Block/Adminhtml/System/Config/Form.php ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Sharpdot
22
+ * @package Sharpdot_SharpShippingByCustomerGroup
23
+ * @copyright Copyright (c) 2010 Sharpdot Inc. (http://www.sharpdotinc.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * System config form block
30
+ *
31
+ * @category Sharpdot
32
+ * @package Sharpdot_SharpShippingByCustomerGroup
33
+ * @author Mike D
34
+ */
35
+ class Sharpdot_SharpShippingByCustomerGroup_Block_Adminhtml_System_Config_Form extends Mage_Adminhtml_Block_System_Config_Form
36
+ {
37
+
38
+
39
+
40
+ /**
41
+ * Init fieldset fields
42
+ *
43
+ * @param Varien_Data_Form_Element_Fieldset $fieldset
44
+ * @param Varien_Simplexml_Element $group
45
+ * @param Varien_Simplexml_Element $section
46
+ * @param string $fieldPrefix
47
+ * @param string $labelPrefix
48
+ * @return Mage_Adminhtml_Block_System_Config_Form
49
+ */
50
+ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelPrefix='')
51
+ {
52
+ if(!$group->is('use_custom_form', 1)){
53
+ return parent::initFields($fieldset, $group, $section, $fieldPrefix='', $labelPrefix='');
54
+ }
55
+
56
+ if (!$this->_configDataObject) {
57
+ $this->_initObjects();
58
+ }
59
+
60
+ // Extends for config data
61
+ $configDataAdditionalGroups = array();
62
+
63
+ $carriers = Mage::getStoreConfig('carriers');
64
+
65
+
66
+ $xmlString = "<config><fields>";
67
+ $sort_order = 0;
68
+ foreach($carriers as $code => $carrierConfig){
69
+ //TODO: if payment method is not active then hide it and set value to empty or null -MRD
70
+ if(!isset($carrierConfig['active']) || $carrierConfig['active'] == 0){
71
+ continue;
72
+ }
73
+ //Mainly keeps google checkout option from showing.
74
+ if(!isset($carrierConfig['title'])){
75
+ continue;
76
+ }
77
+
78
+ ++$sort_order;
79
+ $xmlString .= '
80
+ <'.$code.' translate="label">
81
+ <label>'.$carrierConfig['title'].'</label>
82
+ <frontend_type>multiselect</frontend_type>
83
+ <source_model>sharpshippingbycustomergroup/adminhtml_system_config_source_customer_group</source_model>
84
+ <sort_order>'.$sort_order.'</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </'.$code.'>';
89
+ }
90
+ $xmlString .= "</fields></config>";
91
+
92
+ $element = new Mage_Core_Model_Config_Base();
93
+ $element->loadString($xmlString);
94
+
95
+
96
+ foreach($element->getNode('fields') as $elements){
97
+
98
+
99
+ $elements = (array)$elements;
100
+ // sort either by sort_order or by child node values bypassing the sort_order
101
+ if ($group->sort_fields && $group->sort_fields->by) {
102
+ $fieldset->setSortElementsByAttribute((string)$group->sort_fields->by,
103
+ ($group->sort_fields->direction_desc ? SORT_DESC : SORT_ASC)
104
+ );
105
+ } else {
106
+ usort($elements, array($this, '_sortForm'));
107
+ }
108
+
109
+ foreach ($elements as $e) {
110
+ if (!$this->_canShowField($e)) {
111
+ continue;
112
+ }
113
+
114
+ /**
115
+ * Look for custom defined field path
116
+ */
117
+ $path = (string)$e->config_path;
118
+ if (empty($path)) {
119
+ $path = $section->getName() . '/' . $group->getName() . '/' . $fieldPrefix . $e->getName();
120
+ } elseif (strrpos($path, '/') > 0) {
121
+ // Extend config data with new section group
122
+ $groupPath = substr($path, 0, strrpos($path, '/'));
123
+ if (!isset($configDataAdditionalGroups[$groupPath])) {
124
+ $this->_configData = $this->_configDataObject->extendConfig($groupPath, false, $this->_configData);
125
+ $configDataAdditionalGroups[$groupPath] = true;
126
+ }
127
+ }
128
+
129
+ $id = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $e->getName();
130
+
131
+ if (isset($this->_configData[$path])) {
132
+ $data = $this->_configData[$path];
133
+ $inherit = false;
134
+ } else {
135
+ $data = $this->_configRoot->descend($path);
136
+ $inherit = true;
137
+ }
138
+ if ($e->frontend_model) {
139
+ $fieldRenderer = Mage::getBlockSingleton((string)$e->frontend_model);
140
+ } else {
141
+ $fieldRenderer = $this->_defaultFieldRenderer;
142
+ }
143
+
144
+ $fieldRenderer->setForm($this);
145
+ $fieldRenderer->setConfigData($this->_configData);
146
+
147
+ $helperName = $this->_configFields->getAttributeModule($section, $group, $e);
148
+ $fieldType = (string)$e->frontend_type ? (string)$e->frontend_type : 'text';
149
+ $name = 'groups['.$group->getName().'][fields]['.$fieldPrefix.$e->getName().'][value]';
150
+ $label = Mage::helper($helperName)->__($labelPrefix).' '.Mage::helper($helperName)->__((string)$e->label);
151
+ $hint = (string)$e->hint ? Mage::helper($helperName)->__((string)$e->hint) : '';
152
+
153
+ if ($e->backend_model) {
154
+ $model = Mage::getModel((string)$e->backend_model);
155
+ if (!$model instanceof Mage_Core_Model_Config_Data) {
156
+ Mage::throwException('Invalid config field backend model: '.(string)$e->backend_model);
157
+ }
158
+ $model->setPath($path)
159
+ ->setValue($data)
160
+ ->setWebsite($this->getWebsiteCode())
161
+ ->setStore($this->getStoreCode())
162
+ ->afterLoad();
163
+ $data = $model->getValue();
164
+ }
165
+
166
+ $comment = $this->_prepareFieldComment($e, $helperName, $data);
167
+ $tooltip = $this->_prepareFieldTooltip($e, $helperName);
168
+
169
+ if ($e->depends) {
170
+ foreach ($e->depends->children() as $dependent) {
171
+ $dependentId = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $dependent->getName();
172
+ $dependentValue = (string) $dependent;
173
+ $this->_getDependence()
174
+ ->addFieldMap($id, $id)
175
+ ->addFieldMap($dependentId, $dependentId)
176
+ ->addFieldDependence($id, $dependentId, $dependentValue);
177
+ }
178
+ }
179
+
180
+ $field = $fieldset->addField($id, $fieldType, array(
181
+ 'name' => $name,
182
+ 'label' => $label,
183
+ 'comment' => $comment,
184
+ 'tooltip' => $tooltip,
185
+ 'hint' => $hint,
186
+ 'value' => $data,
187
+ 'inherit' => $inherit,
188
+ 'class' => $e->frontend_class,
189
+ 'field_config' => $e,
190
+ 'scope' => $this->getScope(),
191
+ 'scope_id' => $this->getScopeId(),
192
+ 'scope_label' => $this->getScopeLabel($e),
193
+ 'can_use_default_value' => $this->canUseDefaultValue((int)$e->show_in_default),
194
+ 'can_use_website_value' => $this->canUseWebsiteValue((int)$e->show_in_website),
195
+ ));
196
+ $this->_prepareFieldOriginalData($field, $e);
197
+
198
+ if (isset($e->validate)) {
199
+ $field->addClass($e->validate);
200
+ }
201
+
202
+ if (isset($e->frontend_type) && 'multiselect' === (string)$e->frontend_type && isset($e->can_be_empty)) {
203
+ $field->setCanBeEmpty(true);
204
+ }
205
+
206
+ $field->setRenderer($fieldRenderer);
207
+
208
+ if ($e->source_model) {
209
+ // determine callback for the source model
210
+ $factoryName = (string)$e->source_model;
211
+ $method = false;
212
+ if (preg_match('/^([^:]+?)::([^:]+?)$/', $factoryName, $matches)) {
213
+ array_shift($matches);
214
+ list($factoryName, $method) = array_values($matches);
215
+ }
216
+
217
+ $sourceModel = Mage::getSingleton($factoryName);
218
+ if ($sourceModel instanceof Varien_Object) {
219
+ $sourceModel->setPath($path);
220
+ }
221
+ if ($method) {
222
+ if ($fieldType == 'multiselect') {
223
+ $optionArray = $sourceModel->$method();
224
+ } else {
225
+ $optionArray = array();
226
+ foreach ($sourceModel->$method() as $value => $label) {
227
+ $optionArray[] = array('label' => $label, 'value' => $value);
228
+ }
229
+ }
230
+ } else {
231
+ $optionArray = $sourceModel->toOptionArray($fieldType == 'multiselect');
232
+ }
233
+ $field->setValues($optionArray);
234
+ }
235
+ }
236
+ }
237
+ return $this;
238
+ }
239
+
240
+ }
app/code/community/Sharpdot/SharpShippingByCustomerGroup/Helper/Data.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Sharpdot
22
+ * @package Sharpdot_SharpShippingByCustomerGroup
23
+ * @copyright Copyright (c) 2010 Sharpdot Inc. (http://www.sharpdotinc.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Helper
30
+ *
31
+ * @category Sharpdot
32
+ * @package Sharpdot_SharpShippingByCustomerGroup
33
+ * @author Mike D
34
+ */
35
+ class Sharpdot_SharpShippingByCustomerGroup_Helper_Data extends Mage_Core_Helper_Abstract
36
+ {
37
+ public function getAllowedShippingCarriersByCustomerGroup($customerGroup = null)
38
+ {
39
+ //if no customergroupId then return nothing. this allows admin to get all avaliable methods.
40
+ if(is_null($customerGroup)){
41
+ return array();
42
+ }
43
+
44
+ $carriers = Mage::getStoreConfig('sharpshippingbycustomergroup/shipping_methods');
45
+
46
+ $allowedCarriers = array();
47
+ foreach($carriers as $code => $customerGroupIdCsv){
48
+ $allowedGroupIds = explode(',', $customerGroupIdCsv);
49
+
50
+ if(in_array($customerGroup, $allowedGroupIds)){
51
+ $allowedCarriers[] = $code;
52
+ }
53
+ }
54
+
55
+ return $allowedCarriers;
56
+ }
57
+ }
app/code/community/Sharpdot/SharpShippingByCustomerGroup/Model/Adminhtml/System/Config/Source/Customer/Group.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Sharpdot
22
+ * @package Sharpdot_SharpShippingByCustomerGroup
23
+ * @copyright Copyright (c) 2010 Sharpdot Inc. (http://www.sharpdotinc.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Sharpdot_SharpShippingByCustomerGroup_Model_Adminhtml_System_Config_Source_Customer_Group
29
+ {
30
+ protected $_options;
31
+
32
+ public function toOptionArray()
33
+ {
34
+ if (!$this->_options) {
35
+ $this->_options = Mage::getResourceModel('customer/group_collection')
36
+ //->setRealGroupsFilter()
37
+ ->loadData()->toOptionArray();
38
+ array_unshift($this->_options, array('value'=> '', 'label'=> Mage::helper('sharppaymentsbycustomergroup')->__('-- Please Select --')));
39
+ }
40
+ return $this->_options;
41
+ }
42
+ }
app/code/community/Sharpdot/SharpShippingByCustomerGroup/Model/Shipping/Rate/Request.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Sharpdot
22
+ * @package Sharpdot_SharpShippingByCustomerGroup
23
+ * @copyright Copyright (c) 2010 Sharpdot Inc. (http://www.sharpdotinc..com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Fields:
29
+ * - orig:
30
+ * - country_id: UK
31
+ * - region_id: 1
32
+ * - postcode: 90034
33
+ * - dest:
34
+ * - country_id: UK
35
+ * - region_id: 2
36
+ * - postcode: 01005
37
+ * - package:
38
+ * - value: $100
39
+ * - weight: 1.5 lb
40
+ * - height: 10"
41
+ * - width: 10"
42
+ * - depth: 10"
43
+ * - order:
44
+ * - total_qty: 10
45
+ * - subtotal: $100
46
+ * - option
47
+ * - insurance: true
48
+ * - handling: $1
49
+ * - table (shiptable)
50
+ * - condition_name: package_weight
51
+ * - limit
52
+ * - carrier: ups
53
+ * - method: 3dp
54
+ * - ups
55
+ * - pickup: CC
56
+ * - container: CP
57
+ * - address: RES
58
+ */
59
+ class Sharpdot_SharpShippingByCustomerGroup_Model_Shipping_Rate_Request extends Mage_Shipping_Model_Rate_Request
60
+ {
61
+
62
+ protected function _construct()
63
+ {
64
+ //allways force the check.
65
+ $this->setLimitCarrier();
66
+ }
67
+
68
+ protected function _getCustomerGroupCarriers()
69
+ {
70
+ //Is enabled
71
+ if(!Mage::getStoreConfig('sharpshippingbycustomergroup/settings/enabled')){
72
+ return array();
73
+ }
74
+
75
+ //Is admin
76
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) { //Dont restrict admin
77
+ return array();
78
+ }
79
+
80
+
81
+ $customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
82
+ $allowedShippingMethodsByGroup = Mage::helper('sharpshippingbycustomergroup')->getAllowedShippingCarriersByCustomerGroup($customerGroupId);
83
+
84
+ return $allowedShippingMethodsByGroup;
85
+ }
86
+
87
+ public function setLimitCarrier($carrier='')
88
+ {
89
+ if(empty($carrier)){
90
+ $carrier = array();
91
+ }elseif(!is_array($carrier)){
92
+ $carrier = array($carrier);
93
+ }
94
+
95
+
96
+ $allowedCarriers = array_unique(array_merge($this->_getCustomerGroupCarriers(), $carrier));
97
+
98
+ $this->setData('limit_carrier', $allowedCarriers);
99
+ }
100
+ }
app/code/community/Sharpdot/SharpShippingByCustomerGroup/etc/config.xml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Sharpdot_SharpShippingByCustomerGroup>
5
+ <version>0.1.0</version>
6
+ </Sharpdot_SharpShippingByCustomerGroup>
7
+ </modules>
8
+ <admin />
9
+ <global>
10
+ <blocks>
11
+ <sharpshippingbycustomergroup><class>Sharpdot_SharpShippingByCustomerGroup_Block</class></sharpshippingbycustomergroup>
12
+ </blocks>
13
+ <helpers>
14
+ <sharpshippingbycustomergroup>
15
+ <class>Sharpdot_SharpShippingByCustomerGroup_Helper</class>
16
+ </sharpshippingbycustomergroup>
17
+ </helpers>
18
+ <models>
19
+ <sharpshippingbycustomergroup>
20
+ <class>Sharpdot_SharpShippingByCustomerGroup_Model</class>
21
+ <resourceModel>sharpshippingbycustomergroup_mysql4</resourceModel>
22
+ </sharpshippingbycustomergroup>
23
+ <sharpshippingbycustomergroup_mysql4>
24
+ <class>Sharpdot_SharpShippingByCustomerGroup_Model_Mysql4</class>
25
+ </sharpshippingbycustomergroup_mysql4>
26
+
27
+ <shipping>
28
+ <rewrite>
29
+ <rate_request>Sharpdot_SharpShippingByCustomerGroup_Model_Shipping_Rate_Request</rate_request>
30
+ </rewrite>
31
+ </shipping>
32
+ </models>
33
+ <resources>
34
+ <sharpshippingbycustomergroup_setup>
35
+ <setup>
36
+ <module>Sharpdot_SharpShippingByCustomerGroup</module>
37
+ </setup>
38
+ <connection>
39
+ <use>core_setup</use>
40
+ </connection>
41
+ </sharpshippingbycustomergroup_setup>
42
+ <sharpshippingbycustomergroup_write>
43
+ <connection>
44
+ <use>core_write</use>
45
+ </connection>
46
+ </sharpshippingbycustomergroup_write>
47
+ <sharpshippingbycustomergroup_read>
48
+ <connection>
49
+ <use>core_read</use>
50
+ </connection>
51
+ </sharpshippingbycustomergroup_read>
52
+ </resources>
53
+ </global>
54
+ <adminhtml>
55
+ <translate>
56
+ <modules>
57
+ <Sharpdot_SharpShippingByCustomerGroup>
58
+ <files>
59
+ <default>Sharpdot_SharpShippingByCustomerGroup.csv</default>
60
+ </files>
61
+ </Sharpdot_SharpShippingByCustomerGroup>
62
+ </modules>
63
+ </translate>
64
+ <acl>
65
+ <resources>
66
+ <admin>
67
+ <children>
68
+ <system>
69
+ <children>
70
+ <config>
71
+ <children>
72
+ <sharpshippingbycustomergroup translate="title" module="sharpshippingbycustomergroup">
73
+ <title>Shipping Methods By Customer Group Section</title>
74
+ </sharpshippingbycustomergroup>
75
+ </children>
76
+ </config>
77
+ </children>
78
+ </system>
79
+ </children>
80
+ </admin>
81
+ </resources>
82
+ </acl>
83
+ </adminhtml>
84
+ <frontend>
85
+ <translate>
86
+ <modules>
87
+ <Sharpdot_SharpShippingByCustomerGroup>
88
+ <files>
89
+ <default>Sharpdot_SharpShippingByCustomerGroup.csv</default>
90
+ </files>
91
+ </Sharpdot_SharpShippingByCustomerGroup>
92
+ </modules>
93
+ </translate>
94
+ <layout>
95
+ <updates>
96
+ <sharpshippingbycustomergroup module="Sharpdot_SharpShippingByCustomerGroup">
97
+ <file>sharpdot_sharpshippingbycustomergroup.xml</file>
98
+ </sharpshippingbycustomergroup>
99
+ </updates>
100
+ </layout>
101
+ </frontend>
102
+
103
+ <default>
104
+ <sharpshippingbycustomergroup>
105
+ <settings>
106
+ <enabled>enabled</enabled>
107
+ </settings>
108
+ </sharpshippingbycustomergroup>
109
+ </default>
110
+
111
+ </config>
app/code/community/Sharpdot/SharpShippingByCustomerGroup/etc/system.xml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Sharpdot
23
+ * @package Sharpdot_SharpShippingByCustomerGroup
24
+ * @copyright Copyright (c) 2010 Sharpdot Inc. (http://www.sharpdotinc.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <sections>
30
+ <sharpshippingbycustomergroup translate="label" module="sharpshippingbycustomergroup">
31
+ <class>separator-top</class>
32
+ <label>Shipping Carriers By Customer Group</label>
33
+ <tab>sales</tab>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>200</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <frontend_model>sharpshippingbycustomergroup/adminhtml_system_config_form</frontend_model>
40
+ <groups>
41
+ <settings translate="label">
42
+ <label>General Settings</label>
43
+ <frontend_type>text</frontend_type>
44
+ <sort_order>10</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ <fields>
49
+ <enabled translate="label">
50
+ <label>Enabled</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>1</sort_order>
54
+
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>0</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ </enabled>
59
+ </fields>
60
+ </settings>
61
+ <shipping_methods translate="label">
62
+ <label>Allowed Carriers by Customer Group</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>100</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ <use_custom_form>1</use_custom_form>
69
+ <!-- Note That Fields are set up in the Sections Frontend Model -->
70
+ </shipping_methods>
71
+ </groups>
72
+ </sharpshippingbycustomergroup>
73
+ </sections>
74
+ </config>
app/etc/modules/Sharpdot_SharpShippingByCustomerGroup.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Sharpdot_SharpShippingByCustomerGroup>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ </depends>
9
+ </Sharpdot_SharpShippingByCustomerGroup>
10
+ </modules>
11
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>SharpShippingByCustomerGroup</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Selectable Shipping Carriers by Customer Group</summary>
10
+ <description>This package allows administrators to choose which enabled shipping carriers a customer group can use.</description>
11
+ <notes>Selectable Payments for Customer Groups</notes>
12
+ <authors><author><name>Michael Dost</name><user>auto-converted</user><email>mdost@sharpdotinc.com</email></author></authors>
13
+ <date>2011-01-14</date>
14
+ <time>05:34:44</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Sharpdot_SharpShippingByCustomerGroup.xml" hash="eddd74bebc76e5aa615ab604e82a89c6"/></dir></target><target name="magecommunity"><dir name="Sharpdot"><dir name="SharpShippingByCustomerGroup"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Form.php" hash="01a38d4eab68272eb10a332251c2cc63"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="bd369b22536f4aece80c2397f2cb01fc"/><file name="system.xml" hash="089ecdea050b69b3c133c042da63d678"/></dir><dir name="Helper"><file name="Data.php" hash="87f42620bcf782da87eee11bf4fc958e"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Customer"><file name="Group.php" hash="9e21d0d37264e25d53f10e7c7a104b08"/></dir></dir></dir></dir></dir><dir name="Shipping"><dir name="Rate"><file name="Request.php" hash="5255ecb245861d789bd66f7427e135e0"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>