Transdirect_Shipping - Version 1.1.1

Version Notes

Fix pointing link staging to live

Download this release

Release Info

Developer Joshua Oliver
Extension Transdirect_Shipping
Version 1.1.1
Comparing to
See all releases


Code changes from version 1.1.0 to 1.1.1

Files changed (37) hide show
  1. app/code/local/Transdirect/.DS_Store +0 -0
  2. app/code/local/Transdirect/Ship/.DS_Store +0 -0
  3. app/code/local/Transdirect/Ship/Block/.DS_Store +0 -0
  4. app/code/local/Transdirect/Ship/Block/Adminhtml/.DS_Store +0 -0
  5. app/code/local/Transdirect/Ship/Block/Adminhtml/Grid.php +15 -0
  6. app/code/local/Transdirect/Ship/Block/Adminhtml/System/.DS_Store +0 -0
  7. app/code/local/Transdirect/Ship/Block/Adminhtml/System/Config/.DS_Store +0 -0
  8. app/code/local/Transdirect/Ship/Block/Adminhtml/System/Config/Date.php +25 -0
  9. app/code/local/Transdirect/Ship/Block/Country.php +17 -0
  10. app/code/local/Transdirect/Ship/Block/Couriers.php +126 -0
  11. app/code/local/Transdirect/Ship/Block/Enablecourier.php +18 -0
  12. app/code/local/Transdirect/Ship/Block/Unitcourier.php +18 -0
  13. app/code/local/Transdirect/Ship/Model/.DS_Store +0 -0
  14. app/code/local/Transdirect/Ship/Model/Carrier/Transdirect.php +359 -487
  15. app/code/local/Transdirect/Ship/Model/Observer.php +253 -0
  16. app/code/local/Transdirect/Ship/Model/Resource/Setup.php +10 -0
  17. app/code/local/Transdirect/Ship/Model/Source/AddressType.php +1 -1
  18. app/code/local/Transdirect/Ship/Model/Source/Couriers.php +14 -5
  19. app/code/local/Transdirect/Ship/Model/Source/OrderStatus.php +20 -0
  20. app/code/local/Transdirect/Ship/Model/Source/Unit.php +14 -0
  21. app/code/local/Transdirect/Ship/Model/System/.DS_Store +0 -0
  22. app/code/local/Transdirect/Ship/Model/System/Config/.DS_Store +0 -0
  23. app/code/local/Transdirect/Ship/Model/System/Config/Backend/Serialized.php +42 -0
  24. app/code/local/Transdirect/Ship/etc/config.xml +65 -17
  25. app/code/local/Transdirect/Ship/etc/system.xml +204 -213
  26. app/code/local/Transdirect/Ship/sql/.DS_Store +0 -0
  27. app/code/local/Transdirect/Ship/sql/ship_setup_catalog/.DS_Store +0 -0
  28. app/code/local/Transdirect/Ship/sql/{ship_setup → ship_setup_catalog}/mysql4-install-0.1.0.php +24 -25
  29. app/code/local/Transdirect/Ship/sql/ship_setup_sales/.DS_Store +0 -0
  30. app/code/local/Transdirect/Ship/sql/ship_setup_sales/mysql4-install-0.1.0.php +12 -0
  31. app/design/adminhtml/default/default/template/system/config/form/field/couriersarray.phtml +160 -0
  32. app/design/frontend/default/default/template/checkout/.DS_Store +0 -0
  33. app/design/frontend/default/default/template/checkout/onepage/.DS_Store +0 -0
  34. app/design/frontend/default/default/template/checkout/onepage/shipping.phtml +166 -0
  35. app/design/frontend/default/default/template/ship/shipping.phtml +4 -3
  36. app/design/frontend/rwd/default/template/checkout/onepage/custom-shipping.phtml +182 -0
  37. package.xml +5 -5
app/code/local/Transdirect/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Block/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Block/Adminhtml/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Block/Adminhtml/Grid.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Transdirect_Ship_Block_Adminhtml_Grid extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ //where is the controller
7
+ $this->_controller = 'adminhtml_test';
8
+ $this->_blockGroup = 'test';
9
+ //text in the admin header
10
+ $this->_headerText = 'Adressbook management';
11
+ //value of the add button
12
+ $this->_addButtonLabel = 'Add a contact';
13
+ parent::__construct();
14
+ }
15
+ }
app/code/local/Transdirect/Ship/Block/Adminhtml/System/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Block/Adminhtml/System/Config/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Block/Adminhtml/System/Config/Date.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Transdirect_Ship_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $date = new Varien_Data_Form_Element_Date();
7
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
8
+
9
+ $data = array(
10
+ 'name' => $element->getName(),
11
+ 'html_id' => $element->getId(),
12
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
13
+ );
14
+ $date->setData($data);
15
+ if(!$date->setValue()) {
16
+ $date->setValue(Mage::getModel('core/date')->date('Y-m-d'), $format);
17
+ } else {
18
+ $date->setValue($element->getValue(), $format);
19
+ }
20
+ $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
21
+ $date->setForm($element->getForm());
22
+
23
+ return $date->getElementHtml();
24
+ }
25
+ }
app/code/local/Transdirect/Ship/Block/Country.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Transdirect_Ship_Block_Country extends Mage_Core_Block_Text
3
+ {
4
+ public function _toHtml()
5
+ {
6
+ // is_render_to_js_template,type,name,column_name,column,module_name
7
+
8
+ // groups[displayoptions][fields][shipping_costs][value][0][enable_courier]
9
+ // groups[displayoptions][fields][shipping_costs][value][0][country]
10
+ return '<span>#{' . $this->getData('column_name') . '}</span>';
11
+ }
12
+
13
+ public function setInputName($value)
14
+ {
15
+ return $this->setName($value);
16
+ }
17
+ }
app/code/local/Transdirect/Ship/Block/Couriers.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Transdirect_Ship_Block_Couriers
3
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $_itemEnabledRenderer;
6
+ protected $_itemRenderer;
7
+ protected $_itemSurchargeRenderer;
8
+
9
+ public function _prepareToRender()
10
+ {
11
+ $this->addColumn('enable_courier', array(
12
+ 'label' => Mage::helper('ship')->__('Enable'),
13
+ 'class' => 'surchargecourier',
14
+ 'renderer' => $this->_getEnabledRenderer(),
15
+ ));
16
+ $this->addColumn('courier', array(
17
+ 'label' => Mage::helper('ship')->__('Courier'),
18
+ 'renderer' => $this->_getRenderer()
19
+ ));
20
+
21
+ $this->addColumn('rename_group', array(
22
+ 'label' => Mage::helper('ship')->__('Rename/Group'),
23
+ 'style' => 'width:100px',
24
+ ));
25
+
26
+ $this->addColumn('surcharge_courier', array(
27
+ 'label' => Mage::helper('ship')->__('Surcharge'),
28
+ 'class' => 'surchargecourier',
29
+ 'style' => 'width:100px',
30
+ ));
31
+
32
+ $this->addColumn('surcharge_courier_unit', array(
33
+ 'label' => Mage::helper('ship')->__('Unit'),
34
+ 'class' => 'surchargecourier',
35
+ 'renderer' => $this->_getUnitRenderer(),
36
+ ));
37
+
38
+ $this->addColumn('enable_surcharge_courier', array(
39
+ 'label' => Mage::helper('ship')->__('Enable Surcharge'),
40
+ 'renderer' => $this->_getEnabledSurchageRenderer(),
41
+ ));
42
+
43
+ $this->_addAfter = false;
44
+ // $this->_addButtonLabel = false;
45
+ }
46
+
47
+ /**
48
+ * Check if columns are defined, set template
49
+ *
50
+ */
51
+ public function __construct()
52
+ {
53
+ if (!$this->_addButtonLabel) {
54
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add');
55
+ }
56
+ // parent::__construct();
57
+ if (!$this->getTemplate()) {
58
+ $this->setTemplate('system/config/form/field/couriersarray.phtml');
59
+ }
60
+ }
61
+
62
+ protected function _getUnitRenderer()
63
+ {
64
+ if (!$this->_itemUnitRenderer) {
65
+ $this->_itemUnitRenderer = $this->getLayout()->createBlock(
66
+ 'ship/unitcourier', '',
67
+ array('is_render_to_js_template' => true, 'class' => 'enable')
68
+ );
69
+ }
70
+ return $this->_itemUnitRenderer;
71
+ }
72
+
73
+ protected function _getEnabledRenderer()
74
+ {
75
+ if (!$this->_itemEnabledRenderer) {
76
+ $this->_itemEnabledRenderer = $this->getLayout()->createBlock(
77
+ 'ship/enablecourier', '',
78
+ array('is_render_to_js_template' => true, 'class' => 'enable')
79
+ );
80
+ }
81
+ return $this->_itemEnabledRenderer;
82
+ }
83
+
84
+ protected function _getEnabledSurchageRenderer()
85
+ {
86
+ if (!$this->_itemSurchargeRenderer) {
87
+ $this->_itemSurchargeRenderer = $this->getLayout()->createBlock(
88
+ 'ship/enablecourier', '',
89
+ array('is_render_to_js_template' => true, 'class' => 'enable')
90
+ );
91
+ }
92
+ return $this->_itemSurchargeRenderer;
93
+ }
94
+
95
+ protected function _getRenderer()
96
+ {
97
+ if (!$this->_itemRenderer) {
98
+ $this->_itemRenderer = $this->getLayout()->createBlock(
99
+ 'ship/country', '',
100
+ array('is_render_to_js_template' => true)
101
+ );
102
+ }
103
+ return $this->_itemRenderer;
104
+ }
105
+
106
+ protected function _prepareArrayRow(Varien_Object $row)
107
+ {
108
+ $row->setData(
109
+ 'option_extra_attr_' . $this->_getEnabledRenderer()
110
+ ->calcOptionHash($row->getData('enable_courier')),
111
+ 'selected="selected"'
112
+ );
113
+ $row->setData(
114
+ 'option_extra_attr_' . $this->_getEnabledSurchageRenderer()
115
+ ->calcOptionHash($row->getData('enable_surcharge_courier')),
116
+ 'selected="selected"'
117
+ );
118
+
119
+ $row->setData(
120
+ 'option_extra_attr_' . $this->_getUnitRenderer()
121
+ ->calcOptionHash($row->getData('surcharge_courier_unit')),
122
+ 'selected="selected"'
123
+ );
124
+
125
+ }
126
+ }
app/code/local/Transdirect/Ship/Block/Enablecourier.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Transdirect_Ship_Block_Enablecourier extends Mage_Core_Block_Html_Select
3
+ {
4
+ public function _toHtml()
5
+ {
6
+ $options = Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray();
7
+ foreach ($options as $option) {
8
+ $this->addOption($option['value'], $option['label']);
9
+ }
10
+
11
+ return parent::_toHtml();
12
+ }
13
+
14
+ public function setInputName($value)
15
+ {
16
+ return $this->setName($value);
17
+ }
18
+ }
app/code/local/Transdirect/Ship/Block/Unitcourier.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Transdirect_Ship_Block_UnitCourier extends Mage_Core_Block_Html_Select
3
+ {
4
+ public function _toHtml()
5
+ {
6
+ $options = Mage::getSingleton('ship/source_unit')->toOptionArray();
7
+ foreach ($options as $option) {
8
+ $this->addOption($option['value'], $option['label']);
9
+ }
10
+
11
+ return parent::_toHtml();
12
+ }
13
+
14
+ public function setInputName($value)
15
+ {
16
+ return $this->setName($value);
17
+ }
18
+ }
app/code/local/Transdirect/Ship/Model/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Model/Carrier/Transdirect.php CHANGED
@@ -1,635 +1,507 @@
1
  <?php
2
 
