Version Notes
Added debug logging option to help with installations
Download this release
Release Info
Developer | Freightquote |
Extension | Freightquote_com_Shipping_Module |
Version | 1.2.1 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.2.1
- app/code/community/Freightquote/Shipping/Helper/Data.php +13 -0
- app/code/community/Freightquote/Shipping/Model/Carrier/Shipping.php +614 -0
- app/code/community/Freightquote/Shipping/Model/Carrier/Source/Class.php +23 -0
- app/code/community/Freightquote/Shipping/Model/Carrier/Source/Commodity.php +23 -0
- app/code/community/Freightquote/Shipping/Model/Carrier/Source/Content.php +23 -0
- app/code/community/Freightquote/Shipping/Model/Carrier/Source/Locationtype.php +23 -0
- app/code/community/Freightquote/Shipping/Model/Carrier/Source/Packaging.php +23 -0
- app/code/community/Freightquote/Shipping/Model/Carrier/Source/Servicetype.php +23 -0
- app/code/community/Freightquote/Shipping/Model/Resource/Eav/Mysql4/Setup.php +237 -0
- app/code/community/Freightquote/Shipping/etc/config.xml +83 -0
- app/code/community/Freightquote/Shipping/etc/system.xml +260 -0
- app/code/community/Freightquote/Shipping/sql/freightquote_setup/mysql4-install-1.0.0.php +12 -0
- app/etc/modules/Freightquote_Shipping.xml +19 -0
- package.xml +5 -5
app/code/community/Freightquote/Shipping/Helper/Data.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Helper_Data extends Mage_Core_Helper_Abstract {
|
11 |
+
|
12 |
+
}
|
13 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Carrier/Shipping.php
ADDED
@@ -0,0 +1,614 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Carrier_Shipping
|
11 |
+
extends Mage_Shipping_Model_Carrier_Abstract {
|
12 |
+
|
13 |
+
protected $_code = 'freightquote';
|
14 |
+
protected $_request = null;
|
15 |
+
protected $_response = null;
|
16 |
+
protected $_result = null;
|
17 |
+
protected $_gatewayUrl = 'https://b2b.Freightquote.com/WebService/QuoteService.asmx';
|
18 |
+
//protected $_gatewayUrl = '10.40.1.130:8081/QuoteService.asmx';
|
19 |
+
|
20 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
21 |
+
if (!$this->getConfigData('active')) {
|
22 |
+
Mage::log('The ' . $this->_code . ' shipping method is not active.');
|
23 |
+
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
$this->_request = $this->setRequest($request);
|
28 |
+
|
29 |
+
$this->_getQuotes();
|
30 |
+
|
31 |
+
//$this->_updateFreeMethodQuote($request);
|
32 |
+
|
33 |
+
return $this->_result;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function setRequest(Mage_Shipping_Model_Rate_Request $request) {
|
37 |
+
$r = new Varien_Object();
|
38 |
+
|
39 |
+
if ($request->getLimitMethod()) {
|
40 |
+
$r->setService($request->getLimitMethod());
|
41 |
+
}
|
42 |
+
|
43 |
+
$storeId = Mage::app()->getStore()->getId();
|
44 |
+
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
|
45 |
+
|
46 |
+
$store = new Mage_Adminhtml_Model_System_Store();
|
47 |
+
$storeName = strtolower($store->getStoreName($storeId));
|
48 |
+
|
49 |
+
unset($store, $storeId, $websiteId);
|
50 |
+
|
51 |
+
$r->setOrigName($storeName);
|
52 |
+
|
53 |
+
$r->setUsername($this->getConfigData('username'));
|
54 |
+
$r->setPassword($this->getConfigData('password'));
|
55 |
+
|
56 |
+
if ($request->getFreightquotePackaging()) {
|
57 |
+
$packaging = $request->getFreightquotePackaging();
|
58 |
+
}
|
59 |
+
|
60 |
+
//$r->setPackaging($packaging);
|
61 |
+
$r->setServiceType($this->getConfigData('service_type'));
|
62 |
+
|
63 |
+
$r->setOrigLocationType($this->getConfigData('origin_location_type'));
|
64 |
+
$r->setOrigLiftgate(($this->getConfigData('origin_liftgate') == 1 ? 'true' : 'false'));
|
65 |
+
|
66 |
+
$r->setDestLocationType($this->getConfigData('destination_location_type'));
|
67 |
+
$r->setDestLiftgate(($this->getConfigData('destination_liftgate') == 1 ? 'true' : 'false'));
|
68 |
+
|
69 |
+
$r->setOrigName(Mage::getStoreConfig('design/head/default_title'));
|
70 |
+
if ($request->getOrigPostcode()) {
|
71 |
+
$r->setOrigPostcode($request->getOrigPostcode());
|
72 |
+
} else {
|
73 |
+
$r->setOrigPostcode(Mage::getStoreConfig('shipping/origin/postcode', $this->getStore()));
|
74 |
+
}
|
75 |
+
|
76 |
+
if ($request->getOrigCountry()) {
|
77 |
+
$origCountry = $request->getOrigCountry();
|
78 |
+
} else {
|
79 |
+
$origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
|
80 |
+
}
|
81 |
+
$r->setOrigCountry(Mage::getModel('directory/country')->load($origCountry)->getIso2Code());
|
82 |
+
|
83 |
+
$r->setOrigDock(($this->getConfigData('origin_dock') ? 'true' : 'false'));
|
84 |
+
$r->setOrigConstruction(($this->getConfigData('origin_construction') ? 'true' : 'false'));
|
85 |
+
$r->setOrigResidence(($this->getConfigData('origin_residence') ? 'true' : 'false'));
|
86 |
+
|
87 |
+
|
88 |
+
if ($request->getDestCountryId()) {
|
89 |
+
$destCountry = $request->getDestCountryId();
|
90 |
+
} else {
|
91 |
+
$destCountry = self::USA_COUNTRY_ID;
|
92 |
+
}
|
93 |
+
|
94 |
+
$r->setDestCountry($destCountry);
|
95 |
+
|
96 |
+
if ($request->getDestPostcode()) {
|
97 |
+
if ($destCountry == 'US') {
|
98 |
+
$destPostcode = preg_replace('/[^0-9]/', '', $request->getDestPostcode());
|
99 |
+
$destPostcode = substr($destPostcode, 0, 5);
|
100 |
+
} elseif ($destCountry == 'CA') {
|
101 |
+
$destPostcode = preg_replace('/[^0-9A-Z]/', '', strtoupper($request->getDestPostcode()));
|
102 |
+
$destPostcode = substr($destPostcode, 0, 6);
|
103 |
+
}
|
104 |
+
$r->setDestPostcode($destPostcode);
|
105 |
+
} else {
|
106 |
+
Mage::log('Freightquote.com Shipping Module missing destination postcode.');
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
|
110 |
+
$r->setDestResidence(($this->getConfigData('destination_residence') == 1 ? 'true' : 'false'));
|
111 |
+
$r->setDestConstruction(($this->getConfigData('destination_construction') == 1 ? 'true' : 'false'));
|
112 |
+
$r->setDestDock(($this->getConfigData('destination_dock') == 1 ? 'true' : 'false'));
|
113 |
+
|
114 |
+
$weight = $this->getTotalNumOfBoxes($request->getPackageWeight());
|
115 |
+
$r->setWeight($weight);
|
116 |
+
|
117 |
+
if ($request->getFreeMethodWeight()!= $request->getPackageWeight()) {
|
118 |
+
$r->setFreeMethodWeight($request->getFreeMethodWeight());
|
119 |
+
}
|
120 |
+
|
121 |
+
$r->setValue($request->getPackageValue());
|
122 |
+
$r->setValueWithDiscount($request->getPackageValueWithDiscount());
|
123 |
+
|
124 |
+
return $r;
|
125 |
+
}
|
126 |
+
|
127 |
+
protected function _getQuotes() {
|
128 |
+
$r =& $this->_request;
|
129 |
+
|
130 |
+
$customerName = trim(Mage::getSingleton('customer/session')->getCustomer()->getName());
|
131 |
+
|
132 |
+
/* Set up initial XML structure */
|
133 |
+
$requestXml = array(
|
134 |
+
'GetRatingEngineQuote' => array(
|
135 |
+
'request' => array(
|
136 |
+
'CustomerId' => (int)$r->getUserId(),
|
137 |
+
'QuoteType' => 'B2B',
|
138 |
+
'ServiceType' => $r->getServiceType(),
|
139 |
+
'QuoteShipment' => array(
|
140 |
+
'ShipmentLabel' => $this->getConfigData('shipment_label'),
|
141 |
+
'IsBlind' => ($this->getConfigData('blind_ship') ? 'true' : 'false'),
|
142 |
+
'ShipmentLocations' => array(
|
143 |
+
'Location' => array(
|
144 |
+
array(
|
145 |
+
'LocationName' => $r->getOrigName(),
|
146 |
+
'LocationType' => $r->getOrigLocationType(),
|
147 |
+
'HasLoadingDock' => $r->getOrigDock(),
|
148 |
+
'RequiresLiftgate' => $r->getOrigLiftgate(),
|
149 |
+
'IsConstructionSite' => $r->getOrigConstruction(),
|
150 |
+
'IsResidential' => $r->getOrigResidence(),
|
151 |
+
'LocationAddress' => array(
|
152 |
+
'PostalCode' => $r->getOrigPostcode(),
|
153 |
+
'CountryCode' => $r->getOrigCountry()
|
154 |
+
)
|
155 |
+
),
|
156 |
+
array(
|
157 |
+
'LocationName' => ($customerName == '' ? 'Guest' : $customerName),
|
158 |
+
'LocationType' => $r->getDestLocationType(),
|
159 |
+
'HasLoadingDock' => $r->getDestDock(),
|
160 |
+
'RequiresLiftgate' => $r->getDestLiftgate(),
|
161 |
+
'IsConstructionSite' => $r->getDestConstruction(),
|
162 |
+
'IsResidential' => $r->getDestResidence(),
|
163 |
+
'LocationAddress' => array(
|
164 |
+
'PostalCode' => $r->getDestPostcode(),
|
165 |
+
'CountryCode' => $r->getDestCountry()
|
166 |
+
)
|
167 |
+
)
|
168 |
+
)
|
169 |
+
),
|
170 |
+
'ShipmentProducts' => array(
|
171 |
+
'Product' => array()
|
172 |
+
)
|
173 |
+
)
|
174 |
+
),
|
175 |
+
'user' => array(
|
176 |
+
'Name' => $r->getUsername(),
|
177 |
+
'Password' => $r->getPassword()
|
178 |
+
)
|
179 |
+
)
|
180 |
+
);
|
181 |
+
|
182 |
+
/* Process cart items */
|
183 |
+
$cartItems = Mage::getModel('checkout/session')->getQuote()->getAllItems();
|
184 |
+
$shipmentProducts = array();
|
185 |
+
$counter = 1;
|
186 |
+
$excluded = 0;
|
187 |
+
|
188 |
+
foreach ($cartItems as $item) {
|
189 |
+
$product = $item->getProduct();
|
190 |
+
|
191 |
+
if ($product->getData('freightquote_enable') == 1) {
|
192 |
+
$shipmentProducts[] = array(
|
193 |
+
'Class' => $product->getData('freightquote_class'),
|
194 |
+
'ProductDescription' => $item->getName(),
|
195 |
+
'Weight' => ceil($item->getQty() * (int)$item->getWeight()),
|
196 |
+
'Length' => ceil($product->getData('freightquote_length')),
|
197 |
+
'Width' => ceil($product->getData('freightquote_width')),
|
198 |
+
'Height' => ceil($product->getData('freightquote_height')),
|
199 |
+
'PackageType' => ($product->getData('freightquote_packaging') ? $product->getData('freightquote_packaging') : 'Boxes'),
|
200 |
+
'DeclaredValue' => round($item->getPrice()),
|
201 |
+
'CommodityType' => ($product->getData('freightquote_commodity') ? $product->getData('freightquote_commodity') : 'GeneralMerchandise'),
|
202 |
+
'ContentType' => ($product->getData('freightquote_content') ? $product->getData('freightquote_content') : 'NewCommercialGoods'),
|
203 |
+
'IsHazardousMaterial' => ($product->getData('freightquote_hzmt') == 1 ? 'true' : 'false'),
|
204 |
+
'NMFC' => $product->getData('freightquote_nmfc'),
|
205 |
+
'PieceCount' => $item->getQty(),
|
206 |
+
'ItemNumber' => $counter
|
207 |
+
);
|
208 |
+
$counter++;
|
209 |
+
} else {
|
210 |
+
$excluded++;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
$totalProducts = count($shipmentProducts);
|
215 |
+
|
216 |
+
/* Don't continue if there are no valid products */
|
217 |
+
if ($totalProducts < 1) {
|
218 |
+
return false;
|
219 |
+
}
|
220 |
+
|
221 |
+
/* Maximum 6 products allowed per query, so repeat the query multiple times if necessary */
|
222 |
+
$responses = array();
|
223 |
+
|
224 |
+
/* Only 6 items allowed per query */
|
225 |
+
for ($x = 0; $x < $totalProducts; $x+=6) {
|
226 |
+
$productRequest = array();
|
227 |
+
|
228 |
+
for ($n = 1; $n <= 6; $n++) {
|
229 |
+
$ret = ($n + $x) - 1;
|
230 |
+
if (isset($shipmentProducts[$ret])) {
|
231 |
+
$productRequest[] = $shipmentProducts[$ret];
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
$requestXml['GetRatingEngineQuote']['request']['QuoteShipment']['ShipmentProducts']['Product'] = $productRequest;
|
236 |
+
|
237 |
+
$response = $this->_executeRequest($requestXml);
|
238 |
+
|
239 |
+
if (!$response) {
|
240 |
+
Mage::log('Freightquote.com: Invalid response from Freightquote.com');
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
|
244 |
+
if (isset($response['GetRatingEngineQuoteResponse'])) {
|
245 |
+
$responses[] = $response['GetRatingEngineQuoteResponse'][0]['GetRatingEngineQuoteResult'][0];
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
$totalShippingPrice = array(
|
250 |
+
'rate' => 0,
|
251 |
+
'shipment_id' => ''
|
252 |
+
);
|
253 |
+
|
254 |
+
$errors = array();
|
255 |
+
|
256 |
+
foreach ($responses as $quote) {
|
257 |
+
|
258 |
+
|
259 |
+
if (@is_array($quote['QuoteCarrierOptions'])) {
|
260 |
+
if ($totalShippingPrice['shipment_id'] != '') $totalShippingPrice['shipment_id'] .= ' & ';
|
261 |
+
$totalShippingPrice['shipment_id'] .= $quote['QuoteId'];
|
262 |
+
|
263 |
+
$totalShippingPrice['rate'] += preg_replace('/[^0-9\.]/', '', $quote['QuoteCarrierOptions'][0]['CarrierOption'][0]['QuoteAmount']);
|
264 |
+
} elseif (@count($quote['ValidationErrors']) > 0) {
|
265 |
+
foreach ($quote['ValidationErrors'][0]['B2BError'] as $errorMsg) {
|
266 |
+
|
267 |
+
if ($this->getConfigData('debug')){
|
268 |
+
Mage::log('Freightquote.com - response: ' . $errorMsg['ErrorMessage']);
|
269 |
+
}
|
270 |
+
|
271 |
+
$errors[] = $errorMsg['ErrorMessage'];
|
272 |
+
}
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
/* If there are any validation errors, don't display this shipping option */
|
277 |
+
if (count($errors) > 0) {
|
278 |
+
Mage::log('Freightquote.com: Validation errors. No rate was returned.');
|
279 |
+
return false;
|
280 |
+
}
|
281 |
+
|
282 |
+
|
283 |
+
/* If the shipping price is 0 and no errors were returned, don't display this shipping option */
|
284 |
+
if ($totalShippingPrice['rate'] <= 0 && count($errors) < 1) {
|
285 |
+
Mage::log('Freightquote.com: Total shipping price returned was 0');
|
286 |
+
return false;
|
287 |
+
}
|
288 |
+
|
289 |
+
//Add price modifier
|
290 |
+
if ($this->getConfigData('rate_modifier') > 0) {
|
291 |
+
$totalShippingPrice['rate'] = $totalShippingPrice['rate'] * $this->getConfigData('rate_modifier');
|
292 |
+
}
|
293 |
+
|
294 |
+
//Add handling charges
|
295 |
+
if ($this->getConfigData('handling_fee') > 0) {
|
296 |
+
if ($this->getConfigData('handling_action') == 'O') {
|
297 |
+
$totalShippingPrice['rate'] += $this->getConfigData('handling_fee');
|
298 |
+
} elseif ($this->getConfigData('handling_action') == 'P') {
|
299 |
+
$totalShippingPrice['rate'] += $this->getConfigData('handling_fee') * $totalProducts;
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
$this->_result = Mage::getModel('shipping/rate_result');
|
304 |
+
|
305 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
306 |
+
$method->setCarrier($this->_code);
|
307 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
308 |
+
$method->setMethod('default');
|
309 |
+
$method->setMethodTitle('Quote #: ' . $totalShippingPrice['shipment_id']);
|
310 |
+
$method->setPrice($totalShippingPrice['rate']);
|
311 |
+
|
312 |
+
$this->_result->append($method);
|
313 |
+
|
314 |
+
return true;
|
315 |
+
}
|
316 |
+
|
317 |
+
protected function _executeRequest($arr) {
|
318 |
+
//Make sure cURL exists
|
319 |
+
if (!function_exists('curl_init')) {
|
320 |
+
Mage::log('Freightquote.com: cURL not found on the server.');
|
321 |
+
return false;
|
322 |
+
}
|
323 |
+
|
324 |
+
//XML template file used for request
|
325 |
+
$xml = $this->_arrayToXml($arr);
|
326 |
+
|
327 |
+
//Initialize curl
|
328 |
+
$ch = curl_init();
|
329 |
+
|
330 |
+
$headers = array(
|
331 |
+
'Content-Type: text/xml; charset=utf-8',
|
332 |
+
'Content-Length: ' . strlen($xml),
|
333 |
+
'SOAPAction: "http://tempuri.org/GetRatingEngineQuote"'
|
334 |
+
);
|
335 |
+
|
336 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
337 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
338 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
339 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
|
340 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
341 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
342 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
343 |
+
curl_setopt($ch, CURLOPT_URL, $this->_gatewayUrl);
|
344 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
|
345 |
+
|
346 |
+
$this->_response = curl_exec($ch);
|
347 |
+
|
348 |
+
if ($this->getConfigData('debug')){
|
349 |
+
Mage::log('Freightquote.com request: ' . $xml);
|
350 |
+
Mage::log('Freightquote.com response: ' . $this->_response);
|
351 |
+
}
|
352 |
+
|
353 |
+
if (curl_errno($ch) == 0) {
|
354 |
+
curl_close($ch);
|
355 |
+
|
356 |
+
//Simple check to make sure that this is a valid XML response
|
357 |
+
if (strpos(strtolower($this->_response), 'soap:envelope') === false) {
|
358 |
+
Mage::log('Freightquote.com: Invalid response from server.');
|
359 |
+
return false;
|
360 |
+
}
|
361 |
+
|
362 |
+
if ($this->_response) {
|
363 |
+
//Convert the XML into an easy-to-use associative array
|
364 |
+
$this->_response = $this->_parseXml($this->_response);
|
365 |
+
}
|
366 |
+
|
367 |
+
return $this->_response;
|
368 |
+
} else {
|
369 |
+
//Collect the error returned
|
370 |
+
$curlErrors = curl_error($ch) . ' (Error No. ' . curl_errno($ch) . ')';
|
371 |
+
|
372 |
+
curl_close($ch);
|
373 |
+
|
374 |
+
Mage::log('Freightquote.com: ' . $curlErrors);
|
375 |
+
return false;
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
protected function _getPickupDate() {
|
380 |
+
$nextDate = date("U")+86400;
|
381 |
+
|
382 |
+
$workDay = date("w", $nextDate);
|
383 |
+
|
384 |
+
if ($workDay > 0 && $workDay < 6) {
|
385 |
+
while ($this->_isHoliday($nextDate)) {
|
386 |
+
$nextDate += 86400;
|
387 |
+
$workDay = date("w", $nextDate);
|
388 |
+
}
|
389 |
+
return date(DATE_ATOM, $nextDate);
|
390 |
+
} else {
|
391 |
+
while ($workDay < 1 || $workDay > 5) {
|
392 |
+
$nextDate += 86400;
|
393 |
+
$workDay = date("w", $nextDate);
|
394 |
+
if ($workDay > 0 && $workDay < 6) {
|
395 |
+
while ($this->_isHoliday($nextDate)) {
|
396 |
+
$nextDate += 86400;
|
397 |
+
$workDay = date("w", $nextDate);
|
398 |
+
}
|
399 |
+
return date(DATE_ATOM, $nextDate);
|
400 |
+
}
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
protected function _isHoliday($date) {
|
406 |
+
$fed_holidays = array(
|
407 |
+
"2010-01-01", "2010-01-18", "2010-02-15", "2010-05-31",
|
408 |
+
"2010-07-05", "2010-09-06", "2010-10-11", "2010-11-11",
|
409 |
+
"2010-11-25", "2010-12-24",
|
410 |
+
|
411 |
+
"2010-12-31", "2011-01-17", "2011-02-21", "2011-05-30",
|
412 |
+
"2011-07-04", "2011-09-05", "2011-10-10", "2011-11-11",
|
413 |
+
"2011-11-24", "2011-12-26",
|
414 |
+
|
415 |
+
"2012-01-02", "2012-01-16", "2012-02-20", "2012-05-28",
|
416 |
+
"2012-07-04", "2012-09-03", "2012-10-08", "2012-11-12",
|
417 |
+
"2012-11-22", "2012-12-25"
|
418 |
+
);
|
419 |
+
|
420 |
+
if (in_array(date("Y-m-d", $date), $fed_holidays)) {
|
421 |
+
return true;
|
422 |
+
}
|
423 |
+
|
424 |
+
return false;
|
425 |
+
}
|
426 |
+
|
427 |
+
protected function _arrayToXml($array, $wrapper = true) {
|
428 |
+
$xml = '';
|
429 |
+
|
430 |
+
if ($wrapper) {
|
431 |
+
$xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n" .
|
432 |
+
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n" .
|
433 |
+
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' . "\n" .
|
434 |
+
'<soap:Body>' . "\n";
|
435 |
+
}
|
436 |
+
|
437 |
+
$first_key = true;
|
438 |
+
|
439 |
+
foreach ($array as $key => $value) {
|
440 |
+
$position = 0;
|
441 |
+
|
442 |
+
if (is_array($value)) {
|
443 |
+
$is_value_assoc = $this->_isAssoc($value);
|
444 |
+
$xml .= "<$key" . ($first_key && $wrapper ? ' xmlns="http://tempuri.org/"' : '') . ">\n";
|
445 |
+
$first_key = false;
|
446 |
+
|
447 |
+
foreach ($value as $key2 => $value2) {
|
448 |
+
if (is_array($value2)) {
|
449 |
+
if ($is_value_assoc) {
|
450 |
+
$xml .= "<$key2>\n" . $this->_arrayToXml($value2, false) . "</$key2>\n";
|
451 |
+
} elseif (is_array($value2)) {
|
452 |
+
$xml .= $this->_arrayToXml($value2, false);
|
453 |
+
$position++;
|
454 |
+
|
455 |
+
if ($position < count($value) && count($value) > 1) $xml .= "</$key>\n<$key>\n";
|
456 |
+
}
|
457 |
+
} else {
|
458 |
+
$xml .= "<$key2>" . $this->_xmlSafe($value2) . "</$key2>\n";
|
459 |
+
}
|
460 |
+
}
|
461 |
+
$xml .= "</$key>\n";
|
462 |
+
} else {
|
463 |
+
|
464 |
+
$xml .= "<$key>" . $this->_xmlSafe($value) . "</$key>\n";
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
if ($wrapper) {
|
469 |
+
$xml .= '</soap:Body>' . "\n" .
|
470 |
+
'</soap:Envelope>';
|
471 |
+
}
|
472 |
+
|
473 |
+
return $xml;
|
474 |
+
}
|
475 |
+
|
476 |
+
protected function _isAssoc($array) {
|
477 |
+
return (is_array($array) && 0 !== count(array_diff_key($array, array_keys(array_keys($array)))));
|
478 |
+
}
|
479 |
+
|
480 |
+
protected function _parseXml($text) {
|
481 |
+
$reg_exp = '/<(\w+)[^>]*>(.*?)<\/\\1>/s';
|
482 |
+
preg_match_all($reg_exp, $text, $match);
|
483 |
+
foreach ($match[1] as $key=>$val) {
|
484 |
+
if ( preg_match($reg_exp, $match[2][$key]) ) {
|
485 |
+
$array[$val][] = $this->_parseXml($match[2][$key]);
|
486 |
+
} else {
|
487 |
+
$array[$val] = $match[2][$key];
|
488 |
+
}
|
489 |
+
}
|
490 |
+
return $array;
|
491 |
+
}
|
492 |
+
|
493 |
+
protected function _xmlSafe($str) {
|
494 |
+
//The 5 evil characters in XML
|
495 |
+
$str = str_replace('<', '<', $str);
|
496 |
+
$str = str_replace('>', '>', $str);
|
497 |
+
$str = str_replace('&', '&', $str);
|
498 |
+
$str = str_replace("'", ''', $str);
|
499 |
+
$str = str_replace('"', '"', $str);
|
500 |
+
|
501 |
+
return $str;
|
502 |
+
}
|
503 |
+
|
504 |
+
public function getCode($type, $code = '') {
|
505 |
+
$codes = array(
|
506 |
+
'classes' => array(
|
507 |
+
array('value' => '50', 'label' => '50'),
|
508 |
+
array('value' => '55', 'label' => '55'),
|
509 |
+
array('value' => '60', 'label' => '60'),
|
510 |
+
array('value' => '65', 'label' => '65'),
|
511 |
+
array('value' => '70', 'label' => '70'),
|
512 |
+
array('value' => '77.5', 'label' => '77.5'),
|
513 |
+
array('value' => '85', 'label' => '85'),
|
514 |
+
array('value' => '92.5', 'label' => '92.5'),
|
515 |
+
array('value' => '100', 'label' => '100'),
|
516 |
+
array('value' => '110', 'label' => '110'),
|
517 |
+
array('value' => '125', 'label' => '125'),
|
518 |
+
array('value' => '150', 'label' => '150'),
|
519 |
+
array('value' => '175', 'label' => '175'),
|
520 |
+
array('value' => '200', 'label' => '200'),
|
521 |
+
array('value' => '250', 'label' => '250'),
|
522 |
+
array('value' => '300', 'label' => '300'),
|
523 |
+
array('value' => '400', 'label' => '400'),
|
524 |
+
array('value' => '500', 'label' => '500')
|
525 |
+
),
|
526 |
+
|
527 |
+
'packaging' => array(
|
528 |
+
array('value' => 'Bags', 'label' => 'Bags'),
|
529 |
+
array('value' => 'Bales', 'label' => 'Bales'),
|
530 |
+
array('value' => 'Boxes', 'label' => 'Boxes'),
|
531 |
+
array('value' => 'Bundles', 'label' => 'Bundles'),
|
532 |
+
array('value' => 'Carpets', 'label' => 'Carpets'),
|
533 |
+
array('value' => 'Coils', 'label' => 'Coils'),
|
534 |
+
array('value' => 'Crates', 'label' => 'Crates'),
|
535 |
+
array('value' => 'Cylinders', 'label' => 'Cylinders'),
|
536 |
+
array('value' => 'Drums', 'label' => 'Drums'),
|
537 |
+
array('value' => 'Pails', 'label' => 'Pails'),
|
538 |
+
array('value' => 'Reels', 'label' => 'Reels'),
|
539 |
+
array('value' => 'Rolls', 'label' => 'Rolls'),
|
540 |
+
array('value' => 'TubesPipes', 'label' => 'Tubes/Pipes'),
|
541 |
+
array('value' => 'Motorcycle', 'label' => 'Motorcycle'),
|
542 |
+
array('value' => 'ATV', 'label' => 'ATV'),
|
543 |
+
array('value' => 'Pallets_48x40', 'label' => 'Pallets 48x40'),
|
544 |
+
array('value' => 'Pallets_other', 'label' => 'Pallets Other'),
|
545 |
+
array('value' => 'Pallets_120x120', 'label' => 'Pallets 120x120'),
|
546 |
+
array('value' => 'Pallets_120x100', 'label' => 'Pallets 120x100'),
|
547 |
+
array('value' => 'Pallets_120x80', 'label' => 'Pallets 120x80'),
|
548 |
+
array('value' => 'Pallets_europe', 'label' => 'Pallets Europe'),
|
549 |
+
array('value' => 'Pallets_48x48', 'label' => 'Pallets 48x48'),
|
550 |
+
array('value' => 'Pallets_60x48', 'label' => 'Pallets 60x48')
|
551 |
+
),
|
552 |
+
|
553 |
+
'commodities' => array(
|
554 |
+
array('value' => 'GeneralMerchandise', 'label' => 'General Merchandise'),
|
555 |
+
array('value' => 'Machinery', 'label' => 'Machinery'),
|
556 |
+
array('value' => 'HouseholdGoods', 'label' => 'Household Goods'),
|
557 |
+
array('value' => 'FragileGoods', 'label' => 'Fragile Goods'),
|
558 |
+
array('value' => 'ComputerHardware', 'label' => 'Computer Hardware'),
|
559 |
+
array('value' => 'BottledProducts', 'label' => 'Bottled Products'),
|
560 |
+
array('value' => 'BottleBeverages', 'label' => 'Bottle Beverages'),
|
561 |
+
array('value' => 'NonPerishableFood', 'label' => 'Non Perishable Food'),
|
562 |
+
array('value' => 'SteelSheet', 'label' => 'Steel Sheet'),
|
563 |
+
array('value' => 'BrandedGoods', 'label' => 'Branded Goods'),
|
564 |
+
array('value' => 'PrecisionInstruments', 'label' => 'Precision Instruments'),
|
565 |
+
array('value' => 'ChemicalsHazardous', 'label' => 'Chemicals Hazardous'),
|
566 |
+
array('value' => 'FineArt', 'label' => 'Fine Art'),
|
567 |
+
array('value' => 'Automobiles', 'label' => 'Automobiles'),
|
568 |
+
array('value' => 'CellPhones', 'label' => 'Cell Phones'),
|
569 |
+
array('value' => 'NewMachinery', 'label' => 'New Machinery'),
|
570 |
+
array('value' => 'UsedMachinery', 'label' => 'Used Machinery'),
|
571 |
+
array('value' => 'HotTubs', 'label' => 'Hot Tubs')
|
572 |
+
),
|
573 |
+
|
574 |
+
'contents' => array(
|
575 |
+
array('value' => 'NewCommercialGoods', 'label' => 'New Commercial Goods'),
|
576 |
+
array('value' => 'UsedCommercialGoods', 'label' => 'Used Commercial Goods'),
|
577 |
+
array('value' => 'HouseholdGoods', 'label' => 'Household Goods'),
|
578 |
+
array('value' => 'FragileGoods', 'label' => 'Fragile Goods'),
|
579 |
+
array('value' => 'Automobile', 'label' => 'Automobile'),
|
580 |
+
array('value' => 'Motorcycle', 'label' => 'Motorcycle'),
|
581 |
+
array('value' => 'AutoOrMotorcycle', 'label' => 'Auto or Motorcycle')
|
582 |
+
),
|
583 |
+
|
584 |
+
'location_type' => array(
|
585 |
+
array('value' => 'Origin', 'label' => 'Origin'),
|
586 |
+
array('value' => 'Destination', 'label' => 'Destination'),
|
587 |
+
array('value' => 'StopoffPickupDelivery', 'label' => 'Stopoff Pickup Delivery'),
|
588 |
+
array('value' => 'StopoffDelivery', 'label' => 'Stopoff Delivery'),
|
589 |
+
array('value' => 'StopoffPickup', 'label' => 'Stopoff Pickup'),
|
590 |
+
),
|
591 |
+
|
592 |
+
'service_type' => array(
|
593 |
+
array('value' => 'LTL', 'label' => 'LTL'),
|
594 |
+
array('value' => 'Truckload', 'label' => 'Truckload')
|
595 |
+
//array('value' => 'Europe', 'label' => 'Europe'),
|
596 |
+
//array('value' => 'Groupage', 'label' => 'Groupage'),
|
597 |
+
//array('value' => 'Haulage', 'label' => 'Haulage')
|
598 |
+
)
|
599 |
+
);
|
600 |
+
|
601 |
+
if (!isset($codes[$type])) {
|
602 |
+
return false;
|
603 |
+
} elseif ('' === $code) {
|
604 |
+
return $codes[$type];
|
605 |
+
}
|
606 |
+
|
607 |
+
if (!isset($codes[$type][$code])) {
|
608 |
+
return false;
|
609 |
+
} else {
|
610 |
+
return $codes[$type][$code];
|
611 |
+
}
|
612 |
+
}
|
613 |
+
}
|
614 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Carrier/Source/Class.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Carrier_Source_Class extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
|
11 |
+
public function toOptionArray() {
|
12 |
+
$freightquote = Mage::getSingleton('freightquote/carrier_shipping');
|
13 |
+
|
14 |
+
$arr = $freightquote->getCode('classes');
|
15 |
+
|
16 |
+
return $arr;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getAllOptions() {
|
20 |
+
return $this->toOptionArray();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Carrier/Source/Commodity.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Carrier_Source_Commodity extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
|
11 |
+
public function toOptionArray() {
|
12 |
+
$freightquote = Mage::getSingleton('freightquote/carrier_shipping');
|
13 |
+
|
14 |
+
$arr = $freightquote->getCode('commodities');
|
15 |
+
|
16 |
+
return $arr;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getAllOptions() {
|
20 |
+
return $this->toOptionArray();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Carrier/Source/Content.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Carrier_Source_Content extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
|
11 |
+
public function toOptionArray() {
|
12 |
+
$freightquote = Mage::getSingleton('freightquote/carrier_shipping');
|
13 |
+
|
14 |
+
$arr = $freightquote->getCode('contents');
|
15 |
+
|
16 |
+
return $arr;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getAllOptions() {
|
20 |
+
return $this->toOptionArray();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Carrier/Source/Locationtype.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Carrier_Source_Locationtype extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
|
11 |
+
public function toOptionArray() {
|
12 |
+
$freightquote = Mage::getSingleton('freightquote/carrier_shipping');
|
13 |
+
|
14 |
+
$arr = $freightquote->getCode('location_type');
|
15 |
+
|
16 |
+
return $arr;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getAllOptions() {
|
20 |
+
return $this->toOptionArray();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Carrier/Source/Packaging.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Carrier_Source_Packaging extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
|
11 |
+
public function toOptionArray() {
|
12 |
+
$freightquote = Mage::getSingleton('freightquote/carrier_shipping');
|
13 |
+
|
14 |
+
$arr = $freightquote->getCode('packaging');
|
15 |
+
|
16 |
+
return $arr;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getAllOptions() {
|
20 |
+
return $this->toOptionArray();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Carrier/Source/Servicetype.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Carrier_Source_Servicetype extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
|
11 |
+
public function toOptionArray() {
|
12 |
+
$freightquote = Mage::getSingleton('freightquote/carrier_shipping');
|
13 |
+
|
14 |
+
$arr = $freightquote->getCode('service_type');
|
15 |
+
|
16 |
+
return $arr;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getAllOptions() {
|
20 |
+
return $this->toOptionArray();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Freightquote/Shipping/Model/Resource/Eav/Mysql4/Setup.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Freightquote_Shipping_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {
|
11 |
+
|
12 |
+
public function getDefaultEntities() {
|
13 |
+
return array(
|
14 |
+
'catalog_product' => array(
|
15 |
+
'entity_model' => 'catalog/product',
|
16 |
+
'attribute_model' => 'catalog/resource_eav_attribute',
|
17 |
+
'table' => 'catalog/product',
|
18 |
+
'additional_attribute_table' => 'catalog/eav_attribute',
|
19 |
+
'entity_attribute_collection' => 'catalog/product_attribute_collection',
|
20 |
+
'attributes' => array(
|
21 |
+
'freightquote_enable' => array(
|
22 |
+
'group' => 'Freightquote.com',
|
23 |
+
'type' => 'int',
|
24 |
+
'backend' => '',
|
25 |
+
'frontend' => '',
|
26 |
+
'label' => 'Ship with Freightquote.com',
|
27 |
+
'input' => 'select',
|
28 |
+
'class' => '',
|
29 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
30 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
31 |
+
'visible' => true,
|
32 |
+
'required' => true,
|
33 |
+
'user_defined' => false,
|
34 |
+
'default' => '0',
|
35 |
+
'searchable' => false,
|
36 |
+
'filterable' => false,
|
37 |
+
'comparable' => false,
|
38 |
+
'visible_on_front' => false,
|
39 |
+
'unique' => false,
|
40 |
+
'apply_to' => 'simple'
|
41 |
+
),
|
42 |
+
'freightquote_class' => array(
|
43 |
+
'group' => 'Freightquote.com',
|
44 |
+
'type' => 'varchar',
|
45 |
+
'backend' => '',
|
46 |
+
'frontend' => '',
|
47 |
+
'label' => 'Freight Class',
|
48 |
+
'input' => 'select',
|
49 |
+
'class' => '',
|
50 |
+
'source' => 'Freightquote_Shipping_Model_Carrier_Source_Class',
|
51 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
52 |
+
'visible' => true,
|
53 |
+
'required' => true,
|
54 |
+
'user_defined' => false,
|
55 |
+
'default' => '50',
|
56 |
+
'searchable' => false,
|
57 |
+
'filterable' => false,
|
58 |
+
'comparable' => false,
|
59 |
+
'visible_on_front' => false,
|
60 |
+
'unique' => false,
|
61 |
+
'apply_to' => 'simple'
|
62 |
+
),
|
63 |
+
'freightquote_length' => array(
|
64 |
+
'group' => 'Freightquote.com',
|
65 |
+
'type' => 'int',
|
66 |
+
'backend' => '',
|
67 |
+
'frontend' => '',
|
68 |
+
'label' => 'Length (inches)',
|
69 |
+
'input' => 'text',
|
70 |
+
'width' => '50',
|
71 |
+
'class' => '',
|
72 |
+
'source' => '',
|
73 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
74 |
+
'visible' => true,
|
75 |
+
'required' => true,
|
76 |
+
'user_defined' => false,
|
77 |
+
'default' => '0',
|
78 |
+
'searchable' => false,
|
79 |
+
'filterable' => false,
|
80 |
+
'comparable' => false,
|
81 |
+
'visible_on_front' => false,
|
82 |
+
'unique' => false,
|
83 |
+
'apply_to' => 'simple'
|
84 |
+
),
|
85 |
+
'freightquote_width' => array(
|
86 |
+
'group' => 'Freightquote.com',
|
87 |
+
'type' => 'int',
|
88 |
+
'backend' => '',
|
89 |
+
'frontend' => '',
|
90 |
+
'label' => 'Width (inches)',
|
91 |
+
'input' => 'text',
|
92 |
+
'class' => '',
|
93 |
+
'source' => '',
|
94 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
95 |
+
'visible' => true,
|
96 |
+
'required' => true,
|
97 |
+
'user_defined' => false,
|
98 |
+
'default' => '0',
|
99 |
+
'searchable' => false,
|
100 |
+
'filterable' => false,
|
101 |
+
'comparable' => false,
|
102 |
+
'visible_on_front' => false,
|
103 |
+
'unique' => false,
|
104 |
+
'apply_to' => 'simple'
|
105 |
+
),
|
106 |
+
'freightquote_height' => array(
|
107 |
+
'group' => 'Freightquote.com',
|
108 |
+
'type' => 'int',
|
109 |
+
'backend' => '',
|
110 |
+
'frontend' => '',
|
111 |
+
'label' => 'Height (inches)',
|
112 |
+
'input' => 'text',
|
113 |
+
'class' => '',
|
114 |
+
'source' => '',
|
115 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
116 |
+
'visible' => true,
|
117 |
+
'required' => true,
|
118 |
+
'user_defined' => false,
|
119 |
+
'default' => '0',
|
120 |
+
'searchable' => false,
|
121 |
+
'filterable' => false,
|
122 |
+
'comparable' => false,
|
123 |
+
'visible_on_front' => false,
|
124 |
+
'unique' => false,
|
125 |
+
'apply_to' => 'simple'
|
126 |
+
),
|
127 |
+
'freightquote_nmfc' => array(
|
128 |
+
'group' => 'Freightquote.com',
|
129 |
+
'type' => 'varchar',
|
130 |
+
'backend' => '',
|
131 |
+
'frontend' => '',
|
132 |
+
'label' => 'NMFC (optional)',
|
133 |
+
'input' => 'text',
|
134 |
+
'class' => '',
|
135 |
+
'source' => '',
|
136 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
137 |
+
'visible' => true,
|
138 |
+
'required' => false,
|
139 |
+
'user_defined' => false,
|
140 |
+
'default' => '',
|
141 |
+
'searchable' => false,
|
142 |
+
'filterable' => false,
|
143 |
+
'comparable' => false,
|
144 |
+
'visible_on_front' => false,
|
145 |
+
'unique' => false,
|
146 |
+
'apply_to' => 'simple'
|
147 |
+
),
|
148 |
+
'freightquote_hzmt' => array(
|
149 |
+
'group' => 'Freightquote.com',
|
150 |
+
'type' => 'int',
|
151 |
+
'backend' => '',
|
152 |
+
'frontend' => '',
|
153 |
+
'label' => 'Hazardous Material',
|
154 |
+
'input' => 'select',
|
155 |
+
'class' => '',
|
156 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
157 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
158 |
+
'visible' => true,
|
159 |
+
'required' => true,
|
160 |
+
'user_defined' => false,
|
161 |
+
'default' => '0',
|
162 |
+
'searchable' => false,
|
163 |
+
'filterable' => false,
|
164 |
+
'comparable' => false,
|
165 |
+
'visible_on_front' => false,
|
166 |
+
'unique' => false,
|
167 |
+
'apply_to' => 'simple'
|
168 |
+
),
|
169 |
+
'freightquote_packaging' => array(
|
170 |
+
'group' => 'Freightquote.com',
|
171 |
+
'type' => 'varchar',
|
172 |
+
'backend' => '',
|
173 |
+
'frontend' => '',
|
174 |
+
'label' => 'Packaging Type',
|
175 |
+
'input' => 'select',
|
176 |
+
'class' => '',
|
177 |
+
'source' => 'Freightquote_Shipping_Model_Carrier_Source_Packaging',
|
178 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
179 |
+
'visible' => true,
|
180 |
+
'required' => true,
|
181 |
+
'user_defined' => false,
|
182 |
+
'default' => 'Boxes',
|
183 |
+
'searchable' => false,
|
184 |
+
'filterable' => false,
|
185 |
+
'comparable' => false,
|
186 |
+
'visible_on_front' => false,
|
187 |
+
'unique' => false,
|
188 |
+
'apply_to' => 'simple'
|
189 |
+
),
|
190 |
+
'freightquote_commodity' => array(
|
191 |
+
'group' => 'Freightquote.com',
|
192 |
+
'type' => 'varchar',
|
193 |
+
'backend' => '',
|
194 |
+
'frontend' => '',
|
195 |
+
'label' => 'Commodity Type',
|
196 |
+
'input' => 'select',
|
197 |
+
'class' => '',
|
198 |
+
'source' => 'Freightquote_Shipping_Model_Carrier_Source_Commodity',
|
199 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
200 |
+
'visible' => true,
|
201 |
+
'required' => true,
|
202 |
+
'user_defined' => false,
|
203 |
+
'default' => 'GeneralMerchandise',
|
204 |
+
'searchable' => false,
|
205 |
+
'filterable' => false,
|
206 |
+
'comparable' => false,
|
207 |
+
'visible_on_front' => false,
|
208 |
+
'unique' => false,
|
209 |
+
'apply_to' => 'simple'
|
210 |
+
),
|
211 |
+
'freightquote_content' => array(
|
212 |
+
'group' => 'Freightquote.com',
|
213 |
+
'type' => 'varchar',
|
214 |
+
'backend' => '',
|
215 |
+
'frontend' => '',
|
216 |
+
'label' => 'Contents Type',
|
217 |
+
'input' => 'select',
|
218 |
+
'class' => '',
|
219 |
+
'source' => 'Freightquote_Shipping_Model_Carrier_Source_Content',
|
220 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
221 |
+
'visible' => true,
|
222 |
+
'required' => true,
|
223 |
+
'user_defined' => false,
|
224 |
+
'default' => 'NewCommercialGoods',
|
225 |
+
'searchable' => false,
|
226 |
+
'filterable' => false,
|
227 |
+
'comparable' => false,
|
228 |
+
'visible_on_front' => false,
|
229 |
+
'unique' => false,
|
230 |
+
'apply_to' => 'simple'
|
231 |
+
)
|
232 |
+
)
|
233 |
+
)
|
234 |
+
);
|
235 |
+
}
|
236 |
+
}
|
237 |
+
?>
|
app/code/community/Freightquote/Shipping/etc/config.xml
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Freightquote_Shipping>
|
12 |
+
<version>1.2.1</version>
|
13 |
+
</Freightquote_Shipping>
|
14 |
+
</modules>
|
15 |
+
<global>
|
16 |
+
<models>
|
17 |
+
<freightquote>
|
18 |
+
<class>Freightquote_Shipping_Model</class>
|
19 |
+
</freightquote>
|
20 |
+
</models>
|
21 |
+
<helpers>
|
22 |
+
<freightquote>
|
23 |
+
<class>Freightquote_Shipping_Helper</class>
|
24 |
+
</freightquote>
|
25 |
+
</helpers>
|
26 |
+
<resources>
|
27 |
+
<freightquote_setup>
|
28 |
+
<setup>
|
29 |
+
<module>Freightquote_Shipping</module>
|
30 |
+
<class>Freightquote_Shipping_Model_Resource_Eav_Mysql4_Setup</class>
|
31 |
+
</setup>
|
32 |
+
<connection>
|
33 |
+
<use>core_setup</use>
|
34 |
+
</connection>
|
35 |
+
</freightquote_setup>
|
36 |
+
<freightquote_write>
|
37 |
+
<connection>
|
38 |
+
<use>core_write</use>
|
39 |
+
</connection>
|
40 |
+
</freightquote_write>
|
41 |
+
<freightquote_read>
|
42 |
+
<connection>
|
43 |
+
<use>core_read</use>
|
44 |
+
</connection>
|
45 |
+
</freightquote_read>
|
46 |
+
</resources>
|
47 |
+
<sales>
|
48 |
+
<quote>
|
49 |
+
<item>
|
50 |
+
<product_attributes>
|
51 |
+
<freightquote_enable/>
|
52 |
+
<freightquote_class/>
|
53 |
+
<freightquote_length/>
|
54 |
+
<freightquote_width/>
|
55 |
+
<freightquote_height/>
|
56 |
+
<freightquote_nmfc/>
|
57 |
+
<freightquote_hzmt/>
|
58 |
+
<freightquote_packaging/>
|
59 |
+
<freightquote_commodity/>
|
60 |
+
<freightquote_content/>
|
61 |
+
</product_attributes>
|
62 |
+
</item>
|
63 |
+
</quote>
|
64 |
+
</sales>
|
65 |
+
</global>
|
66 |
+
<default>
|
67 |
+
<carriers>
|
68 |
+
<freightquote>
|
69 |
+
<active>1</active>
|
70 |
+
<sort_order>10</sort_order>
|
71 |
+
<model>Freightquote_Shipping_Model_Carrier_Shipping</model>
|
72 |
+
<title>Freightquote.com</title>
|
73 |
+
<username>jholland@freightquote.com</username>
|
74 |
+
<password>xana7798</password>
|
75 |
+
<shipment_label>Thank you for shopping with us!</shipment_label>
|
76 |
+
<origin_country>US</origin_country>
|
77 |
+
<origin_location_type>Origin</origin_location_type>
|
78 |
+
<destination_location_type>Destination</destination_location_type>
|
79 |
+
<rate_modifier>1</rate_modifier>
|
80 |
+
</freightquote>
|
81 |
+
</carriers>
|
82 |
+
</default>
|
83 |
+
</config>
|
app/code/community/Freightquote/Shipping/etc/system.xml
ADDED
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<sections>
|
11 |
+
<carriers>
|
12 |
+
<groups>
|
13 |
+
<freightquote translate="label" module="shipping">
|
14 |
+
<label>Freightquote.com</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>13</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<active translate="label">
|
22 |
+
<label>Enabled</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>0</show_in_store>
|
29 |
+
</active>
|
30 |
+
<title translate="label">
|
31 |
+
<label>Title</label>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
<comment>This is the shipping method title your customers will see.</comment>
|
38 |
+
</title>
|
39 |
+
<username translate="label">
|
40 |
+
<label>Username</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>3</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
<comment>Enter the e-mail address used to log into Freightquote.com.</comment>
|
47 |
+
</username>
|
48 |
+
<password translate="label">
|
49 |
+
<label>Password</label>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>4</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>0</show_in_store>
|
55 |
+
<comment>Enter the password used to log into Freightquote.com.</comment>
|
56 |
+
</password>
|
57 |
+
<shipment_label translate="label">
|
58 |
+
<label>Shipping Label</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>5</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
<comment>This can be used to assign a label to the shipment that will be meaningful to the end user.</comment>
|
65 |
+
</shipment_label>
|
66 |
+
<service_type translate="label">
|
67 |
+
<label>Service Type</label>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>Freightquote_Shipping_Model_Carrier_Source_Servicetype</source_model>
|
70 |
+
<sort_order>6</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>0</show_in_store>
|
74 |
+
<comment>Select the service type you will use for your shipments.</comment>
|
75 |
+
</service_type>
|
76 |
+
<origin_location_type translate="label">
|
77 |
+
<label><![CDATA[<b>ORIGIN:</b> Location Type]]></label>
|
78 |
+
<frontend_type>select</frontend_type>
|
79 |
+
<source_model>Freightquote_Shipping_Model_Carrier_Source_Locationtype</source_model>
|
80 |
+
<sort_order>7</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>0</show_in_store>
|
84 |
+
<comment>Choose the location type that best fits. (Recommended: "Origin")</comment>
|
85 |
+
</origin_location_type>
|
86 |
+
<origin_dock translate="label">
|
87 |
+
<label><![CDATA[<b>ORIGIN:</b> Loading Dock]]></label>
|
88 |
+
<frontend_type>select</frontend_type>
|
89 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
90 |
+
<sort_order>8</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>0</show_in_store>
|
94 |
+
<comment>Does your shipping location have a loading dock?</comment>
|
95 |
+
</origin_dock>
|
96 |
+
<origin_liftgate translate="label">
|
97 |
+
<label><![CDATA[<b>ORIGIN:</b> Liftgate Required?]]></label>
|
98 |
+
<frontend_type>select</frontend_type>
|
99 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
100 |
+
<sort_order>9</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>0</show_in_store>
|
104 |
+
<comment>Do you require a liftgate?</comment>
|
105 |
+
</origin_liftgate>
|
106 |
+
<origin_residence translate="label">
|
107 |
+
<label><![CDATA[<b>ORIGIN:</b> Residential]]></label>
|
108 |
+
<frontend_type>select</frontend_type>
|
109 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
110 |
+
<sort_order>10</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>1</show_in_website>
|
113 |
+
<show_in_store>0</show_in_store>
|
114 |
+
<comment>Is your shipping location a residence?</comment>
|
115 |
+
</origin_residence>
|
116 |
+
<origin_construction translate="label">
|
117 |
+
<label><![CDATA[<b>ORIGIN:</b> Construction Site]]></label>
|
118 |
+
<frontend_type>select</frontend_type>
|
119 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
120 |
+
<sort_order>11</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>0</show_in_store>
|
124 |
+
<comment>Is your shipping location a construction site?</comment>
|
125 |
+
</origin_construction>
|
126 |
+
<destination_location_type translate="label">
|
127 |
+
<label><![CDATA[<b>DESTINATION:</b> Location Type]]></label>
|
128 |
+
<frontend_type>select</frontend_type>
|
129 |
+
<source_model>Freightquote_Shipping_Model_Carrier_Source_Locationtype</source_model>
|
130 |
+
<sort_order>12</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>0</show_in_store>
|
134 |
+
<comment>Choose the location type that best fits. (Recommended: "Destination")</comment>
|
135 |
+
</destination_location_type>
|
136 |
+
<destination_dock translate="label">
|
137 |
+
<label><![CDATA[<b>DESTINATION:</b> Loading Dock]]></label>
|
138 |
+
<frontend_type>select</frontend_type>
|
139 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
140 |
+
<sort_order>13</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>0</show_in_store>
|
144 |
+
<comment>Do your recipients typically have loading docks?</comment>
|
145 |
+
</destination_dock>
|
146 |
+
<destination_liftgate translate="label">
|
147 |
+
<label><![CDATA[<b>DESTINATION:</b> Liftgate Required?]]></label>
|
148 |
+
<frontend_type>select</frontend_type>
|
149 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
150 |
+
<sort_order>14</sort_order>
|
151 |
+
<show_in_default>1</show_in_default>
|
152 |
+
<show_in_website>1</show_in_website>
|
153 |
+
<show_in_store>0</show_in_store>
|
154 |
+
<comment>Do your customers typically require a liftgate?</comment>
|
155 |
+
</destination_liftgate>
|
156 |
+
<destination_residence translate="label">
|
157 |
+
<label><![CDATA[<b>DESTINATION:</b> Residential]]></label>
|
158 |
+
<frontend_type>select</frontend_type>
|
159 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
160 |
+
<sort_order>15</sort_order>
|
161 |
+
<show_in_default>1</show_in_default>
|
162 |
+
<show_in_website>1</show_in_website>
|
163 |
+
<show_in_store>0</show_in_store>
|
164 |
+
<comment>Do you typically ship to residences? (Prices will be higher)</comment>
|
165 |
+
</destination_residence>
|
166 |
+
<destination_construction translate="label">
|
167 |
+
<label><![CDATA[<b>DESTINATION:</b> Construction Site]]></label>
|
168 |
+
<frontend_type>select</frontend_type>
|
169 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
170 |
+
<sort_order>16</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>0</show_in_store>
|
174 |
+
<comment>Do you typically ship to construction sites?</comment>
|
175 |
+
</destination_construction>
|
176 |
+
<blind_ship translate="label">
|
177 |
+
<label>Blind Ship</label>
|
178 |
+
<frontend_type>select</frontend_type>
|
179 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
180 |
+
<sort_order>17</sort_order>
|
181 |
+
<show_in_default>1</show_in_default>
|
182 |
+
<show_in_website>1</show_in_website>
|
183 |
+
<show_in_store>0</show_in_store>
|
184 |
+
<comment>Blind shipping prevents the recipient of the shipment from seeing the address of the place of origin.</comment>
|
185 |
+
</blind_ship>
|
186 |
+
<handling_action translate="label">
|
187 |
+
<label>Handling Applied</label>
|
188 |
+
<frontend_type>select</frontend_type>
|
189 |
+
<source_model>shipping/source_handlingAction</source_model>
|
190 |
+
<sort_order>18</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>0</show_in_store>
|
194 |
+
</handling_action>
|
195 |
+
<handling_fee translate="label">
|
196 |
+
<label>Handling Fee</label>
|
197 |
+
<frontend_type>text</frontend_type>
|
198 |
+
<sort_order>19</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>0</show_in_store>
|
202 |
+
<can_be_empty>1</can_be_empty>
|
203 |
+
</handling_fee>
|
204 |
+
<rate_modifier translate="label">
|
205 |
+
<label>Rate Modifier</label>
|
206 |
+
<frontend_type>text</frontend_type>
|
207 |
+
<sort_order>20</sort_order>
|
208 |
+
<show_in_default>1</show_in_default>
|
209 |
+
<show_in_website>1</show_in_website>
|
210 |
+
<show_in_store>0</show_in_store>
|
211 |
+
<can_be_empty>1</can_be_empty>
|
212 |
+
<comment>If you'd like to increase or decrease the rate returned, enter a number that will be multiplied with the rate. e.g. For a 10% rate increase, enter "1.1" or for a 30% decrease in the rate, enter "0.7"</comment>
|
213 |
+
</rate_modifier>
|
214 |
+
<!--
|
215 |
+
<sallowspecific translate="label">
|
216 |
+
<label>Ship to applicable countries</label>
|
217 |
+
<frontend_type>select</frontend_type>
|
218 |
+
<sort_order>19</sort_order>
|
219 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
220 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>1</show_in_store>
|
224 |
+
</sallowspecific>
|
225 |
+
<specificcountry translate="label">
|
226 |
+
<label>Ship to Specific countries</label>
|
227 |
+
<frontend_type>multiselect</frontend_type>
|
228 |
+
<sort_order>20</sort_order>
|
229 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
230 |
+
<show_in_default>1</show_in_default>
|
231 |
+
<show_in_website>1</show_in_website>
|
232 |
+
<show_in_store>1</show_in_store>
|
233 |
+
</specificcountry>
|
234 |
+
-->
|
235 |
+
<sort_order translate="label">
|
236 |
+
<label>Sort Order</label>
|
237 |
+
<frontend_type>text</frontend_type>
|
238 |
+
<sort_order>21</sort_order>
|
239 |
+
<show_in_default>1</show_in_default>
|
240 |
+
<show_in_website>1</show_in_website>
|
241 |
+
<show_in_store>0</show_in_store>
|
242 |
+
<can_be_empty>1</can_be_empty>
|
243 |
+
<comment>Entering a numeric value here will move this module higher or lower in the selection of shipping methods presented to the customer.</comment>
|
244 |
+
</sort_order>
|
245 |
+
<debug translate="label">
|
246 |
+
<label>Debug</label>
|
247 |
+
<frontend_type>select</frontend_type>
|
248 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
249 |
+
<sort_order>22</sort_order>
|
250 |
+
<show_in_default>1</show_in_default>
|
251 |
+
<show_in_website>1</show_in_website>
|
252 |
+
<show_in_store>0</show_in_store>
|
253 |
+
<comment>Turn on to capture quoting calls and errors in the system.log. Turn off when done.</comment>
|
254 |
+
</debug>
|
255 |
+
</fields>
|
256 |
+
</freightquote>
|
257 |
+
</groups>
|
258 |
+
</carriers>
|
259 |
+
</sections>
|
260 |
+
</config>
|
app/code/community/Freightquote/Shipping/sql/freightquote_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
$installer = $this;
|
11 |
+
$installer->installEntities();
|
12 |
+
?>
|
app/etc/modules/Freightquote_Shipping.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
Freightquote.com Shipping Module for Magento Commerce
|
4 |
+
|
5 |
+
Copyright (c) 2015 Freightquote.com
|
6 |
+
|
7 |
+
Released under the Open Software License (OSL 3.0)
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Freightquote_Shipping>
|
12 |
+
<active>true</active>
|
13 |
+
<codePool>community</codePool>
|
14 |
+
<depends>
|
15 |
+
<Mage_Shipping />
|
16 |
+
</depends>
|
17 |
+
</Freightquote_Shipping>
|
18 |
+
</modules>
|
19 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Freightquote_com_Shipping_Module</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -11,9 +11,9 @@
|
|
11 |
<p>Note: This is the only shipping module maintained by Freightquote</p></description>
|
12 |
<notes>Added debug logging option to help with installations</notes>
|
13 |
<authors><author><name>Freightquote</name><user>MAG000030254</user><email>fqconnect@freightquote.com</email></author></authors>
|
14 |
-
<date>2015-09-
|
15 |
-
<time>
|
16 |
-
<contents><target name="
|
17 |
<compatible/>
|
18 |
-
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Freightquote_com_Shipping_Module</name>
|
4 |
+
<version>1.2.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
11 |
<p>Note: This is the only shipping module maintained by Freightquote</p></description>
|
12 |
<notes>Added debug logging option to help with installations</notes>
|
13 |
<authors><author><name>Freightquote</name><user>MAG000030254</user><email>fqconnect@freightquote.com</email></author></authors>
|
14 |
+
<date>2015-09-24</date>
|
15 |
+
<time>13:30:05</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Freightquote"><dir name="Shipping"><dir name="Helper"><file name="Data.php" hash="749a0471c52b7cede4e73991d2157cbc"/></dir><dir name="Model"><dir name="Carrier"><file name="Shipping.php" hash="3daaafcb5d86eed9243554736e2dfeb2"/><dir name="Source"><file name="Class.php" hash="8b010b6933bd957442512aa167c5012b"/><file name="Commodity.php" hash="a51fc911fb0aa8709c6dfe98b384a918"/><file name="Content.php" hash="184d212febb2c3c4ce76aeba47b29708"/><file name="Locationtype.php" hash="02d459f8e95d449c8b9d59b4089bef88"/><file name="Packaging.php" hash="9b3051552a611c0861ba1833aa0eab7d"/><file name="Servicetype.php" hash="07a57461b49eb7670144b5f36a6ad339"/></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="21392cf6d0d43c33ae23d9cceddb02d7"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="0ebc6491a642d625bcd54f5dbc0ed1f9"/><file name="system.xml" hash="4ccf1ff41af2ac095cca3163eaa034d2"/></dir><dir name="sql"><dir name="freightquote_setup"><file name="mysql4-install-1.0.0.php" hash="d03c1c4b8679200418dc321a2e123b23"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Freightquote_Shipping.xml" hash="80e189a151b894aa53ad9c7323f6b9e1"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
|
19 |
</package>
|