Version Notes
Completed
Download this release
Release Info
Developer | OMS |
Extension | OMS_Global_Freight_Estimator |
Version | 1.0.1 |
Comparing to | |
See all releases |
Version 1.0.1
- app/code/local/Discretelogix/Shippingimport/Helper/Data.php +7 -0
- app/code/local/Discretelogix/Shippingimport/Model/Carrier/Localdelivery.php +276 -0
- app/code/local/Discretelogix/Shippingimport/Model/Carrier/_Localdelivery.php +239 -0
- app/code/local/Discretelogix/Shippingimport/Model/Carrier/__Localdelivery.php +266 -0
- app/code/local/Discretelogix/Shippingimport/Model/Enable.php +15 -0
- app/code/local/Discretelogix/Shippingimport/Model/Handlingfees.php +15 -0
- app/code/local/Discretelogix/Shippingimport/Model/Import.php +24 -0
- app/code/local/Discretelogix/Shippingimport/Model/Methodslist.php +29 -0
- app/code/local/Discretelogix/Shippingimport/Model/Mysql4/Import.php +12 -0
- app/code/local/Discretelogix/Shippingimport/Model/Mysql4/Import/Collection.php +12 -0
- app/code/local/Discretelogix/Shippingimport/Model/Resource/Eav/Mysql4/Setup.php +86 -0
- app/code/local/Discretelogix/Shippingimport/Model/Unit.php +15 -0
- app/code/local/Discretelogix/Shippingimport/controllers/IndexController.php +82 -0
- app/code/local/Discretelogix/Shippingimport/etc/adminhtml.xml +23 -0
- app/code/local/Discretelogix/Shippingimport/etc/config.xml +108 -0
- app/code/local/Discretelogix/Shippingimport/etc/system.xml +231 -0
- app/code/local/Discretelogix/Shippingimport/sql/shippingimport_setup/mysql4-install-0.0.1.php +81 -0
- app/etc/modules/Discretelogix_Shippingimport.xml +11 -0
- package.xml +84 -0
app/code/local/Discretelogix/Shippingimport/Helper/Data.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Discretelogix_Shippingimport_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
7 |
+
|
app/code/local/Discretelogix/Shippingimport/Model/Carrier/Localdelivery.php
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php
|
3 |
+
class FreightLineItem
|
4 |
+
{
|
5 |
+
public $Quantity;
|
6 |
+
public $Length;
|
7 |
+
public $Width;
|
8 |
+
public $Height;
|
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 */
|
16 |
+
protected $_code = 'customshiping';
|
17 |
+
|
18 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
19 |
+
{
|
20 |
+
// skip if not enabled
|
21 |
+
if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active'))
|
22 |
+
return false;
|
23 |
+
|
24 |
+
try
|
25 |
+
{
|
26 |
+
$enable=Mage::getStoreConfig('webservice/webservice_group/webservice_enable',Mage::app()->getStore());
|
27 |
+
|
28 |
+
if($enable=="no")
|
29 |
+
{
|
30 |
+
return false;
|
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());
|
41 |
+
$Unit = Mage::getStoreConfig('webservice/webservice_group/webservice_unit',Mage::app()->getStore());
|
42 |
+
$custname = Mage::getStoreConfig('webservice/webservice_group/webservice_custname',Mage::app()->getStore());
|
43 |
+
|
44 |
+
if($Unit=="")
|
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 |
+
|
57 |
+
$allowedMethodsArr=split(",",$allowedMethods);
|
58 |
+
|
59 |
+
$importModel= Mage::getModel('shippingimport/import');
|
60 |
+
$result = Mage::getModel('shipping/rate_result');
|
61 |
+
|
62 |
+
$client = new SoapClient($url, array('trace' => TRUE));
|
63 |
+
|
64 |
+
//$session = $client->__login('testaccount@oms.com.au', 'f7vmz!299pl');
|
65 |
+
$SOAPrequest["strB2BCustomerName"]=$custname;
|
66 |
+
$SOAPrequest["strB2BCustomerEmail"]=$username;
|
67 |
+
$SOAPrequest["strB2BCustomerPassword"]=$password;
|
68 |
+
$SOAPrequest["strCurrencyAbbrev"]=$currencycode;
|
69 |
+
$SOAPrequest["strWarehouseName"]=$warehousename;
|
70 |
+
$SOAPrequest["lngAdjustedWeight"]="";
|
71 |
+
$SOAPrequest["siUnit"]= $Unit;
|
72 |
+
|
73 |
+
$adminsession = Mage::getSingleton('admin/session')->isLoggedIn();
|
74 |
+
|
75 |
+
$session = Mage::getSingleton('checkout/session');
|
76 |
+
$object= new FreightLineItem();
|
77 |
+
if (!empty($session) || !empty($adminsession))
|
78 |
+
{
|
79 |
+
$count=0;
|
80 |
+
|
81 |
+
if(Mage::getSingleton('admin/session')->isLoggedIn())
|
82 |
+
{
|
83 |
+
$items = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getAllVisibleItems();
|
84 |
+
$adminData = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getShippingAddress()->getData();
|
85 |
+
if(empty($postcode))
|
86 |
+
{
|
87 |
+
$postcode=$adminData['postcode'] ;
|
88 |
+
$country=$adminData['country_id'];
|
89 |
+
$_iso3countrycode=$this->_getISO3Code($country);
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
93 |
+
else
|
94 |
+
{
|
95 |
+
$data = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData();
|
96 |
+
$postcode = $data['postcode'];
|
97 |
+
$country=$data['country_id'];
|
98 |
+
$_iso3countrycode=$this->_getISO3Code($country);
|
99 |
+
$items = Mage::getSingleton('checkout/cart')->getItems();
|
100 |
+
}
|
101 |
+
$itemlength=0;
|
102 |
+
$itemWidth=0;
|
103 |
+
$itemHeight=0;
|
104 |
+
$itemWeight=0;
|
105 |
+
$itemQuantity=0;
|
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 |
+
{
|
122 |
+
$itemlength =0;
|
123 |
+
}
|
124 |
+
|
125 |
+
$width=$_product->getResource()->getAttribute('width');
|
126 |
+
if(!empty($width))
|
127 |
+
{
|
128 |
+
$itemWidth =(int)$width->getFrontend()->getValue($_product);
|
129 |
+
}
|
130 |
+
else
|
131 |
+
{
|
132 |
+
$itemWidth =0;
|
133 |
+
}
|
134 |
+
$height=$_product->getResource()->getAttribute('height');
|
135 |
+
if(!empty($height))
|
136 |
+
{
|
137 |
+
$itemHeight =(int)$height->getFrontend()->getValue($_product);
|
138 |
+
}
|
139 |
+
else
|
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;
|
153 |
+
|
154 |
+
$freightArray[$count]=$object;
|
155 |
+
$count++;
|
156 |
+
$_product=null;
|
157 |
+
$object=null;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
/* echo "<pre/>";
|
162 |
+
print_r($freightArray);
|
163 |
+
exit;*/
|
164 |
+
|
165 |
+
$SOAPrequest["oLineItems"]['FreightLineItem']=$freightArray;
|
166 |
+
$SOAPrequest["oRestriction"]="NA";
|
167 |
+
$SOAPrequest["strDestinationCountry"]=$_iso3countrycode;
|
168 |
+
$SOAPrequest["strDestinationPostal"]=$postcode;
|
169 |
+
$SOAPrequest["strOriginationCountry"]=$OriginCountry;
|
170 |
+
$SOAPrequest["strOriginationPostal"]=$OriginPostal;
|
171 |
+
$SOAPrequest["lngInsuranceAmount"]=$InsuranceAmount;
|
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 |
+
|
183 |
+
|
184 |
+
//echo $result1->EstimateFreightResult->WSMessage;exit;
|
185 |
+
try
|
186 |
+
{
|
187 |
+
$rateresult=$result1->EstimateFreightResult->EstimateFreight->RateReplyDetails;
|
188 |
+
}
|
189 |
+
catch(Exception $e)
|
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;
|
199 |
+
if(!empty($rate->ServiceType))
|
200 |
+
{
|
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 |
+
{
|
211 |
+
echo $e->getMessage();
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
if(in_array($rate->ServiceType,$allowedMethodsArr))
|
216 |
+
{
|
217 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
218 |
+
$method->setCarrier($this->_code);
|
219 |
+
$method->setCarrierTitle($this->_code);
|
220 |
+
$method->setMethod($rate->ServiceType);
|
221 |
+
$method->setMethodTitle($rate->ServiceType);
|
222 |
+
$method->setCost($rate->TotalCharge->Amount);
|
223 |
+
$method->setPrice($rate->TotalCharge->Amount);
|
224 |
+
$result->append($method);
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
}
|
233 |
+
catch(Exception $e)
|
234 |
+
{
|
235 |
+
echo $e->getMessage();
|
236 |
+
exit;
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
return $result;
|
246 |
+
|
247 |
+
}
|
248 |
+
|
249 |
+
public function getAllowedMethods()
|
250 |
+
{
|
251 |
+
return array('customshiping'=>$this->getConfigData('name'));
|
252 |
+
}
|
253 |
+
|
254 |
+
public function _getISO3Code($szISO2Code)
|
255 |
+
{
|
256 |
+
$boFound = false;
|
257 |
+
$nCount = 1;
|
258 |
+
|
259 |
+
$collection = Mage::getModel('directory/country_api')->items();
|
260 |
+
|
261 |
+
while ($boFound == false &&
|
262 |
+
$nCount < count($collection))
|
263 |
+
{
|
264 |
+
$item = $collection[$nCount];
|
265 |
+
if($item['iso2_code'] == $szISO2Code)
|
266 |
+
{
|
267 |
+
$boFound = true;
|
268 |
+
$szISO3Code = $item['iso3_code'];
|
269 |
+
}
|
270 |
+
$nCount++;
|
271 |
+
}
|
272 |
+
|
273 |
+
return $szISO3Code;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
app/code/local/Discretelogix/Shippingimport/Model/Carrier/_Localdelivery.php
ADDED
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php
|
3 |
+
class FreightLineItem
|
4 |
+
{
|
5 |
+
public $Quantity;
|
6 |
+
public $Length;
|
7 |
+
public $Width;
|
8 |
+
public $Height;
|
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 */
|
16 |
+
protected $_code = 'customshiping';
|
17 |
+
|
18 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
19 |
+
{
|
20 |
+
try
|
21 |
+
{
|
22 |
+
$url=Mage::getStoreConfig('webservice/webservice_group/webservice_url',Mage::app()->getStore());
|
23 |
+
$username=Mage::getStoreConfig('webservice/webservice_group/webservice_username',Mage::app()->getStore());
|
24 |
+
$password=Mage::getStoreConfig('webservice/webservice_group/webservice_password',Mage::app()->getStore());
|
25 |
+
$allowedMethods=Mage::getStoreConfig('carriers/customshiping/allowedmethods',Mage::app()->getStore());
|
26 |
+
$warehousename=Mage::getStoreConfig('webservice/webservice_group/webservice_warehousename',Mage::app()->getStore());
|
27 |
+
$OriginCountry =Mage::getStoreConfig('webservice/webservice_group/webservice_originCountry',Mage::app()->getStore());
|
28 |
+
$OriginPostal =Mage::getStoreConfig('webservice/webservice_group/webservice_originPostal',Mage::app()->getStore());
|
29 |
+
$Unit = Mage::getStoreConfig('webservice/webservice_group/webservice_unit',Mage::app()->getStore());
|
30 |
+
$custname = Mage::getStoreConfig('webservice/webservice_group/webservice_custname',Mage::app()->getStore());
|
31 |
+
|
32 |
+
if($Unit=="")
|
33 |
+
$Unit="US";
|
34 |
+
$InsuranceAmount= Mage::getStoreConfig('webservice/webservice_group/webservice_insuranceamount',Mage::app()->getStore());
|
35 |
+
$AddHandlingFees = Mage::getStoreConfig('webservice/webservice_group/webservice_addhandlingfees',Mage::app()->getStore());
|
36 |
+
|
37 |
+
|
38 |
+
$HandlingFeePercent = Mage::getStoreConfig('webservice/webservice_group/webservice_handlingfeepercent',Mage::app()->getStore());
|
39 |
+
$data = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData();
|
40 |
+
$postcode = $data['postcode'];
|
41 |
+
|
42 |
+
$country=$data['country_id'];
|
43 |
+
$_iso3countrycode=$this->_getISO3Code($country);
|
44 |
+
|
45 |
+
$currencycode=Mage::app()->getStore()-> getCurrentCurrencyCode();
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
$allowedMethodsArr=split(",",$allowedMethods);
|
50 |
+
|
51 |
+
$importModel= Mage::getModel('shippingimport/import');
|
52 |
+
$result = Mage::getModel('shipping/rate_result');
|
53 |
+
|
54 |
+
$client = new SoapClient($url, array('trace' => TRUE));
|
55 |
+
|
56 |
+
//$session = $client->__login('testaccount@oms.com.au', 'f7vmz!299pl');
|
57 |
+
$SOAPrequest["strB2BCustomerName"]=$custname;
|
58 |
+
$SOAPrequest["strB2BCustomerEmail"]=$username;
|
59 |
+
$SOAPrequest["strB2BCustomerPassword"]=$password;
|
60 |
+
$SOAPrequest["strCurrencyAbbrev"]=$currencycode;
|
61 |
+
$SOAPrequest["strWarehouseName"]=$warehousename;
|
62 |
+
$SOAPrequest["lngAdjustedWeight"]="";
|
63 |
+
$SOAPrequest["siUnit"]= $Unit;
|
64 |
+
|
65 |
+
$adminsession = Mage::getSingleton('admin/session')->isLoggedIn();
|
66 |
+
|
67 |
+
$session = Mage::getSingleton('checkout/session');
|
68 |
+
if (!empty($session) || !empty($adminsession))
|
69 |
+
{
|
70 |
+
$count=0;
|
71 |
+
$object= new FreightLineItem();
|
72 |
+
if(Mage::getSingleton('admin/session')->isLoggedIn())
|
73 |
+
{
|
74 |
+
$items = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getAllVisibleItems();
|
75 |
+
}
|
76 |
+
else
|
77 |
+
{
|
78 |
+
$items = Mage::getSingleton('checkout/cart')->getItems();
|
79 |
+
}
|
80 |
+
|
81 |
+
foreach ($items as $item)
|
82 |
+
{
|
83 |
+
$_product= Mage::getSingleton('catalog/product')->load($item->getProductId());
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
$object->Quantity +=(int)$item->getQty();
|
89 |
+
$length=$_product->getResource()->getAttribute('length');
|
90 |
+
|
91 |
+
if(!empty($length))
|
92 |
+
{
|
93 |
+
$object->Length +=(int)$length->getFrontend()->getValue($_product);
|
94 |
+
}
|
95 |
+
else
|
96 |
+
{
|
97 |
+
$object->Length +=0;
|
98 |
+
}
|
99 |
+
|
100 |
+
$width=$_product->getResource()->getAttribute('width');
|
101 |
+
if(!empty($width))
|
102 |
+
{
|
103 |
+
$object->Width +=(int)$width->getFrontend()->getValue($_product);
|
104 |
+
}
|
105 |
+
else
|
106 |
+
{
|
107 |
+
$object->Width +=0;
|
108 |
+
}
|
109 |
+
$height=$_product->getResource()->getAttribute('height');
|
110 |
+
if(!empty($height))
|
111 |
+
{
|
112 |
+
$object->Height +=(int)$height->getFrontend()->getValue($_product);
|
113 |
+
}
|
114 |
+
else
|
115 |
+
{
|
116 |
+
$object->Height +=0;
|
117 |
+
}
|
118 |
+
$object->ActualWeight +=(int)$item->getWeight();
|
119 |
+
$SOAPrequest["oLineItems"]['FreightLineItem']=$object;
|
120 |
+
$count++;
|
121 |
+
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
//print_r($object);
|
126 |
+
// exit;
|
127 |
+
|
128 |
+
$SOAPrequest["oRestriction"]="NA";
|
129 |
+
$SOAPrequest["strDestinationCountry"]=$_iso3countrycode;
|
130 |
+
$SOAPrequest["strDestinationPostal"]=$OriginPostal;
|
131 |
+
$SOAPrequest["strOriginationCountry"]=$OriginCountry;
|
132 |
+
$SOAPrequest["strOriginationPostal"]=$postcode;
|
133 |
+
$SOAPrequest["lngInsuranceAmount"]=$InsuranceAmount;
|
134 |
+
$SOAPrequest["bAddHandlingFees"]=$AddHandlingFees;
|
135 |
+
$SOAPrequest["lngPctOfHandlingFees"]=$HandlingFeePercent;
|
136 |
+
|
137 |
+
|
138 |
+
$result1 = $client->EstimateFreight($SOAPrequest);
|
139 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
140 |
+
$methods=get_class_methods($method);
|
141 |
+
|
142 |
+
//echo "<pre/>";
|
143 |
+
//print_r($SOAPrequest);
|
144 |
+
//exit;
|
145 |
+
//echo $result1->EstimateFreightResult->WSMessage;exit;
|
146 |
+
try
|
147 |
+
{
|
148 |
+
$rateresult=$result1->EstimateFreightResult->EstimateFreight->RateReplyDetails;
|
149 |
+
}
|
150 |
+
catch(Exception $e)
|
151 |
+
{
|
152 |
+
Mage::getSingleton('core/session')->addError($result1->EstimateFreightResult->WSMessage);
|
153 |
+
}
|
154 |
+
|
155 |
+
if(!empty($rateresult))
|
156 |
+
{
|
157 |
+
foreach($rateresult as $rate)
|
158 |
+
{
|
159 |
+
// echo $rate->ServiceType;
|
160 |
+
if(!empty($rate->ServiceType))
|
161 |
+
{
|
162 |
+
$data=$importModel->checkMethod(trim($rate->ServiceType));
|
163 |
+
if(empty($data))
|
164 |
+
{
|
165 |
+
$data["name"]=$rate->ServiceType;
|
166 |
+
try
|
167 |
+
{
|
168 |
+
$importModel->setData($data)->save();
|
169 |
+
}
|
170 |
+
catch(Exception $e)
|
171 |
+
{
|
172 |
+
echo $e->getMessage();
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
if(in_array($rate->ServiceType,$allowedMethodsArr))
|
177 |
+
{
|
178 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
179 |
+
$method->setCarrier($this->_code);
|
180 |
+
$method->setCarrierTitle($this->_code);
|
181 |
+
$method->setMethod($rate->ServiceType);
|
182 |
+
$method->setMethodTitle($rate->ServiceType);
|
183 |
+
$method->setCost($rate->TotalCharge->Amount);
|
184 |
+
$method->setPrice($rate->TotalCharge->Amount);
|
185 |
+
$result->append($method);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
}
|
194 |
+
catch(Exception $e)
|
195 |
+
{
|
196 |
+
echo $e->getMessage();
|
197 |
+
exit;
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
// skip if not enabled
|
202 |
+
// if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active'))
|
203 |
+
// return false;
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
return $result;
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
public function getAllowedMethods()
|
213 |
+
{
|
214 |
+
return array('customshiping'=>$this->getConfigData('name'));
|
215 |
+
}
|
216 |
+
|
217 |
+
public function _getISO3Code($szISO2Code)
|
218 |
+
{
|
219 |
+
$boFound = false;
|
220 |
+
$nCount = 1;
|
221 |
+
|
222 |
+
$collection = Mage::getModel('directory/country_api')->items();
|
223 |
+
|
224 |
+
while ($boFound == false &&
|
225 |
+
$nCount < count($collection))
|
226 |
+
{
|
227 |
+
$item = $collection[$nCount];
|
228 |
+
if($item['iso2_code'] == $szISO2Code)
|
229 |
+
{
|
230 |
+
$boFound = true;
|
231 |
+
$szISO3Code = $item['iso3_code'];
|
232 |
+
}
|
233 |
+
$nCount++;
|
234 |
+
}
|
235 |
+
|
236 |
+
return $szISO3Code;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
app/code/local/Discretelogix/Shippingimport/Model/Carrier/__Localdelivery.php
ADDED
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php
|
3 |
+
class FreightLineItem
|
4 |
+
{
|
5 |
+
public $Quantity;
|
6 |
+
public $Length;
|
7 |
+
public $Width;
|
8 |
+
public $Height;
|
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 */
|
16 |
+
protected $_code = 'customshiping';
|
17 |
+
|
18 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
19 |
+
{
|
20 |
+
try
|
21 |
+
{
|
22 |
+
|
23 |
+
$url=Mage::getStoreConfig('webservice/webservice_group/webservice_url',Mage::app()->getStore());
|
24 |
+
$username=Mage::getStoreConfig('webservice/webservice_group/webservice_username',Mage::app()->getStore());
|
25 |
+
$password=Mage::getStoreConfig('webservice/webservice_group/webservice_password',Mage::app()->getStore());
|
26 |
+
$allowedMethods=Mage::getStoreConfig('carriers/customshiping/allowedmethods',Mage::app()->getStore());
|
27 |
+
$warehousename=Mage::getStoreConfig('webservice/webservice_group/webservice_warehousename',Mage::app()->getStore());
|
28 |
+
$OriginCountry =Mage::getStoreConfig('webservice/webservice_group/webservice_originCountry',Mage::app()->getStore());
|
29 |
+
$OriginPostal =Mage::getStoreConfig('webservice/webservice_group/webservice_originPostal',Mage::app()->getStore());
|
30 |
+
$Unit = Mage::getStoreConfig('webservice/webservice_group/webservice_unit',Mage::app()->getStore());
|
31 |
+
$custname = Mage::getStoreConfig('webservice/webservice_group/webservice_custname',Mage::app()->getStore());
|
32 |
+
|
33 |
+
if($Unit=="")
|
34 |
+
$Unit="US";
|
35 |
+
$InsuranceAmount= Mage::getStoreConfig('webservice/webservice_group/webservice_insuranceamount',Mage::app()->getStore());
|
36 |
+
$AddHandlingFees = Mage::getStoreConfig('webservice/webservice_group/webservice_addhandlingfees',Mage::app()->getStore());
|
37 |
+
|
38 |
+
|
39 |
+
$HandlingFeePercent = Mage::getStoreConfig('webservice/webservice_group/webservice_handlingfeepercent',Mage::app()->getStore());
|
40 |
+
|
41 |
+
|
42 |
+
$currencycode=Mage::app()->getStore()-> getCurrentCurrencyCode();
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
$allowedMethodsArr=split(",",$allowedMethods);
|
47 |
+
|
48 |
+
$importModel= Mage::getModel('shippingimport/import');
|
49 |
+
$result = Mage::getModel('shipping/rate_result');
|
50 |
+
|
51 |
+
$client = new SoapClient($url, array('trace' => TRUE));
|
52 |
+
|
53 |
+
//$session = $client->__login('testaccount@oms.com.au', 'f7vmz!299pl');
|
54 |
+
$SOAPrequest["strB2BCustomerName"]=$custname;
|
55 |
+
$SOAPrequest["strB2BCustomerEmail"]=$username;
|
56 |
+
$SOAPrequest["strB2BCustomerPassword"]=$password;
|
57 |
+
$SOAPrequest["strCurrencyAbbrev"]=$currencycode;
|
58 |
+
$SOAPrequest["strWarehouseName"]=$warehousename;
|
59 |
+
$SOAPrequest["lngAdjustedWeight"]="";
|
60 |
+
$SOAPrequest["siUnit"]= $Unit;
|
61 |
+
|
62 |
+
$adminsession = Mage::getSingleton('admin/session')->isLoggedIn();
|
63 |
+
|
64 |
+
$session = Mage::getSingleton('checkout/session');
|
65 |
+
$object= new FreightLineItem();
|
66 |
+
if (!empty($session) || !empty($adminsession))
|
67 |
+
{
|
68 |
+
$count=0;
|
69 |
+
|
70 |
+
if(Mage::getSingleton('admin/session')->isLoggedIn())
|
71 |
+
{
|
72 |
+
$items = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getAllVisibleItems();
|
73 |
+
$adminData = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getShippingAddress()->getData();
|
74 |
+
if(empty($postcode))
|
75 |
+
{
|
76 |
+
$postcode=$adminData['postcode'] ;
|
77 |
+
$country=$adminData['country_id'];
|
78 |
+
$_iso3countrycode=$this->_getISO3Code($country);
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
else
|
83 |
+
{
|
84 |
+
$data = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData();
|
85 |
+
$postcode = $data['postcode'];
|
86 |
+
$country=$data['country_id'];
|
87 |
+
$_iso3countrycode=$this->_getISO3Code($country);
|
88 |
+
$items = Mage::getSingleton('checkout/cart')->getItems();
|
89 |
+
}
|
90 |
+
$itemlength=0;
|
91 |
+
$itemWidth=0;
|
92 |
+
$itemHeight=0;
|
93 |
+
$itemWeight=0;
|
94 |
+
$itemQuantity=0;
|
95 |
+
|
96 |
+
$count=0;
|
97 |
+
$freightArray[]=array();
|
98 |
+
foreach ($items as $item)
|
99 |
+
{
|
100 |
+
|
101 |
+
$_product= Mage::getSingleton('catalog/product')->load($item->getProductId());
|
102 |
+
$itemQuantity =(int)$item->getQty();
|
103 |
+
$length=$_product->getResource()->getAttribute('length');
|
104 |
+
|
105 |
+
if(!empty($length))
|
106 |
+
{
|
107 |
+
$itemlength =(int)$length->getFrontend()->getValue($_product);
|
108 |
+
}
|
109 |
+
else
|
110 |
+
{
|
111 |
+
$itemlength =0;
|
112 |
+
}
|
113 |
+
|
114 |
+
$width=$_product->getResource()->getAttribute('width');
|
115 |
+
if(!empty($width))
|
116 |
+
{
|
117 |
+
$itemWidth =(int)$width->getFrontend()->getValue($_product);
|
118 |
+
}
|
119 |
+
else
|
120 |
+
{
|
121 |
+
$itemWidth =0;
|
122 |
+
}
|
123 |
+
$height=$_product->getResource()->getAttribute('height');
|
124 |
+
if(!empty($height))
|
125 |
+
{
|
126 |
+
$itemHeight =(int)$height->getFrontend()->getValue($_product);
|
127 |
+
}
|
128 |
+
else
|
129 |
+
{
|
130 |
+
$itemHeight =0;
|
131 |
+
}
|
132 |
+
$itemWeight =(int)$item->getWeight();
|
133 |
+
|
134 |
+
$object->Quantity =$itemQuantity;
|
135 |
+
|
136 |
+
$object->Length = $itemlength;
|
137 |
+
|
138 |
+
$object->Weight = $itemWeight;
|
139 |
+
$object->Width = $itemWidth;
|
140 |
+
$object->Height = $itemHeight;
|
141 |
+
$object->ActualWeight=$itemWeight;
|
142 |
+
|
143 |
+
$freightArray[$count]=$object;
|
144 |
+
$count++;
|
145 |
+
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
echo "<pre/>";
|
150 |
+
print_r($freightArray);
|
151 |
+
exit;
|
152 |
+
|
153 |
+
$SOAPrequest["oLineItems"]['FreightLineItem']=$object;
|
154 |
+
$SOAPrequest["oRestriction"]="NA";
|
155 |
+
$SOAPrequest["strDestinationCountry"]=$_iso3countrycode;
|
156 |
+
$SOAPrequest["strDestinationPostal"]=$postcode;
|
157 |
+
$SOAPrequest["strOriginationCountry"]=$OriginCountry;
|
158 |
+
$SOAPrequest["strOriginationPostal"]=$OriginPostal;
|
159 |
+
$SOAPrequest["lngInsuranceAmount"]=$InsuranceAmount;
|
160 |
+
$SOAPrequest["bAddHandlingFees"]=$AddHandlingFees;
|
161 |
+
$SOAPrequest["lngPctOfHandlingFees"]=$HandlingFeePercent;
|
162 |
+
|
163 |
+
/*echo "<pre/>";
|
164 |
+
print_r($SOAPrequest);
|
165 |
+
exit;*/
|
166 |
+
$result1 = $client->EstimateFreight($SOAPrequest);
|
167 |
+
|
168 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
169 |
+
// $methods=get_class_methods($method);
|
170 |
+
|
171 |
+
|
172 |
+
//echo $result1->EstimateFreightResult->WSMessage;exit;
|
173 |
+
try
|
174 |
+
{
|
175 |
+
$rateresult=$result1->EstimateFreightResult->EstimateFreight->RateReplyDetails;
|
176 |
+
}
|
177 |
+
catch(Exception $e)
|
178 |
+
{
|
179 |
+
Mage::getSingleton('core/session')->addError($result1->EstimateFreightResult->WSMessage);
|
180 |
+
}
|
181 |
+
|
182 |
+
if(!empty($rateresult))
|
183 |
+
{
|
184 |
+
foreach($rateresult as $rate)
|
185 |
+
{
|
186 |
+
// echo $rate->ServiceType;
|
187 |
+
if(!empty($rate->ServiceType))
|
188 |
+
{
|
189 |
+
$data=$importModel->checkMethod(trim($rate->ServiceType));
|
190 |
+
if(empty($data))
|
191 |
+
{
|
192 |
+
$data["name"]=$rate->ServiceType;
|
193 |
+
try
|
194 |
+
{
|
195 |
+
$importModel->setData($data)->save();
|
196 |
+
}
|
197 |
+
catch(Exception $e)
|
198 |
+
{
|
199 |
+
echo $e->getMessage();
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
if(in_array($rate->ServiceType,$allowedMethodsArr))
|
204 |
+
{
|
205 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
206 |
+
$method->setCarrier($this->_code);
|
207 |
+
$method->setCarrierTitle($this->_code);
|
208 |
+
$method->setMethod($rate->ServiceType);
|
209 |
+
$method->setMethodTitle($rate->ServiceType);
|
210 |
+
$method->setCost($rate->TotalCharge->Amount);
|
211 |
+
$method->setPrice($rate->TotalCharge->Amount);
|
212 |
+
$result->append($method);
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
|
220 |
+
}
|
221 |
+
catch(Exception $e)
|
222 |
+
{
|
223 |
+
echo $e->getMessage();
|
224 |
+
exit;
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
// skip if not enabled
|
229 |
+
// if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active'))
|
230 |
+
// return false;
|
231 |
+
|
232 |
+
|
233 |
+
|
234 |
+
|
235 |
+
return $result;
|
236 |
+
|
237 |
+
}
|
238 |
+
|
239 |
+
public function getAllowedMethods()
|
240 |
+
{
|
241 |
+
return array('customshiping'=>$this->getConfigData('name'));
|
242 |
+
}
|
243 |
+
|
244 |
+
public function _getISO3Code($szISO2Code)
|
245 |
+
{
|
246 |
+
$boFound = false;
|
247 |
+
$nCount = 1;
|
248 |
+
|
249 |
+
$collection = Mage::getModel('directory/country_api')->items();
|
250 |
+
|
251 |
+
while ($boFound == false &&
|
252 |
+
$nCount < count($collection))
|
253 |
+
{
|
254 |
+
$item = $collection[$nCount];
|
255 |
+
if($item['iso2_code'] == $szISO2Code)
|
256 |
+
{
|
257 |
+
$boFound = true;
|
258 |
+
$szISO3Code = $item['iso3_code'];
|
259 |
+
}
|
260 |
+
$nCount++;
|
261 |
+
}
|
262 |
+
|
263 |
+
return $szISO3Code;
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
app/code/local/Discretelogix/Shippingimport/Model/Enable.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Discretelogix_Shippingimport_Model_Enable
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
|
7 |
+
return array(
|
8 |
+
array('value' => 'yes', 'label'=>Mage::helper('adminhtml')->__('Yes')),
|
9 |
+
array('value' => 'no', 'label'=>Mage::helper('adminhtml')->__('No'))
|
10 |
+
|
11 |
+
);
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
15 |
+
|
app/code/local/Discretelogix/Shippingimport/Model/Handlingfees.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Discretelogix_Shippingimport_Model_Handlingfees
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
|
7 |
+
return array(
|
8 |
+
array('value' => 'true', 'label'=>Mage::helper('adminhtml')->__('True')),
|
9 |
+
array('value' => 'false', 'label'=>Mage::helper('adminhtml')->__('False'))
|
10 |
+
|
11 |
+
);
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
15 |
+
|
app/code/local/Discretelogix/Shippingimport/Model/Import.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/Discretelogix/Shippingimport/Model/Resource/Eav/Mysql4/Setup.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Discretelogix_Shippingimport_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* @return array
|
6 |
+
*/
|
7 |
+
public function getDefaultEntities()
|
8 |
+
{
|
9 |
+
return array(
|
10 |
+
'catalog_product' => array(
|
11 |
+
'entity_model' => 'catalog/product',
|
12 |
+
'attribute_model' => 'catalog/resource_eav_attribute',
|
13 |
+
'table' => 'catalog/product',
|
14 |
+
'attributes' => array(
|
15 |
+
'height' => array(
|
16 |
+
'group' => 'General',
|
17 |
+
'label' => 'Height',
|
18 |
+
'type' => 'text',
|
19 |
+
'input' => 'varchar',
|
20 |
+
'default' => '0',
|
21 |
+
'class' => '',
|
22 |
+
'backend' => '',
|
23 |
+
'frontend' => '',
|
24 |
+
'source' => '',
|
25 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
26 |
+
'visible' => true,
|
27 |
+
'required' => false,
|
28 |
+
'user_defined' => true,
|
29 |
+
'searchable' => false,
|
30 |
+
'filterable' => false,
|
31 |
+
'comparable' => false,
|
32 |
+
'visible_on_front' => false,
|
33 |
+
'visible_in_advanced_search' => false,
|
34 |
+
'unique' => false
|
35 |
+
),
|
36 |
+
'width' => array(
|
37 |
+
'group' => 'General',
|
38 |
+
'label' => 'Width',
|
39 |
+
'type' => 'text',
|
40 |
+
'input' => 'varchar',
|
41 |
+
'default' => '0',
|
42 |
+
'class' => '',
|
43 |
+
'backend' => '',
|
44 |
+
'frontend' => '',
|
45 |
+
'source' => '',
|
46 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
47 |
+
'visible' => true,
|
48 |
+
'required' => false,
|
49 |
+
'user_defined' => true,
|
50 |
+
'searchable' => false,
|
51 |
+
'filterable' => false,
|
52 |
+
'comparable' => false,
|
53 |
+
'visible_on_front' => false,
|
54 |
+
'visible_in_advanced_search' => false,
|
55 |
+
'unique' => false
|
56 |
+
),
|
57 |
+
'Length' => array(
|
58 |
+
'group' => 'General',
|
59 |
+
'label' => 'Length',
|
60 |
+
'type' => 'text',
|
61 |
+
'input' => 'varchar',
|
62 |
+
'default' => '0',
|
63 |
+
'class' => '',
|
64 |
+
'backend' => '',
|
65 |
+
'frontend' => '',
|
66 |
+
'source' => '',
|
67 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
68 |
+
'visible' => true,
|
69 |
+
'required' => false,
|
70 |
+
'user_defined' => true,
|
71 |
+
'searchable' => false,
|
72 |
+
'filterable' => false,
|
73 |
+
'comparable' => false,
|
74 |
+
'visible_on_front' => false,
|
75 |
+
'visible_in_advanced_search' => false,
|
76 |
+
'unique' => false
|
77 |
+
)
|
78 |
+
|
79 |
+
|
80 |
+
)
|
81 |
+
),
|
82 |
+
// define attributes for other model entities here
|
83 |
+
);
|
84 |
+
|
85 |
+
}
|
86 |
+
}
|
app/code/local/Discretelogix/Shippingimport/Model/Unit.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Discretelogix_Shippingimport_Model_Unit
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
|
7 |
+
return array(
|
8 |
+
array('value' => 'US', 'label'=>Mage::helper('adminhtml')->__('US')),
|
9 |
+
array('value' => 'Metrics', 'label'=>Mage::helper('adminhtml')->__('Metrics'))
|
10 |
+
|
11 |
+
);
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
15 |
+
|
app/code/local/Discretelogix/Shippingimport/controllers/IndexController.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Discretelogix_Shippingimport_IndexController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction()
|
7 |
+
{
|
8 |
+
try
|
9 |
+
{
|
10 |
+
$url=Mage::getStoreConfig('webservice/webservice_group/webservice_url',Mage::app()->getStore());
|
11 |
+
$username=Mage::getStoreConfig('webservice/webservice_group/webservice_username',Mage::app()->getStore());
|
12 |
+
$password=Mage::getStoreConfig('webservice/webservice_group/webservice_password',Mage::app()->getStore());
|
13 |
+
$importModel= Mage::getModel('shippingimport/import');
|
14 |
+
|
15 |
+
$client = new SoapClient($url);
|
16 |
+
|
17 |
+
//$session = $client->__login('testaccount@oms.com.au', 'f7vmz!299pl');
|
18 |
+
$request["strB2BCustomerName"]="Park City Apparel";
|
19 |
+
$request["strB2BCustomerEmail"]=$username;
|
20 |
+
$request["strB2BCustomerPassword"]=$password;
|
21 |
+
$request["strCurrencyAbbrev"]="AUD";
|
22 |
+
$request["strWarehouseName"]="";
|
23 |
+
$request["lngAdjustedWeight"]="";
|
24 |
+
$request["siUnit"]="US";
|
25 |
+
|
26 |
+
|
27 |
+
$innerArray["Quantity"]=60;
|
28 |
+
$innerArray["Length"]=10;
|
29 |
+
$innerArray["Width"]=30;
|
30 |
+
$innerArray["Height"]=40;
|
31 |
+
$innerArray["ActualWeight"]=10;
|
32 |
+
$request["oLineItems"]["FreightLineItem"]=$innerArray;
|
33 |
+
|
34 |
+
$request["oRestriction"]="NA";
|
35 |
+
$request["strDestinationCountry"]="AUS";
|
36 |
+
$request["strDestinationPostal"]="2001";
|
37 |
+
$request["strOriginationCountry"]="AUS";
|
38 |
+
$request["strOriginationPostal"]="2170";
|
39 |
+
$request["lngInsuranceAmount"]="0";
|
40 |
+
$request["bAddHandlingFees"]=false;
|
41 |
+
$request["lngPctOfHandlingFees"]=0;
|
42 |
+
$result = $client->EstimateFreight($request);
|
43 |
+
$rateresult=$result->EstimateFreightResult->EstimateFreight->RateReplyDetails;
|
44 |
+
echo "<pre/>";
|
45 |
+
print_r($rateresult);
|
46 |
+
|
47 |
+
foreach($rateresult as $rate)
|
48 |
+
{
|
49 |
+
// echo $rate->ServiceType;
|
50 |
+
if(!empty($rate->ServiceType))
|
51 |
+
{
|
52 |
+
$data=$importModel->checkMethod(trim($rate->ServiceType));
|
53 |
+
if(empty($data))
|
54 |
+
{
|
55 |
+
$data["name"]=$rate->ServiceType;
|
56 |
+
try
|
57 |
+
{
|
58 |
+
$importModel->setData($data)->save();
|
59 |
+
}
|
60 |
+
catch(Exception $e)
|
61 |
+
{
|
62 |
+
echo $e->getMessage();
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
echo "Data Saved";
|
71 |
+
|
72 |
+
|
73 |
+
}
|
74 |
+
catch(Exception $e)
|
75 |
+
{
|
76 |
+
echo $e->getMessage();
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
app/code/local/Discretelogix/Shippingimport/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
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>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/local/Discretelogix/Shippingimport/etc/config.xml
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
20 |
+
</routers>
|
21 |
+
|
22 |
+
</frontend>
|
23 |
+
<adminhtml>
|
24 |
+
<acl>
|
25 |
+
<resources>
|
26 |
+
<all>
|
27 |
+
<title>Allow Everything</title>
|
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>
|
38 |
+
</acl>
|
39 |
+
</adminhtml>
|
40 |
+
<!-- <acl>
|
41 |
+
<resources>
|
42 |
+
<admin>
|
43 |
+
<children>
|
44 |
+
<system>
|
45 |
+
<children>
|
46 |
+
<config>
|
47 |
+
<children>
|
48 |
+
<webservice translate="title" module="shipping">
|
49 |
+
<title>Shipping SOAP Web Service</title>
|
50 |
+
<sort_order>100</sort_order>
|
51 |
+
</webservice>
|
52 |
+
</children>
|
53 |
+
</config>
|
54 |
+
</children>
|
55 |
+
</system>
|
56 |
+
</children>
|
57 |
+
</admin>
|
58 |
+
</resources>
|
59 |
+
</acl>-->
|
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>
|
71 |
+
</import>
|
72 |
+
|
73 |
+
</entities>
|
74 |
+
</shippingimport_mysql4>
|
75 |
+
</models>
|
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>
|
84 |
+
</connection>
|
85 |
+
</shippingimport_setup>
|
86 |
+
</resources>
|
87 |
+
<helpers>
|
88 |
+
<Shippingimport>
|
89 |
+
<class>Discretelogix_Shippingimport_Helper</class>
|
90 |
+
</Shippingimport>
|
91 |
+
</helpers>
|
92 |
+
</global>
|
93 |
+
<default>
|
94 |
+
<carriers>
|
95 |
+
<customshiping>
|
96 |
+
<active>1</active>
|
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>
|
104 |
+
<handling_type>F</handling_type>
|
105 |
+
</customshiping>
|
106 |
+
</carriers>
|
107 |
+
</default>
|
108 |
+
</config>
|
app/code/local/Discretelogix/Shippingimport/etc/system.xml
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<webservice translate="label" module="shipping">
|
5 |
+
<label>OMS Global Freight Estimator</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</webservice>
|
8 |
+
</tabs>
|
9 |
+
|
10 |
+
<sections>
|
11 |
+
<webservice translate="label" module="shipping">
|
12 |
+
<label>Extension Options</label>
|
13 |
+
<tab>webservice</tab>
|
14 |
+
<sort_order>1000</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
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>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
|
28 |
+
<fields>
|
29 |
+
<webservice_enable translate="label">
|
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>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</webservice_enable>
|
39 |
+
<webservice_url translate="label">
|
40 |
+
<label>SOAP web service URL: </label>
|
41 |
+
<comment>SOAP Web service URL.</comment>
|
42 |
+
<frontend_type>text</frontend_type>
|
43 |
+
<sort_order>20</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
</webservice_url>
|
48 |
+
<webservice_custname translate="label">
|
49 |
+
<label>Customer Name: </label>
|
50 |
+
<comment></comment>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<sort_order>21</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
</webservice_custname>
|
57 |
+
<webservice_username translate="label">
|
58 |
+
<label>Username: </label>
|
59 |
+
<comment>Username for SOAP Web service authentication.</comment>
|
60 |
+
<frontend_type>text</frontend_type>
|
61 |
+
<sort_order>30</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
</webservice_username>
|
66 |
+
<webservice_password translate="label">
|
67 |
+
<label>Password: </label>
|
68 |
+
<comment>Password for SOAP Web service authentication.</comment>
|
69 |
+
<frontend_type>password</frontend_type>
|
70 |
+
<sort_order>40</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</webservice_password>
|
75 |
+
<webservice_warehousename translate="label">
|
76 |
+
<label>Warehouse Name: </label>
|
77 |
+
<comment>Warehouse name.</comment>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>41</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
</webservice_warehousename>
|
84 |
+
<webservice_originCountry translate="label">
|
85 |
+
<label>Origin Country: </label>
|
86 |
+
<comment></comment>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<sort_order>42</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>1</show_in_store>
|
92 |
+
</webservice_originCountry>
|
93 |
+
<webservice_originPostal translate="label">
|
94 |
+
<label>Origin Postal: </label>
|
95 |
+
<comment></comment>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<sort_order>43</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
</webservice_originPostal>
|
102 |
+
<webservice_unit translate="label">
|
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>
|
115 |
+
<frontend_type>text</frontend_type>
|
116 |
+
<sort_order>45</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_insuranceamount>
|
121 |
+
<webservice_addhandlingfees translate="label">
|
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>
|
129 |
+
<show_in_store>1</show_in_store>
|
130 |
+
</webservice_addhandlingfees>
|
131 |
+
<webservice_handlingfeepercent translate="label">
|
132 |
+
<label>Handling Fee Percent: </label>
|
133 |
+
<comment></comment>
|
134 |
+
<frontend_type>text</frontend_type>
|
135 |
+
<sort_order>47</sort_order>
|
136 |
+
<show_in_default>1</show_in_default>
|
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>
|
143 |
+
</webservice>
|
144 |
+
<carriers>
|
145 |
+
<groups>
|
146 |
+
<customshiping translate="label" module="shipping">
|
147 |
+
<label>OMS Global Freight Estimator</label>
|
148 |
+
<frontend_type>text</frontend_type>
|
149 |
+
<sort_order>13</sort_order>
|
150 |
+
<show_in_default>1</show_in_default>
|
151 |
+
<show_in_website>1</show_in_website>
|
152 |
+
<show_in_store>1</show_in_store>
|
153 |
+
<fields>
|
154 |
+
<active translate="label">
|
155 |
+
<label>Enabled</label>
|
156 |
+
<frontend_type>select</frontend_type>
|
157 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
158 |
+
<sort_order>1</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
</active>
|
163 |
+
<!-- <sort_order translate="label">
|
164 |
+
<label>Sort order</label>
|
165 |
+
<frontend_type>text</frontend_type>
|
166 |
+
<sort_order>100</sort_order>
|
167 |
+
<show_in_default>1</show_in_default>
|
168 |
+
<show_in_website>1</show_in_website>
|
169 |
+
<show_in_store>1</show_in_store>
|
170 |
+
</sort_order>
|
171 |
+
<title translate="label">
|
172 |
+
<label>Title</label>
|
173 |
+
<frontend_type>text</frontend_type>
|
174 |
+
<sort_order>2</sort_order>
|
175 |
+
<show_in_default>1</show_in_default>
|
176 |
+
<show_in_website>1</show_in_website>
|
177 |
+
<show_in_store>1</show_in_store>
|
178 |
+
</title>
|
179 |
+
<methodtitle translate="label">
|
180 |
+
<label>Method Title</label>
|
181 |
+
<frontend_type>text</frontend_type>
|
182 |
+
<sort_order>2</sort_order>
|
183 |
+
<show_in_default>1</show_in_default>
|
184 |
+
<show_in_website>1</show_in_website>
|
185 |
+
<show_in_store>1</show_in_store>
|
186 |
+
</methodtitle>
|
187 |
+
<handling translate="label">
|
188 |
+
<label>Handling fee</label>
|
189 |
+
<frontend_type>text</frontend_type>
|
190 |
+
<sort_order>12</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>1</show_in_store>
|
194 |
+
</handling>
|
195 |
+
<handling_type translate="label">
|
196 |
+
<label>Calculate Handling Fee</label>
|
197 |
+
<frontend_type>select</frontend_type>
|
198 |
+
<source_model>shipping/source_handlingType</source_model>
|
199 |
+
<sort_order>10</sort_order>
|
200 |
+
<show_in_default>1</show_in_default>
|
201 |
+
<show_in_website>1</show_in_website>
|
202 |
+
<show_in_store>0</show_in_store>
|
203 |
+
</handling_type>-->
|
204 |
+
|
205 |
+
|
206 |
+
<allowedmethods translate="label">
|
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>
|
214 |
+
</allowedmethods>
|
215 |
+
<specificerrmsg translate="label">
|
216 |
+
<label>Displayed Error Message</label>
|
217 |
+
<frontend_type>textarea</frontend_type>
|
218 |
+
<sort_order>90</sort_order>
|
219 |
+
<show_in_default>1</show_in_default>
|
220 |
+
<show_in_website>1</show_in_website>
|
221 |
+
<show_in_store>1</show_in_store>
|
222 |
+
</specificerrmsg>
|
223 |
+
</fields>
|
224 |
+
</customshiping>
|
225 |
+
|
226 |
+
|
227 |
+
|
228 |
+
</groups>
|
229 |
+
</carriers>
|
230 |
+
</sections>
|
231 |
+
</config>
|
app/code/local/Discretelogix/Shippingimport/sql/shippingimport_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
$installer->startSetup();
|
10 |
+
|
11 |
+
$installer->run("
|
12 |
+
|
13 |
+
CREATE TABLE IF NOT EXISTS `shipping_imported_methods` (
|
14 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
15 |
+
`name` varchar(100) NOT NULL,
|
16 |
+
PRIMARY KEY (`id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
18 |
+
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
// $setup->addAttributeGroup('catalog_product', 'Default', 'Special Attributes', 1000);
|
23 |
+
|
24 |
+
// the attribute added will be displayed under the group/tab Special Attributes in product edit page
|
25 |
+
$setup->addAttribute('catalog_product', 'height', array(
|
26 |
+
'group' => 'General',
|
27 |
+
'input' => 'text',
|
28 |
+
'type' => 'text',
|
29 |
+
'label' => 'Height',
|
30 |
+
'backend' => '',
|
31 |
+
'visible' => true,
|
32 |
+
'required' => 0,
|
33 |
+
'user_defined' => true,
|
34 |
+
'searchable' => 1,
|
35 |
+
'filterable' => 0,
|
36 |
+
'comparable' => 1,
|
37 |
+
'visible_on_front' => 1,
|
38 |
+
'visible_in_advanced_search' => 0,
|
39 |
+
'is_html_allowed_on_front' => 0,
|
40 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
41 |
+
));
|
42 |
+
|
43 |
+
$setup->addAttribute('catalog_product', 'width', array(
|
44 |
+
'group' => 'General',
|
45 |
+
'input' => 'text',
|
46 |
+
'type' => 'text',
|
47 |
+
'label' => 'Width',
|
48 |
+
'backend' => '',
|
49 |
+
'visible' => true,
|
50 |
+
'required' => 0,
|
51 |
+
'user_defined' => true,
|
52 |
+
'searchable' => 1,
|
53 |
+
'filterable' => 0,
|
54 |
+
'comparable' => 1,
|
55 |
+
'visible_on_front' => 1,
|
56 |
+
'visible_in_advanced_search' => 0,
|
57 |
+
'is_html_allowed_on_front' => 0,
|
58 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
59 |
+
));
|
60 |
+
|
61 |
+
$setup->addAttribute('catalog_product', 'length', array(
|
62 |
+
'group' => 'General',
|
63 |
+
'input' => 'text',
|
64 |
+
'type' => 'text',
|
65 |
+
'label' => 'Length',
|
66 |
+
'backend' => '',
|
67 |
+
'visible' => true,
|
68 |
+
'required' => 0,
|
69 |
+
'user_defined' => true,
|
70 |
+
'searchable' => 1,
|
71 |
+
'filterable' => 0,
|
72 |
+
'comparable' => 1,
|
73 |
+
'visible_on_front' => 1,
|
74 |
+
'visible_in_advanced_search' => 0,
|
75 |
+
'is_html_allowed_on_front' => 0,
|
76 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
77 |
+
));
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
$installer->endSetup();
|
app/etc/modules/Discretelogix_Shippingimport.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
|
5 |
+
<Discretelogix_Shippingimport>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>local</codePool>
|
8 |
+
</Discretelogix_Shippingimport>
|
9 |
+
|
10 |
+
</modules>
|
11 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|