3
- class Transdirect_Ship_Model_Carrier_Transdirect extends Mage_Shipping_Model_Carrier_Abstract
4
-
5
- implements Mage_Shipping_Model_Carrier_Interface {
6
-
7
  protected $_code = 'transdirect';
8
 
9
-
10
-
11
- public function collectRates(Mage_Shipping_Model_Rate_Request $request)
12
-
13
- {
14
 
15
  //echo '<pre>'; print_r($request); die('request');
16
-
17
  if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
18
-
19
  return false;
20
-
21
  }
22
 
23
-
24
-
25
  $price = $this->getConfigData('price'); // set a default shipping price maybe 0
26
-
27
  $price = 0;
28
 
29
-
30
-
31
  /* API Request Start */
32
-
33
-
34
-
35
- $account_email = Mage::getStoreConfig('transdirect_section/authentication/email');
36
-
37
- $account_password = Mage::getStoreConfig('transdirect_section/authentication/password');
38
-
39
- $warehouse_suburb = Mage::getStoreConfig('transdirect_section/warehouseaddress/suburb');
40
-
41
- $warehouse_postcode = Mage::getStoreConfig('transdirect_section/warehouseaddress/postcode');
42
-
43
- $warehouse_address = Mage::getStoreConfig('transdirect_section/warehouseaddress/address');
44
-
45
- $dimension_width = Mage::getStoreConfig('transdirect_section/defaultitemsize/dimensionswidth');
46
-
47
- $dimension_height = Mage::getStoreConfig('transdirect_section/defaultitemsize/dimensionsheight');
48
-
49
- $dimension_dim = Mage::getStoreConfig('transdirect_section/defaultitemsize/dimensionsdim');
50
-
51
- $dimension_weight = Mage::getStoreConfig('transdirect_section/defaultitemsize/weight');
52
-
53
- $display_carriers = Mage::getStoreConfig('transdirect_section/displayoptions/availablecoriers');
54
-
55
- $display_quote = Mage::getStoreConfig('transdirect_section/displayoptions/quotedisplay');
56
-
57
- $display_fixedprice = Mage::getStoreConfig('transdirect_section/displayoptions/fixedpriceonerror');
58
-
59
- $display_fixedprice1 = Mage::getStoreConfig('transdirect_section/displayoptions/fixedpriceonerror1');
60
-
61
  $display_showcouriername = Mage::getStoreConfig('transdirect_section/displayoptions/showcouriernames');
62
-
63
- $display_surcharge = Mage::getStoreConfig('transdirect_section/displayoptions/handlingsurcharge');
64
-
65
- $display_surcharge1 = Mage::getStoreConfig('transdirect_section/displayoptions/handlingsurcharge1');
66
-
67
  $display_includesurchage = Mage::getStoreConfig('transdirect_section/displayoptions/includesurcharge');
68
-
69
-
70
-
71
-
72
 
73
  // Cart Total Weight Code Start by Nayan
74
-
75
-
76
-
77
  $quote = Mage::getSingleton('checkout/session')->getQuote();
78
-
79
  $cartItems = $quote->getAllVisibleItems();
80
-
81
  $total_qty = Mage::helper('checkout/cart')->getSummaryCount();
82
 
83
-
84
-
85
  $weight = 0;
86
-
87
  $height = 0;
88
-
89
  $width = 0;
90
-
91
  $length = 0;
92
 
93
- foreach ($cartItems as $item)
94
-
95
- {
 
96
 
 
97
  //echo '<pre>'; print_r($item->getQty()); die('qty');
98
-
99
  $productId = $item->getProductId();
100
-
101
  $productQty = $item->getQty();
102
-
103
-
104
-
105
  $product = Mage::getModel('catalog/product')->load($productId);
106
 
107
  //echo $product->getItemWeight();
108
-
109
- $weight += $product->getItemWeight() * $productQty;
110
-
111
- $height += $product->getItemHeight() * $productQty;
112
-
113
- $width += $product->getItemWidth() * $productQty;
114
-
115
- $length += $product->getItemDim() * $productQty;
116
-
117
- }
118
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
-
121
- $cart_total_weight = $weight;
122
-
123
- $cart_total_height = $height;
124
-
125
- $cart_total_width = $width;
126
-
127
- $cart_total_length = $length;
128
 
129
 
130
 
131
  // Cart Total Weight Code End by Nayan
 
 
 
 
132
 
133
-
134
-
135
-
136
-
137
- if(!$cart_total_weight){ $cart_total_weight = $dimension_weight; }
138
-
139
- if(!$cart_total_height){ $cart_total_height = $dimension_height; }
140
-
141
- if(!$cart_total_width){ $cart_total_width = $dimension_width; }
142
-
143
- if(!$cart_total_length){ $cart_total_length = $dimension_dim; }
144
-
145
-
146
-
147
- /* echo 'width--'.$cart_total_weight;
148
-
149
- echo 'height---'.$cart_total_height;
150
-
151
- echo 'width---'.$cart_total_width;
152
-
153
- echo 'length---'.$cart_total_length;
154
-
155
- die('here');
156
-
157
- */
158
-
159
-
160
 
161
  // Getting Cart page Quote Address Details Code Start by Nayan
162
-
163
-
164
-
165
  $receiver_country = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCountryId();
166
-
167
  $receiver_postcode = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getPostcode();
168
-
169
  $receiver_regionId = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegionId();
170
-
171
  $receiver_region = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegion();
172
-
173
-
174
-
175
  $region = Mage::getModel('directory/region')->load($receiver_regionId);
176
-
177
  $receiver_region_tmp = $region->getName();
178
 
179
 
180
-
181
- /*if($receiver_region == '') {
182
-
183
- Mage::getSingleton('checkout/session')->addError("Please enter state/province.");
184
-
185
- session_write_close();
186
-
187
- //$this->_redirect('checkout/cart');
188
-
189
- return false;
190
-
191
- }*/
192
-
193
-
194
-
195
- /*if(!is_numeric($receiver_postcode) || $receiver_postcode == "0" || $receiver_postcode == "00" || $receiver_postcode == "000" || $receiver_postcode == "0000" || $receiver_postcode == "00000" || $receiver_postcode == "000000" || $receiver_postcode == "0000000") {
196
-
197
- Mage::getSingleton('checkout/session')->addError("Please enter valid and correct postcode.");
198
-
199
- session_write_close();
200
-
201
- return false;
202
-
203
- //$this->_redirect('checkout/cart');
204
-
205
- }*/
206
-
207
-
208
-
209
- if(!$receiver_regionId)
210
-
211
- {
212
-
213
  $receiver_suburb = $receiver_region;
214
-
215
- }
216
-
217
- else
218
-
219
- {
220
-
221
  $receiver_suburb = $receiver_region_tmp;
222
-
223
  }
224
 
225
-
226
-
227
- /*echo $tmp_cart_postcode_val = $_COOKIE['cart_postocde'];
228
-
229
- echo $tmp_cart_locality_val = $_COOKIE['cart_locality'];
230
-
231
- //die('val');*/
232
-
233
-
234
 
235
  $receiver_postcode = $_COOKIE['cart_postocde'];
236
-
237
  $receiver_suburb = $_COOKIE['cart_locality'];
238
 
239
-
240
-
241
-
242
-
243
- /* echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getPostcode();
244
-
245
- echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCountryId();
246
-
247
- echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegion();
248
-
249
- echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegionId();
250
-
251
- */
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
  //echo $receiver_suburb; die('suburb');
262
 
263
-
264
 
265
  // Getting Cart page Quote Address Details Code End by Nayan
266
 
267
 
268
-
269
- $quoteDetails = array(
270
-
271
- 'declared_value'=>10000,
272
-
273
- 'items' => array
274
-
275
- (
276
-
277
- array('width' => $cart_total_width, 'height' => $cart_total_height, 'weight'=> $cart_total_weight, 'length'=> $cart_total_length, 'quantity'=>$total_qty, 'description'=>'item description')
278
-
279
- ),
280
-
281
- 'sender' => array('country' => 'AU', 'suburb'=> $warehouse_suburb, 'postcode' => $warehouse_postcode, 'type'=> $warehouse_address),
282
-
283
- 'receiver' => array('country' => $receiver_country, 'suburb'=>$receiver_suburb, 'postcode' => $receiver_postcode, 'type'=> 'residential')
284
-
285
- );
286
-
287
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
 
289
  $json_data = json_encode($quoteDetails);
290
-
291
  //echo '<pre>'; print_r($json_data); die('json');
292
 
293
-
294
-
295
  $ch = curl_init();
296
-
297
- curl_setopt($ch, CURLOPT_URL, "https://www.staging.transdirect.com.au/api/bookings");
298
-
299
- //curl_setopt($ch, CURLOPT_URL, "https://www.transdirect.com.au/api/bookings");
300
-
301
  curl_setopt($ch, CURLOPT_USERPWD, "$account_email:$account_password");
302
-
303
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
304
-
305
  curl_setopt($ch, CURLOPT_HEADER, FALSE);
306
-
307
  curl_setopt($ch, CURLOPT_POST, TRUE);
308
-
309
  curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
310
-
311
  curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
312
-
313
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
314
-
315
  $response = curl_exec($ch);
316
-
317
-
318
-
319
  $report = curl_getinfo($ch);
320
-
321
  //echo '<pre>'; print_r($report);
322
 
323
-
324
-
325
  if(curl_errno($ch)) {
326
-
327
  echo 'Response error: ' . curl_error($ch);
328
-
329
  }
330
-
331
-
332
-
333
  curl_close($ch);
334
 
335
-
336
-
337
  if ($response) {
338
-
339
  $json_decode_varible = json_decode($response, true);
340
-
341
  $quotes_val = $json_decode_varible['quotes'];
342
-
343
  //echo "<pre>"; print_r($quotes_val); die('quotes');
344
-
345
- // var_dump($quotes_val);
346
-
347
- Mage::getSingleton('core/session')->unsTransitVal();
348
-
349
  Mage::getSingleton('core/session')->unsSomeSessionVar();
350
-
351
  $session_val1 = Mage::getSingleton('core/session')->setSomeSessionVar1($quotes_val);
352
-
353
-
354
-
355
-
356
-
357
  } else {
358
-
359
  echo "Failed";
360
-
361
- }
362
-
363
-
364
 
365
  /* End */
366
 
367
-
368
-
369
-
370
-
371
  //$available_carriers = array($display_carriers);
372
-
373
- //print_r($available_carriers);
374
-
375
  $available_carriers = explode( ',', $display_carriers);
376
 
377
-
378
-
379
- /* function cmp1($a, $b) {
380
-
381
- return strcmp($a['transit_time'], $b['transit_time']);
382
-
383
- }
384
-
385
- */
386
-
387
-
388
-
389
  // function build_sorter($key) {
 
 
 
390
 
391
- // return function ($a, $b) use ($key) {
392
 
393
- // return strnatcmp($a[$key], $b[$key]);
394
 
395
- // };
396
-
397
- // }
 
 
398
 
399
 
400
-
401
  $display_quote = Mage::getStoreConfig('transdirect_section/displayoptions/quotedisplay');
402
-
403
-
404
-
405
- //if($display_quote == 'display_cheapest'){ uasort($quotes_val, build_sorter('total')); }
406
-
407
- //if($display_quote == 'display_cheapest_fastest'){ uasort($quotes_val, build_sorter('transit_time')); }
408
-
409
-
410
-
411
-
412
-
413
  $handling = Mage::getStoreConfig('carriers/'.$this->_code.'/handling');
414
-
415
  $result = Mage::getModel('shipping/rate_result');
416
-
417
  $show = true;
418
 
419
  if($show){
 
 
 
 
 
 
 
 
 
 
 
420
 
421
-
422
-
423
- //die('before');
424
-
425
- //$quotes_val = Mage::getSingleton('core/session')->getSomeSessionVar();
426
-
427
-
428
-
429
- //$session = Mage::getSingleton('core/session', array('name' => 'frontend'));
430
-
431
- //echo $session->getSomeSessionVar();
432
-
433
-
434
-
435
- //echo '<pre>'; print_r($session->getSomeSessionVar());
436
-
437
- //die('after');
438
-
439
-
440
-
441
- if($quotes_val == ''){
442
-
443
- Mage::getSingleton('core/session')->unsetAll();
444
-
445
- //Mage::getSingleton('core/session')->addError("Please enter correct details, either suburb or postcode not entered properly.");
446
-
447
- //session_write_close();
448
-
449
- //return false;
450
-
451
-
452
-
453
- $method = Mage::getModel('shipping/rate_result_method');
454
-
455
- $method->setCarrier($this->_code);
456
-
457
- $method->setMethod($this->_code);
458
-
459
- $method->setCarrierTitle($this->getConfigData('title'));
460
-
461
- $method->setMethodTitle('Fixed Price');
462
-
463
-
464
-
465
- if($display_fixedprice == '1'){
466
-
467
- $method->setPrice($display_fixedprice1);
468
-
469
- $method->setCost($display_fixedprice1);
470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  }
472
 
473
-
474
 
475
- $result->append($method);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
 
 
 
 
 
 
 
 
477
 
478
-
479
- }
480
-
481
- else {
482
-
483
-
484
-
485
 
 
 
 
486
 
487
-
488
 
 
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
 
491
- foreach($quotes_val as $key => $val) {
492
-
493
-
494
-
495
- if($key=='fastway'){ $method_title = "Fastway"; }
496
-
497
- if($key=='toll_priority_overnight'){$method_title = "Toll Priority Overnight"; }
498
-
499
- if($key=='couriers_please'){$method_title = "Couriers Please"; }
500
-
501
- if($key=='allied'){$method_title = "Allied Express"; }
502
-
503
- if($key=='toll'){ $method_title = "Toll"; }
504
-
505
- if($key=='mainfreight'){ $method_title = "Mainfreight"; }
506
-
507
- if($key=='northline'){$method_title = "Northline"; }
508
-
509
-
510
-
511
- $quote_form_region_val = Mage::getSingleton('core/session')->setTransitVal($quotes_val[$key]['transit_time']);
512
-
513
-
514
-
515
- //echo $method_title; die;
516
-
517
- // echo count($val); die;
518
-
519
- //echo $key.'<br>';
520
-
521
- //print_r($available_carriers);
522
-
523
-
524
-
525
- //usort($quotes_val, 'cmp1');
526
-
527
-
528
-
529
- $courier_title = $key;
530
-
531
- $courier_price = $quotes_val[$key]['total'];
532
-
533
-
534
-
535
- $method = Mage::getModel('shipping/rate_result_method');
536
-
537
- $method->setCarrier($this->_code);
538
-
539
- $method->setMethod($courier_title);
540
-
541
- $method->setCarrierTitle($this->getConfigData('title'));
542
-
543
-
544
-
545
- if($display_surcharge == '1'){
546
-
547
-
548
-
549
- $tmp_display_surcharge = $courier_price + $display_surcharge1;
550
-
551
- $tmp_method_title = $method_title.' + Handling Charge';
552
-
553
-
554
-
555
- if(in_array($key,$available_carriers)) {
556
-
557
- $method->setMethodTitle($tmp_method_title);
558
-
559
- $method->setPrice($tmp_display_surcharge);
560
-
561
- $method->setCost($tmp_display_surcharge);
562
-
563
- }
564
-
565
-
566
 
 
567
  } else {
568
 
569
-
570
-
571
- if(in_array($key,$available_carriers)) {
572
-
573
- //echo '<br>'.$key . ' - matched<br>';
574
-
575
- $method->setMethodTitle($method_title);
576
-
577
- $method->setSortOrder($quotes_val[$key]['transit_time']);
578
-
579
- $method->setPrice($courier_price);
580
-
581
- $method->setCost($courier_price);
582
-
583
- }
584
-
585
-
586
-
587
  }
588
 
589
-
590
 
591
- $result->append($method);
 
 
 
 
592
 
593
-
594
 
 
 
 
 
 
 
 
595
  }
596
 
597
- //die('arr');
598
-
599
- }
600
-
601
-
602
-
603
-
604
 
 
 
605
  //echo '<pre>'; print_r($result); die('model');
606
-
607
-
608
-
609
- }else{
610
-
611
  $error = Mage::getModel('shipping/rate_result_error');
612
-
613
  $error->setCarrier($this->_code);
614
-
615
  $error->setCarrierTitle($this->getConfigData('name'));
616
-
617
  $error->setErrorMessage($this->getConfigData('specificerrmsg'));
618
-
619
  $result->append($error);
620
-
621
  }
622
-
623
  return $result;
624
-
625
  }
626
 
627
- public function getAllowedMethods()
628
-
629
- {
630
-
631
  return array('transdirect'=>$this->getConfigData('name'));
632
-
633
  }
634
 
635
  }
1
  <?php
2
 
3
+ class Transdirect_Ship_Model_Carrier_Transdirect extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
4
+
 
 
5
  protected $_code = 'transdirect';
6
 
7
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
 
 
 
 
8
 
9
  //echo '<pre>'; print_r($request); die('request');
 
10
  if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
 
11
  return false;
 
12
  }
13
 
 
 
14
  $price = $this->getConfigData('price'); // set a default shipping price maybe 0
 
15
  $price = 0;
16
 
 
 
17
  /* API Request Start */
18
+ $account_email = Mage::getStoreConfig('transdirect_section/authentication/email');
19
+ $account_password = Mage::getStoreConfig('transdirect_section/authentication/password');
20
+ $warehouse_suburb = Mage::getStoreConfig('transdirect_section/warehouseaddress/suburb');
21
+ $warehouse_postcode = Mage::getStoreConfig('transdirect_section/warehouseaddress/postcode');
22
+ $warehouse_address = Mage::getStoreConfig('transdirect_section/warehouseaddress/address');
23
+ $dimension_width = Mage::getStoreConfig('transdirect_section/defaultitemsize/dimensionswidth');
24
+ $dimension_height = Mage::getStoreConfig('transdirect_section/defaultitemsize/dimensionsheight');
25
+ $dimension_dim = Mage::getStoreConfig('transdirect_section/defaultitemsize/dimensionsdim');
26
+ $dimension_weight = Mage::getStoreConfig('transdirect_section/defaultitemsize/weight');
27
+ $display_carriers = Mage::getStoreConfig('transdirect_section/displayoptions/availablecoriers');
28
+ $display_quote = Mage::getStoreConfig('transdirect_section/displayoptions/quotedisplay');
29
+ $display_fixedprice = Mage::getStoreConfig('transdirect_section/displayoptions/fixedpriceonerror');
30
+ $display_fixedprice1 = Mage::getStoreConfig('transdirect_section/displayoptions/fixedpriceonerror1');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  $display_showcouriername = Mage::getStoreConfig('transdirect_section/displayoptions/showcouriernames');
32
+ $display_surcharge = Mage::getStoreConfig('transdirect_section/displayoptions/handlingsurcharge');
33
+ $display_surcharge1 = Mage::getStoreConfig('transdirect_section/displayoptions/handlingsurcharge1');
34
+ $display_surcharge_unit = Mage::getStoreConfig('transdirect_section/displayoptions/handlingunit');
 
 
35
  $display_includesurchage = Mage::getStoreConfig('transdirect_section/displayoptions/includesurcharge');
36
+ $order_box_enable = Mage::getStoreConfig('transdirect_section/orderbox/enableorderbox');
37
+ $order_box_size = Mage::getStoreConfig('transdirect_section/orderbox/boxsize');
38
+ $couriers_name = Mage::getStoreConfig('transdirect_section/displayoptions/couriersname');
 
39
 
40
  // Cart Total Weight Code Start by Nayan
 
 
 
41
  $quote = Mage::getSingleton('checkout/session')->getQuote();
 
42
  $cartItems = $quote->getAllVisibleItems();
 
43
  $total_qty = Mage::helper('checkout/cart')->getSummaryCount();
44
 
 
 
45
  $weight = 0;
 
46
  $height = 0;
 
47
  $width = 0;
 
48
  $length = 0;
49
 
50
+ $cart_total_weight = 0;
51
+ $cart_total_height = 0;
52
+ $cart_total_width = 0;
53
+ $cart_total_length = 0;
54
 
