OMS_Global_Freight_Estimator - Version 1.0.2

Version Notes

Completed

Download this release

Release Info

Developer OMS
Extension OMS_Global_Freight_Estimator
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

Files changed (24) hide show
  1. app/code/local/Discretelogix/Shippingimport/Helper/Data.php +0 -7
  2. app/code/local/Discretelogix/Shippingimport/Model/Import.php +0 -24
  3. app/code/local/Discretelogix/Shippingimport/Model/Methodslist.php +0 -29
  4. app/code/local/Discretelogix/Shippingimport/Model/Mysql4/Import.php +0 -12
  5. app/code/local/Discretelogix/Shippingimport/Model/Mysql4/Import/Collection.php +0 -12
  6. app/code/local/OMS/Shippingimport/Helper/Data.php +7 -0
  7. app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Carrier/Localdelivery.php +99 -15
  8. app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Carrier/_Localdelivery.php +1 -1
  9. app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Carrier/__Localdelivery.php +1 -1
  10. app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Enable.php +1 -1
  11. app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Handlingfees.php +1 -1
  12. app/code/local/OMS/Shippingimport/Model/Import.php +54 -0
  13. app/code/local/OMS/Shippingimport/Model/Methodslist.php +28 -0
  14. app/code/local/OMS/Shippingimport/Model/Mysql4/Import.php +12 -0
  15. app/code/local/OMS/Shippingimport/Model/Mysql4/Import/Collection.php +12 -0
  16. app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Resource/Eav/Mysql4/Setup.php +1 -1
  17. app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Unit.php +1 -1
  18. app/code/local/{Discretelogix → OMS}/Shippingimport/controllers/IndexController.php +1 -1
  19. app/code/local/{Discretelogix → OMS}/Shippingimport/etc/adminhtml.xml +1 -1
  20. app/code/local/{Discretelogix → OMS}/Shippingimport/etc/config.xml +11 -11
  21. app/code/local/{Discretelogix → OMS}/Shippingimport/etc/system.xml +25 -5
  22. app/code/local/{Discretelogix → OMS}/Shippingimport/sql/shippingimport_setup/mysql4-install-0.0.1.php +0 -0
  23. app/etc/modules/{Discretelogix_Shippingimport.xml → OMS_Shippingimport.xml} +2 -2
  24. package.xml +18 -84
app/code/local/Discretelogix/Shippingimport/Helper/Data.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- class Discretelogix_Shippingimport_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
-
6
- }
7
-
 
 
 
 
 
 
 