55
+ foreach ($cartItems as $item) {
56
  //echo '<pre>'; print_r($item->getQty()); die('qty');
 
57
  $productId = $item->getProductId();
 
58
  $productQty = $item->getQty();
 
 
 
59
  $product = Mage::getModel('catalog/product')->load($productId);
60
 
61
  //echo $product->getItemWeight();
62
+ // $weight += $product->getItemWeight() * $productQty;
63
+ // $height += $product->getItemHeight() * $productQty;
64
+ // $width += $product->getItemWidth() * $productQty;
65
+ // $length += $product->getItemDim() * $productQty;
66
+ $items_list = array();
67
+ $box_items = array();
68
+
69
+ $weight = $product->getItemWeight();
70
+ $height = $product->getItemHeight();
71
+ $width = $product->getItemWidth() ;
72
+ $length = $product->getItemDim();
73
+
74
+ // Cart Total Weight Code End by Nayan
75
+ if(!$weight) {
76
+ $cart_total_weight = $dimension_weight;
77
+ } else {
78
+ $cart_total_weight = $weight;
79
+ }
80
+ if(!$height) {
81
+ $cart_total_height = $dimension_height;
82
+ } else {
83
+ $cart_total_height = $height;
84
+ }
85
+ if(!$width) {
86
+ $cart_total_width = $dimension_width;
87
+ } else {
88
+ $cart_total_width = $width;
89
+ }
90
+ if(!$length) {
91
+ $cart_total_length = $dimension_dim;
92
+ } else {
93
+ $cart_total_length = $length;
94
+ }
95
+
96
+ if ($order_box_enable == 1) {
97
+ $cubic_weight = ($cart_total_length * $cart_total_width * $cart_total_height) / 250;
98
+
99
+ if($cart_total_weight > $cubic_weight) {
100
+ $cubic_weight = $cart_total_weight;
101
+ }
102
+
103
+
104
+
105
+ for($x = 1; $x <= $productQty; $x++) {
106
+ if ($cubic_weight > $order_box_size) {
107
+
108
+ for($x = $order_box_size; $x <= $cubic_weight; $x *= 2) {
109
+ array_push($items_list, array(
110
+ // 'itemidx' => $i,
111
+ 'cubic_weight' => $order_box_size
112
+ ));
113
+ }
114
+ $r = 0;
115
+ if (($r = $cubic_weight % $order_box_size)) {
116
+ array_push($items_list, array(
117
+ // 'itemidx' => $i,
118
+ 'cubic_weight' => $r
119
+ ));
120
+ }
121
+ } else {
122
+ array_push($items_list, array(
123
+ // 'itemidx' => $i,
124
+ 'cubic_weight' => $cubic_weight
125
+ ));
126
+ }
127
+ }
128
+ }
129
+
130
+ }
131
+
132
+ if ($order_box_enable == 1) {
133
+ foreach ($items_list as $item) {
134
+ $newBox = true;
135
+ foreach ($box_items as $box) {
136
+ if($item['cubic_weight'] <= $order_box_size - $box['weight']) {
137
+ $box['weight'] += $item['cubic_weight'];
138
+ $box['quantity']++;
139
+ $newBox = false;
140
+ break;
141
+ }
142
+ }
143
+ if ($newBox) {
144
+ $length = $width = $height = pow(250 * $item['cubic_weight'], 1/3);
145
+ array_push($box_items, array(
146
+ 'weight' => $item['cubic_weight'],
147
+ 'height' => $height,
148
+ 'width' => $width,
149
+ 'length' => $length,
150
+ 'quantity' => 1,
151
+ 'description'=>'item description'
152
+ ));
153
+ }
154
+ }
155
+ }
156
 
157
+ // $cart_total_weight = $weight;
158
+ // $cart_total_height = $height;
159
+ // $cart_total_width = $width;
160
+ // $cart_total_length = $length;
 
 
 
 
161
 
162
 
163
 
164
  // Cart Total Weight Code End by Nayan
165
+ // if(!$cart_total_weight){ $cart_total_weight = $dimension_weight; }
166
+ // if(!$cart_total_height){ $cart_total_height = $dimension_height; }
167
+ // if(!$cart_total_width){ $cart_total_width = $dimension_width; }
168
+ // if(!$cart_total_length){ $cart_total_length = $dimension_dim; }
169
 
170
+ // echo 'width--'.$cart_total_weight;
171
+ // echo 'height---'.$cart_total_height;
172
+ // echo 'width---'.$cart_total_width;
173
+ // echo 'length---'.$cart_total_length;
174
+ // die('here');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
  // Getting Cart page Quote Address Details Code Start by Nayan
 
 
 
177
  $receiver_country = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCountryId();
 
178
  $receiver_postcode = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getPostcode();
 
179
  $receiver_regionId = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegionId();
 
180
  $receiver_region = (string) Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegion();
 
 
 
181
  $region = Mage::getModel('directory/region')->load($receiver_regionId);
 
182
  $receiver_region_tmp = $region->getName();
183
 
184
 
185
+ // if($receiver_region == '') {
186
+ // Mage::getSingleton('checkout/session')->addError("Please enter state/province.");
187
+ // session_write_close();
188
+ // //$this->_redirect('checkout/cart');
189
+ // return false;
190
+ // }
191
+
192
+ // if(!is_numeric($receiver_postcode) || $receiver_postcode == "0" || $receiver_postcode == "00" || $receiver_postcode == "000" || $receiver_postcode == "0000" || $receiver_postcode == "00000" || $receiver_postcode == "000000" || $receiver_postcode == "0000000") {
193
+ // Mage::getSingleton('checkout/session')->addError("Please enter valid and correct postcode.");
194
+ // session_write_close();
195
+ // return false;
196
+ // // $this->_redirect('checkout/cart');
197
+ //}
198
+
199
+ if(!$receiver_regionId) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  $receiver_suburb = $receiver_region;
201
+ } else {
 
 
 
 
 
 
202
  $receiver_suburb = $receiver_region_tmp;
 
203
  }
204
 
205
+ // echo $tmp_cart_postcode_val = $_COOKIE['cart_postocde'];
206
+ // echo $tmp_cart_locality_val = $_COOKIE['cart_locality'];
207
+ //die('val');
 
 
 
 
 
 
208
 
209
  $receiver_postcode = $_COOKIE['cart_postocde'];
 
210
  $receiver_suburb = $_COOKIE['cart_locality'];
211
 
212
+ // echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getPostcode();
213
+ // echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCountryId();
214
+ // echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegion();
215
+ // echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegionId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  //echo $receiver_suburb; die('suburb');
217
 
 
218
 
219
  // Getting Cart page Quote Address Details Code End by Nayan
220
 
221
 
222
+ if ($order_box_enable == 1) {
223
+ $quoteDetails = array(
224
+ 'declared_value'=>10000,
225
+ 'items' => $box_items,
226
+ 'sender' => array(
227
+ 'country' => 'AU',
228
+ 'suburb'=> $warehouse_suburb,
229
+ 'postcode' => $warehouse_postcode,
230
+ 'type'=> $warehouse_address
231
+ ),
232
+
233
+ 'receiver' => array(
234
+ 'country' => $receiver_country,
235
+ 'suburb'=>$receiver_suburb,
236
+ 'postcode' => $receiver_postcode,
237
+ 'type'=> 'residential'
238
+ )
239
+ );
240
+ } else {
241
+ $quoteDetails = array(
242
+ 'declared_value'=>10000,
243
+ 'items' => array(array(
244
+ 'width' => $cart_total_width,
245
+ 'height' => $cart_total_height,
246
+ 'weight'=> $cart_total_weight,
247
+ 'length'=> $cart_total_length,
248
+ 'quantity'=>$total_qty,
249
+ 'description'=>'item description'
250
+ )),
251
+
252
+ 'sender' => array(
253
+ 'country' => 'AU',
254
+ 'suburb'=> $warehouse_suburb,
255
+ 'postcode' => $warehouse_postcode,
256
+ 'type'=> $warehouse_address
257
+ ),
258
+
259
+ 'receiver' => array(
260
+ 'country' => $receiver_country,
261
+ 'suburb'=>$receiver_suburb,
262
+ 'postcode' => $receiver_postcode,
263
+ 'type'=> 'residential'
264
+ )
265
+ );
266
+ }
267
 
268
  $json_data = json_encode($quoteDetails);
 
269
  //echo '<pre>'; print_r($json_data); die('json');
270
 
271
+
 
272
  $ch = curl_init();
273
+ // curl_setopt($ch, CURLOPT_URL, "https://www.staging.transdirect.com.au/api/bookings");
274
+ curl_setopt($ch, CURLOPT_URL, "https://www.transdirect.com.au/api/bookings");
 
 
 
275
  curl_setopt($ch, CURLOPT_USERPWD, "$account_email:$account_password");
 
276
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
 
277
  curl_setopt($ch, CURLOPT_HEADER, FALSE);
 
278
  curl_setopt($ch, CURLOPT_POST, TRUE);
 
279
  curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
 
280
  curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
 
281
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
282
  $response = curl_exec($ch);
 
 
 
283
  $report = curl_getinfo($ch);
 
284
  //echo '<pre>'; print_r($report);
285
 
286
+ // var_dump($response);
 
287
  if(curl_errno($ch)) {
 
288
  echo 'Response error: ' . curl_error($ch);
 
289
  }
 
 
 
290
  curl_close($ch);
291
 
 
 
292
  if ($response) {
 
293
  $json_decode_varible = json_decode($response, true);
 
294
  $quotes_val = $json_decode_varible['quotes'];
295
+ $booking_id = $json_decode_varible['id'];
296
  //echo "<pre>"; print_r($quotes_val); die('quotes');
297
+ Mage::getSingleton('core/session')->unsTransitVal();
 
 
 
 
298
  Mage::getSingleton('core/session')->unsSomeSessionVar();
 
299
  $session_val1 = Mage::getSingleton('core/session')->setSomeSessionVar1($quotes_val);
300
+ $session_val2 = Mage::getSingleton('core/session')->setSomeSessionVar2($booking_id);
 
 
 
 
301
  } else {
 
302
  echo "Failed";
303
+ }
 
 
 
304
 
305
  /* End */
306
 
 
 
 
 
307
  //$available_carriers = array($display_carriers);
 
 
 
308
  $available_carriers = explode( ',', $display_carriers);
309
 
310
+ // function cmp1($a, $b) {
311
+ // return strcmp($a['transit_time'], $b['transit_time']);
312
+ //}
313
+
 
 
 
 
 
 
 
 
314
  // function build_sorter($key) {
315
+ // return function ($a, $b) use ($key) {
316
+ // return strnatcmp($a[$key], $b[$key]);
317
+ // };
318
 
319
+ // }
320
 
 
321
 
322
+ function getCheapest($a, $b)
323
+ {
324
+ // Sort row primarily by total being cheapest total on top
325
+ return $a['total'] - $b['total'];
326
+ }
327
 
328
 
 
329
  $display_quote = Mage::getStoreConfig('transdirect_section/displayoptions/quotedisplay');
330
+ //if($display_quote == 'display_cheapest'){ uasort($quotes_val, build_sorter('total')); }
331
+ //if($display_quote == 'display_cheapest_fastest'){ uasort($quotes_val, build_sorter('transit_time')); }
 
 
 
 
 
 
 
 
 
332
  $handling = Mage::getStoreConfig('carriers/'.$this->_code.'/handling');
 
333
  $result = Mage::getModel('shipping/rate_result');
 
334
  $show = true;
335
 
336
  if($show){
337
+ if($quotes_val == ''){
338
+ Mage::getSingleton('core/session')->unsetAll();
339
+ //Mage::getSingleton('core/session')->addError("Please enter correct details, either suburb or postcode not entered properly.");
340
+ //session_write_close();
341
+ //return false;
342
+ $method = Mage::getModel('shipping/rate_result_method');
343
+ $method->setCarrier($this->_code);
344
+ $method->setMethod($this->_code);
345
+ $method->setCarrierTitle($this->getConfigData('title'));
346
+ $method->setMethodTitle('Fixed Price');
347
+
348
 
349
+ if($display_fixedprice == '1'){
350
+ $method->setPrice($display_fixedprice1);
351
+ $method->setCost($display_fixedprice1);
352
+ }
353
+
354
+ $result->append($method);
355
+
356
+ } else {
357
+ $quotesKeys = array_keys($quotes_val);
358
+ $couriersConfig = unserialize($couriers_name);
359
+ $courierVal;
360
+ $x = 0;
361
+ while (1) {
362
+ if ($x >= count($quotesKeys) - 1) {
363
+ break;
364
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
 
366
+ $key = $quotesKeys[$x];
367
+ $val = $quotes_val[$key];
368
+ $skip = false;
369
+ // find the config for this quote
370
+ if (isset($couriersConfig[$key])) {
371
+ // var_dump($couriersConfig[$key]['enable_surcharge_courier']);
372
+ $courierVal = $couriersConfig[$key];
373
+
374
+
375
+ // var_dump($courierVal);
376
+ if($courierVal['enable_surcharge_courier'] == 1) {
377
+ if($courierVal['surcharge_courier_unit'] == '%') {
378
+ $courierVal['surcharge_courier'] = $courierVal['surcharge_courier'] / 100;
379
+ }
380
+ $val['total'] += (int) $courierVal['surcharge_courier'];
381
  }
382
 
 
383
 
384
+ if($courierVal['enable_courier'] == 1) {
385
+ if ($courierVal['rename_group']) {
386
+ $renameKey = strtolower($courierVal['rename_group']);
387
+ if (isset($quotes_val[$renameKey])) {
388
+ if ($val['total'] < $quotes_val[$renameKey]['total']) {
389
+ $quotes_val[$renameKey] = $val;
390
+ $couriersConfig[$renameKey] = $courierVal;
391
+ $couriersConfig[$renameKey]['rename_group'] = '';
392
+ $couriersConfig[$renameKey]['enable_surcharge_courier'] = 0;
393
+ }
394
+ } else {
395
+ $quotes_val[$renameKey] = $val;
396
+ $couriersConfig[$renameKey] = $courierVal;
397
+ $couriersConfig[$renameKey]['rename_group'] = '';
398
+ $couriersConfig[$renameKey]['enable_surcharge_courier'] = 0;
399
+ }
400
 
401
+ $quotesKeys[] = $renameKey;
402
+ $skip = true;
403
+ }
404
+ } else {
405
+ $skip = true;
406
+ }
407
+ }
408
 
409
+ $x++;
 
 
 
 
 
 
410
 
411
+ if ($skip) {
412
+ continue;
413
+ }
414
 
 
415
 
416
+ $method_title = ucwords(str_replace('_', ' ', $key));
417
 
418
+ // if($key=='fastway'){ $method_title = "Fastway"; }
419
+ // if($key=='toll_priority_overnight'){$method_title = "Toll Priority Overnight"; }
420
+ // if($key=='couriers_please'){$method_title = "Couriers Please"; }
421
+ // if($key=='allied'){$method_title = "Allied Express"; }
422
+ // if($key=='toll'){ $method_title = "Toll"; }
423
+ // if($key=='mainfreight'){ $method_title = "Mainfreight"; }
424
+ // if($key=='northline'){$method_title = "Northline"; }
425
+ // if($key=='toll_priority_sameday'){$method_title = "Toll Priority Sameday"; }
426
+ // if($key=='auspost_regular_eparcel'){$method_title = "Auspost Regular Eparcel"; }
427
+ // if($key=='auspost_express_eparcel'){$method_title = "Auspost Express Eparcel"; }
428
+ // if($key=='tnt_nine_express'){$method_title = "TNT Nine Express"; }
429
+ // if($key=='tnt_overnight_express'){$method_title = "TNT Overnight Express"; }
430
+ // if($key=='tnt_road_express'){$method_title = "TNT Road Express"; }
431
+ // if($key=='tnt_ten_express'){$method_title = "TNT Ten Express"; }
432
+ // if($key=='tnt_twelve_express'){$method_title = "TNT Twelve Express"; }
433
+ // if($key=='direct_couriers_regular'){$method_title = "Direct Couriers Regular"; }
434
+ // if($key=='direct_couriers_express'){$method_title = "Direct Couriers Express"; }
435
+ // if($key=='direct_couriers_elite'){$method_title = "Direct Couriers Elite"; }
436
+
437
+ $quote_form_region_val = Mage::getSingleton('core/session')->setTransitVal($quotes_val[$key]['transit_time']);
438
+
439
+ //echo $method_title; die;
440
+ // echo count($val); die;
441
+ //echo $key.'<br>';
442
+ //print_r($available_carriers);
443
+ //usort($quotes_val, 'cmp1');
444
+ // var_dump($couriersConfig[$key]);
445
+ $courier_title = $method_title;
446
+ $courier_price = $val['total'];
447
+
448
+
449
+ $method = Mage::getModel('shipping/rate_result_method');
450
+ $method->setCarrier($this->_code);
451
+ $method->setMethod($courier_title);
452
+ $method->setCarrierTitle($this->getConfigData('title'));
453
+
454
+ if($courierVal['enable_surcharge_courier'] == 1) {
455
+ $courier_price = $courier_price + ($courier_price * $courierVal['surcharge_courier']);
456
+ }
457
 
458
+ if($display_surcharge == '1'){
459
+ if($display_surcharge_unit == '%') {
460
+ $display_surcharge1 = $display_surcharge1 / 100;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
 
462
+ $tmp_display_surcharge = $courier_price + ($courier_price * $display_surcharge1);
463
  } else {
464
 
465
+ $tmp_display_surcharge = $courier_price + $display_surcharge1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  }
467
 
468
+ $tmp_method_title = $method_title.' + Handling Charge';
469
 
470
+ // if(in_array($key,$available_carriers)) {
471
+ $method->setMethodTitle($tmp_method_title);
472
+ $method->setPrice($tmp_display_surcharge);
473
+ $method->setCost($tmp_display_surcharge);
474
+ // }
475
 
476
+ } else {
477
 
478
+ // if(in_array($key,$available_carriers)) {
479
+ //echo '<br>'.$key . ' - matched<br>';
480
+ $method->setMethodTitle($method_title);
481
+ $method->setSortOrder($quotes_val[$key]['transit_time']);
482
+ $method->setPrice($courier_price);
483
+ $method->setCost($courier_price);
484
+ // }
485
  }
486
 
487
+ $result->append($method);
488
+ }
 
 
 
 
 
489
 
490
+ //die('arr');
491
+ }
492
  //echo '<pre>'; print_r($result); die('model');
493
+ } else{
 
 
 
 
494
  $error = Mage::getModel('shipping/rate_result_error');
 
495
  $error->setCarrier($this->_code);
 
496
  $error->setCarrierTitle($this->getConfigData('name'));
 
497
  $error->setErrorMessage($this->getConfigData('specificerrmsg'));
 
498
  $result->append($error);
 
499
  }
 
500
  return $result;
 
501
  }
502
 
503
+ public function getAllowedMethods() {
 
 
 
504
  return array('transdirect'=>$this->getConfigData('name'));
 
505
  }
506
 
507
  }
app/code/local/Transdirect/Ship/Model/Observer.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Transdirect_Ship_Model_Observer{
4
+
5
+ public function Savefield($observer){
6
+ // session id
7
+ $booking_id = Mage::getSingleton('core/session')->getSomeSessionVar2();
8
+ //get event data
9
+ $event = $observer->getEvent();
10
+ //get order
11
+ $order = $event->getOrder();
12
+ //set the booking id here
13
+ $order->setBookingId($booking_id);
14
+ }
15
+
16
+
17
+ // public function adminSystemConfigChangedSection() {
18
+ // add cron job here
19
+
20
+ // $config_order_sync_enable = Mage::getStoreConfig('transdirect_section/ordersync/enableordersync');
21
+ // $config_order_stat = Mage::getStoreConfig('transdirect_section/ordersync/orderstatus');
22
+ // $config_from_date = Mage::getStoreConfig('transdirect_section/ordersync/fromdate');
23
+ // $collection = Mage::getResourceModel('sales/order_collection')->addAttributeToSelect('*');
24
+ // $account_email = Mage::getStoreConfig('transdirect_section/authentication/email');
25
+ // $account_password = Mage::getStoreConfig('transdirect_section/authentication/password');
26
+ // $api_array = '';
27
+
28
+
29
+ // $ch1 = curl_init();
30
+ // curl_setopt($ch1, CURLOPT_URL, "https://www.transdirect.com.au/api/orders/");
31
+ // curl_setopt($ch1, CURLOPT_RETURNTRANSFER, TRUE);
32
+ // curl_setopt($ch1, CURLOPT_HEADER, FALSE);
33
+ // curl_setopt($ch1, CURLOPT_HTTPHEADER, array(
34
+ // "Authorization: Basic " . base64_encode($account_email . ":" . $account_password),
35
+ // "Content-Type: application/json"
36
+ // ));
37
+ // curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
38
+ // $response = curl_exec($ch1);
39
+ // curl_close($ch1);
40
+ // $response_order = json_decode($response);
41
+
42
+ // var_dump($response_order);
43
+
44
+ // $dateString = strtotime($config_from_date);
45
+ // $fromDateFormat = date('Y-m-d',$dateString);
46
+ // $dt = new DateTime();
47
+ // $imported_time = $dt->format('H:i:s');
48
+
49
+ // if($config_order_sync_enable == 1) {
50
+
51
+ // foreach ($collection as $col) {
52
+ // $items = $col->getAllVisibleItems();
53
+ // $sku = '';
54
+ // $delimiter = 'transdirect_';
55
+ // $selected_courier = $col->getShippingMethod();
56
+ // if(strpos($selected_courier, $delimiter) !== FALSE) {
57
+ // $selected_courier = substr($selected_courier, strpos($selected_courier, $delimiter) + strlen($delimiter));
58
+ // }
59
+
60
+ // foreach ($items as $item) {
61
+ // $sku = $item->getSku();
62
+ // }
63
+ // $address = Mage::getModel('sales/order_address')->load($col->getShippingAddressId());
64
+ // $fromdate = substr($col->getUpdatedAt(), 0, strpos($col->getUpdatedAt(), ' '));
65
+ // if($col->getStatus() == $config_order_stat && strtotime($fromdate) >= strtotime($fromDateFormat)) {
66
+
67
+ // $api_array['transdirect_order_id'] = (int) $col->getBookingId();
68
+ // $api_array['transdirect_order_status'] = $col->getStatus();
69
+ // $api_array['order_id'] = $col->getIncrementId();
70
+ // $api_array['goods_summary'] = $sku;
71
+ // $api_array['goods_dump'] = 'test';
72
+ // $api_array['imported_from'] = 'Magento';
73
+ // $api_array['purchased_time'] = $col->getCreatedAt();
74
+ // $api_array['sale_price'] = number_format($col->getBaseSubtotal(), 2);
75
+ // $api_array['selected_courier'] = strtolower($selected_courier);
76
+ // $api_array['courier_price'] = number_format($col->getShippingAmount(), 2);
77
+ // $api_array['paid_time'] = '2015-06-01T16:06:52+1000';
78
+ // $api_array['buyer_name'] = $col->getCustomerFirstname() .' '. $col->getCustomerLastname();
79
+ // $api_array['buyer_email'] = $col->getCustomerEmail();
80
+ // $api_array['delivery']['name'] = $address->getFirstname() .' '. $address->getLastname();
81
+ // $api_array['delivery']['email'] = $address->getEmail();
82
+ // $api_array['delivery']['phone'] = $address->getTelephone();
83
+ // $api_array['delivery']['address'] = $address->getStreetFull() .' '. $address->getCity() .', '. $address->getPostcode();
84
+ // $api_array['last_updated'] = $col->getUpdatedAt();
85
+
86
+ // $found = false;
87
+ // $foundOrder;
88
+ // foreach ($response_order as $key => $value) {
89
+ // if($value->order_id == $col->getIncrementId()) {
90
+ // $foundOrder = $value;
91
+ // $found = true;
92
+ // break;
93
+ // }
94
+ // }
95
+
96
+ // if ($found) {
97
+ // if ($foundOrder->last_updated <= $col->getUpdatedAt()) {
98
+ // $id = (int) $foundOrder->id;
99
+ // $ch2 = curl_init();
100
+ // curl_setopt($ch2, CURLOPT_URL, "https://www.transdirect.com.au/api/orders/". $id);
101
+ // curl_setopt($ch2, CURLOPT_RETURNTRANSFER, TRUE);
102
+ // curl_setopt($ch2, CURLOPT_HEADER, FALSE);
103
+ // curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, "PUT");
104
+ // curl_setopt($ch2, CURLOPT_POSTFIELDS, json_encode($api_array));
105
+ // curl_setopt($ch2, CURLOPT_HTTPHEADER, array(
106
+ // "Authorization: Basic " . base64_encode($account_email . ":" . $account_password),
107
+ // "Content-Type: application/json"
108
+ // ));
109
+ // curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false);
110
+ // curl_exec($ch2);
111
+ // curl_close($ch2);
112
+ // }
113
+ // } else {
114
+ // $json_data = json_encode($api_array);
115
+ // $ch = curl_init();
116
+ // curl_setopt($ch, CURLOPT_URL, "https://www.transdirect.com.au/api/orders");
117
+ // curl_setopt($ch, CURLOPT_USERPWD, "$account_email:$account_password");
118
+ // curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
119
+ // curl_setopt($ch, CURLOPT_HEADER, FALSE);
120
+ // curl_setopt($ch, CURLOPT_POST, TRUE);
121
+ // curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($api_array));
122
+ // curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
123
+ // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
124
+ // curl_exec($ch);
125
+ // curl_getinfo($ch);
126
+ // curl_close($ch);
127
+ // }
128
+ // }
129
+ // }
130
+ // }
131
+
132
+ // exit();
133
+ // }
134
+
135
+ public function method1() {
136
+ }
137
+
138
+ public function cronOderSync() {
139
+ // add cron job here
140
+ Mage::log("WORKS!");
141
+ $config_order_sync_enable = Mage::getStoreConfig('transdirect_section/ordersync/enableordersync');
142
+ $config_order_stat = Mage::getStoreConfig('transdirect_section/ordersync/orderstatus');
143
+ $config_from_date = Mage::getStoreConfig('transdirect_section/ordersync/fromdate');
144
+ $collection = Mage::getResourceModel('sales/order_collection')->addAttributeToSelect('*');
145
+ $account_email = Mage::getStoreConfig('transdirect_section/authentication/email');
146
+ $account_password = Mage::getStoreConfig('transdirect_section/authentication/password');
147
+ $api_array = '';
148
+
149
+ $ch1 = curl_init();
150
+ curl_setopt($ch1, CURLOPT_URL, "https://www.transdirect.com.au/api/orders/");
151
+ curl_setopt($ch1, CURLOPT_RETURNTRANSFER, TRUE);
152
+ curl_setopt($ch1, CURLOPT_HEADER, FALSE);
153
+ curl_setopt($ch1, CURLOPT_HTTPHEADER, array(
154
+ "Authorization: Basic " . base64_encode($account_email . ":" . $account_password),
155
+ "Content-Type: application/json"
156
+ ));
157
+ curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
158
+ $response = curl_exec($ch1);
159
+ curl_close($ch1);
160
+ $response_order = json_decode($response);
161
+
162
+ $dateString = strtotime($config_from_date);
163
+ $fromDateFormat = date('Y-m-d',$dateString);
164
+ $dt = new DateTime();
165
+ $imported_time = $dt->format('H:i:s');
166
+
167
+ if($config_order_sync_enable == 1) {
168
+
169
+ foreach ($collection as $col) {
170
+ $items = $col->getAllVisibleItems();
171
+ $sku = '';
172
+ $delimiter = 'transdirect_';
173
+ $selected_courier = $col->getShippingMethod();
174
+ if(strpos($selected_courier, $delimiter) !== FALSE) {
175
+ $selected_courier = substr($selected_courier, strpos($selected_courier, $delimiter) + strlen($delimiter));
176
+ }
177
+
178
+ foreach ($items as $item) {
179
+ $sku = $item->getSku();
180
+ }
181
+ $address = Mage::getModel('sales/order_address')->load($col->getShippingAddressId());
182
+ $fromdate = substr($col->getUpdatedAt(), 0, strpos($col->getUpdatedAt(), ' '));
183
+ if($col->getStatus() == $config_order_stat && strtotime($fromdate) >= strtotime($fromDateFormat)) {
184
+
185
+ $api_array['transdirect_order_id'] = (int) $col->getBookingId();
186
+ $api_array['transdirect_order_status'] = $col->getStatus();
187
+ $api_array['order_id'] = $col->getIncrementId();
188
+ $api_array['goods_summary'] = $sku;
189
+ $api_array['goods_dump'] = 'test';
190
+ $api_array['imported_from'] = 'Magento';
191
+ $api_array['purchased_time'] = $col->getCreatedAt();
192
+ $api_array['sale_price'] = number_format($col->getBaseSubtotal(), 2);
193
+ $api_array['selected_courier'] = strtolower($selected_courier);
194
+ $api_array['courier_price'] = number_format($col->getShippingAmount(), 2);
195
+ $api_array['paid_time'] = '2015-06-01T16:06:52+1000';
196
+ $api_array['buyer_name'] = $col->getCustomerFirstname() .' '. $col->getCustomerLastname();
197
+ $api_array['buyer_email'] = $col->getCustomerEmail();
198
+ $api_array['delivery']['name'] = $address->getFirstname() .' '. $address->getLastname();
199
+ $api_array['delivery']['email'] = $address->getEmail();
200
+ $api_array['delivery']['phone'] = $address->getTelephone();
201
+ $api_array['delivery']['address'] = $address->getStreetFull() .' '. $address->getCity() .', '. $address->getPostcode();
202
+ $api_array['last_updated'] = $col->getUpdatedAt();
203
+
204
+ $found = false;
205
+ $foundOrder;
206
+ foreach ($response_order as $key => $value) {
207
+ if($value->order_id == $col->getIncrementId()) {
208
+ $foundOrder = $value;
209
+ $found = true;
210
+ break;
211
+ }
212
+ }
213
+
214
+ if ($found) {
215
+ if ($foundOrder->last_updated <= $col->getUpdatedAt()) {
216
+ $id = (int) $foundOrder->id;
217
+ $ch2 = curl_init();
218
+ curl_setopt($ch2, CURLOPT_URL, "https://www.transdirect.com.au/api/orders/". $id);
219
+ curl_setopt($ch2, CURLOPT_RETURNTRANSFER, TRUE);
220
+ curl_setopt($ch2, CURLOPT_HEADER, FALSE);
221
+ curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, "PUT");
222
+ curl_setopt($ch2, CURLOPT_POSTFIELDS, json_encode($api_array));
223
+ curl_setopt($ch2, CURLOPT_HTTPHEADER, array(
224
+ "Authorization: Basic " . base64_encode($account_email . ":" . $account_password),
225
+ "Content-Type: application/json"
226
+ ));
227
+ curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false);
228
+ curl_exec($ch2);
229
+ curl_close($ch2);
230
+ }
231
+ } else {
232
+ $json_data = json_encode($api_array);
233
+ $ch = curl_init();
234
+ curl_setopt($ch, CURLOPT_URL, "https://www.transdirect.com.au/api/orders");
235
+ curl_setopt($ch, CURLOPT_USERPWD, "$account_email:$account_password");
236
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
237
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
238
+ curl_setopt($ch, CURLOPT_POST, TRUE);
239
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($api_array));
240
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
241
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
242
+ curl_exec($ch);
243
+ curl_getinfo($ch);
244
+ curl_close($ch);
245
+ }
246
+ }
247
+ }
248
+ }
249
+ }
250
+
251
+ }
252
+
253
+
app/code/local/Transdirect/Ship/Model/Resource/Setup.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: yogesh
5
+ * Date: 12/8/15
6
+ * Time: 7:57 PM
7
+ */
8
+
9
+ class Transdirect_Ship_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
10
+ }
app/code/local/Transdirect/Ship/Model/Source/AddressType.php CHANGED
@@ -16,7 +16,7 @@ class Transdirect_Ship_Model_Source_AddressType extends Varien_Object
16
 
17
  array('value' => 'residential', 'label' => $hlp->__('Residential')),
18
 
19
- array('value' => 'commercial', 'label' => $hlp->__('Commercial')),
20
 
21
  );
22
 
16
 
17
  array('value' => 'residential', 'label' => $hlp->__('Residential')),
18
 
19
+ array('value' => 'business', 'label' => $hlp->__('Commercial')),
20
 
21
  );
22
 
app/code/local/Transdirect/Ship/Model/Source/Couriers.php CHANGED
@@ -6,14 +6,23 @@ class Transdirect_Ship_Model_Source_Couriers extends Varien_Object
6
  {
7
  $hlp = Mage::helper('ship');
8
  return array(
9
- array('value' => 'toll', 'label' => $hlp->__('Toll')),
10
- array('value' => 'toll_priority_overnight', 'label' => $hlp->__('Toll Priority')),
11
  array('value' => 'allied', 'label' => $hlp->__('Allied Express')),
12
  array('value' => 'couriers_please', 'label' => $hlp->__('Couriers Please')),
13
  array('value' => 'fastway', 'label' => $hlp->__('Fastway')),
14
- array('value' => 'mainfreight', 'label' => $hlp->__('Mainfreight')),
15
  array('value' => 'northline', 'label' => $hlp->__('Northline')),
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  );
17
  }