app/code/local/Discretelogix/Shippingimport/Model/Import.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
-
4
- class Discretelogix_Shippingimport_Model_Import extends Mage_Core_Model_Abstract
5
- {
6
- public function _construct()
7
- {
8
- parent::_construct();
9
- $this->_init("shippingimport/import");
10
-
11
- }
12
-
13
-
14
- public function checkMethod($name)
15
- {
16
- $collection=Mage::getModel("shippingimport/import")->getCollection()->addFilter("name",array("eq"=>$name));
17
-
18
- $data=$collection->getData();
19
- return $data;
20
-
21
-
22
- }
23
-
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Discretelogix/Shippingimport/Model/Methodslist.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- class Discretelogix_Shippingimport_Model_Methodslist
3
- {
4
- public function toOptionArray()
5
- {
6
- $data=$this->getMethods();
7
- $methods=array();
8
- foreach($data as $method)
9
- {
10
- $methods[]=array('value' => $method["name"], 'label'=>Mage::helper('adminhtml')->__($method["name"]));
11
-
12
- }
13
- return $methods;
14
- /*array(
15
- array('value' => 'Courier', 'label'=>Mage::helper('adminhtml')->__('Courier'),'selected'=>true),
16
- array('value' => 'Courier-Bold', 'label'=>Mage::helper('adminhtml')->__('Courier-Bold')),
17
- array('value' => 'Courier-Oblique', 'label'=>Mage::helper('adminhtml')->__('Courier-Oblique')),
18
- array('value' => 'Courier-BoldOblique', 'label'=>Mage::helper('adminhtml')->__('Courier-BoldOblique'))
19
- );*/
20
- }
21
-
22
- public function getMethods()
23
- {
24
- $collection=Mage::getModel("shippingimport/import")->getCollection();
25
- $data=$collection->getData();
26
- return $data;
27
-
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Discretelogix/Shippingimport/Model/Mysql4/Import.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
-
4
- class Discretelogix_Shippingimport_Model_Mysql4_Import extends Mage_Core_Model_Mysql4_Abstract
5
- {
6
- public function _construct()
7
- {
8
- $this->_init("shippingimport/import","id");
9
-
10
- }
11
-
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Discretelogix/Shippingimport/Model/Mysql4/Import/Collection.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
-
4
- class Discretelogix_Shippingimport_Model_Mysql4_Import_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
5
- {
6
- public function _construct()
7
- {
8
- $this->_init("shippingimport/import");
9
-
10
- }
11
-
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/OMS/Shippingimport/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class OMS_Shippingimport_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
7
+
app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Carrier/Localdelivery.php RENAMED
@@ -1,4 +1,3 @@
1
-
2
  <?php
3
  class FreightLineItem
4
  {
@@ -9,7 +8,7 @@
9
  public $ActualWeight;
10
 
11
  }
12
- class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Shipping_Model_Carrier_Abstract
13
  implements Mage_Shipping_Model_Carrier_Interface
14
  {
15
  /* Use group alias */
@@ -31,10 +30,23 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
31
 
32
  }
33
 
34
- $url=Mage::getStoreConfig('webservice/webservice_group/webservice_url',Mage::app()->getStore());
 
 
 
 
 
 
35
  $username=Mage::getStoreConfig('webservice/webservice_group/webservice_username',Mage::app()->getStore());
36
  $password=Mage::getStoreConfig('webservice/webservice_group/webservice_password',Mage::app()->getStore());
37
  $allowedMethods=Mage::getStoreConfig('carriers/customshiping/allowedmethods',Mage::app()->getStore());
 
 
 
 
 
 
 
38
  $warehousename=Mage::getStoreConfig('webservice/webservice_group/webservice_warehousename',Mage::app()->getStore());
39
  $OriginCountry =Mage::getStoreConfig('webservice/webservice_group/webservice_originCountry',Mage::app()->getStore());
40
  $OriginPostal =Mage::getStoreConfig('webservice/webservice_group/webservice_originPostal',Mage::app()->getStore());
@@ -45,12 +57,29 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
45
  $Unit="US";
46
  $InsuranceAmount= Mage::getStoreConfig('webservice/webservice_group/webservice_insuranceamount',Mage::app()->getStore());
47
  $AddHandlingFees = Mage::getStoreConfig('webservice/webservice_group/webservice_addhandlingfees',Mage::app()->getStore());
 
 
 
 
 
 
 
 
 
 
 
48
 
49
 
50
  $HandlingFeePercent = Mage::getStoreConfig('webservice/webservice_group/webservice_handlingfeepercent',Mage::app()->getStore());
 
 
51
 
 
52
 
 
 
53
  $currencycode=Mage::app()->getStore()-> getCurrentCurrencyCode();
 
54
 
55
 
56
 
@@ -106,16 +135,33 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
106
 
107
  $count=0;
108
  $freightArray[]="";
 
 
 
 
 
109
  foreach ($items as $item)
110
  {
111
  $object= new FreightLineItem();
112
  $_product= Mage::getSingleton('catalog/product')->load($item->getProductId());
 
113
  $itemQuantity =(int)$item->getQty();
114
  $length=$_product->getResource()->getAttribute('length');
115
 
 
 
 
 
 
 
 
 
 
 
116
  if(!empty($length))
117
  {
118
  $itemlength =(int)$length->getFrontend()->getValue($_product);
 
119
  }
120
  else
121
  {
@@ -140,13 +186,13 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
140
  {
141
  $itemHeight =0;
142
  }
143
- $itemWeight =(int)$item->getWeight();
144
 
145
- $object->Quantity =$itemQuantity;
146
 
147
  $object->Length = $itemlength;
148
 
149
- $object->Weight = $itemWeight;
150
  $object->Width = $itemWidth;
151
  $object->Height = $itemHeight;
152
  $object->ActualWeight=$itemWeight;
@@ -157,8 +203,8 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
157
  $object=null;
158
  }
159
  }
160
-
161
- /* echo "<pre/>";
162
  print_r($freightArray);
163
  exit;*/
164
 
@@ -172,11 +218,21 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
172
  $SOAPrequest["bAddHandlingFees"]=$AddHandlingFees;
173
  $SOAPrequest["lngPctOfHandlingFees"]=$HandlingFeePercent;
174
 
175
- /* echo "<pre/>";
176
  print_r($SOAPrequest);
177
  exit;*/
 
 
 
 
 
178
  $result1 = $client->EstimateFreight($SOAPrequest);
179
 
 
 
 
 
 
180
  $method = Mage::getModel('shipping/rate_result_method');
181
  // $methods=get_class_methods($method);
182
 
@@ -190,9 +246,14 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
190
  {
191
  Mage::getSingleton('core/session')->addError($result1->EstimateFreightResult->WSMessage);
192
  }
193
-
194
- if(!empty($rateresult))
 
 
 
 
195
  {
 
196
  foreach($rateresult as $rate)
197
  {
198
  // echo $rate->ServiceType;
@@ -201,10 +262,12 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
201
  $data=$importModel->checkMethod(trim($rate->ServiceType));
202
  if(empty($data))
203
  {
204
- $data["name"]=$rate->ServiceType;
205
  try
206
  {
207
- $importModel->setData($data)->save();
 
 
208
  }
209
  catch(Exception $e)
210
  {
@@ -212,7 +275,7 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
212
  }
213
  }
214
 
215
- if(in_array($rate->ServiceType,$allowedMethodsArr))
216
  {
217
  $method = Mage::getModel('shipping/rate_result_method');
218
  $method->setCarrier($this->_code);
@@ -222,9 +285,30 @@ class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Ship
222
  $method->setCost($rate->TotalCharge->Amount);
223
  $method->setPrice($rate->TotalCharge->Amount);
224
  $result->append($method);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  }
226
  }
227
- }
 
 
228
 
229
  }
230
 
 
1
  <?php
2
  class FreightLineItem
3
  {
8
  public $ActualWeight;
9
 
10
  }
11
+ class OMS_Shippingimport_Model_Carrier_Localdelivery extends Mage_Shipping_Model_Carrier_Abstract
12
  implements Mage_Shipping_Model_Carrier_Interface
13
  {
14
  /* Use group alias */
30
 
31
  }
32
 
33
+ $url=Mage::getStoreConfig('webservice/webservice_group/webservice_url',Mage::app()->getStore());
34
+ $pos=strpos($url,"?WSDL");
35
+ if($pos === false)
36
+ {
37
+ $url=$url."?WSDL";
38
+
39
+ }
40
  $username=Mage::getStoreConfig('webservice/webservice_group/webservice_username',Mage::app()->getStore());
41
  $password=Mage::getStoreConfig('webservice/webservice_group/webservice_password',Mage::app()->getStore());
42
  $allowedMethods=Mage::getStoreConfig('carriers/customshiping/allowedmethods',Mage::app()->getStore());
43
+ $allMethods=Mage::getModel("shippingimport/import")->getAllMethods();
44
+ $methods=array();
45
+ foreach($allMethods as $method)
46
+ {
47
+ $methods[]=$method["name"];
48
+
49
+ }
50
  $warehousename=Mage::getStoreConfig('webservice/webservice_group/webservice_warehousename',Mage::app()->getStore());
51
  $OriginCountry =Mage::getStoreConfig('webservice/webservice_group/webservice_originCountry',Mage::app()->getStore());
52
  $OriginPostal =Mage::getStoreConfig('webservice/webservice_group/webservice_originPostal',Mage::app()->getStore());
57
  $Unit="US";
58
  $InsuranceAmount= Mage::getStoreConfig('webservice/webservice_group/webservice_insuranceamount',Mage::app()->getStore());
59
  $AddHandlingFees = Mage::getStoreConfig('webservice/webservice_group/webservice_addhandlingfees',Mage::app()->getStore());
60
+
61
+ if($AddHandlingFees=="true")
62
+ {
63
+
64
+ $AddHandlingFees==1;
65
+ }
66
+ else
67
+ {
68
+
69
+ $AddHandlingFees=0;
70
+ }
71
 
72
 
73
  $HandlingFeePercent = Mage::getStoreConfig('webservice/webservice_group/webservice_handlingfeepercent',Mage::app()->getStore());
74
+ $debug=Mage::getStoreConfig('webservice/webservice_group/webservice_debug',Mage::app()->getStore());
75
+
76
 
77
+ $currencycode = Mage::getStoreConfig('webservice/webservice_group/webservice_CurrencyAbbrev',Mage::app()->getStore());
78
 
79
+ if($currencycode=="")
80
+ {
81
  $currencycode=Mage::app()->getStore()-> getCurrentCurrencyCode();
82
+ }
83
 
84
 
85
 
135
 
136
  $count=0;
137
  $freightArray[]="";
138
+ /*echo "<pre/>";
139
+ print_r($items->getData());*/
140
+
141
+ $parentid[]="";
142
+ $real_qty=0;
143
  foreach ($items as $item)
144
  {
145
  $object= new FreightLineItem();
146
  $_product= Mage::getSingleton('catalog/product')->load($item->getProductId());
147
+
148
  $itemQuantity =(int)$item->getQty();
149
  $length=$_product->getResource()->getAttribute('length');
150
 
151
+ $id=$item->getId();
152
+ //$parentid[]=$id;
153
+ $parent_item_id=$item->getParentItemId();
154
+ if($parent_item_id=="")
155
+ {
156
+ $real_qty=$itemQuantity;
157
+ }
158
+ if($parent_item_id!="" || !($_product->isConfigurable()))
159
+ {
160
+
161
  if(!empty($length))
162
  {
163
  $itemlength =(int)$length->getFrontend()->getValue($_product);
164
+
165
  }
166
  else
167
  {
186
  {
187
  $itemHeight =0;
188
  }
189
+ $itemWeight =(float)$item->getWeight();
190
 
191
+ $object->Quantity =$real_qty;
192
 
193
  $object->Length = $itemlength;
194
 
195
+ $object->Weight =$itemWeight;
196
  $object->Width = $itemWidth;
197
  $object->Height = $itemHeight;
198
  $object->ActualWeight=$itemWeight;
203
  $object=null;
204
  }
205
  }
206
+ }
207
+ /* echo "<pre/>";
208
  print_r($freightArray);
209
  exit;*/
210
 
218
  $SOAPrequest["bAddHandlingFees"]=$AddHandlingFees;
219
  $SOAPrequest["lngPctOfHandlingFees"]=$HandlingFeePercent;
220
 
221
+ /*echo "<pre/>";
222
  print_r($SOAPrequest);
223
  exit;*/
224
+ if($debug=="true")
225
+ {
226
+ Mage::log("SOAP request:", null, 'OMS_Shipping.log');
227
+ Mage::log($SOAPrequest, null, 'OMS_Shipping.log');
228
+ }
229
  $result1 = $client->EstimateFreight($SOAPrequest);
230
 
231
+ if($debug=="true")
232
+ {
233
+ Mage::log("SOAP response:", null, 'OMS_Shipping.log');
234
+ Mage::log($result1, null, 'OMS_Shipping.log');
235
+ }
236
  $method = Mage::getModel('shipping/rate_result_method');
237
  // $methods=get_class_methods($method);
238
 
246
  {
247
  Mage::getSingleton('core/session')->addError($result1->EstimateFreightResult->WSMessage);
248
  }
249
+ /*echo "<pre/>";
250
+ print_r($methods);
251
+ echo "<br/>";
252
+ print_r($rateresult);
253
+ exit;*/
254
+ if(!empty($rateresult))
255
  {
256
+ $config_methods="";
257
  foreach($rateresult as $rate)
258
  {
259
  // echo $rate->ServiceType;
262
  $data=$importModel->checkMethod(trim($rate->ServiceType));
263
  if(empty($data))
264
  {
265
+ // $data["name"]=$rate->ServiceType;
266
  try
267
  {
268
+ //$importModel->setData($data)->save();
269
+ if($rate->ServiceType!="")
270
+ $importModel->insertShipping($rate->ServiceType);
271
  }
272
  catch(Exception $e)
273
  {
275
  }
276
  }
277
 
278
+ if(in_array($rate->ServiceType,$allowedMethodsArr) || (!in_array($rate->ServiceType,$methods)))
279
  {
280
  $method = Mage::getModel('shipping/rate_result_method');
281
  $method->setCarrier($this->_code);
285
  $method->setCost($rate->TotalCharge->Amount);
286
  $method->setPrice($rate->TotalCharge->Amount);
287
  $result->append($method);
288
+
289
+ if(!in_array($rate->ServiceType,$methods))
290
+ {
291
+ $configModel = new Mage_Core_Model_Config();
292
+
293
+
294
+ if($config_methods!="")
295
+ {
296
+ $config_methods =$config_methods.",".trim($rate->ServiceType);
297
+ }
298
+ else
299
+ {
300
+ $config_methods=$allowedMethods;
301
+ $config_methods .=$config_methods. trim($rate->ServiceType);
302
+ }
303
+
304
+ //$configModel ->saveConfig('design/head/demonotice', "1", 'default', 0);
305
+ $configModel ->saveConfig('carriers/customshiping/allowedmethods', $config_methods);
306
+ }
307
  }
308
  }
309
+ }
310
+
311
+
312
 
313
  }
314
 
app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Carrier/_Localdelivery.php RENAMED
@@ -9,7 +9,7 @@
9
  public $ActualWeight;
10
 
11
  }
12
- class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Shipping_Model_Carrier_Abstract
13
  implements Mage_Shipping_Model_Carrier_Interface
14
  {
15
  /* Use group alias */
9
  public $ActualWeight;
10
 
11
  }
12
+ class OMS_Shippingimport_Model_Carrier_Localdelivery extends Mage_Shipping_Model_Carrier_Abstract
13
  implements Mage_Shipping_Model_Carrier_Interface
14
  {
15
  /* Use group alias */
app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Carrier/__Localdelivery.php RENAMED
@@ -9,7 +9,7 @@
9
  public $ActualWeight;
10
 
11
  }
12
- class Discretelogix_Shippingimport_Model_Carrier_Localdelivery extends Mage_Shipping_Model_Carrier_Abstract
13
  implements Mage_Shipping_Model_Carrier_Interface
14
  {
15
  /* Use group alias */
9
  public $ActualWeight;
10
 
11
  }
12
+ class OMS_Shippingimport_Model_Carrier_Localdelivery extends Mage_Shipping_Model_Carrier_Abstract
13
  implements Mage_Shipping_Model_Carrier_Interface
14
  {
15
  /* Use group alias */
app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Enable.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Discretelogix_Shippingimport_Model_Enable
3
  {
4
  public function toOptionArray()
5
  {
1
  <?php
2
+ class OMS_Shippingimport_Model_Enable
3
  {
4
  public function toOptionArray()
5
  {
app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Handlingfees.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Discretelogix_Shippingimport_Model_Handlingfees
3
  {
4
  public function toOptionArray()
5
  {
1
  <?php
2
+ class OMS_Shippingimport_Model_Handlingfees
3
  {
4
  public function toOptionArray()
5
  {
app/code/local/OMS/Shippingimport/Model/Import.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class OMS_Shippingimport_Model_Import extends Mage_Core_Model_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init("shippingimport/import");
10
+
11
+ }
12
+
13
+
14
+ /* public function checkMethod($name)
15
+ {
16
+ $collection=Mage::getModel("shippingimport/import")->getCollection()->addFilter("name",array("eq"=>$name));
17
+
18
+ $data=$collection->getData();
19
+ return $data;
20
+
21
+
22
+ }*/
23
+
24
+ public function checkMethod($name)
25
+ {
26
+ //$table=Mage::getSingleton('core/resource')->getTableName('shipping_imported_methods');
27
+ $query="select * from shipping_imported_methods where name='".$name."'";
28
+
29
+ $data=Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
30
+ return $data;
31
+
32
+
33
+ }
34
+
35
+ public function getAllMethods()
36
+ {
37
+ //$table=Mage::getSingleton('core/resource')->getTableName('shipping_imported_methods');
38
+
39
+ $query="select * from shipping_imported_methods";
40
+
41
+ $data=Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
42
+ return $data;
43
+
44
+ }
45
+
46
+ public function insertShipping($name)
47
+ {
48
+ $query="insert into shipping_imported_methods(name) values('".$name."')";
49
+
50
+ Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
51
+
52
+ }
53
+
54
+ }
app/code/local/OMS/Shippingimport/Model/Methodslist.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class OMS_Shippingimport_Model_Methodslist
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ $data=$this->getMethods();
7
+ $methods=array();
8
+ foreach($data as $method)
9
+ {
10
+ $methods[]=array('value' => $method["name"], 'label'=>Mage::helper('adminhtml')->__($method["name"]));
11
+
12
+ }
13
+ return $methods;
14
+
15
+ }
16
+
17
+ public function getMethods()
18
+ {
19
+ /* $collection=Mage::getModel("shippingimport/import")->getCollection();
20
+ $data=$collection->getData();
21
+ return $data;*/
22
+
23
+ $model=Mage::getModel("shippingimport/import");
24
+ $data= $model->getAllMethods();
25
+ return $data;
26
+
27
+ }
28
+ }
app/code/local/OMS/Shippingimport/Model/Mysql4/Import.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class OMS_Shippingimport_Model_Mysql4_Import extends Mage_Core_Model_Mysql4_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ $this->_init("shippingimport/import","id");
9
+
10
+ }
11
+
12
+ }
app/code/local/OMS/Shippingimport/Model/Mysql4/Import/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class OMS_Shippingimport_Model_Mysql4_Import_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ $this->_init("shippingimport/import");
9
+
10
+ }
11
+
12
+ }
app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Resource/Eav/Mysql4/Setup.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Discretelogix_Shippingimport_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
3
  {
4
  /**
5
  * @return array
1
  <?php
2
+ class OMS_Shippingimport_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
3
  {
4
  /**
5
  * @return array
app/code/local/{Discretelogix → OMS}/Shippingimport/Model/Unit.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Discretelogix_Shippingimport_Model_Unit
3
  {
4
  public function toOptionArray()
5
  {
1
  <?php
2
+ class OMS_Shippingimport_Model_Unit
3
  {
4
  public function toOptionArray()
5
  {
app/code/local/{Discretelogix → OMS}/Shippingimport/controllers/IndexController.php RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Discretelogix_Shippingimport_IndexController extends Mage_Core_Controller_Front_Action
4
  {
5
 
6
  public function indexAction()
1
  <?php
2
 
3
+ class OMS_Shippingimport_IndexController extends Mage_Core_Controller_Front_Action
4
  {
5
 
6
  public function indexAction()
app/code/local/{Discretelogix → OMS}/Shippingimport/etc/adminhtml.xml RENAMED
@@ -9,7 +9,7 @@
9
  <config>
10
  <children>
11
  <webservice translate="title" module="shipping">
12
- <title>Shipping SOAP Web Service</title>
13
  <sort_order>100</sort_order>
14
  </webservice>
15
  </children>
9
  <config>
10
  <children>
11
  <webservice translate="title" module="shipping">
12
+ <title>OMS Global Freight Estimator</title>
13
  <sort_order>100</sort_order>
14
  </webservice>
15
  </children>
app/code/local/{Discretelogix → OMS}/Shippingimport/etc/config.xml RENAMED
@@ -1,19 +1,19 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
- <Discretelogix_Shippingimport>
5
  <version>0.0.1</version>
6
  <depends>
7
  <Mage_Shipping/>
8
  </depends>
9
- </Discretelogix_Shippingimport>
10
  </modules>
11
  <frontend>
12
  <routers>
13
  <shippingimport>
14
  <use>standard</use>
15
  <args>
16
- <module>Discretelogix_Shippingimport</module>
17
  <frontName>shipping</frontName>
18
  </args>
19
  </shippingimport>
@@ -28,10 +28,10 @@
28
  </all>
29
  <admin>
30
  <children>
31
- <Discretelogix_Shippingimport>
32
  <title>Web Module</title>
33
  <sort_order>10</sort_order>
34
- </Discretelogix_Shippingimport>
35
  </children>
36
  </admin>
37
  </resources>
@@ -60,11 +60,11 @@
60
  <global>
61
  <models>
62
  <shippingimport>
63
- <class>Discretelogix_Shippingimport_Model</class>
64
  <resourceModel>shippingimport_mysql4</resourceModel>
65
  </shippingimport>
66
  <shippingimport_mysql4>
67
- <class>Discretelogix_Shippingimport_Model_Mysql4</class>
68
  <entities>
69
  <import>
70
  <table>shipping_imported_methods</table>
@@ -76,8 +76,8 @@
76
  <resources>
77
  <shippingimport_setup>
78
  <setup>
79
- <module>Discretelogix_Shippingimport</module>
80
- <class>Discretelogix_Shippingimport_Model_Resource_Eav_Mysql4_Setup</class>
81
  </setup>
82
  <connection>
83
  <use>core_setup</use>
@@ -86,7 +86,7 @@
86
  </resources>
87
  <helpers>
88
  <Shippingimport>
89
- <class>Discretelogix_Shippingimport_Helper</class>
90
  </Shippingimport>
91
  </helpers>
92
  </global>
@@ -97,7 +97,7 @@
97
  <allowed_methods>delivery</allowed_methods>
98
  <methods>delivery</methods>
99
  <sallowspecific>0</sallowspecific>
100
- <model>Discretelogix_Shippingimport_Model_Carrier_Localdelivery</model>
101
  <name>OMS Shipping</name>
102
  <title>Shipping Rates</title>
103
  <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+ <OMS_Shippingimport>
5
  <version>0.0.1</version>
6
  <depends>
7
  <Mage_Shipping/>
8
  </depends>
9
+ </OMS_Shippingimport>
10
  </modules>
11
  <frontend>
12
  <routers>
13
  <shippingimport>
14
  <use>standard</use>
15
  <args>
16
+ <module>OMS_Shippingimport</module>
17
  <frontName>shipping</frontName>
18
  </args>
19
  </shippingimport>
28
  </all>
29
  <admin>
30
  <children>
31
+ <OMS_Shippingimport>
32
  <title>Web Module</title>
33
  <sort_order>10</sort_order>
34
+ </OMS_Shippingimport>
35
  </children>
36
  </admin>
37
  </resources>
60
  <global>
61
  <models>
62
  <shippingimport>
63
+ <class>OMS_Shippingimport_Model</class>
64
  <resourceModel>shippingimport_mysql4</resourceModel>
65
  </shippingimport>
66
  <shippingimport_mysql4>
67
+ <class>OMS_Shippingimport_Model_Mysql4</class>
68
  <entities>
69
  <import>
70
  <table>shipping_imported_methods</table>
76
  <resources>
77
  <shippingimport_setup>
78
  <setup>
79
+ <module>OMS_Shippingimport</module>
80
+ <class>OMS_Shippingimport_Model_Resource_Eav_Mysql4_Setup</class>
81
  </setup>
82
  <connection>
83
  <use>core_setup</use>
86
  </resources>
87
  <helpers>
88
  <Shippingimport>
89
+ <class>OMS_Shippingimport_Helper</class>
90
  </Shippingimport>
91
  </helpers>
92
  </global>
97
  <allowed_methods>delivery</allowed_methods>
98
  <methods>delivery</methods>
99
  <sallowspecific>0</sallowspecific>
100
+ <model>OMS_Shippingimport_Model_Carrier_Localdelivery</model>
101
  <name>OMS Shipping</name>
102
  <title>Shipping Rates</title>
103
  <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
app/code/local/{Discretelogix → OMS}/Shippingimport/etc/system.xml RENAMED
@@ -18,7 +18,7 @@
18
 
19
  <groups>
20
  <webservice_group translate="label" module="shipping">
21
- <label>OMS Global Freight Estimator</label>
22
  <frontend_type>text</frontend_type>
23
  <sort_order>1000</sort_order>
24
  <show_in_default>1</show_in_default>
@@ -30,7 +30,7 @@
30
  <label>Enabled: </label>
31
  <comment></comment>
32
  <frontend_type>select</frontend_type>
33
- <source_model>Discretelogix_Shippingimport_Model_Enable</source_model>
34
  <sort_order>19</sort_order>
35
  <show_in_default>1</show_in_default>
36
  <show_in_website>1</show_in_website>
@@ -103,12 +103,22 @@
103
  <label>Unit: </label>
104
  <comment></comment>
105
  <frontend_type>select</frontend_type>
106
- <source_model>Discretelogix_Shippingimport_Model_Unit</source_model>
107
  <sort_order>44</sort_order>
108
  <show_in_default>1</show_in_default>
109
  <show_in_website>1</show_in_website>
110
  <show_in_store>1</show_in_store>
111
  </webservice_unit>
 
 
 
 
 
 
 
 
 
 
112
  <webservice_insuranceamount translate="label">
113
  <label>Insurance Amount: </label>
114
  <comment></comment>
@@ -122,7 +132,7 @@
122
  <label>Add Handling Fees: </label>
123
  <comment></comment>
124
  <frontend_type>select</frontend_type>
125
- <source_model>Discretelogix_Shippingimport_Model_Handlingfees</source_model>
126
  <sort_order>46</sort_order>
127
  <show_in_default>1</show_in_default>
128
  <show_in_website>1</show_in_website>
@@ -137,6 +147,16 @@
137
  <show_in_website>1</show_in_website>
138
  <show_in_store>1</show_in_store>
139
  </webservice_handlingfeepercent>
 
 
 
 
 
 
 
 
 
 
140
  </fields>
141
  </webservice_group>
142
  </groups>
@@ -207,7 +227,7 @@
207
  <label>Allowed Methods</label>
208
  <frontend_type>multiselect</frontend_type>
209
  <sort_order>80</sort_order>
210
- <source_model>Discretelogix_Shippingimport_Model_Methodslist</source_model>
211
  <show_in_default>1</show_in_default>
212
  <show_in_website>1</show_in_website>
213
  <show_in_store>1</show_in_store>
18
 
19
  <groups>
20
  <webservice_group translate="label" module="shipping">
21
+ <label>OMS Global Freight Estimator Configuration</label>
22
  <frontend_type>text</frontend_type>
23
  <sort_order>1000</sort_order>
24
  <show_in_default>1</show_in_default>
30
  <label>Enabled: </label>
31
  <comment></comment>
32
  <frontend_type>select</frontend_type>
33
+ <source_model>OMS_Shippingimport_Model_Enable</source_model>
34
  <sort_order>19</sort_order>
35
  <show_in_default>1</show_in_default>
36
  <show_in_website>1</show_in_website>
103
  <label>Unit: </label>
104
  <comment></comment>
105
  <frontend_type>select</frontend_type>
106
+ <source_model>OMS_Shippingimport_Model_Unit</source_model>
107
  <sort_order>44</sort_order>
108
  <show_in_default>1</show_in_default>
109
  <show_in_website>1</show_in_website>
110
  <show_in_store>1</show_in_store>
111
  </webservice_unit>
112
+ <webservice_CurrencyAbbrev translate="label">
113
+ <label>Currency Abbreviation: </label>
114
+ <comment></comment>
115
+ <frontend_type>text</frontend_type>
116
+ <sort_order>44</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ </webservice_CurrencyAbbrev>
121
+
122
  <webservice_insuranceamount translate="label">
123
  <label>Insurance Amount: </label>
124
  <comment></comment>
132
  <label>Add Handling Fees: </label>
133
  <comment></comment>
134
  <frontend_type>select</frontend_type>
135
+ <source_model>OMS_Shippingimport_Model_Handlingfees</source_model>
136
  <sort_order>46</sort_order>
137
  <show_in_default>1</show_in_default>
138
  <show_in_website>1</show_in_website>
147
  <show_in_website>1</show_in_website>
148
  <show_in_store>1</show_in_store>
149
  </webservice_handlingfeepercent>
150
+ <webservice_debug translate="label">
151
+ <label>Debug: </label>
152
+ <comment>Will add Webservice call info to a log.</comment>
153
+ <frontend_type>select</frontend_type>
154
+ <source_model>OMS_Shippingimport_Model_Handlingfees</source_model>
155
+ <sort_order>48</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>1</show_in_store>
159
+ </webservice_debug>
160
  </fields>
161
  </webservice_group>
162
  </groups>
227
  <label>Allowed Methods</label>
228
  <frontend_type>multiselect</frontend_type>
229
  <sort_order>80</sort_order>
230
+ <source_model>OMS_Shippingimport_Model_Methodslist</source_model>
231
  <show_in_default>1</show_in_default>
232
  <show_in_website>1</show_in_website>
233
  <show_in_store>1</show_in_store>
app/code/local/{Discretelogix → OMS}/Shippingimport/sql/shippingimport_setup/mysql4-install-0.0.1.php RENAMED
File without changes
app/etc/modules/{Discretelogix_Shippingimport.xml → OMS_Shippingimport.xml} RENAMED
@@ -2,10 +2,10 @@
2
  <config>
3
  <modules>
4
 
5
- <Discretelogix_Shippingimport>
6
  <active>true</active>
7
  <codePool>local</codePool>
8
- </Discretelogix_Shippingimport>
9
 
10
  </modules>
11
  </config>
2
  <config>
3
  <modules>
4
 
5
+ <OMS_Shippingimport>
6
  <active>true</active>
7
  <codePool>local</codePool>
8
+ </OMS_Shippingimport>
9
 
10
  </modules>
11
  </config>
package.xml CHANGED
@@ -1,84 +1,18 @@
1
- <?xml version="1.0"?>
2
- <package>
3
- <name>OMS_Global_Freight_Estimator</name>
4
- <version>1.0.1</version>
5
- <stability>stable</stability>
6
- <license>GPL</license>
7
- <channel>community</channel>
8
- <extends/>
9
- <summary>Retreive and display live and accurate shipping rates.</summary>
10
- <description>Displays shipping rates.</description>
11
- <notes>Completed</notes>
12
- <authors>
13
- <author>
14
- <name>OMS</name>
15
- <user>OMS</user>
16
- <email>david.morris@oms.us.com</email>
17
- </author>
18
- </authors>
19
- <date>2012-10-01</date>
20
- <time>15:38:18</time>
21
- <contents>
22
- <target name="magelocal">
23
- <dir name="Discretelogix">
24
- <dir name="Shippingimport">
25
- <dir name="Helper">
26
- <file name="Data.php" hash="0e80a1f4735884f1c88b76b25b9ee9d5"/>
27
- </dir>
28
- <dir name="Model">
29
- <dir name="Carrier">
30
- <file name="Localdelivery.php" hash="f43069ef62abbef5025730c72fdeebad"/>
31
- <file name="_Localdelivery.php" hash="b6d9006d6450ac61db74c5f30bb56aeb"/>
32
- <file name="__Localdelivery.php" hash="62407aa8d2ae22dcc232077dfdd5299f"/>
33
- </dir>
34
- <file name="Enable.php" hash="27503f2345449d8ad476b7ed705a4196"/>
35
- <file name="Handlingfees.php" hash="3f3fdf8557190cec4f786d63697c1d66"/>
36
- <file name="Import.php" hash="4bbaef745a4a973be001975fcbb92ca8"/>
37
- <file name="Methodslist.php" hash="7def7ff53fe8df9240ba74ca02e96252"/>
38
- <dir name="Mysql4">
39
- <dir name="Import">
40
- <file name="Collection.php" hash="3fdb97c52fc30e58fec1829b6f93f477"/>
41
- </dir>
42
- <file name="Import.php" hash="adb97b24eb8f757a0111c87f4d6a323f"/>
43
- </dir>
44
- <dir name="Resource">
45
- <dir name="Eav">
46
- <dir name="Mysql4">
47
- <file name="Setup.php" hash="65035aef1bb79a13a49b596187139b85"/>
48
- </dir>
49
- </dir>
50
- </dir>
51
- <file name="Unit.php" hash="51defb0b2281c0add597c57e67e47a10"/>
52
- </dir>
53
- <dir name="controllers">
54
- <file name="IndexController.php" hash="e2c98fd728c7c0e71f3b9df90934d3b7"/>
55
- </dir>
56
- <dir name="etc">
57
- <file name="adminhtml.xml" hash="ea5b26de474c6e4ee445013789e383a8"/>
58
- <file name="config.xml" hash="45c73742e81318129ea1c70e9b9ad82d"/>
59
- <file name="system.xml" hash="c8f7a01e50d95b83e7ad21cc0576abae"/>
60
- </dir>
61
- <dir name="sql">
62
- <dir name="shippingimport_setup">
63
- <file name="mysql4-install-0.0.1.php" hash="d6d1d20afa936be5ef35207545df4a15"/>
64
- </dir>
65
- </dir>
66
- </dir>
67
- </dir>
68
- </target>
69
- <target name="mageetc">
70
- <dir name="modules">
71
- <file name="Discretelogix_Shippingimport.xml" hash="24e6c1788c336a0653079edd518c2a3f"/>
72
- </dir>
73
- </target>
74
- </contents>
75
- <compatible/>
76
- <dependencies>
77
- <required>
78
- <php>
79
- <min>5.2.0</min>
80
- <max>5.4.0</max>
81
- </php>
82
- </required>
83
- </dependencies>
84
- </package>
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>OMS_Global_Freight_Estimator</name>
4
+ <version>1.0.2</version>
5
+ <stability>stable</stability>
6
+ <license>AFL 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Retreive and display live and accurate shipping rates.</summary>
10
+ <description>Displays shipping rates.</description>
11
+ <notes>Completed</notes>
12
+ <authors><author><name>OMS</name><user>OMS</user><email>david.morris@oms.us.com</email></author></authors>
13
+ <date>2012-10-25</date>
14
+ <time>07:21:16</time>
15
+ <contents><target name="magelocal"><dir name="OMS"><dir name="Shippingimport"><dir name="Helper"><file name="Data.php" hash="0e80a1f4735884f1c88b76b25b9ee9d5"/></dir><dir name="Model"><dir name="Carrier"><file name="Localdelivery.php" hash="dad6ac945f69720fc8fc1e2679ab3c40"/><file name="_Localdelivery.php" hash="b6d9006d6450ac61db74c5f30bb56aeb"/><file name="__Localdelivery.php" hash="62407aa8d2ae22dcc232077dfdd5299f"/></dir><file name="Enable.php" hash="27503f2345449d8ad476b7ed705a4196"/><file name="Handlingfees.php" hash="3f3fdf8557190cec4f786d63697c1d66"/><file name="Import.php" hash="9bf8bd095f3880d80263fa77e9841b49"/><file name="Methodslist.php" hash="d2a684ca77d6752e4e38c04033094749"/><dir name="Mysql4"><dir name="Import"><file name="Collection.php" hash="3fdb97c52fc30e58fec1829b6f93f477"/></dir><file name="Import.php" hash="adb97b24eb8f757a0111c87f4d6a323f"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="65035aef1bb79a13a49b596187139b85"/></dir></dir></dir><file name="Unit.php" hash="51defb0b2281c0add597c57e67e47a10"/></dir><dir name="controllers"><file name="IndexController.php" hash="e2c98fd728c7c0e71f3b9df90934d3b7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="ea5b26de474c6e4ee445013789e383a8"/><file name="config.xml" hash="45c73742e81318129ea1c70e9b9ad82d"/><file name="system.xml" hash="c1c9e23691d07e372076473764c9d3c7"/></dir><dir name="sql"><dir name="shippingimport_setup"><file name="mysql4-install-0.0.1.php" hash="d6d1d20afa936be5ef35207545df4a15"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="OMS_Shippingimport.xml" hash="24e6c1788c336a0653079edd518c2a3f"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>5.4.0</max></php></required></dependencies>
18
+ </package>