18
-
19
- }
6
  {
7
  $hlp = Mage::helper('ship');
8
  return array(
 
 
9
  array('value' => 'allied', 'label' => $hlp->__('Allied Express')),
10
  array('value' => 'couriers_please', 'label' => $hlp->__('Couriers Please')),
11
  array('value' => 'fastway', 'label' => $hlp->__('Fastway')),
 
12
  array('value' => 'northline', 'label' => $hlp->__('Northline')),
13
+ array('value' => 'toll', 'label' => $hlp->__('Toll')),
14
+ array('value' => 'toll_priority_sameday', 'label' => $hlp->__('Toll Priority Sameday')),
15
+ array('value' => 'toll_priority_overnight', 'label' => $hlp->__('Toll Priority')),
16
+ array('value' => 'auspost_regular_eparcel', 'label' => $hlp->__('Auspost Regular Eparcel')),
17
+ array('value' => 'auspost_express_eparcel', 'label' => $hlp->__('Auspost Express Eparcel')),
18
+ array('value' => 'tnt_nine_express', 'label' => $hlp->__('TNT Nine Express')),
19
+ array('value' => 'tnt_overnight_express', 'label' => $hlp->__('TNT Overnight Express')),
20
+ array('value' => 'tnt_road_express', 'label' => $hlp->__('TNT Road Express')),
21
+ array('value' => 'tnt_ten_express', 'label' => $hlp->__('TNT Ten Express')),
22
+ array('value' => 'tnt_twelve_express', 'label' => $hlp->__('TNT Twelve Express')),
23
+ array('value' => 'direct_couriers_regular', 'label' => $hlp->__('Direct Regular Couriers')),
24
+ array('value' => 'direct_couriers_express', 'label' => $hlp->__('Direct Express Couriers')),
25
+ array('value' => 'direct_couriers_elite', 'label' => $hlp->__('Direct Elite Couriers')),
26
  );
27
  }
28
+ }
 
app/code/local/Transdirect/Ship/Model/Source/OrderStatus.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Transdirect_Ship_Model_Source_OrderStatus extends Varien_Object
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $hlp = Mage::helper('ship');
8
+ $orderStatusCollection = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
9
+ $status = array();
10
+
11
+ foreach($orderStatusCollection as $orderStatus) {
12
+ $status[] = array (
13
+ 'value' => $orderStatus['status'], 'label' => $orderStatus['label']
14
+ );
15
+ }
16
+
17
+ return $status;
18
+ }
19
+
20
+ }
app/code/local/Transdirect/Ship/Model/Source/Unit.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Transdirect_Ship_Model_Source_Unit extends Varien_Object
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $hlp = Mage::helper('ship');
8
+ return array(
9
+ array('value' => '$', 'label' => $hlp->__('$')),
10
+ array('value' => '%', 'label' => $hlp->__('%')),
11
+ );
12
+ }
13
+
14
+ }
app/code/local/Transdirect/Ship/Model/System/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Model/System/Config/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/Model/System/Config/Backend/Serialized.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Transdirect_Ship_Model_System_Config_Backend_Serialized extends Mage_Adminhtml_Model_System_Config_Backend_Serialized
4
+ {
5
+
6
+ protected function _afterLoad()
7
+ {
8
+ if (!is_array($this->getValue())) {
9
+ $couriers = new Transdirect_Ship_Model_Source_Couriers();
10
+ $value = $this->getValue();
11
+ $value = unserialize($value);
12
+ if (empty($value)) {
13
+ $value = [];
14
+ foreach ($couriers->toOptionArray() as $courier) {
15
+ $value[$courier['value']] = [
16
+ 'enable_courier' => '',
17
+ 'courier' => $courier['label'],
18
+ 'rename_group' => '',
19
+ 'surcharge_courier' => 0,
20
+ 'enable_surcharge_courier' => ''
21
+ ];
22
+ }
23
+ } else {
24
+ foreach ($couriers->toOptionArray() as $courier) {
25
+ $value[$courier['value']]['courier'] = $courier['label'];
26
+ }
27
+ }
28
+
29
+ $this->setValue($value);
30
+ }
31
+ }
32
+
33
+ protected function _beforeSave()
34
+ {
35
+ $value = $this->getValue();
36
+ if (is_array($value)) {
37
+ unset($value['__empty']);
38
+ }
39
+ $this->setValue($value);
40
+ parent::_beforeSave();
41
+ }
42
+ }
app/code/local/Transdirect/Ship/etc/config.xml CHANGED
@@ -37,16 +37,52 @@
37
  </ship>
38
  </entities>
39
  </ship_mysql4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  </models>
41
  <resources>
42
- <ship_setup>
 
 
 
 
 
 
 
 
 
43
  <setup>
44
  <module>Transdirect_Ship</module>
 
45
  </setup>
46
  <connection>
47
  <use>core_setup</use>
48
  </connection>
49
- </ship_setup>
50
  <ship_write>
51
  <connection>
52
  <use>core_write</use>
@@ -69,20 +105,32 @@
69
  </ship>
70
  </helpers>
71
  </global>
 
 
 
 
 
 
 
 
 
 
 
 
72
  <default>
73
- <carriers>
74
- <transdirect_section>
75
- <warehouseaddress><address>1</address></warehouseaddress>
76
- <displayoptions><showcouriernames>1</showcouriernames></displayoptions>
77
- </transdirect_section>
78
- <transdirect>
79
- <active>1</active>
80
- <model>ship/carrier_transdirect</model>
81
- <title>Carrier</title>
82
- <name>Method Name</name>
83
- <price>5.00</price>
84
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
85
- </transdirect>
86
- </carriers>
87
- </default>
88
  </config>
37
  </ship>
38
  </entities>
39
  </ship_mysql4>
40
+ </models>
41
+ <!-- Added by ellen (events) -->
42
+ <events>
43
+ <!-- <admin_system_config_changed_section_transdirect_section>
44
+ <observers>
45
+ <Transdirect_Ship>
46
+ <type>singleton</type>
47
+ <class>Transdirect_Ship_Model_Observer</class>
48
+ <method>adminSystemConfigChangedSection</method>
49
+ </Transdirect_Ship>
50
+ </observers>
51
+ </admin_system_config_changed_section_transdirect_section> -->
52
+ <checkout_type_onepage_save_order>
53
+ <observers>
54
+ <ship>
55
+ <type>singleton</type>
56
+ <class>Transdirect_Ship_Model_Observer</class>
57
+ <method>Savefield</method>
58
+ </ship>
59
+ </observers>
60
+ </checkout_type_onepage_save_order>
61
+ </events>
62
+ <models>
63
+ <ship>
64
+ <class>Transdirect_Ship_Model</class>
65
+ </ship>
66
  </models>
67
  <resources>
68
+ <ship_setup_sales>
69
+ <setup>
70
+ <module>Transdirect_Ship</module>
71
+ <class>Mage_Sales_Model_Mysql4_Setup</class>
72
+ </setup>
73
+ <connection>
74
+ <use>core_setup</use>
75
+ </connection>
76
+ </ship_setup_sales>
77
+ <ship_setup_catalog>
78
  <setup>
79
  <module>Transdirect_Ship</module>
80
+ <class>Mage_Catalog_Model_Resource_Setup</class>
81
  </setup>
82
  <connection>
83
  <use>core_setup</use>
84
  </connection>
85
+ </ship_setup_catalog>
86
  <ship_write>
87
  <connection>
88
  <use>core_write</use>
105
  </ship>
106
  </helpers>
107
  </global>
108
+ <crontab>
109
+ <jobs>
110
+ <transdirect_ship_cron>
111
+ <schedule>
112
+ <cron_expr>*/5 * * * *</cron_expr>
113
+ </schedule>
114
+ <run>
115
+ <model>Transdirect_Ship/observer::cronOderSync</model>
116
+ </run>
117
+ </transdirect_ship_cron>
118
+ </jobs>
119
+ </crontab>
120
  <default>
121
+ <carriers>
122
+ <transdirect_section>
123
+ <warehouseaddress><address>1</address></warehouseaddress>
124
+ <displayoptions><showcouriernames>1</showcouriernames></displayoptions>
125
+ </transdirect_section>
126
+ <transdirect>
127
+ <active>1</active>
128
+ <model>ship/carrier_transdirect</model>
129
+ <title>Carrier</title>
130
+ <name>Method Name</name>
131
+ <price>5.00</price>
132
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
133
+ </transdirect>
134
+ </carriers>
135
+ </default>
136
  </config>
app/code/local/Transdirect/Ship/etc/system.xml CHANGED
@@ -1,37 +1,23 @@
1
  <?xml version="1.0" ?>
2
 
3
  <config>
4
-
5
  <tabs>
6
-
7
  <transdirect_ship module="ship" translate="label">
8
-
9
  <label>Transdirect Shipping Module</label>
10
-
11
  <sort_order>100</sort_order>
12
-
13
  </transdirect_ship>
14
-
15
  </tabs>
16
 
17
  <sections>
18
-
19
  <transdirect_section module="ship" translate="label">
20
-
21
  <label>General Settings</label>
22
-
23
  <sort_order>200</sort_order>
24
-
25
  <show_in_default>1</show_in_default>
26
-
27
  <show_in_website>1</show_in_website>
28
-
29
  <show_in_store>1</show_in_store>
30
-
31
  <tab>transdirect_ship</tab>
32
 
33
  <groups>
34
-
35
  <enabletab translate="label">
36
  <label>Enable Extension</label>
37
  <sort_order>1</sort_order>
@@ -45,388 +31,393 @@
45
  <show_in_default>1</show_in_default>
46
  <show_in_website>1</show_in_website>
47
  <show_in_store>1</show_in_store>
48
- <frontend_type>select</frontend_type>
49
  <source_model>adminhtml/system_config_source_yesno</source_model>
50
  </enable>
51
  </fields>
52
  </enabletab>
53
 
54
  <authentication translate="label">
55
-
56
  <label>Authentication (Member Details)</label>
57
-
58
  <sort_order>2</sort_order>
59
-
60
  <show_in_default>1</show_in_default>
61
-
62
  <show_in_website>1</show_in_website>
63
-
64
  <show_in_store>1</show_in_store>
65
 
66
  <fields>
67
-
68
  <email translate="label tooltip comment">
69
-
70
  <label>Email</label>
71
-
72
- <sort_order>1</sort_order>
73
-
74
  <show_in_default>1</show_in_default>
75
-
76
  <show_in_website>1</show_in_website>
77
-
78
  <show_in_store>1</show_in_store>
79
-
80
  <frontend_type>text</frontend_type>
81
-
82
  </email>
83
 
84
  <password translate="label tooltip comment">
85
-
86
  <label>Password</label>
87
-
88
  <sort_order>2</sort_order>
89
-
90
  <show_in_default>1</show_in_default>
91
-
92
  <show_in_website>1</show_in_website>
93
-
94
  <show_in_store>1</show_in_store>
95
-
96
  <frontend_type>text</frontend_type>
97
-
98
  </password>
99
-
100
  </fields>
101
-
102
  </authentication>
103
 
104
  <warehouseaddress translate="label">
105
-
106
  <label>Warehouse Address</label>
107
-
108
  <sort_order>3</sort_order>
109
-
110
  <show_in_default>1</show_in_default>
111
-
112
  <show_in_website>1</show_in_website>
113
-
114
  <show_in_store>1</show_in_store>
115
 
116
  <fields>
117
-
118
  <suburb translate="label tooltip comment">
119
-
120
  <label>Suburb</label>
121
-
122
  <sort_order>1</sort_order>
123
-
124
  <show_in_default>1</show_in_default>
125
-
126
  <show_in_website>1</show_in_website>
127
-
128
  <show_in_store>1</show_in_store>
129
-
130
  <frontend_type>text</frontend_type>
131
-
132
  </suburb>
133
 
134
  <postcode translate="label tooltip comment">
135
-
136
  <label>Postcode</label>
137
-
138
  <sort_order>2</sort_order>
139
-
140
  <show_in_default>1</show_in_default>
141
-
142
  <show_in_website>1</show_in_website>
143
-
144
  <show_in_store>1</show_in_store>
145
-
146
  <frontend_type>text</frontend_type>
147
-
148
  </postcode>
149
 
150
  <address translate="label tooltip comment">
151
-
152
  <label>Address</label>
153
-
154
  <sort_order>3</sort_order>
155
-
156
  <show_in_default>1</show_in_default>
157
-
158
  <show_in_website>1</show_in_website>
159
-
160
  <show_in_store>1</show_in_store>
161
-
162
- <frontend_type>select</frontend_type>
163
-
164
- <source_model>ship/source_addressType</source_model>
165
-
166
  </address>
167
-
168
  </fields>
169
-
170
  </warehouseaddress>
171
 
172
  <defaultitemsize translate="label">
173
-
174
  <label>Default Item Size</label>
175
-
176
  <sort_order>4</sort_order>
177
-
178
  <show_in_default>1</show_in_default>
179
-
180
  <show_in_website>1</show_in_website>
181
-
182
  <show_in_store>1</show_in_store>
183
 
184
  <fields>
185
-
186
  <dimensionswidth translate="label tooltip comment">
187
-
188
  <label>Dimensions</label>
189
-
190
  <sort_order>1</sort_order>
191
-
192
  <comment>Width (cm)</comment>
193
-
194
  <show_in_default>1</show_in_default>
195
-
196
  <show_in_website>1</show_in_website>
197
-
198
  <show_in_store>1</show_in_store>
199
-
200
  <frontend_type>text</frontend_type>
201
-
202
  </dimensionswidth>
203
 
204
  <dimensionsheight translate="label tooltip comment">
205
-
206
  <sort_order>2</sort_order>
207
-
208
  <comment>Height (cm)</comment>
209
-
210
  <show_in_default>1</show_in_default>
211
-
212
  <show_in_website>1</show_in_website>
213
-
214
  <show_in_store>1</show_in_store>
215
-
216
  <frontend_type>text</frontend_type>
217
-
218
  </dimensionsheight>
219
 
220
  <dimensionsdim translate="label tooltip comment">
221
-
222
  <sort_order>3</sort_order>
223
-
224
  <comment>Length (cm)</comment>
225
-
226
  <show_in_default>1</show_in_default>
227
-
228
  <show_in_website>1</show_in_website>
229
-
230
  <show_in_store>1</show_in_store>
231
-
232
  <frontend_type>text</frontend_type>
233
-
234
  </dimensionsdim>
235
 
236
  <weight translate="label tooltip comment">
237
-
238
  <label>Weight</label>
239
-
240
  <sort_order>4</sort_order>
241
-
242
  <comment>KG</comment>
 
 
 
 
 
 
 
 
243
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  <show_in_default>1</show_in_default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
 
 
 
 
 
 
246
  <show_in_website>1</show_in_website>
 
 
 
 
 
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  <show_in_store>1</show_in_store>
 
 
249
 
 
 
 
 
 
 
250
  <frontend_type>text</frontend_type>
 
251
 
252
- </weight>
 
 
 
 
 
 
 
253
 
 
 
 
 
 
 
 
 
254
  </fields>
255
-
256
- </defaultitemsize>
257
 
258
  <displayoptions translate="label">
259
-
260
  <label>Display Options</label>
261
-
262
- <sort_order>5</sort_order>
263
-
264
  <show_in_default>1</show_in_default>
265
-
266
  <show_in_website>1</show_in_website>
267
-
268
  <show_in_store>1</show_in_store>
269
 
270
  <fields>
271
-
272
- <availablecoriers translate="label tooltip comment">
273
-
274
  <label>Available Couriers: (Shift Select)</label>
275
-
276
  <sort_order>1</sort_order>
277
-
278
  <show_in_default>1</show_in_default>
279
-
280
  <show_in_website>1</show_in_website>
281
-
282
  <show_in_store>1</show_in_store>
283
-
284
  <frontend_type>Multiselect</frontend_type>
285
-
286
  <source_model>ship/source_couriers</source_model>
287
-
288
- </availablecoriers>
289
 
290
  <quotedisplay translate="label tooltip comment">
291
-
292
  <label>Quote Display</label>
293
-
294
- <sort_order>2</sort_order>
295
-
296
  <show_in_default>1</show_in_default>
297
-
298
  <show_in_website>1</show_in_website>
299
-
300
  <show_in_store>1</show_in_store>
301
-
302
  <frontend_type>select</frontend_type>
303
-
304
  <source_model>ship/source_quotes</source_model>
305
-
306
  </quotedisplay>
307
 
308
- <fixedpriceonerror translate="label tooltip comment">
309
-
310
- <label>Fixed Price On Error</label>
311
-
312
- <sort_order>3</sort_order>
313
-
314
  <show_in_default>1</show_in_default>
315
-
316
  <show_in_website>1</show_in_website>
317
-
318
  <show_in_store>1</show_in_store>
 
 
 
 
319
 
320
- <!--<frontend_type>checkbox</frontend_type>-->
321
-
322
- <frontend_type>select</frontend_type>
323
-
324
- <source_model>adminhtml/system_config_source_yesno</source_model>
325
-
326
- <comment>If there is some error getting a quote, just return the set fixed price.</comment>
327
-
328
- </fixedpriceonerror>
329
-
330
- <fixedpriceonerror1 translate="label tooltip comment">
331
-
332
- <label>Fixed Price On Error (Value)</label>
333
-
334
- <sort_order>4</sort_order>
335
-
336
  <show_in_default>1</show_in_default>
337
-
338
  <show_in_website>1</show_in_website>
339
-
340
  <show_in_store>1</show_in_store>
 
 
 
341
 
342
- <frontend_type>text</frontend_type>
343
-
344
- </fixedpriceonerror1>
345
-
346
- <showcouriernames translate="label tooltip comment">
347
-
348
- <label>Show Courier Names</label>
349
-
350
- <sort_order>5</sort_order>
351
-
352
  <show_in_default>1</show_in_default>
353
-
354
  <show_in_website>1</show_in_website>
355
-
356
  <show_in_store>1</show_in_store>
 
 
 
357
 
358
- <frontend_type>select</frontend_type>
359
-
360
- <source_model>adminhtml/system_config_source_yesno</source_model>
361
-
362
- <comment>eg. show (Courier Name - Price - Shipping Time) instead of just (Price - Shipping Time).</comment>
363
-
364
- </showcouriernames>
365
-
366
- <handlingsurcharge translate="label tooltip comment">
367
-
368
- <label>Handling Surcharge</label>
369
-
370
- <sort_order>6</sort_order>
371
-
372
  <show_in_default>1</show_in_default>
373
-
374
  <show_in_website>1</show_in_website>
375
-
376
  <show_in_store>1</show_in_store>
377
-
378
- <frontend_type>select</frontend_type>
379
-
380
- <source_model>adminhtml/system_config_source_yesno</source_model>
381
-
382
- <comment>Add a surcharge to the quoted amounts.</comment>
383
-
384
  </handlingsurcharge>
 
385
 
386
- <handlingsurcharge1 translate="label tooltip comment">
387
-
388
- <label>Handling Surcharge (Value)</label>
389
-
390
- <sort_order>7</sort_order>
391
-
392
  <show_in_default>1</show_in_default>
393
-
394
  <show_in_website>1</show_in_website>
395
-
396
  <show_in_store>1</show_in_store>
397
-
398
  <frontend_type>text</frontend_type>
399
-
400
  </handlingsurcharge1>
401
 
402
- <includesurcharge translate="label tooltip comment">
403
-
404
- <label>Include Insurance Surcharge</label>
 
 
 
 
 
 
405
 
 
 
406
  <sort_order>8</sort_order>
407
-
408
  <show_in_default>1</show_in_default>
409
-
410
  <show_in_website>1</show_in_website>
 
 
 
 
 
411
 
 
 
 
 
 
412
  <show_in_store>1</show_in_store>
 
 
413
 
414
- <frontend_type>select</frontend_type>
415
 
 
 
 
 
 
 
 
416
  <source_model>adminhtml/system_config_source_yesno</source_model>
417
-
418
  <comment>This is an option from the api when requesting a quote.</comment>
419
-
420
  </includesurcharge>
421
 
 
 
 
 
 
 
 
 
 
422
  </fields>
423
-
424
  </displayoptions>
425
 
426
- </groups>
 
 
 
 
 
427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  </transdirect_section>
429
-
430
  </sections>
431
-
432
  </config>
1
  <?xml version="1.0" ?>
2
 
3
  <config>
 
4
  <tabs>
 
5
  <transdirect_ship module="ship" translate="label">
 
6
  <label>Transdirect Shipping Module</label>
 
7
  <sort_order>100</sort_order>
 
8
  </transdirect_ship>
 
9
  </tabs>
10
 
11
  <sections>
 
12
  <transdirect_section module="ship" translate="label">
 
13
  <label>General Settings</label>
 
14
  <sort_order>200</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
  <tab>transdirect_ship</tab>
19
 
20
  <groups>
 
21
  <enabletab translate="label">
22
  <label>Enable Extension</label>
23
  <sort_order>1</sort_order>
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
33
  <show_in_store>1</show_in_store>
34
+ <frontend_type>select</frontend_type>
35
  <source_model>adminhtml/system_config_source_yesno</source_model>
36
  </enable>
37
  </fields>
38
  </enabletab>
39
 
40
  <authentication translate="label">
 
41
  <label>Authentication (Member Details)</label>
 
42
  <sort_order>2</sort_order>
 
43
  <show_in_default>1</show_in_default>
 
44
  <show_in_website>1</show_in_website>
 
45
  <show_in_store>1</show_in_store>
46
 
47
  <fields>
 
48
  <email translate="label tooltip comment">
 
49
  <label>Email</label>
50
+ <sort_order>1</sort_order>
 
 
51
  <show_in_default>1</show_in_default>
 
52
  <show_in_website>1</show_in_website>
 
53
  <show_in_store>1</show_in_store>
 
54
  <frontend_type>text</frontend_type>
 
55
  </email>
56
 
57
  <password translate="label tooltip comment">
 
58
  <label>Password</label>
 
59
  <sort_order>2</sort_order>
 
60
  <show_in_default>1</show_in_default>
 
61
  <show_in_website>1</show_in_website>
 
62
  <show_in_store>1</show_in_store>
 
63
  <frontend_type>text</frontend_type>
 
64
  </password>
 
65
  </fields>
 
66
  </authentication>
67
 
68
  <warehouseaddress translate="label">
 
69
  <label>Warehouse Address</label>
 
70
  <sort_order>3</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
 
75
  <fields>
 
76
  <suburb translate="label tooltip comment">
 
77
  <label>Suburb</label>
 
78
  <sort_order>1</sort_order>
 
79
  <show_in_default>1</show_in_default>
 
80
  <show_in_website>1</show_in_website>
 
81
  <show_in_store>1</show_in_store>
 
82
  <frontend_type>text</frontend_type>
 
83
  </suburb>
84
 
85
  <postcode translate="label tooltip comment">
 
86
  <label>Postcode</label>
 
87
  <sort_order>2</sort_order>
 
88
  <show_in_default>1</show_in_default>
 
89
  <show_in_website>1</show_in_website>
 
90
  <show_in_store>1</show_in_store>
 
91
  <frontend_type>text</frontend_type>
 
92
  </postcode>
93
 
94
  <address translate="label tooltip comment">
 
95
  <label>Address</label>
 
96
  <sort_order>3</sort_order>
 
97
  <show_in_default>1</show_in_default>
 
98
  <show_in_website>1</show_in_website>
 
99
  <show_in_store>1</show_in_store>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>ship/source_addressType</source_model>
 
 
 
102
  </address>
 
103
  </fields>
 
104
  </warehouseaddress>
105
 
106
  <defaultitemsize translate="label">
 
107
  <label>Default Item Size</label>
 
108
  <sort_order>4</sort_order>
 
109
  <show_in_default>1</show_in_default>
 
110
  <show_in_website>1</show_in_website>
 
111
  <show_in_store>1</show_in_store>
112
 
113
  <fields>
 
114
  <dimensionswidth translate="label tooltip comment">
 
115
  <label>Dimensions</label>
 
116
  <sort_order>1</sort_order>
 
117
  <comment>Width (cm)</comment>
 
118
  <show_in_default>1</show_in_default>
 
119
  <show_in_website>1</show_in_website>
 
120
  <show_in_store>1</show_in_store>
 
121
  <frontend_type>text</frontend_type>
 
122
  </dimensionswidth>
123
 
124
  <dimensionsheight translate="label tooltip comment">
 
125
  <sort_order>2</sort_order>
 
126
  <comment>Height (cm)</comment>
 
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
  <frontend_type>text</frontend_type>
 
131
  </dimensionsheight>
132
 
133
  <dimensionsdim translate="label tooltip comment">
 
134
  <sort_order>3</sort_order>
 
135
  <comment>Length (cm)</comment>
 
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
  <frontend_type>text</frontend_type>
 
140
  </dimensionsdim>
141
 
142
  <weight translate="label tooltip comment">
 
143
  <label>Weight</label>
 
144
  <sort_order>4</sort_order>
 
145
  <comment>KG</comment>
146
+ <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
+ <show_in_store>1</show_in_store>
149
+ <frontend_type>text</frontend_type>
150
+ </weight>
151
+ </fields>
152
+ </defaultitemsize>
153
+
154
 
155
+ <ordersync translate="label">
156
+ <label>Order Sync</label>
157
+ <sort_order>5</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+
162
+ <fields>
163
+ <enableordersync translate="label tooltip comment">
164
+ <label>Enable Order Sync Functionality</label>
165
+ <sort_order>1</sort_order>
166
+ <comment>Sync orders in woocommerce based on status and date selected.</comment>
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
+ <frontend_type>select</frontend_type>
171
+ <source_model>adminhtml/system_config_source_yesno</source_model>
172
+ </enableordersync>
173
+
174
+ <orderstatus translate="label tooltip comment">
175
+ <label>Sync if Status is:</label>
176
+ <sort_order>2</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>1</show_in_store>
180
+ <frontend_type>select</frontend_type>
181
+ <source_model>ship/source_orderstatus</source_model>
182
+ </orderstatus>
183
 
184
+ <fromdate type="short">
185
+ <label>From Date:</label>
186
+ <frontend_type>text</frontend_type>
187
+ <frontend_model>ship/adminhtml_system_config_date</frontend_model>
188
+ <sort_order>3</sort_order>
189
+ <show_in_default>1</show_in_default>
190
  <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ </fromdate>
193
+ </fields>
194
+
195
+ </ordersync>
196
 
197
+ <fromaddress translate="label">
198
+ <label>From Address</label>
199
+ <sort_order>6</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>1</show_in_store>
203
+
204
+ <fields>
205
+ <companyaddress translate="label tooltip comment">
206
+ <label>Company Address</label>
207
+ <sort_order>1</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>1</show_in_store>
211
+ <frontend_type>text</frontend_type>
212
+ </companyaddress>
213
+
214
+ <emailaddress translate="label tooltip comment">
215
+ <label>Email Address</label>
216
+ <sort_order>2</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
  <show_in_store>1</show_in_store>
220
+ <frontend_type>text</frontend_type>
221
+ </emailaddress>
222
 
223
+ <phone translate="label tooltip comment">
224
+ <label>Phone</label>
225
+ <sort_order>3</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>1</show_in_website>
228
+ <show_in_store>1</show_in_store>
229
  <frontend_type>text</frontend_type>
230
+ </phone>
231
 
232
+ <address translate="label tooltip comment">
233
+ <label>Address</label>
234
+ <sort_order>4</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ <frontend_type>text</frontend_type>
239
+ </address>
240
 
241
+ <suburb translate="label tooltip comment">
242
+ <label>Suburb</label>
243
+ <sort_order>5</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ <frontend_type>text</frontend_type>
248
+ </suburb>
249
  </fields>
250
+ </fromaddress>
 
251
 
252
  <displayoptions translate="label">
 
253
  <label>Display Options</label>
254
+ <comment>This selects which couriers you are able to quote from,
255
+ this is an option on the api.</comment>
256
+ <sort_order>7</sort_order>
257
  <show_in_default>1</show_in_default>
 
258
  <show_in_website>1</show_in_website>
 
259
  <show_in_store>1</show_in_store>
260
 
261
  <fields>
262
+ <!-- <availablecoriers translate="label tooltip comment">
 
 
263
  <label>Available Couriers: (Shift Select)</label>
 
264
  <sort_order>1</sort_order>
 
265
  <show_in_default>1</show_in_default>
 
266
  <show_in_website>1</show_in_website>
 
267
  <show_in_store>1</show_in_store>
 
268
  <frontend_type>Multiselect</frontend_type>
 
269
  <source_model>ship/source_couriers</source_model>
270
+ </availablecoriers> -->
 
271
 
272
  <quotedisplay translate="label tooltip comment">
 
273
  <label>Quote Display</label>
274
+ <comment>This is manipulation that the module needs to do to the results
275
+ that it gets back from the API. The options that are listed in the dropdown are self explanitory.</comment>
276
+ <sort_order>1</sort_order>
277
  <show_in_default>1</show_in_default>
 
278
  <show_in_website>1</show_in_website>
 
279
  <show_in_store>1</show_in_store>
 
280
  <frontend_type>select</frontend_type>
 
281
  <source_model>ship/source_quotes</source_model>
 
282
  </quotedisplay>
283
 
284
+ <showcouriernames translate="label tooltip comment">
285
+ <label>Show Courier Names</label>
286
+ <sort_order>2</sort_order>
 
 
 
287
  <show_in_default>1</show_in_default>
 
288
  <show_in_website>1</show_in_website>
 
289
  <show_in_store>1</show_in_store>
290
+ <frontend_type>select</frontend_type>
291
+ <source_model>adminhtml/system_config_source_yesno</source_model>
292
+ <comment>eg. show (Courier Name - Price - Shipping Time) instead of just (Price - Shipping Time).</comment>
293
+ </showcouriernames>
294
 
295
+ <pickup translate="label tooltip comment">
296
+ <label>Pickup - If Tail Lift Required Include in Quote</label>
297
+ <sort_order>3</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  <show_in_default>1</show_in_default>
 
299
  <show_in_website>1</show_in_website>
 
300
  <show_in_store>1</show_in_store>
301
+ <frontend_type>select</frontend_type>
302
+ <source_model>adminhtml/system_config_source_yesno</source_model>
303
+ </pickup>
304
 
305
+ <delivery translate="label tooltip comment">
306
+ <label>Delivery - If Tail Lift Required Include in Quote</label>
307
+ <sort_order>4</sort_order>
 
 
 
 
 
 
 
308
  <show_in_default>1</show_in_default>
 
309
  <show_in_website>1</show_in_website>
 
310
  <show_in_store>1</show_in_store>
311
+ <frontend_type>select</frontend_type>
312
+ <source_model>adminhtml/system_config_source_yesno</source_model>
313
+ </delivery>
314
 
315
+ <handlingsurcharge translate="label tooltip comment">
316
+ <label>Apply General Surcharge</label>
317
+ <sort_order>5</sort_order>
 
 
 
 
 
 
 
 
 
 
 
318
  <show_in_default>1</show_in_default>
 
319
  <show_in_website>1</show_in_website>
 
320
  <show_in_store>1</show_in_store>
321
+ <frontend_type>select</frontend_type>
322
+ <source_model>adminhtml/system_config_source_yesno</source_model>
323
+ <comment>Add a surcharge to the quoted amounts.</comment>
 
 
 
 
324
  </handlingsurcharge>
325
+
326
 
327
+ <handlingsurcharge1 translate="label tooltip comment">
328
+ <label>Apply General Handling Surcharge (Value)</label>
329
+ <sort_order>6</sort_order>
 
 
 
330
  <show_in_default>1</show_in_default>
 
331
  <show_in_website>1</show_in_website>
 
332
  <show_in_store>1</show_in_store>
 
333
  <frontend_type>text</frontend_type>
 
334
  </handlingsurcharge1>
335
 
336
+ <handlingunit translate="label tooltip comment">
337
+ <label>Unit</label>
338
+ <sort_order>7</sort_order>
339
+ <show_in_default>1</show_in_default>
340
+ <show_in_website>1</show_in_website>
341
+ <show_in_store>1</show_in_store>
342
+ <frontend_type>select</frontend_type>
343
+ <source_model>ship/source_unit</source_model>
344
+ </handlingunit>
345
 
346
+ <fixedpriceonerror translate="label tooltip comment">
347
+ <label>Fixed Price On Error</label>
348
  <sort_order>8</sort_order>
 
349
  <show_in_default>1</show_in_default>
 
350
  <show_in_website>1</show_in_website>
351
+ <show_in_store>1</show_in_store>
352
+ <frontend_type>select</frontend_type>
353
+ <source_model>adminhtml/system_config_source_yesno</source_model>
354
+ <comment>If there is some error getting a quote, just return the set fixed price.</comment>
355
+ </fixedpriceonerror>
356
 
357
+ <fixedpriceonerror1 translate="label tooltip comment">
358
+ <label>Fixed Price On Error (Value)</label>
359
+ <sort_order>9</sort_order>
360
+ <show_in_default>1</show_in_default>
361
+ <show_in_website>1</show_in_website>
362
  <show_in_store>1</show_in_store>
363
+ <frontend_type>text</frontend_type>
364
+ </fixedpriceonerror1>
365
 
 
366
 
367
+ <includesurcharge translate="label tooltip comment">
368
+ <label>Inclue Insurance Surcharge</label>
369
+ <sort_order>10</sort_order>
370
+ <show_in_default>1</show_in_default>
371
+ <show_in_website>1</show_in_website>
372
+ <show_in_store>1</show_in_store>
373
+ <frontend_type>select</frontend_type>
374
  <source_model>adminhtml/system_config_source_yesno</source_model>
 
375
  <comment>This is an option from the api when requesting a quote.</comment>
 
376
  </includesurcharge>
377
 
378
+ <couriersname translate="label">
379
+ <label>Available Couriers:</label>
380
+ <frontend_model>ship/couriers</frontend_model>
381
+ <backend_model>ship/system_config_backend_serialized</backend_model>
382
+ <sort_order>11</sort_order>
383
+ <show_in_default>1</show_in_default>
384
+ <show_in_website>1</show_in_website>
385
+ <show_in_store>1</show_in_store>
386
+ </couriersname>
387
  </fields>
 
388
  </displayoptions>
389
 
390
+ <orderbox translate="label">
391
+ <label>Order Boxing</label>
392
+ <sort_order>8</sort_order>
393
+ <show_in_default>1</show_in_default>
394
+ <show_in_website>1</show_in_website>
395
+ <show_in_store>1</show_in_store>
396
 
397
+ <fields>
398
+ <enableorderbox translate="label tooltip comment">
399
+ <label>Group Smaller items in "Boxes" for the purpose of quoting</label>
400
+ <sort_order>1</sort_order>
401
+ <comment>Warning - Using this functionality may result in in some shipping costs being approximated</comment>
402
+ <show_in_default>1</show_in_default>
403
+ <show_in_website>1</show_in_website>
404
+ <show_in_store>1</show_in_store>
405
+ <frontend_type>select</frontend_type>
406
+ <source_model>adminhtml/system_config_source_yesno</source_model>
407
+ </enableorderbox>
408
+
409
+ <boxsize translate="label tooltip comment">
410
+ <label>Box Size</label>
411
+ <sort_order>2</sort_order>
412
+ <comment>Kilograms (kg)</comment>
413
+ <show_in_default>1</show_in_default>
414
+ <show_in_website>1</show_in_website>
415
+ <show_in_store>1</show_in_store>
416
+ <frontend_type>text</frontend_type>
417
+ </boxsize>
418
+ </fields>
419
+ </orderbox>
420
+ </groups>
421
  </transdirect_section>
 
422
  </sections>
 
423
  </config>
app/code/local/Transdirect/Ship/sql/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/sql/ship_setup_catalog/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/sql/{ship_setup → ship_setup_catalog}/mysql4-install-0.1.0.php RENAMED
@@ -1,23 +1,22 @@
1
  <?php
2
-
3
-
4
  $installer = $this;
 
 
5
 
6
- /* $installer Mage_Core_Model_Resource_Setup */
7
 
8
  $installer->startSetup();
9
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
10
-
11
 
12
- $setup->addAttribute('catalog_product', 'item_height', array(
13
  'backend' => '',
14
  'source' => '',
15
- 'entity_model' => 'catalog/product',
16
  'label' => 'Item Height',
17
- //'group' => 'ItemSize',
18
- 'group' => 'For Shipping Item Information',
19
  'input' => 'text',
20
- 'type' => 'text',
21
  'is_html_allowed_on_front' => true,
22
  'global' => true,
23
  'visible' => true,
@@ -27,15 +26,15 @@ $setup->addAttribute('catalog_product', 'item_height', array(
27
  'visible_on_front' => true
28
  ));
29
 
30
- $setup->addAttribute('catalog_product', 'item_width', array(
31
  'backend' => '',
32
  'source' => '',
33
- 'entity_model' => 'catalog/product',
34
  'label' => 'Item Width',
35
- //'group' => 'ItemSize',
36
- 'group' => 'For Shipping Item Information',
37
  'input' => 'text',
38
- 'type' => 'text',
39
  'is_html_allowed_on_front' => true,
40
  'global' => true,
41
  'visible' => true,
@@ -45,15 +44,15 @@ $setup->addAttribute('catalog_product', 'item_width', array(
45
  'visible_on_front' => true
46
  ));
47
 
48
- $setup->addAttribute('catalog_product', 'item_dim', array(
49
  'backend' => '',
50
  'source' => '',
51
- 'entity_model' => 'catalog/product',
52
  'label' => 'Item Length',
53
- //'group' => 'ItemSize',
54
- 'group' => 'For Shipping Item Information',
55
  'input' => 'text',
56
- 'type' => 'text',
57
  'is_html_allowed_on_front' => true,
58
  'global' => true,
59
  'visible' => true,
@@ -63,15 +62,15 @@ $setup->addAttribute('catalog_product', 'item_dim', array(
63
  'visible_on_front' => true
64
  ));
65
 
66
- $setup->addAttribute('catalog_product', 'item_weight', array(
67
  'backend' => '',
68
  'source' => '',
69
- 'entity_model' => 'catalog/product',
70
  'label' => 'Item Weight',
71
- //'group' => 'ItemSize',
72
- 'group' => 'For Shipping Item Information',
73
  'input' => 'text',
74
- 'type' => 'text',
75
  'is_html_allowed_on_front' => true,
76
  'global' => true,
77
  'visible' => true,
1
  <?php
2
+ require_once('app/Mage.php');
 
3
  $installer = $this;
4
+ // $installer->startSetup();
5
+ $installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
6
 
7
+ // $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
8
 
9
  $installer->startSetup();
 
 
10
 
11
+ $this->addAttribute('catalog_product', 'item_height', array(
12
  'backend' => '',
13
  'source' => '',
14
+ 'entity_model' => 'catalog/product',
15
  'label' => 'Item Height',
16
+ //'group' => 'ItemSize',
17
+ 'group' => 'For Shipping Item Information',
18
  'input' => 'text',
19
+ 'type' => 'text',
20
  'is_html_allowed_on_front' => true,
21
  'global' => true,
22
  'visible' => true,
26
  'visible_on_front' => true
27
  ));
28
 
29
+ $this->addAttribute('catalog_product', 'item_width', array(
30
  'backend' => '',
31
  'source' => '',
32
+ 'entity_model' => 'catalog/product',
33
  'label' => 'Item Width',
34
+ //'group' => 'ItemSize',
35
+ 'group' => 'For Shipping Item Information',
36
  'input' => 'text',
37
+ 'type' => 'text',
38
  'is_html_allowed_on_front' => true,
39
  'global' => true,
40
  'visible' => true,
44
  'visible_on_front' => true
45
  ));
46
 
47
+ $this->addAttribute('catalog_product', 'item_dim', array(
48
  'backend' => '',
49
  'source' => '',
50
+ 'entity_model' => 'catalog/product',
51
  'label' => 'Item Length',
52
+ //'group' => 'ItemSize',
53
+ 'group' => 'For Shipping Item Information',
54
  'input' => 'text',
55
+ 'type' => 'text',
56
  'is_html_allowed_on_front' => true,
57
  'global' => true,
58
  'visible' => true,
62
  'visible_on_front' => true
63
  ));
64
 
65
+ $this->addAttribute('catalog_product', 'item_weight', array(
66
  'backend' => '',
67
  'source' => '',
68
+ 'entity_model' => 'catalog/product',
69
  'label' => 'Item Weight',
70
+ //'group' => 'ItemSize',
71
+ 'group' => 'For Shipping Item Information',
72
  'input' => 'text',
73
+ 'type' => 'text',
74
  'is_html_allowed_on_front' => true,
75
  'global' => true,
76
  'visible' => true,
app/code/local/Transdirect/Ship/sql/ship_setup_sales/.DS_Store ADDED
Binary file
app/code/local/Transdirect/Ship/sql/ship_setup_sales/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+ $this->addAttribute('order', 'booking_id', array(
4
+ 'type' => 'varchar',
5
+ 'label' => 'Booking Id',
6
+ 'visible' => true,
7
+ 'required' => false,
8
+ 'visible_on_front' => true,
9
+ 'user_defined' => true
10
+ ));
11
+
12
+ $this->endSetup();
app/design/adminhtml/default/default/template/system/config/form/field/couriersarray.phtml ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+
29
+ <style type="text/css">
30
+ .form-list td.value select.enable{
31
+ width: 80px !important;
32
+ }
33
+
34
+ .grid table td span {
35
+ display: block;
36
+ width: 150px;
37
+ }
38
+ </style>
39
+ <?php
40
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
41
+
42
+ $_colspan = 2;
43
+ if (!$this->_addAfter) {
44
+ $_colspan -= 1;
45
+ }
46
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
47
+ ?>
48
+
49
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
50
+ <table cellpadding="0" cellspacing="0" class="border">
51
+ <tbody>
52
+
53
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
54
+ <?php foreach ($this->_columns as $columnName => $column):?>
55
+ <th><?php echo $column['label'] ?></th>
56
+ <?php endforeach;?>
57
+ </tr>
58
+
59
+ </tbody>
60
+ </table>
61
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
62
+ </div>
63
+
64
+ <script type="text/javascript">
65
+ //<![CDATA[
66
+ // create row creator
67
+ var arrayRow<?php echo $_htmlId ?> = {
68
+ // define row prototypeJS template
69
+ template : new Template(
70
+ '<tr id="#{_id}">'
71
+ <?php foreach ($this->_columns as $columnName => $column):?>
72
+ +'<td>'
73
+ +'<?php echo $this->_renderCellTemplate($columnName)?>'
74
+ +'<\/td>'
75
+ <?php endforeach;?>
76
+ <?php if ($this->_addAfter):?>
77
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/span><\/span><\/button><\/td>'
78
+ <?php endif;?>
79
+ // +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('adminhtml')->__('Delete') ?><\/span><\/span><\/span><\/button><\/td>'
80
+ +'<\/tr>'
81
+ ),
82
+
83
+ rowsCount : 0,
84
+
85
+ add : function(templateData, insertAfterId)
86
+ {
87
+ // generate default template data
88
+ if ('' == templateData) {
89
+ var d = new Date();
90
+ var templateData = {
91
+ <?php foreach ($this->_columns as $columnName => $column):?>
92
+ <?php echo $columnName ?> : '',
93
+ <?php endforeach;?>
94
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
95
+ };
96
+ }
97
+
98
+ // insert before last row
99
+ if ('' == insertAfterId) {
100
+ // Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
101
+ }
102
+ // insert after specified row
103
+ else {
104
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
105
+ }
106
+
107
+ <?php if ($this->_addAfter):?>
108
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
109
+ <?php endif;?>
110
+
111
+ this.rowsCount += 1;
112
+ },
113
+
114
+ del : function(rowId)
115
+ {
116
+ $(rowId).remove();
117
+ this.rowsCount -= 1;
118
+ if (0 == this.rowsCount) {
119
+ this.showButtonOnly();
120
+ }
121
+ },
122
+
123
+ showButtonOnly : function()
124
+ {
125
+ // $('grid<?php echo $_htmlId ?>').hide();
126
+ // $('empty<?php echo $_htmlId ?>').show();
127
+ }
128
+ }
129
+
130
+ // bind add action to "Add" button in last row
131
+ // Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
132
+
133
+ // add existing rows
134
+ <?php
135
+ $_addAfterId = "headings{$_htmlId}";
136
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
137
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
138
+ $_addAfterId = $_rowId;
139
+ }
140
+ ?>
141
+
142
+ // initialize standalone button
143
+ // $('empty<?php echo $_htmlId ?>').hide();
144
+ // Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
145
+ // $('grid<?php echo $_htmlId ?>').show();
146
+ // $('empty<?php echo $_htmlId ?>').hide();
147
+ // arrayRow<?php echo $_htmlId ?>.add('', '');
148
+ // });
149
+
150
+ // if no rows, hide grid and show button only
151
+ <?php if (!$this->getArrayRows()):?>
152
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
153
+ <?php endif;?>
154
+
155
+ // toggle the grid, if element is disabled (depending on scope)
156
+ <?php if ($this->getElement()->getDisabled()):?>
157
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
158
+ <?php endif;?>
159
+ //]]>
160
+ </script>
app/design/frontend/default/default/template/checkout/.DS_Store ADDED
Binary file
app/design/frontend/default/default/template/checkout/onepage/.DS_Store ADDED
Binary file
app/design/frontend/default/default/template/checkout/onepage/shipping.phtml ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form action="" id="co-shipping-form">
28
+ <ul class="form-list">
29
+ <?php if ($this->customerHasAddresses()): ?>
30
+ <li class="wide">
31
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
32
+ <div class="input-box">
33
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
34
+ </div>
35
+ </li>
36
+ <?php endif ?>
37
+ <li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
38
+ <fieldset>
39
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
40
+ <ul>
41
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
42
+ <li class="fields">
43
+ <div class="fields">
44
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
45
+ <div class="input-box">
46
+ <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
47
+ </div>
48
+ </div>
49
+ </li>
50
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
51
+ <li class="wide">
52
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
55
+ </div>
56
+ </li>
57
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
58
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
59
+ <li class="wide">
60
+ <div class="input-box">
61
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
62
+ </div>
63
+ </li>
64
+ <?php endfor; ?>
65
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
66
+ <li class="wide">
67
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
68
+ <div class="input-box">
69
+ <input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
70
+ </div>
71
+ </li>
72
+ <?php endif; ?>
73
+ <li class="fields">
74
+ <div class="field">
75
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
76
+ <div class="input-box">
77
+ <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
78
+ </div>
79
+ </div>
80
+ <div class="field">
81
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
82
+ <div class="input-box">
83
+ <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
84
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
85
+ </select>
86
+ <script type="text/javascript">
87
+ //<![CDATA[
88
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
89
+ //]]>
90
+ </script>
91
+ <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
92
+ </div>
93
+ </div>
94
+ </li>
95
+ <li class="fields">
96
+ <div class="field">
97
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
98
+ <div class="input-box">
99
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
100
+ </div>
101
+ </div>
102
+ <div class="field">
103
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
104
+ <div class="input-box">
105
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
106
+ </div>
107
+ </div>
108
+ </li>
109
+ <li class="fields">
110
+ <div class="field">
111
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
112
+ <div class="input-box">
113
+ <input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
114
+ </div>
115
+ </div>
116
+ <div class="field">
117
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
118
+ <div class="input-box">
119
+ <input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
120
+ </div>
121
+ </div>
122
+ </li>
123
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
124
+ <li class="control">
125
+ <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
126
+ <?php else:?>
127
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
128
+ <?php endif;?>
129
+ </ul>
130
+ </fieldset>
131
+ </li>
132
+ <li class="control">
133
+ <input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
134
+ </li>
135
+ <li class="fields">
136
+ <div class="field">
137
+ <?php $booking_id = Mage::getSingleton('core/session')->getSomeSessionVar2();?>
138
+ <div class="input-box">
139
+ <input type="hidden" name="booking_id" value="<?php echo $this->htmlEscape($booking_id) ?>" title="<?php echo $this->__('Booking ID') ?>" id="booking_id" class="input-text" />
140
+ </div>
141
+
142
+ </div>
143
+ </li>
144
+ </ul>
145
+
146
+ <div class="buttons-set" id="shipping-buttons-container">
147
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
148
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
149
+ <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
150
+ <span id="shipping-please-wait" class="please-wait" style="display:none;">
151
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
152
+ </span>
153
+ </div>
154
+ </form>
155
+ <script type="text/javascript">
156
+ //<![CDATA[
157
+ var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
158
+ '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
159
+ var shippingForm = new VarienForm('co-shipping-form');
160
+ shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
161
+ //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
162
+ $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
163
+
164
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
165
+ //]]>
166
+ </script>
app/design/frontend/default/default/template/ship/shipping.phtml CHANGED
@@ -177,9 +177,10 @@
177
 
178
 
179
 
180
- <?php $transit_val = Mage::getSingleton('core/session')->getTransitVal(); //die('tra');
181
-
182
- $quotes_val1 = Mage::getSingleton('core/session')->getSomeSessionVar1();
 
183
 
184
 
185
 
177
 
178
 
179
 
180
+ <?php
181
+ $transit_val = Mage::getSingleton('core/session')->getTransitVal(); //die('tra');
182
+ $quotes_val1 = Mage::getSingleton('core/session')->getSomeSessionVar1();
183
+ $booking_id = Mage::getSingleton('core/session')->getSomeSessionVar2();
184
 
185
 
186
 
app/design/frontend/rwd/default/template/checkout/onepage/custom-shipping.phtml ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form action="" id="co-shipping-form">
28
+ <ul class="form-list">
29
+ <?php if ($this->customerHasAddresses()): ?>
30
+ <li class="wide">
31
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
32
+ <div class="input-box">
33
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
34
+ </div>
35
+ </li>
36
+ <?php endif ?>
37
+ <li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
38
+ <fieldset>
39
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
40
+ <ul>
41
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
42
+ <li class="fields">
43
+ <div class="fields">
44
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
45
+ <div class="input-box">
46
+ <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
47
+ </div>
48
+ </div>
49
+ </li>
50
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
51
+ <li class="wide">
52
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
55
+ </div>
56
+ </li>
57
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
58
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
59
+ <li class="wide">
60
+ <div class="input-box">
61
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
62
+ </div>
63
+ </li>
64
+ <?php endfor; ?>
65
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
66
+ <li class="wide">
67
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
68
+ <div class="input-box">
69
+ <input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
70
+ </div>
71
+ </li>
72
+ <?php endif; ?>
73
+ <li class="fields">
74
+ <div class="field">
75
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
76
+ <div class="input-box">
77
+ <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
78
+ </div>
79
+ </div>
80
+ <div class="field">
81
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
82
+ <div class="input-box">
83
+ <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
84
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
85
+ </select>
86
+ <script type="text/javascript">
87
+ //<![CDATA[
88
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
89
+ //]]>
90
+ </script>
91
+ <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
92
+ </div>
93
+ </div>
94
+ </li>
95
+ <li class="fields">
96
+ <div class="field">
97
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
98
+ <div class="input-box">
99
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
100
+ </div>
101
+ </div>
102
+ <div class="field">
103
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
104
+ <div class="input-box">
105
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
106
+ </div>
107
+ </div>
108
+ </li>
109
+ <li class="fields">
110
+ <div class="field">
111
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
112
+ <div class="input-box">
113
+ <input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
114
+ </div>
115
+ </div>
116
+ <div class="field">
117
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
118
+ <div class="input-box">
119
+ <input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
120
+ </div>
121
+ </div>
122
+ </li>
123
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
124
+ <li class="control">
125
+ <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
126
+ <?php else:?>
127
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
128
+ <?php endif;?>
129
+ </ul>
130
+ </fieldset>
131
+ </li>
132
+ <li class="control">
133
+ <input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
134
+ </li>
135
+ <li class="fields">
136
+ <div class="field">
137
+ <?php $booking_id = Mage::getSingleton('core/session')->getSomeSessionVar2();?>
138
+ <div class="input-box">
139
+ <inputtype="text" name="booking_id" value="<?php echo $this->htmlEscape($booking_id) ?>" title="<?php echo $this->__('Booking ID') ?>" id="booking_id" class="input-text" />
140
+ </div>
141
+
142
+ </div>
143
+ </li>
144
+ <li class="fields">
145
+ <div class="field">
146
+ <div class="input-box">
147
+ <input type="text" name="booking_id" value="<?php echo $this->htmlEscape($this->getQuote()->getBookingId()) ?>" title="<?php echo $this->__('Booking ID') ?>" class="input-text" id="shipping:booking_id" />
148
+ </div>
149
+ </div>
150
+ </li>
151
+ <li class="fields">
152
+ <div class="field">
153
+ <?php $booking_id = Mage::getSingleton('core/session')->getSomeSessionVar2();?>
154
+ <div class="input-box">
155
+ <input type="hidden" name="booking_id" value="<?php echo $this->htmlEscape($booking_id) ?>" title="<?php echo $this->__('Booking ID') ?>" id="booking_id" class="input-text" />
156
+ </div>
157
+
158
+ </div>
159
+ </li>
160
+ </ul>
161
+
162
+ <div class="buttons-set" id="shipping-buttons-container">
163
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
164
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
165
+ <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
166
+ <span id="shipping-please-wait" class="please-wait" style="display:none;">
167
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
168
+ </span>
169
+ </div>
170
+ </form>
171
+ <script type="text/javascript">
172
+ //<![CDATA[
173
+ var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
174
+ '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
175
+ var shippingForm = new VarienForm('co-shipping-form');
176
+ shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
177
+ //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
178
+ $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
179
+
180
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
181
+ //]]>
182
+ </script>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Transdirect_Shipping</name>
4
- <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -30,11 +30,11 @@ and more.&#xD;
30
  To find out more about Transdirect's service, please contact sales@transdirect.com.au.&#xD;
31
  &#xD;
32
  Transdirect - Delivering Solutions.</description>
33
- <notes>First version of Magento Module</notes>
34
  <authors><author><name>Joshua Oliver</name><user>transdirect</user><email>josh+transdirect@bywave.com.au</email></author></authors>
35
- <date>2014-10-21</date>
36
- <time>08:49:07</time>
37
- <contents><target name="magelocal"><dir name="Transdirect"><dir name="Ship"><dir name="Block"><file name="Quotes.php" hash="0e539cc0a2831069789a3d9b3f647772"/><file name="Ship.php" hash="27112cddd22559ebd1f3d6b7abf64a3d"/></dir><dir name="Helper"><file name="Data.php" hash="0252ec0e51cfda0a3f23ddf359f75202"/></dir><dir name="Model"><dir name="Carrier"><file name="Transdirect.php" hash="ca0a520a9f1a4c1b407ecad4ec6c71ca"/></dir><dir name="Source"><file name="AddressType.php" hash="3385ec33de0d820a9098f3aa25d3d3d1"/><file name="Couriers.php" hash="f75b6dd256d6b07fb3542a2568eb62df"/><file name="Quotes.php" hash="d382cf07326522786c4f929bbb5e228f"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="0a7b2535288aedd6323990e56049b452"/></dir><dir name="etc"><file name="adminhtml.xml" hash="79534cef195241413dc4503010a9ad18"/><file name="config.xml" hash="d2d455d310db7cd7ff075f945e84c4e6"/><file name="system.xml" hash="830ef06a64d7c78de1e4fda416619b1a"/></dir><dir name="sql"><dir name="ship_setup"><file name="mysql4-install-0.1.0.php" hash="281f495aac68bbaf08b43039e57973a4"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Transdirect_Ship.xml" hash="fbc66a2834c10ad65dd55a7dd4bea798"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="ship"><dir name="css"><file name="jquery.autoSuggest.css" hash="e976e6a48799083cf955aa5373d2838c"/></dir><dir name="js"><file name="jquery-1.11.0.js" hash="573025dfa115bc306dac7dfa18153675"/><file name="jquery.autoSuggest.js" hash="b1833197f28b1321b565b3c56b8a1403"/><file name="location_script.js" hash="9238343017e0cb8552bc7b02c6ad2c04"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="ship"><dir name="css"><file name="jquery.autoSuggest.css" hash="e976e6a48799083cf955aa5373d2838c"/></dir><dir name="js"><file name="jquery-1.11.0.js" hash="573025dfa115bc306dac7dfa18153675"/><file name="jquery.autoSuggest.js" hash="b1833197f28b1321b565b3c56b8a1403"/><file name="location_script.js" hash="9238343017e0cb8552bc7b02c6ad2c04"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ship.xml" hash="7b6b6dcee52e6af102111b227da4b16d"/></dir><dir name="template"><dir name="ship"><dir name="checkout"><dir name="cart"><file name="totals.phtml" hash="96e28634c4a68102067349ef0149cd32"/></dir></dir><dir name="footer"><file name="js.phtml" hash="729153a7b05e9e397ad96abbda8e3a84"/></dir><file name="product_shipping.phtml" hash="a56e35a53ddf0484bc633d5d54fc9ea3"/><file name="shipping.phtml" hash="61f839c1dd36da82f32ae34e62070a46"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="ship.xml" hash="7b6b6dcee52e6af102111b227da4b16d"/></dir><dir name="template"><dir name="ship"><dir name="checkout"><dir name="cart"><file name="totals.phtml" hash="96e28634c4a68102067349ef0149cd32"/></dir></dir><dir name="footer"><file name="js.phtml" hash="729153a7b05e9e397ad96abbda8e3a84"/></dir><file name="product_shipping.phtml" hash="f86fc4817054df798c0549970bc9dc16"/><file name="shipping.phtml" hash="a8e00a911251ba4af976d77b838feb01"/></dir></dir></dir></dir></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
40
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Transdirect_Shipping</name>
4
+ <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
30
  To find out more about Transdirect's service, please contact sales@transdirect.com.au.&#xD;
31
  &#xD;
32
  Transdirect - Delivering Solutions.</description>
33
+ <notes>Fix pointing link staging to live</notes>
34
  <authors><author><name>Joshua Oliver</name><user>transdirect</user><email>josh+transdirect@bywave.com.au</email></author></authors>
35
+ <date>2015-09-17</date>
36
+ <time>04:34:13</time>
37
+ <contents><target name="magelocal"><dir name="Transdirect"><dir name="Ship"><dir name="Block"><dir name="Adminhtml"><file name="Grid.php" hash="fd7f272097ff678f7a7696c179f2a968"/><dir name="System"><dir name="Config"><file name="Date.php" hash="ad27b62a061cde0e1a8f05e06d960d81"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="413ad75aa33a5df85f230c6a4c955fde"/></dir><file name=".DS_Store" hash="b5d686c6ef525f9d00a5bd6760fb7600"/></dir><file name="Country.php" hash="b0b6cf18448a4b0954a63efb3a357394"/><file name="Couriers.php" hash="f4372bf89477d2a9d8d195e572ff7909"/><file name="Enablecourier.php" hash="c27874c939cb1252d11e65230e24951c"/><file name="Quotes.php" hash="0e539cc0a2831069789a3d9b3f647772"/><file name="Ship.php" hash="27112cddd22559ebd1f3d6b7abf64a3d"/><file name="Unitcourier.php" hash="1bafc5ea7cc82e7bd366091684276a31"/><file name=".DS_Store" hash="e1c6e725f9c8716b9ba372aea2582c25"/></dir><dir name="Helper"><file name="Data.php" hash="0252ec0e51cfda0a3f23ddf359f75202"/></dir><dir name="Model"><dir name="Carrier"><file name="Transdirect.php" hash="d652043f9f62a377fa45db31f9019c8a"/></dir><file name="Observer.php" hash="190f8f9662de5e72ae4dcd405133ca11"/><dir name="Resource"><file name="Setup.php" hash="190fa03ddd1b3d6fff1b930122ea189b"/></dir><dir name="Source"><file name="AddressType.php" hash="3eb0fb748607a38b0b31732a895ac980"/><file name="Couriers.php" hash="574fc2c0480f7b4e517f12bfb9708a39"/><file name="OrderStatus.php" hash="654d24a98571156e0b31f24f910182ee"/><file name="Quotes.php" hash="d382cf07326522786c4f929bbb5e228f"/><file name="Unit.php" hash="31307975b626a49d0d06078cbee1ecd6"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Serialized.php" hash="b1b74f9a36a16e99bd8db017468c6b1c"/></dir><file name=".DS_Store" hash="2b1ded80f8da4e52baa9bea89e287055"/></dir><file name=".DS_Store" hash="413ad75aa33a5df85f230c6a4c955fde"/></dir><file name=".DS_Store" hash="14ccd251b8e6b4e22d3ac4975f871e8d"/></dir><dir name="controllers"><file name="IndexController.php" hash="0a7b2535288aedd6323990e56049b452"/></dir><dir name="etc"><file name="adminhtml.xml" hash="79534cef195241413dc4503010a9ad18"/><file name="config.xml" hash="1208f298c6c8ac4c612301cb74964897"/><file name="system.xml" hash="a387040b7a683332572ff512a059bf76"/></dir><dir name="sql"><dir name="ship_setup_catalog"><file name="mysql4-install-0.1.0.php" hash="ff4817bf11abbf293862311418d86e26"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="ship_setup_sales"><file name="mysql4-install-0.1.0.php" hash="3ab28c009fa43907f495c4de18085274"/><file name=".DS_Store" hash="4233c80afd944d59bf445e108a3e2176"/></dir><file name=".DS_Store" hash="47109a1eb7526e20b8b7590dc2e563c5"/></dir><file name=".DS_Store" hash="7c5812f4b5de3fde0fdc9a583aa93caf"/></dir><file name=".DS_Store" hash="9feee51c13f66994a8f3b6275dcada6d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ship.xml" hash="7b6b6dcee52e6af102111b227da4b16d"/></dir><dir name="template"><dir name="ship"><dir name="checkout"><dir name="cart"><file name="totals.phtml" hash="96e28634c4a68102067349ef0149cd32"/></dir></dir><dir name="footer"><file name="js.phtml" hash="729153a7b05e9e397ad96abbda8e3a84"/></dir><file name="product_shipping.phtml" hash="a56e35a53ddf0484bc633d5d54fc9ea3"/><file name="shipping.phtml" hash="d885565bdd58f507fbbb4e0c6254c66a"/></dir><dir name="checkout"><dir name="onepage"><file name="shipping.phtml" hash="e13cf76a57a588f44e84ff12a56d2e46"/><file name=".DS_Store" hash="62c890ce978711988e86f245231d7b28"/></dir><file name=".DS_Store" hash="63ad22dc3e1a524e92945f9fbdf80e08"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="template"><dir name="ship"><dir name="checkout"><dir name="cart"><file name="totals.phtml" hash="96e28634c4a68102067349ef0149cd32"/></dir></dir><dir name="footer"><file name="js.phtml" hash="729153a7b05e9e397ad96abbda8e3a84"/></dir><file name="product_shipping.phtml" hash="f86fc4817054df798c0549970bc9dc16"/><file name="shipping.phtml" hash="a8e00a911251ba4af976d77b838feb01"/></dir><dir name="checkout"><dir name="onepage"><file name="custom-shipping.phtml" hash="88930ea6f21c47ef49243c55e28b2984"/></dir></dir></dir><dir name="layout"><file name="ship.xml" hash="7b6b6dcee52e6af102111b227da4b16d"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="couriersarray.phtml" hash="44fab4c7b846230f8802ae71706e4377"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Transdirect_Ship.xml" hash="fbc66a2834c10ad65dd55a7dd4bea798"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="ship"><dir name="css"><file name="jquery.autoSuggest.css" hash="e976e6a48799083cf955aa5373d2838c"/></dir><dir name="js"><file name="jquery-1.11.0.js" hash="573025dfa115bc306dac7dfa18153675"/><file name="jquery.autoSuggest.js" hash="b1833197f28b1321b565b3c56b8a1403"/><file name="location_script.js" hash="9238343017e0cb8552bc7b02c6ad2c04"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="ship"><dir name="css"><file name="jquery.autoSuggest.css" hash="e976e6a48799083cf955aa5373d2838c"/></dir><dir name="js"><file name="jquery-1.11.0.js" hash="573025dfa115bc306dac7dfa18153675"/><file name="jquery.autoSuggest.js" hash="b1833197f28b1321b565b3c56b8a1403"/><file name="location_script.js" hash="9238343017e0cb8552bc7b02c6ad2c04"/></dir></dir></dir></dir></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
40
  </package>