Shopgo_AramexShipping - Version 1.0.0

Version Notes

Aramex shipping allows to calculate Aramex shipping rates, create Aramex shipments and track them.

Download this release

Release Info

Developer Moe Ghashim
Extension Shopgo_AramexShipping
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (36) hide show
  1. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping.php +14 -0
  2. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit.php +38 -0
  3. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Form.php +19 -0
  4. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Tab/Aramexaccountform.php +61 -0
  5. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Tab/Generalinfoform.php +144 -0
  6. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Tabs.php +30 -0
  7. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Grid.php +88 -0
  8. app/code/community/Shopgo/AramexShipping/Block/Adminhtml/System/Config/Form/Button.php +37 -0
  9. app/code/community/Shopgo/AramexShipping/Helper/Data.php +442 -0
  10. app/code/community/Shopgo/AramexShipping/Model/Carrier/Aramex.php +216 -0
  11. app/code/community/Shopgo/AramexShipping/Model/Mysql4/Shipping.php +10 -0
  12. app/code/community/Shopgo/AramexShipping/Model/Mysql4/Shipping/Collection.php +11 -0
  13. app/code/community/Shopgo/AramexShipping/Model/Observer.php +9 -0
  14. app/code/community/Shopgo/AramexShipping/Model/Product/Attribute/Source/Suppliers.php +22 -0
  15. app/code/community/Shopgo/AramexShipping/Model/Shipping.php +880 -0
  16. app/code/community/Shopgo/AramexShipping/Model/Shipping/Info.php +95 -0
  17. app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Activepaymentmethods.php +15 -0
  18. app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Producttypes.php +26 -0
  19. app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Shippingmode.php +14 -0
  20. app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Unitofmeasure.php +16 -0
  21. app/code/community/Shopgo/AramexShipping/controllers/Adminhtml/AramexController.php +302 -0
  22. app/code/community/Shopgo/AramexShipping/etc/adminhtml.xml +37 -0
  23. app/code/community/Shopgo/AramexShipping/etc/config.xml +125 -0
  24. app/code/community/Shopgo/AramexShipping/etc/system.xml +409 -0
  25. app/code/community/Shopgo/AramexShipping/etc/wsdl/aramex_rates_calculator_service.wsdl +206 -0
  26. app/code/community/Shopgo/AramexShipping/etc/wsdl/aramex_shipments_tracking_service.wsdl +176 -0
  27. app/code/community/Shopgo/AramexShipping/etc/wsdl/aramex_shipping_service.wsdl +486 -0
  28. app/code/community/Shopgo/AramexShipping/sql/aramexshipping_setup/mysql4-install-0.1.0.php +74 -0
  29. app/code/community/Shopgo/AramexShipping/sql/aramexshipping_setup/mysql4-install-1.0.0.php +74 -0
  30. app/design/adminhtml/default/default/layout/shopgo/aramex_shipping.xml +8 -0
  31. app/design/adminhtml/default/default/template/shopgo/aramex_shipping/system/config/button.phtml +47 -0
  32. app/design/frontend/base/default/layout/shopgo/aramex_shipping.xml +13 -0
  33. app/design/frontend/base/default/template/shopgo/aramex_shipping/checkout/cart/shipping.phtml +139 -0
  34. app/design/frontend/base/default/template/shopgo/aramex_shipping/tracking/popup.phtml +158 -0
  35. app/etc/modules/Shopgo_AramexShipping.xml +9 -0
  36. package.xml +18 -0
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_Shipping
4
+ extends Mage_Adminhtml_Block_Widget_Grid_Container
5
+ {
6
+ public function __construct()
7
+ {
8
+ $this->_blockGroup = 'aramexshipping';
9
+ $this->_controller = 'adminhtml_shipping';
10
+ $this->_headerText = Mage::helper('aramexshipping')->__('Aramex Shipping Suppliers Manager');
11
+ $this->_addButtonLabel = Mage::helper('aramexshipping')->__('Add Supplier');
12
+ parent::__construct();
13
+ }
14
+ }
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_Shipping_Edit
4
+ extends Mage_Adminhtml_Block_Widget_Form_Container
5
+ {
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+
10
+ $this->_objectId = 'id';
11
+ $this->_blockGroup = 'aramexshipping';
12
+ $this->_controller = 'adminhtml_shipping';
13
+
14
+ $this->_updateButton('save', 'label', Mage::helper('aramexshipping')->__('Save Supplier'));
15
+ $this->_updateButton('delete', 'label', Mage::helper('aramexshipping')->__('Delete Supplier'));
16
+
17
+ $this->_addButton('saveandcontinue', array(
18
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
19
+ 'onclick' => 'saveAndContinueEdit()',
20
+ 'class' => 'save',
21
+ ), -100);
22
+
23
+ $this->_formScripts[] = "
24
+ function saveAndContinueEdit(){
25
+ editForm.submit($('edit_form').action+'back/edit/');
26
+ }
27
+ ";
28
+ }
29
+
30
+ public function getHeaderText()
31
+ {
32
+ if (Mage::registry('aramex_suppliers_data') && Mage::registry('aramex_suppliers_data')->getId()) {
33
+ return Mage::helper('aramexshipping')->__("Edit Supplier '%s'", $this->htmlEscape(Mage::registry('aramex_suppliers_data')->getIdentifier()));
34
+ } else {
35
+ return Mage::helper('aramexshipping')->__('Add Supplier');
36
+ }
37
+ }
38
+ }
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_Shipping_Edit_Form
4
+ extends Mage_Adminhtml_Block_Widget_Form
5
+ {
6
+ protected function _prepareForm()
7
+ {
8
+ $form = new Varien_Data_Form(array(
9
+ 'id' => 'edit_form',
10
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
11
+ 'method' => 'post',
12
+ 'enctype' => 'multipart/form-data'
13
+ ));
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Tab/Aramexaccountform.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_Shipping_Edit_Tab_Aramexaccountform
4
+ extends Mage_Adminhtml_Block_Widget_Form
5
+ {
6
+ protected function _prepareForm()
7
+ {
8
+ $form = new Varien_Data_Form();
9
+ $this->setForm($form);
10
+
11
+ $fieldset = $form->addFieldset('aramex_account_form', array('legend' => Mage::helper('aramexshipping')->__('Aramex Account')));
12
+
13
+ $fieldset->addField('username', 'text', array(
14
+ 'label' => Mage::helper('aramexshipping')->__('Username'),
15
+ 'class' => 'required-entry',
16
+ 'required' => true,
17
+ 'name' => 'username'
18
+ ));
19
+
20
+ $fieldset->addField('password', 'obscure', array(
21
+ 'label' => Mage::helper('aramexshipping')->__('Password'),
22
+ 'class' => 'required-entry',
23
+ 'required' => true,
24
+ 'name' => 'password'
25
+ ));
26
+
27
+ $fieldset->addField('account_country_code', 'text', array(
28
+ 'label' => Mage::helper('aramexshipping')->__('Account Country Code'),
29
+ 'name' => 'account_country_code'
30
+ ));
31
+
32
+ $fieldset->addField('account_entity', 'text', array(
33
+ 'label' => Mage::helper('aramexshipping')->__('Account Entity'),
34
+ 'name' => 'account_entity'
35
+ ));
36
+
37
+ $fieldset->addField('account_number', 'text', array(
38
+ 'label' => Mage::helper('aramexshipping')->__('Account Number'),
39
+ 'name' => 'account_number'
40
+ ));
41
+
42
+ $fieldset->addField('account_pin', 'obscure', array(
43
+ 'label' => Mage::helper('aramexshipping')->__('Account PIN'),
44
+ 'name' => 'account_pin'
45
+ ));
46
+
47
+ $fieldset->addField('check_account', 'text', array(
48
+ 'name' => 'check_account'
49
+ ))->setRenderer($this->getLayout()->createBlock('aramexshipping/adminhtml_system_config_form_button'));
50
+
51
+ $data = array();
52
+
53
+ if (Mage::registry('aramex_suppliers_data')) {
54
+ $data = Mage::registry('aramex_suppliers_data')->getData();
55
+ }
56
+
57
+ $form->setValues($data);
58
+
59
+ return parent::_prepareForm();
60
+ }
61
+ }
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Tab/Generalinfoform.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_Shipping_Edit_Tab_Generalinfoform
4
+ extends Mage_Adminhtml_Block_Widget_Form
5
+ {
6
+ protected function _prepareForm()
7
+ {
8
+ $form = new Varien_Data_Form();
9
+ $this->setForm($form);
10
+
11
+ $fieldset = $form->addFieldset('general_info_form', array('legend' => Mage::helper('aramexshipping')->__('General information')));
12
+
13
+ $fieldset->addField('identifier', 'text', array(
14
+ 'label' => Mage::helper('aramexshipping')->__('Identifier'),
15
+ 'class' => 'required-entry',
16
+ 'required' => true,
17
+ 'name' => 'identifier'
18
+ ));
19
+
20
+ $fieldset->addField('address_line1', 'text', array(
21
+ 'label' => Mage::helper('aramexshipping')->__('Address Line 1'),
22
+ 'class' => 'required-entry',
23
+ 'required' => true,
24
+ 'name' => 'address_line1'
25
+ ));
26
+
27
+ $fieldset->addField('address_line2', 'text', array(
28
+ 'label' => Mage::helper('aramexshipping')->__('Address Line 2'),
29
+ 'name' => 'address_line2'
30
+ ));
31
+
32
+ $fieldset->addField('address_line3', 'text', array(
33
+ 'label' => Mage::helper('aramexshipping')->__('Address Line 3'),
34
+ 'name' => 'address_line3'
35
+ ));
36
+
37
+ $fieldset->addField('country_code', 'select', array(
38
+ 'label' => Mage::helper('aramexshipping')->__('Country'),
39
+ 'class' => 'required-entry',
40
+ 'required' => true,
41
+ 'values' => Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(),
42
+ 'name' => 'country_code'
43
+ ));
44
+
45
+ $fieldset->addField('city', 'text', array(
46
+ 'label' => Mage::helper('aramexshipping')->__('City'),
47
+ 'class' => 'required-entry',
48
+ 'required' => true,
49
+ 'name' => 'city'
50
+ ));
51
+
52
+ $fieldset->addField('state_or_province_code', 'text', array(
53
+ 'label' => Mage::helper('aramexshipping')->__('State/Province'),
54
+ 'name' => 'state_or_province_code'
55
+ ));
56
+
57
+ $fieldset->addField('post_code', 'text', array(
58
+ 'label' => Mage::helper('aramexshipping')->__('Post Code'),
59
+ 'class' => 'required-entry',
60
+ 'required' => true,
61
+ 'name' => 'post_code'
62
+ ));
63
+
64
+ $fieldset->addField('department', 'text', array(
65
+ 'label' => Mage::helper('aramexshipping')->__('Department'),
66
+ 'name' => 'department'
67
+ ));
68
+
69
+ $fieldset->addField('person_name', 'text', array(
70
+ 'label' => Mage::helper('aramexshipping')->__('Supplier Name'),
71
+ 'class' => 'required-entry',
72
+ 'required' => true,
73
+ 'name' => 'person_name'
74
+ ));
75
+
76
+ $fieldset->addField('title', 'text', array(
77
+ 'label' => Mage::helper('aramexshipping')->__('Supplier Title'),
78
+ 'name' => 'title'
79
+ ));
80
+
81
+ $fieldset->addField('company_name', 'text', array(
82
+ 'label' => Mage::helper('aramexshipping')->__('Company Name'),
83
+ 'class' => 'required-entry',
84
+ 'required' => true,
85
+ 'name' => 'company_name'
86
+ ));
87
+
88
+ $fieldset->addField('phone_number1', 'text', array(
89
+ 'label' => Mage::helper('aramexshipping')->__('Phone Number 1'),
90
+ 'class' => 'required-entry',
91
+ 'required' => true,
92
+ 'name' => 'phone_number1'
93
+ ));
94
+
95
+ $fieldset->addField('phone_number1_ext', 'text', array(
96
+ 'label' => Mage::helper('aramexshipping')->__('Phone Number 1 Ext'),
97
+ 'name' => 'phone_number1_ext'
98
+ ));
99
+
100
+ $fieldset->addField('phone_number2', 'text', array(
101
+ 'label' => Mage::helper('aramexshipping')->__('Phone Number 2'),
102
+ 'name' => 'phone_number2'
103
+ ));
104
+
105
+ $fieldset->addField('phone_number2_ext', 'text', array(
106
+ 'label' => Mage::helper('aramexshipping')->__('Phone Number 2 Ext'),
107
+ 'name' => 'phone_number2_ext'
108
+ ));
109
+
110
+ $fieldset->addField('fax_number', 'text', array(
111
+ 'label' => Mage::helper('aramexshipping')->__('Fax Number'),
112
+ 'name' => 'fax_number'
113
+ ));
114
+
115
+ $fieldset->addField('cellphone', 'text', array(
116
+ 'label' => Mage::helper('aramexshipping')->__('Cellphone'),
117
+ 'class' => 'required-entry',
118
+ 'required' => true,
119
+ 'name' => 'cellphone'
120
+ ));
121
+
122
+ $fieldset->addField('email', 'text', array(
123
+ 'label' => Mage::helper('aramexshipping')->__('Email'),
124
+ 'class' => 'required-entry',
125
+ 'required' => true,
126
+ 'name' => 'email'
127
+ ));
128
+
129
+ $fieldset->addField('type', 'text', array(
130
+ 'label' => Mage::helper('aramexshipping')->__('Type'),
131
+ 'name' => 'type'
132
+ ));
133
+
134
+ $data = array();
135
+
136
+ if (Mage::registry('aramex_suppliers_data')) {
137
+ $data = Mage::registry('aramex_suppliers_data')->getData();
138
+ }
139
+
140
+ $form->setValues($data);
141
+
142
+ return parent::_prepareForm();
143
+ }
144
+ }
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Edit/Tabs.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_Shipping_Edit_Tabs
4
+ extends Mage_Adminhtml_Block_Widget_Tabs
5
+ {
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('aramexshipping_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('aramexshipping')->__('Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('general_info_section', array(
17
+ 'label' => Mage::helper('aramexshipping')->__('General Information'),
18
+ 'title' => Mage::helper('aramexshipping')->__('General Information'),
19
+ 'content' => $this->getLayout()->createBlock('aramexshipping/adminhtml_shipping_edit_tab_generalinfoform')->toHtml()
20
+ ));
21
+
22
+ $this->addTab('aramex_account_section', array(
23
+ 'label' => Mage::helper('aramexshipping')->__('Aramex Account'),
24
+ 'title' => Mage::helper('aramexshipping')->__('Aramex Account'),
25
+ 'content' => $this->getLayout()->createBlock('aramexshipping/adminhtml_shipping_edit_tab_aramexaccountform')->toHtml()
26
+ ));
27
+
28
+ return parent::_beforeToHtml();
29
+ }
30
+ }
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/Shipping/Grid.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_Shipping_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('aramexShuppliersGrid');
9
+ $this->setDefaultSort('asv_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('aramexshipping/shipping')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('asv_id', array(
24
+ 'header' => Mage::helper('aramexshipping')->__('ID'),
25
+ 'width' => '100px',
26
+ 'type' => 'number',
27
+ 'index' => 'asv_id'
28
+ ));
29
+
30
+ $this->addColumn('account_number', array(
31
+ 'header' => Mage::helper('aramexshipping')->__('Aramex Account Number'),
32
+ 'index' => 'account_number'
33
+ ));
34
+
35
+ $this->addColumn('person_name', array(
36
+ 'header' => Mage::helper('aramexshipping')->__('Name'),
37
+ 'index' => 'person_name'
38
+ ));
39
+
40
+ $this->addColumn('email', array(
41
+ 'header' => Mage::helper('aramexshipping')->__('Email'),
42
+ 'index' => 'email'
43
+ ));
44
+
45
+ $this->addColumn('action',
46
+ array(
47
+ 'header' => Mage::helper('aramexshipping')->__('Action'),
48
+ 'width' => '100px',
49
+ 'type' => 'action',
50
+ 'getter' => 'getId',
51
+ 'actions' => array(
52
+ array(
53
+ 'caption' => Mage::helper('aramexshipping')->__('Edit'),
54
+ 'url' => array('base' => '*/*/edit'),
55
+ 'field' => 'id'
56
+ )
57
+ ),
58
+ 'filter' => false,
59
+ 'sortable' => false,
60
+ 'index' => 'stores',
61
+ 'is_system' => true,
62
+ ));
63
+
64
+ $this->addExportType('*/*/exportCsv', Mage::helper('aramexshipping')->__('CSV'));
65
+ $this->addExportType('*/*/exportXml', Mage::helper('aramexshipping')->__('XML'));
66
+
67
+ return parent::_prepareColumns();
68
+ }
69
+
70
+ protected function _prepareMassaction()
71
+ {
72
+ $this->setMassactionIdField('asv_id');
73
+ $this->getMassactionBlock()->setFormFieldName('suppliers_ids');
74
+
75
+ $this->getMassactionBlock()->addItem('delete', array(
76
+ 'label' => Mage::helper('aramexshipping')->__('Delete'),
77
+ 'url' => $this->getUrl('*/*/massDelete'),
78
+ 'confirm' => Mage::helper('aramexshipping')->__('Are you sure?')
79
+ ));
80
+
81
+ return $this;
82
+ }
83
+
84
+ public function getRowUrl($row)
85
+ {
86
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
87
+ }
88
+ }
app/code/community/Shopgo/AramexShipping/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Block_Adminhtml_System_Config_Form_Button
4
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
5
+ {
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $template = $this->setTemplate('shopgo/aramex_shipping/system/config/button.phtml');
10
+ if (Mage::registry('aramex_suppliers_data') && Mage::registry('aramex_suppliers_data')->getId()) {
11
+ $template->setData('id', Mage::registry('aramex_suppliers_data')->getId());
12
+ }
13
+ }
14
+
15
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
16
+ {
17
+ return $this->_toHtml();
18
+ }
19
+
20
+ public function getAjaxCheckUrl()
21
+ {
22
+ return Mage::helper('adminhtml')->getUrl('aramexshipping/adminhtml_aramex/checkaccount');
23
+ }
24
+
25
+ public function getButtonHtml()
26
+ {
27
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(
28
+ array(
29
+ 'id' => 'aramex_account_checker',
30
+ 'label' => $this->helper('adminhtml')->__('Check Account'),
31
+ 'onclick' => 'javascript:checkAramexAccount(); return false;'
32
+ )
33
+ );
34
+
35
+ return $button->toHtml();
36
+ }
37
+ }
app/code/community/Shopgo/AramexShipping/Helper/Data.php ADDED
@@ -0,0 +1,442 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Helper_Data
4
+ extends Mage_Core_Helper_Abstract
5
+ {
6
+ const LOG_FILE = 'aramex_shipping.log';
7
+ const LOG_EMAIL_TEMPLATE = 'aramex_shipping_log_email_template';
8
+ const SUPPLIER_NOTIFICATION_EMAIL_TEMPLATE = 'aramex_shipping_supplier_notification_email_template';
9
+ const GENERAL_CONTACT_EMAIL = 'trans_email/ident_general/email';
10
+ const AUTHOR_EMAIL = 'mageamex@gmail.com';
11
+
12
+ public function getSuppliersCollection($id = null)
13
+ {
14
+ $collection = Mage::getModel('aramexshipping/shipping')->getCollection();
15
+
16
+ if ($id) {
17
+ $collection->addFieldToFilter('asv_id', array('eq' => $id));
18
+ }
19
+
20
+ $suppliers = array();
21
+ foreach ($collection as $supplier) {
22
+ $suppliers[] = $supplier;
23
+ }
24
+
25
+ if (isset($suppliers[0]) && $id) {
26
+ $suppliers = $suppliers[0];
27
+ }
28
+
29
+ return $suppliers;
30
+ }
31
+
32
+ public function getOriginSupplier($section = '')
33
+ {
34
+ $data = array();
35
+
36
+ $generalInfo = array(
37
+ 'country_code' => strtoupper($this->getConfigData('country_id', 'shipping_origin')),
38
+ 'state_or_province_code' => $this->getConfigData('region_id', 'shipping_origin'),
39
+ 'post_code' => $this->getConfigData('postcode', 'shipping_origin'),
40
+ 'city' => ucwords(strtolower($this->getConfigData('city', 'shipping_origin'))),
41
+ 'address_line1' => $this->getConfigData('street_line1', 'shipping_origin'),
42
+ 'address_line2' => $this->getConfigData('street_line2', 'shipping_origin'),
43
+ 'address_line3' => $this->getConfigData('street_line3', 'shipping_origin'),
44
+ 'department' => $this->getConfigData('department', 'shipping_origin'),
45
+ 'person_name' => $this->getConfigData('person_name', 'shipping_origin'),
46
+ 'person_title' => $this->getConfigData('person_title', 'shipping_origin'),
47
+ 'company_name' => $this->getConfigData('company', 'shipping_origin'),
48
+ 'phone_number1' => $this->getConfigData('phone_number1', 'shipping_origin'),
49
+ 'phone_number1_ext' => $this->getConfigData('phone_number1_ext', 'shipping_origin'),
50
+ 'phone_number2' => $this->getConfigData('phone_number2', 'shipping_origin'),
51
+ 'phone_number2_ext' => $this->getConfigData('phone_number2_ext', 'shipping_origin'),
52
+ 'fax_number' => $this->getConfigData('faxnumber', 'shipping_origin'),
53
+ 'cellphone' => $this->getConfigData('cellphone', 'shipping_origin'),
54
+ 'email' => $this->getConfigData('email', 'shipping_origin'),
55
+ 'type' => $this->getConfigData('type', 'shipping_origin')
56
+ );
57
+
58
+ $aramexAccount = array(
59
+ 'username' => $this->getConfigData('username', 'carriers_aramex'),
60
+ 'password' => Mage::helper('core')->decrypt($this->getConfigData('password', 'carriers_aramex')),
61
+ 'account_country_code' => $this->getConfigData('account_country_code', 'carriers_aramex'),
62
+ 'account_entity' => $this->getConfigData('account_entity', 'carriers_aramex'),
63
+ 'account_number' => $this->getConfigData('account_number', 'carriers_aramex'),
64
+ 'account_pin' => Mage::helper('core')->decrypt($this->getConfigData('account_pin', 'carriers_aramex'))
65
+ );
66
+
67
+ if ($section == 'general_info') {
68
+ $data = $generalInfo;
69
+ } elseif ($section == 'aramex_account') {
70
+ $data = $aramexAccount;
71
+ } else {
72
+ $data = array_merge($aramexAccount, $generalInfo);
73
+ }
74
+
75
+ return $data;
76
+ }
77
+
78
+ public function getClientInfo($source)
79
+ {
80
+ if (empty($source)) {
81
+ $source = $this->getOriginSupplier('aramex_account');
82
+ }
83
+
84
+ $clientInfo = array(
85
+ 'UserName' => $source['username'],
86
+ 'Password' => $source['password'],
87
+ 'Version' => 'v1.0'
88
+ );
89
+
90
+ if ($source['account_country_code']) {
91
+ $clientInfo['AccountCountryCode'] = strtoupper($source['account_country_code']);
92
+ }
93
+ if ($source['account_entity']) {
94
+ $clientInfo['AccountEntity'] = strtoupper($source['account_entity']);
95
+ }
96
+ if ($source['account_number']) {
97
+ $clientInfo['AccountNumber'] = $source['account_number'];
98
+ }
99
+ if ($source['account_pin']) {
100
+ $clientInfo['AccountPin'] = $source['account_pin'];
101
+ }
102
+
103
+ return $clientInfo;
104
+ }
105
+
106
+ public function getConfigData($var, $type, $store = null)
107
+ {
108
+ $path = '';
109
+ switch ($type) {
110
+ case 'carriers_aramex':
111
+ $path = 'carriers/aramex/';
112
+ break;
113
+ case 'shipping_origin':
114
+ $path = 'shipping/origin/';
115
+ break;
116
+ }
117
+
118
+ return Mage::getStoreConfig($path . $var, $store);
119
+ }
120
+
121
+ public function soapClient($wsdlName, $callParams, $scOptions = array())
122
+ {
123
+ $wsdl = $this->_getWsdl($wsdlName);
124
+ $result = null;
125
+
126
+ if (!isset($scOptions['soap_version'])) {
127
+ $scOptions['soap_version'] = SOAP_1_1;
128
+ } else if (!$scOptions['soap_version']) {
129
+ $scOptions['soap_version'] = SOAP_1_1;
130
+ }
131
+
132
+ try {
133
+ $soapClient = new SoapClient($wsdl, $scOptions);
134
+ $result = $this->_soapClientCall($wsdlName, $soapClient, $callParams);
135
+ } catch (SoapFault $sf) {
136
+ $this->log($sf->faultstring);
137
+ $result = '[SoapFault]';
138
+ }
139
+
140
+ return $result;
141
+ }
142
+
143
+ private function _soapClientCall($service, $soapClient, $callParams)
144
+ {
145
+ $result = null;
146
+
147
+ switch ($service) {
148
+ case 'rates_calculator':
149
+ $result = $soapClient->CalculateRate($callParams);
150
+ break;
151
+ case 'shipping_service':
152
+ $result = $soapClient->CreateShipments($callParams);
153
+ break;
154
+ case 'tracking_service':
155
+ $result = $soapClient->TrackShipments($callParams);
156
+ break;
157
+ }
158
+
159
+ return $result;
160
+ }
161
+
162
+ private function _getWsdl($name)
163
+ {
164
+ $wsdl = '';
165
+ $wsdlPath = Mage::getModuleDir('etc', 'Shopgo_AramexShipping') . DS . 'wsdl';
166
+
167
+ switch ($name) {
168
+ case 'rates_calculator':
169
+ $wsdl = $wsdlPath . DS . 'aramex_rates_calculator_service.wsdl';
170
+ break;
171
+ case 'shipping_service':
172
+ $wsdl = $wsdlPath . DS . 'aramex_shipping_service.wsdl';
173
+ break;
174
+ case 'tracking_service':
175
+ $wsdl = $wsdlPath . DS . 'aramex_shipments_tracking_service.wsdl';
176
+ break;
177
+ }
178
+
179
+ return $wsdl;
180
+ }
181
+
182
+ public function getServiceErrorMessages($messages)
183
+ {
184
+ $message = '';
185
+
186
+ if (gettype($messages) == 'array') {
187
+ foreach ($messages as $msg) {
188
+ $message .= $msg->Message . "\n";
189
+ }
190
+ } else {
191
+ $message = $messages->Message;
192
+ }
193
+
194
+ return trim($message);
195
+ }
196
+
197
+ public function isPositiveInteger($var)
198
+ {
199
+ return is_numeric($var) && (int)$var == $var && (int)$var > 0;
200
+ }
201
+
202
+ public function currencyConvert($price, $from, $to, $output = '', $round = null)
203
+ {
204
+ $from = strtoupper($from);
205
+ $to = strtoupper($to);
206
+
207
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
208
+ $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
209
+
210
+ if ('_BASE_' == $from) {
211
+ $from = $baseCurrencyCode;
212
+ } elseif ('_CURRENT_' == $from) {
213
+ $from = $currentCurrencyCode;
214
+ }
215
+
216
+ if ('_BASE_' == $to) {
217
+ $to = $baseCurrencyCode;
218
+ } elseif ('_CURRENT_' == $to) {
219
+ $to = $currentCurrencyCode;
220
+ }
221
+
222
+ $output = strtolower($output);
223
+
224
+ $error = false;
225
+ $result = array('price' => $price, 'currency' => $from);
226
+
227
+ if ($from != $to) {
228
+ $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
229
+ $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
230
+
231
+ if (empty($rates) || !isset($rates[$from]) || !isset($rates[$to])) {
232
+ $error = true;
233
+ } elseif (empty($rates[$from]) || empty($rates[$to])) {
234
+ $error = true;
235
+ }
236
+
237
+ if ($error) {
238
+ $this->log($this->__('Currency conversion error.'));
239
+ if (isset($result[$output])) {
240
+ return $result[$output];
241
+ } else {
242
+ return $result;
243
+ }
244
+ }
245
+
246
+ $result = array(
247
+ 'price' => ($price * $rates[$to]) / $rates[$from],
248
+ 'currency' => $to
249
+ );
250
+ }
251
+
252
+ if (is_int($round)) {
253
+ $result['price'] = round($result['price'], $round);
254
+ }
255
+
256
+ if (isset($result[$output])) {
257
+ return $result[$output];
258
+ }
259
+
260
+ return $result;
261
+ }
262
+
263
+ public function convertRateCurrency($price, $priceCurrencyCode)
264
+ {
265
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
266
+ $result = array('price' => $price, 'currency' => $priceCurrencyCode);
267
+
268
+ if ($priceCurrencyCode != $baseCurrencyCode) {
269
+ $result = $this->currencyConvert($price, $priceCurrencyCode, $baseCurrencyCode);
270
+ }
271
+
272
+ return $result;
273
+ }
274
+
275
+ public function sendLogEmail($params = array())
276
+ {
277
+ if (!empty($params)) {
278
+ if (!isset($params['subject']) || !isset($params['content'])) {
279
+ return;
280
+ }
281
+
282
+ $to = array();
283
+
284
+ if (gettype($params['content']) == 'array') {
285
+ $params['content'] = print_r($params['content'], true);
286
+ }
287
+
288
+ $params['website_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
289
+
290
+ $params['content'] = '<pre>' . $params['content'] . '</pre>';
291
+
292
+ if ($this->getConfigData('author_reports', 'carriers_aramex')) {
293
+ $to[] = self::AUTHOR_EMAIL;
294
+ }
295
+
296
+ if ($this->getConfigData('admin_reports', 'carriers_aramex')) {
297
+ $reportsEmails = array_map('trim', explode(',', $this->getConfigData('reports_emails', 'carriers_aramex')));
298
+ if (empty($reportsEmails)) {
299
+ $reportsEmails = array(Mage::getStoreConfig(self::GENERAL_CONTACT_EMAIL));
300
+ }
301
+ $to = array_unique(array_merge($to, $reportsEmails));
302
+ }
303
+
304
+ foreach ($to as $r) {
305
+ $this->sendEmail($r, self::LOG_EMAIL_TEMPLATE, $params);
306
+ }
307
+ }
308
+ }
309
+
310
+ public function notifySupplier($to, $params = array())
311
+ {
312
+ if ($this->getConfigData('alert_suppliers', 'carriers_aramex')) {
313
+ $this->sendEmail($to, self::SUPPLIER_NOTIFICATION_EMAIL_TEMPLATE, $params, 'sales');
314
+ }
315
+ }
316
+
317
+ public function sendEmail($to, $templateId, $params = array(), $sender = 'general')
318
+ {
319
+ $mailTemplate = Mage::getModel('core/email_template');
320
+ $translate = Mage::getSingleton('core/translate');
321
+ $result = true;
322
+
323
+ $mailTemplate->setTemplateSubject($params['subject'])->sendTransactional(
324
+ $templateId,
325
+ $sender,
326
+ $to,
327
+ null,
328
+ $params,
329
+ Mage::app()->getStore()->getId()
330
+ );
331
+
332
+ if (!$mailTemplate->getSentSuccess()) {
333
+ $this->log('Could not send log email.');
334
+ $result = false;
335
+ }
336
+
337
+ $translate->setTranslateInline(true);
338
+
339
+ return $result;
340
+ }
341
+
342
+ public function debug($params, $file = '')
343
+ {
344
+ if ($this->getConfigData('debug', 'carriers_aramex')) {
345
+ $this->log($params, '', $file);
346
+ }
347
+ }
348
+
349
+ public function userMessage($message, $type, $sessionPath = 'core/session')
350
+ {
351
+ try {
352
+ $session = Mage::getSingleton($sessionPath);
353
+
354
+ switch ($type) {
355
+ case 'error':
356
+ $session->addError($message);
357
+ break;
358
+ case 'success':
359
+ $session->addSuccess($message);
360
+ break;
361
+ case 'notice':
362
+ $session->addNotice($message);
363
+ break;
364
+ }
365
+ } catch (Exception $e) {
366
+ $this->log($e, 'exception');
367
+ return false;
368
+ }
369
+
370
+ return true;
371
+ }
372
+
373
+ public function hideLogPrivacies($data, $mass = false)
374
+ {
375
+ $mask = '******';
376
+
377
+ try {
378
+ if ($mass) {
379
+ foreach ($data as $key => $val) {
380
+ if (isset($data[$key]['ClientInfo'])) {
381
+ $data[$key]['ClientInfo']['UserName'] = $mask;
382
+ $data[$key]['ClientInfo']['Password'] = $mask;
383
+ $data[$key]['ClientInfo']['AccountPin'] = $mask;
384
+ }
385
+ if (isset($data[$key]['supplier'])) {
386
+ $data[$key]['supplier']['username'] = $mask;
387
+ $data[$key]['supplier']['password'] = $mask;
388
+ $data[$key]['supplier']['account_pin'] = $mask;
389
+ }
390
+ }
391
+ } else {
392
+ $data['ClientInfo']['UserName'] = $mask;
393
+ $data['ClientInfo']['Password'] = $mask;
394
+ $data['ClientInfo']['AccountPin'] = $mask;
395
+ }
396
+ } catch (Exception $e) {
397
+ $this->log($e, 'exception');
398
+ }
399
+
400
+ return $data;
401
+ }
402
+
403
+ public function log($params, $type = 'system', $_file = '')
404
+ {
405
+ if (empty($params)) {
406
+ return false;
407
+ }
408
+
409
+ if ($type == 'system' || $type == '') {
410
+ if (gettype($params) == 'string') {
411
+ $params = array(array('message' => $params));
412
+ }
413
+
414
+ foreach ($params as $param) {
415
+ if (!isset($param['message'])) {
416
+ continue;
417
+ }
418
+ $message = gettype($param['message']) == 'array' ?
419
+ print_r($param['message'], true) : $param['message'];
420
+ $level = isset($param['level']) ? $param['level'] : null;
421
+ $file = !empty($_file) ? $_file : self::LOG_FILE;
422
+ if (isset($param['file']) && !empty($param['file'])) {
423
+ $file = $param['file'];
424
+ }
425
+ if (strpos($file, '.log') === false) {
426
+ $file .= '.log';
427
+ }
428
+ $forceLog = isset($param['forceLog']) ? $param['forceLog'] : false;
429
+
430
+ Mage::log($message, $level, $file, $forceLog);
431
+ }
432
+ } elseif ($type == 'exception') {
433
+ if (get_class($params) != 'Exception') {
434
+ return false;
435
+ }
436
+
437
+ Mage::logException($params);
438
+ }
439
+
440
+ return true;
441
+ }
442
+ }
app/code/community/Shopgo/AramexShipping/Model/Carrier/Aramex.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_Carrier_Aramex
4
+ extends Mage_Shipping_Model_Carrier_Abstract
5
+ implements Mage_Shipping_Model_Carrier_Interface
6
+ {
7
+ protected $_code = 'aramex';
8
+ protected $_result = null;
9
+
10
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
11
+ {
12
+ if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active')) {
13
+ return false;
14
+ }
15
+
16
+ $destinationData = array(
17
+ 'city' => ucwords(strtolower($request->getDestCity())),
18
+ 'country_id' => $request->getDestCountryId(),
19
+ 'postcode' => $request->getDestPostcode()
20
+ );
21
+
22
+ $quoteId = Mage::getSingleton('checkout/session')->getQuoteId();
23
+ $quote = Mage::getModel("sales/quote")->load($quoteId);
24
+
25
+ $result = Mage::getModel('aramexshipping/shipping')->getRatesAndPackages($quote, true, $destinationData);
26
+
27
+ $error = $result['error'];
28
+ $error_msg = isset($result['error_msg']) ? 'Aramex Error: ' . $result['error_msg'] : '';
29
+ $price = $result['price'];
30
+
31
+ $methodTitle = $request->getFreeShipping() ?
32
+ Mage::helper('aramexshipping')->__('Free shipping applied') : '';
33
+
34
+ $handling = Mage::getStoreConfig('carriers/' . $this->_code . '/handling');
35
+ $result = Mage::getModel('shipping/rate_result');
36
+
37
+ if ((!$error && $price > 0) || (!$error && $request->getFreeShipping())) {
38
+ $method = Mage::getModel('shipping/rate_result_method');
39
+ $method->setCarrier($this->_code);
40
+ $method->setMethod($this->_code);
41
+ $method->setCarrierTitle($this->getConfigData('title'));
42
+ $method->setMethodTitle($methodTitle);
43
+ $method->setPrice($price);
44
+ $method->setCost($price);
45
+ $result->append($method);
46
+ } else {
47
+ $error = Mage::getModel('shipping/rate_result_error');
48
+ $error->setCarrier($this->_code);
49
+ $error->setCarrierTitle($this->getConfigData('title'));
50
+ $error->setErrorMessage($error_msg ? $error_msg : $this->getConfigData('specificerrmsg'));
51
+ $result->append($error);
52
+
53
+ if ($error_msg) {
54
+ Mage::helper('aramexshipping')->log($error_msg, '', 'aramex_collect_rates');
55
+ Mage::helper('aramexshipping')->sendLogEmail(array('subject' => 'Collect Rates Error Log', 'content' => $error_msg));
56
+ }
57
+ }
58
+
59
+ return $result;
60
+ }
61
+
62
+ public function getAllowedMethods()
63
+ {
64
+ return array('aramex' => $this->getConfigData('name'));
65
+ }
66
+
67
+ public function isTrackingAvailable()
68
+ {
69
+ return $this->getConfigData('tracking_service');
70
+ }
71
+
72
+ public function isShippingLabelsAvailable()
73
+ {
74
+ return false;
75
+ }
76
+
77
+ public function isCityRequired()
78
+ {
79
+ return true;
80
+ }
81
+
82
+ public function isZipCodeRequired($countryId = null)
83
+ {
84
+ if ($countryId != null) {
85
+ return !Mage::helper('directory')->isZipCodeOptional($countryId);
86
+ }
87
+ return true;
88
+ }
89
+
90
+ public function isGirthAllowed($countyDest = null) {
91
+ return false;
92
+ }
93
+
94
+ public function getTrackingInfo($tracking)
95
+ {
96
+ if (!$this->isTrackingAvailable()) {
97
+ return false;
98
+ }
99
+
100
+ $info = array();
101
+
102
+ $result = $this->getTracking($tracking);
103
+
104
+ if($result instanceof Mage_Shipping_Model_Tracking_Result){
105
+ if ($trackings = $result->getAllTrackings()) {
106
+ return $trackings;
107
+ }
108
+ } elseif (is_string($result) && !empty($result)) {
109
+ return $result;
110
+ }
111
+
112
+ return false;
113
+ }
114
+
115
+ public function getTracking($trackings)
116
+ {
117
+ if (!is_array($trackings)) {
118
+ $trackings = array($trackings);
119
+ }
120
+
121
+ $response = Mage::getModel('aramexshipping/shipping')->getTracking($trackings);
122
+
123
+ if ($response != '[SoapFault]') {
124
+ $this->_parseTrackingResponse($trackings, $response);
125
+ } else {
126
+ Mage::helper('aramexshipping')->log(
127
+ array('message' => Mage::helper('aramexshipping')->__('Could not get tracking.')),
128
+ '' , 'aramex_tracking'
129
+ );
130
+ Mage::helper('aramexshipping')->sendLogEmail(array('subject' => 'Get Tracking Error Log', 'content' => 'Could not get tracking.'));
131
+ }
132
+
133
+ return $this->_result;
134
+ }
135
+
136
+ private function _parseTrackingResponse($trackings, $response)
137
+ {
138
+ $helper = Mage::helper('aramexshipping');
139
+ $errorTitle = $helper->__('Unable to retrieve tracking');
140
+ $trackingResultsValue = $response->TrackingResults->KeyValueOfstringArrayOfTrackingResultmFAkxlpY->Value;
141
+ $resultArr = array();
142
+ $errorArr = array();
143
+
144
+ if ($response->HasErrors) {
145
+ $code = $response->Notifications->Notification->Code;
146
+ $message = $response->Notifications->Notification->Message;
147
+ $errorTitle = $helper->__('%s : %s', $code, $message);
148
+ } elseif (empty($trackingResultsValue)) {
149
+ $errorTitle = $helper->__('Unable to retrieve tracking');
150
+ } else {
151
+ $trackingResults = $trackingResultsValue->TrackingResult;
152
+ foreach ($trackingResults as $tr) {
153
+ $rArr = array();
154
+ $updateCode = $tr->UpdateCode;
155
+ $tracknum = $tr->WaybillNumber;
156
+ $rArr['delivery_location'] = $tr->UpdateLocation;
157
+ $time = strtotime($tr->UpdateDateTime);
158
+ $rArr['deliverydate'] = (string)date('Y-m-d', $time);
159
+ $rArr['deliverytime'] = (string)date('H:i', $time) . ':00';
160
+ $rArr['status'] = $tr->UpdateDescription;
161
+ $rArr['comment'] = $tr->Comments;
162
+ $resultArr[$tracknum . ' - ' . $updateCode] = $rArr;
163
+ if ($tr->ProblemCode) {
164
+ $errorArr[$tracknum . ' - ' . $updateCode] = 'Problem Code: ' . $tr->ProblemCode;
165
+ }
166
+ }
167
+ }
168
+
169
+ $result = Mage::getModel('shipping/tracking_result');
170
+
171
+ if ($errorArr || $resultArr) {
172
+ foreach ($errorArr as $t => $r) {
173
+ $error = Mage::getModel('shipping/tracking_result_error');
174
+ $error->setCarrier('aramex');
175
+ $error->setCarrierTitle($this->getConfigData('title'));
176
+ $error->setTracking($t);
177
+ $error->setErrorMessage($r);
178
+ $result->append($error);
179
+
180
+ $errorLog = array(
181
+ array('message' => $t),
182
+ array('message' => $r)
183
+ );
184
+ $helper->log($errorLog, '', 'aramex_tracking');
185
+ $helper->sendLogEmail(array('subject' => 'Tracking Response Parser Error Log', 'content' => $errorLog));
186
+ }
187
+
188
+ foreach ($resultArr as $t => $data) {
189
+ $tracking = Mage::getModel('shipping/tracking_result_status');
190
+ $tracking->setCarrier('aramex');
191
+ $tracking->setCarrierTitle($this->getConfigData('title'));
192
+ $tracking->setTracking($t);
193
+ $tracking->addData($data);
194
+ $result->append($tracking);
195
+ }
196
+ } else {
197
+ foreach ($trackings as $t) {
198
+ $error = Mage::getModel('shipping/tracking_result_error');
199
+ $error->setCarrier('aramex');
200
+ $error->setCarrierTitle($this->getConfigData('title'));
201
+ $error->setTracking($t);
202
+ $error->setErrorMessage($errorTitle);
203
+ $result->append($error);
204
+
205
+ $errorLog = array(
206
+ array('message' => $t),
207
+ array('message' => $errorTitle)
208
+ );
209
+ $helper->log($errorLog, '', 'aramex_tracking');
210
+ $helper->sendLogEmail(array('subject' => 'Tracking Response Parser Error Log', 'content' => $errorLog));
211
+ }
212
+ }
213
+
214
+ $this->_result = $result;
215
+ }
216
+ }
app/code/community/Shopgo/AramexShipping/Model/Mysql4/Shipping.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_Mysql4_Shipping
4
+ extends Mage_Core_Model_Mysql4_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ $this->_init('aramexshipping/shipping', 'asv_id');
9
+ }
10
+ }
app/code/community/Shopgo/AramexShipping/Model/Mysql4/Shipping/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_Mysql4_Shipping_Collection
4
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('aramexshipping/shipping');
10
+ }
11
+ }
app/code/community/Shopgo/AramexShipping/Model/Observer.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_Observer
4
+ {
5
+ public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
6
+ {
7
+ Mage::getModel('aramexshipping/shipping')->prepareShipment($observer->getShipment(), 'neutral');
8
+ }
9
+ }
app/code/community/Shopgo/AramexShipping/Model/Product/Attribute/Source/Suppliers.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_Product_Attribute_Source_Suppliers
4
+ extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
5
+ {
6
+ public function getAllOptions()
7
+ {
8
+ $this->_options = array();
9
+ $suppliers = Mage::helper('aramexshipping')->getSuppliersCollection();
10
+
11
+ foreach ($suppliers as $supplier) {
12
+ $this->_options[] = array(
13
+ 'value' => $supplier->getId(),
14
+ 'label' => $supplier->getIdentifier()
15
+ );
16
+ }
17
+
18
+ array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('None')));
19
+
20
+ return $this->_options;
21
+ }
22
+ }
app/code/community/Shopgo/AramexShipping/Model/Shipping.php ADDED
@@ -0,0 +1,880 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_Shipping
4
+ extends Mage_Core_Model_Abstract
5
+ {
6
+ const PRIORITY_DOCUMENT_EXPRESS = 'PDX';
7
+ const PRIORITY_PARCEL_EXPRESS = 'PPX';
8
+ const PRIORITY_LETTER_EXPRESS = 'PLX';
9
+ const DEFERRED_DOCUMENT_EXPRESS = 'DDX';
10
+ const DEFERRED_PARCEL_EXPRESS = 'DPX';
11
+ const GROUND_DOCUMENT_EXPRESS = 'GDX';
12
+ const GROUND_PARCEL_EXPRESS = 'GPX';
13
+ const ECONOMY_PARCEL_EXPRESS = 'EPX';
14
+ const EXPRESS = 'EXP';
15
+ const DOMESTIC = 'DOM';
16
+ const PRODT_ON_DELIVERY = 'OND';
17
+ const SS_CASH_ON_DELIVERY = 'CODS';
18
+ const PAYMENT_TYPE_PREPAID = 'P';
19
+ const POUNDS = 'LB';
20
+ const KILOGRAMS = 'KG';
21
+
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('aramexshipping/shipping');
26
+ }
27
+
28
+ public function getCode($type, $code = '')
29
+ {
30
+ $codes = array(
31
+ 'unit_of_measure' => array(
32
+ self::POUNDS => Mage::helper('aramexshipping')->__('Pounds'),
33
+ self::KILOGRAMS => Mage::helper('aramexshipping')->__('Kilograms')
34
+ )
35
+ );
36
+
37
+ if (!isset($codes[$type])) {
38
+ return false;
39
+ } elseif ('' === $code) {
40
+ return $codes[$type];
41
+ }
42
+
43
+ $code = strtoupper($code);
44
+ if (!isset($codes[$type][$code])) {
45
+ return false;
46
+ } else {
47
+ return $codes[$type][$code];
48
+ }
49
+ }
50
+
51
+ public function checkAccount($clientInfoSource)
52
+ {
53
+ $helper = Mage::helper('aramexshipping');
54
+
55
+ $originData = $helper->getOriginSupplier('general_info');
56
+
57
+ $params = array(
58
+ 'ClientInfo' => $helper->getClientInfo($clientInfoSource),
59
+ 'Transaction' => array(
60
+ 'Reference1' => '001'
61
+ ),
62
+ 'OriginAddress' => array(
63
+ 'City' => ucwords(strtolower($originData['city'])),
64
+ 'CountryCode' => $originData['country_code'],
65
+ 'PostCode' => $originData['post_code']
66
+ ),
67
+ 'DestinationAddress' => array(
68
+ 'City' => 'New York',
69
+ 'CountryCode' => 'US',
70
+ 'PostCode' => '10001'
71
+ ),
72
+ 'ShipmentDetails' => array(
73
+ 'PaymentType' => self::PAYMENT_TYPE_PREPAID,
74
+ 'ProductGroup' => self::EXPRESS,
75
+ 'ProductType' => self::PRIORITY_PARCEL_EXPRESS,
76
+ 'ActualWeight' => array('Value' => 1, 'Unit' => self::POUNDS),
77
+ 'ChargeableWeight' => array('Value' => 1, 'Unit' => self::POUNDS),
78
+ 'NumberOfPieces' => 1
79
+ )
80
+ );
81
+
82
+ $soapResult = $helper->soapClient('rates_calculator', $params, array('trace' => 1));
83
+
84
+ $result = array('valid' => 1, 'message' => 'Valid account information');
85
+
86
+ if ($soapResult == '[SoapFault]') {
87
+ $result = array('valid' => 0,
88
+ 'message' => 'Could not call service provider properly. If the issue presists, please report it to the extension author');
89
+ } elseif ($soapResult->HasErrors) {
90
+ $_message = $helper->getServiceErrorMessages($soapResult->Notifications->Notification);
91
+ if (empty($_message)) {
92
+ $_message = 'Uknown error has occured. If the issue persists, please report it to the extension author';
93
+ }
94
+ $result = array('valid' => 0, 'message' => $_message);
95
+ }
96
+
97
+ return $result;
98
+ }
99
+
100
+ public function calculateRate($requestData, $clientInfoSource = array())
101
+ {
102
+ $helper = Mage::helper('aramexshipping');
103
+
104
+ if (!$helper->getConfigData('active', 'carriers_aramex')) {
105
+ return false;
106
+ }
107
+
108
+ $productGroup = $requestData['countryId'] == $requestData['destCountryId'] ?
109
+ self::DOMESTIC : self::EXPRESS;
110
+ $productType = $productGroup == self::DOMESTIC ?
111
+ self::PRODT_ON_DELIVERY : $helper->getConfigData('product_type', 'carriers_aramex');
112
+
113
+ $params = array(
114
+ 'ClientInfo' => $helper->getClientInfo($clientInfoSource),
115
+ 'Transaction' => array(
116
+ 'Reference1' => '001'
117
+ ),
118
+ 'OriginAddress' => array(
119
+ 'City' => ucwords(strtolower($requestData['city'])),
120
+ 'CountryCode' => strtoupper($requestData['countryId']),
121
+ 'PostCode' => $requestData['postcode']
122
+ ),
123
+ 'DestinationAddress' => array(
124
+ 'City' => ucwords(strtolower($requestData['destCity'])),
125
+ 'CountryCode' => strtoupper($requestData['destCountryId']),
126
+ 'PostCode' => $requestData['destPostcode']
127
+ ),
128
+ 'ShipmentDetails' => array(
129
+ 'PaymentType' => self::PAYMENT_TYPE_PREPAID,
130
+ 'ProductGroup' => $productGroup,
131
+ 'ProductType' => $productType,
132
+ 'ActualWeight' => array('Value' => $requestData['packageWeight'], 'Unit' => $helper->getConfigData('unit_of_measure', 'carriers_aramex')),
133
+ 'ChargeableWeight' => array('Value' => $requestData['packageWeight'], 'Unit' => $helper->getConfigData('unit_of_measure', 'carriers_aramex')),
134
+ 'NumberOfPieces' => $requestData['packageQty']
135
+ )
136
+ );
137
+
138
+ $result = array(
139
+ 'error' => false,
140
+ 'price' => 0,
141
+ 'currency' => Mage::app()->getStore()->getBaseCurrencyCode()
142
+ );
143
+
144
+ $soapResult = $helper->soapClient('rates_calculator', $params, array('trace' => 1));
145
+
146
+ $debugLog = array(
147
+ array('message' => $helper->hideLogPrivacies($params)),
148
+ array('message' => $soapResult)
149
+ );
150
+ $helper->debug($debugLog, 'aramex_calculate_rate');
151
+ $helper->sendLogEmail(array('subject' => 'Calculate Rate Debug Log', 'content' => $debugLog));
152
+
153
+ if ($soapResult != '[SoapFault]') {
154
+ $result['error'] = $soapResult->HasErrors;
155
+ $result['error_msg'] = $helper->getServiceErrorMessages($soapResult->Notifications->Notification);
156
+ $result['price'] = $soapResult->TotalAmount->Value;
157
+ $result['currency'] = $soapResult->TotalAmount->CurrencyCode;
158
+
159
+ if (!$result['error']) {
160
+ $conversion = $helper->convertRateCurrency($result['price'], $result['currency']);
161
+ $result['price'] = $conversion['price'];
162
+ $result['currency'] = $conversion['currency'];
163
+ }
164
+ } else {
165
+ $result['error'] = true;
166
+ }
167
+
168
+ return $result;
169
+ }
170
+
171
+ public function getRatesAndPackages($object, $returnRates = true, $destinationData = array())
172
+ {
173
+ $helper = Mage::helper('aramexshipping');
174
+ $quoteItems = $object->getAllItems();
175
+ $localItems = array();
176
+ $packages = array('origin' => array());
177
+ $suppliers = $helper->getSuppliersCollection();
178
+ $ratesTotal = 0;
179
+
180
+ switch (get_class($object)) {
181
+ case 'Mage_Sales_Model_Quote':
182
+ $quoteType = 'quote';
183
+ break;
184
+ case 'Mage_Sales_Model_Order':
185
+ $quoteType = 'order';
186
+ break;
187
+ case 'Mage_Sales_Model_Order_Shipment':
188
+ $quoteType = 'shipment';
189
+ break;
190
+ default:
191
+ return;
192
+ }
193
+
194
+ if (!$destinationData) {
195
+ $destinationData = $object->getShippingAddress()->getData();
196
+ }
197
+
198
+ foreach ($quoteItems as $item) {
199
+ $localItems[] = $item;
200
+ $itemSupplier = Mage::getModel('catalog/product')->load($item->getProductId())->getAramexSupplier();
201
+
202
+ foreach ($suppliers as $supplier) {
203
+ if ($itemSupplier == $supplier->getId()) {
204
+ if (!isset($packages[$itemSupplier])) {
205
+ $packages[$itemSupplier] = array();
206
+ }
207
+ if (!isset($packages[$itemSupplier]['supplier'])) {
208
+ $packages[$itemSupplier]['supplier'] = $supplier->getData();
209
+ }
210
+ if (!isset($packages[$itemSupplier]['price'])) {
211
+ $packages[$itemSupplier]['price'] = 0;
212
+ }
213
+ if (!isset($packages[$itemSupplier]['weight'])) {
214
+ $packages[$itemSupplier]['weight'] = 0;
215
+ }
216
+ if (!isset($packages[$itemSupplier]['qty'])) {
217
+ $packages[$itemSupplier]['qty'] = 0;
218
+ }
219
+
220
+ $packages[$itemSupplier]['price'] += $item->getBasePrice();
221
+ $packages[$itemSupplier]['weight'] += $item->getWeight();
222
+ $packages[$itemSupplier]['qty'] += $quoteType == 'order' ? $item->getQtyOrdered() : $item->getQty();
223
+
224
+ if ($quoteType == 'order') {
225
+ $packages[$itemSupplier]['qty_invoiced'] += $item->getQtyInvoiced();
226
+ }
227
+
228
+ if ($item->getQtyShipped()) {
229
+ $packages[$itemSupplier]['qty_shipped'] += $item->getQtyShipped();
230
+ }
231
+
232
+ if ($quoteType == 'order' && $item->getParentItemId()) {
233
+ $packages[$itemSupplier]['items'][$item->getParentItemId()]['qty'] = $item->getQtyOrdered();
234
+ $packages[$itemSupplier]['items'][$item->getParentItemId()]['qty_invoiced'] = $item->getQtyInvoiced();
235
+ if ($item->getQtyShipped()) {
236
+ $packages[$itemSupplier]['items'][$item->getParentItemId()]['qty_shipped'] = $item->getQtyShipped();
237
+ }
238
+ } else {
239
+ $packages[$itemSupplier]['items'][$item->getId()]['qty'] =
240
+ $quoteType == 'order' ? $item->getQtyOrdered() : $item->getQty();
241
+ if ($quoteType == 'order') {
242
+ $packages[$itemSupplier]['items'][$item->getId()]['qty_invoiced'] = $item->getQtyInvoiced();
243
+ }
244
+ if ($item->getQtyShipped()) {
245
+ $packages[$itemSupplier]['items'][$item->getId()]['qty_shipped'] = $item->getQtyShipped();
246
+ }
247
+ }
248
+
249
+ $localItems = count($localItems) == 1 ? array() : array_pop($localItems);
250
+
251
+ break;
252
+ }
253
+ }
254
+ }
255
+
256
+ foreach ($localItems as $item) {
257
+ if (!isset($packages[$itemSupplier]['supplier'])) {
258
+ $packages['origin']['supplier'] = $helper->getOriginSupplier();
259
+ }
260
+ if (!isset($packages['origin']['price'])) {
261
+ $packages['origin']['price'] = 0;
262
+ }
263
+ if (!isset($packages['origin']['weight'])) {
264
+ $packages['origin']['weight'] = 0;
265
+ }
266
+ if (!isset($packages['origin']['qty'])) {
267
+ $packages['origin']['qty'] = 0;
268
+ }
269
+
270
+ $packages['origin']['price'] += $item->getBasePrice();
271
+ $packages['origin']['weight'] += $item->getWeight();
272
+ $packages['origin']['qty'] += $quoteType == 'order' ? $item->getQtyOrdered() : $item->getQty();
273
+
274
+ if ($quoteType == 'order') {
275
+ $packages['origin']['qty_invoiced'] += $item->getQtyInvoiced();
276
+ }
277
+
278
+ if ($item->getQtyShipped()) {
279
+ $packages['origin']['qty_shipped'] += $item->getQtyShipped();
280
+ }
281
+
282
+ if ($quoteType == 'order' && $item->getParentItemId()) {
283
+ $packages['origin']['items'][$item->getParentItemId()]['qty'] = $item->getQtyOrdered();
284
+ $packages['origin']['items'][$item->getParentItemId()]['qty_invoiced'] = $item->getQtyInvoiced();
285
+ if ($item->getQtyShipped()) {
286
+ $packages[$itemSupplier]['items'][$item->getParentItemId()]['qty_shipped'] = $item->getQtyShipped();
287
+ }
288
+ } else {
289
+ $packages['origin']['items'][$item->getId()]['qty'] =
290
+ $quoteType == 'order' ? $item->getQtyOrdered() : $item->getQty();
291
+ if ($quoteType == 'order') {
292
+ $packages['origin']['items'][$item->getId()]['qty_invoiced'] = $item->getQtyInvoiced();
293
+ }
294
+ if ($item->getQtyShipped()) {
295
+ $packages[$itemSupplier]['items'][$item->getId()]['qty_shipped'] = $item->getQtyShipped();
296
+ }
297
+ }
298
+ }
299
+
300
+ if (empty($packages['origin'])) {
301
+ unset($packages['origin']);
302
+ }
303
+
304
+ foreach ($packages as $k => $v) {
305
+ $ratePrice = 0;
306
+
307
+ $requestData = array(
308
+ 'city' => $v['supplier']['city'],
309
+ 'countryId' => $v['supplier']['country_code'],
310
+ 'postcode' => $v['supplier']['post_code'],
311
+ 'destCity' => ucwords(strtolower($destinationData['city'])),
312
+ 'destCountryId' => strtoupper($destinationData['country_id']),
313
+ 'destPostcode' => $destinationData['postcode'],
314
+ 'packageWeight' => $v['weight'],
315
+ 'packageQty' => $v['qty']
316
+ );
317
+
318
+ if ($k == 'origin') {
319
+ $rateRequest = $this->calculateRate($requestData, $v['supplier']);
320
+ if ($rateRequest['error']) {
321
+ return $rateRequest;
322
+ }
323
+ } else {
324
+ $rateRequest = $this->calculateRate($requestData, $v['supplier']);
325
+ if ($rateRequest['error']) {
326
+ return $rateRequest;
327
+ }
328
+ }
329
+
330
+ $ratesTotal += $rateRequest['price'];
331
+ $packages[$k]['shipmentFees'] = array(
332
+ 'value' => $rateRequest['price'],
333
+ 'currency' => $rateRequest['currency']
334
+ );
335
+ $packages[$k]['price'] += $rateRequest['price'];
336
+ }
337
+
338
+ $debugLog = array(
339
+ array('log' => $helper->hideLogPrivacies($packages, true)),
340
+ array('quote_type' => $quoteType)
341
+ );
342
+ $helper->debug($debugLog, 'aramex_shipment_packages');
343
+ $helper->sendLogEmail(array('subject' => 'Shipment Packages Debug Log', 'content' => $debugLog));
344
+
345
+ Mage::getSingleton('checkout/session')->setShipmentsPackages($packages);
346
+ Mage::getSingleton('checkout/session')->setQuoteType($quoteType);
347
+
348
+ if ($returnRates) {
349
+ return array('error' => false, 'price' => $ratesTotal);
350
+ }
351
+ }
352
+
353
+ public function prepareShipment($object, $shippingMode)
354
+ {
355
+ $helper = Mage::helper('aramexshipping');
356
+
357
+ $shipment = null;
358
+ $invoice = null;
359
+ $order = null;
360
+
361
+ switch (get_class($object)) {
362
+ case 'Mage_Sales_Model_Order':
363
+ $order = $object;
364
+ break;
365
+ case 'Mage_Sales_Model_Order_Shipment':
366
+ $shipment = $object;
367
+ $order = $shipment->getOrder();
368
+ break;
369
+ case 'Mage_Sales_Model_Order_Invoice':
370
+ $invoice = $object;
371
+ $order = $invoice->getOrder();
372
+ break;
373
+ default:
374
+ return;
375
+ }
376
+
377
+ if (!$helper->getConfigData('active', 'carriers_aramex')
378
+ || !$helper->getConfigData('shipping_service', 'carriers_aramex')
379
+ || $order->getShippingCarrier()->getCarrierCode() != 'aramex'
380
+ || ($shippingMode == 'auto' && !$order->canShip())) {
381
+ return;
382
+ }
383
+
384
+ if (Mage::registry('skip_shipment_save_after')) {
385
+ Mage::unregister('skip_shipment_save_after');
386
+ return;
387
+ }
388
+
389
+ if ($shippingMode == 'neutral') {
390
+ $this->getRatesAndPackages($shipment, false);
391
+ }
392
+
393
+ $packages = Mage::getSingleton('checkout/session')->getShipmentsPackages();
394
+ $quoteType = Mage::getSingleton('checkout/session')->getQuoteType();
395
+
396
+ if (empty($quoteType)) {
397
+ $quoteType = 'order';
398
+ }
399
+
400
+ if (empty($packages)) {
401
+ return;
402
+ }
403
+
404
+ $destinationData = $order->getShippingAddress()->getData();
405
+
406
+ foreach ($packages as $package) {
407
+ $this->_createShipment($object, $package, $destinationData, $quoteType);
408
+ }
409
+
410
+ $this->_sendShipmentEmail();
411
+
412
+ Mage::getSingleton('checkout/session')->unsShipmentsPackages();
413
+ Mage::getSingleton('checkout/session')->unsQuoteType();
414
+ }
415
+
416
+ private function _createShipment($object, $package, $destinationData, $quoteType = 'order')
417
+ {
418
+ $helper = Mage::helper('aramexshipping');
419
+
420
+ $shipment = null;
421
+ $order = null;
422
+
423
+ switch (get_class($object)) {
424
+ case 'Mage_Sales_Model_Order':
425
+ $order = $object;
426
+ break;
427
+ case 'Mage_Sales_Model_Order_Shipment':
428
+ $shipment = $object;
429
+ $order = $shipment->getOrder();
430
+ break;
431
+ default:
432
+ return;
433
+ }
434
+
435
+ $supplierData = $package['supplier'];
436
+
437
+ $clientInfo = $helper->getClientInfo($supplierData);
438
+
439
+ $services = '';
440
+
441
+ if ($helper->getConfigData('cod', 'carriers_aramex')) {
442
+ $codMethods = $helper->getConfigData('cod_methods', 'carriers_aramex');
443
+
444
+ if (gettype($codMethods) == 'string') {
445
+ $codMethods = array($codMethods);
446
+ }
447
+
448
+ if (in_array($order->getPayment()->getMethodInstance()->getCode(), $codMethods)) {
449
+ $services = self::SS_CASH_ON_DELIVERY;
450
+ }
451
+ }
452
+
453
+ $productGroup = $supplierData['country_code'] == $destinationData['country_id'] ? self::DOMESTIC : self::EXPRESS;
454
+ $productType = $productGroup == self::DOMESTIC ?
455
+ self::PRODT_ON_DELIVERY : $helper->getConfigData('product_type', 'carriers_aramex');
456
+
457
+ $qty = $package['qty'];
458
+
459
+ $params = array(
460
+ 'Shipments' => array(
461
+ 'Shipment' => array(
462
+ 'Shipper' => array(
463
+ 'AccountNumber' => $clientInfo['AccountNumber'],
464
+ 'PartyAddress' => array(
465
+ 'Line1' => $supplierData['address_line1'],
466
+ 'Line2' => $supplierData['address_line2'],
467
+ 'Line3' => $supplierData['address_line3'],
468
+ 'City' => ucwords(strtolower($supplierData['city'])),
469
+ 'StateOrProvinceCode' => $supplierData['state_or_province_code'],
470
+ 'PostCode' => $supplierData['post_code'],
471
+ 'CountryCode' => strtoupper($supplierData['country_code']),
472
+ ),
473
+ 'Contact' => array(
474
+ 'Department' => $supplierData['department'],
475
+ 'PersonName' => $supplierData['person_name'],
476
+ 'Title' => $supplierData['person_title'],
477
+ 'CompanyName' => $supplierData['company_name'],
478
+ 'PhoneNumber1' => $supplierData['phone_number1'],
479
+ 'PhoneNumber1Ext' => $supplierData['phone_number1_ext'],
480
+ 'PhoneNumber2' => $supplierData['phone_number2'],
481
+ 'PhoneNumber2Ext' => $supplierData['phone_number2_ext'],
482
+ 'FaxNumber' => $supplierData['fax_number'],
483
+ 'CellPhone' => $supplierData['cellphone'],
484
+ 'EmailAddress' => $supplierData['email'],
485
+ 'Type' => $supplierData['type']
486
+ ),
487
+ ),
488
+ 'Consignee' => array(
489
+ 'AccountNumber' => '',
490
+ 'PartyAddress' => array(
491
+ 'Line1' => $destinationData['street'],
492
+ 'Line2' => '',
493
+ 'Line3' => '',
494
+ 'City' => ucwords(strtolower($destinationData['city'])),
495
+ 'StateOrProvinceCode' => $destinationData['region'],
496
+ 'PostCode' => $destinationData['postcode'],
497
+ 'CountryCode' => strtoupper($destinationData['country_id'])
498
+ ),
499
+ 'Contact' => array(
500
+ 'Department' => '',
501
+ 'PersonName' => $destinationData['firstname'] . ' ' . $destinationData['lastname'],
502
+ 'Title' => $destinationData['title'],
503
+ 'CompanyName' => '-',
504
+ 'PhoneNumber1' => $destinationData['telephone'],
505
+ 'PhoneNumber1Ext' => '',
506
+ 'PhoneNumber2' => '',
507
+ 'PhoneNumber2Ext' => '',
508
+ 'FaxNumber' => $destinationData['fax'],
509
+ 'CellPhone' => $destinationData['telephone'],
510
+ 'EmailAddress' => $destinationData['email'],
511
+ 'Type' => ''
512
+ ),
513
+ ),
514
+ 'TransportType' => 0,
515
+ 'ShippingDateTime' => time(),
516
+ 'PickupLocation' => '',
517
+ 'PickupGUID' => '',
518
+ 'Comments' => '',
519
+ 'AccountingInstrcutions' => '',
520
+ 'OperationsInstructions' => '',
521
+ 'Details' => array(
522
+ 'ActualWeight' => array(
523
+ 'Value' => $package['weight'],
524
+ 'Unit' => $helper->getConfigData('unit_of_measure', 'carriers_aramex')
525
+ ),
526
+ 'ProductGroup' => $productGroup,
527
+ 'ProductType' => $productType,
528
+ 'PaymentType' => self::PAYMENT_TYPE_PREPAID,
529
+ 'PaymentOptions' => '',
530
+ 'Services' => $services,
531
+ 'NumberOfPieces' => $qty,
532
+ 'DescriptionOfGoods' => '-',
533
+ 'GoodsOriginCountry' => strtoupper($supplierData['country_code']),
534
+ 'CustomsValueAmount' => array(
535
+ 'Value' => .0001,
536
+ 'CurrencyCode' => 'USD'
537
+ ),
538
+ 'Items' => array()
539
+ ),
540
+ ),
541
+ ),
542
+ 'ClientInfo' => $clientInfo,
543
+ 'Transaction' => array(
544
+ 'Reference1' => '001',
545
+ 'Reference2' => '',
546
+ 'Reference3' => '',
547
+ 'Reference4' => '',
548
+ 'Reference5' => ''
549
+ ),
550
+ 'LabelInfo' => array(
551
+ 'ReportID' => 9201,
552
+ 'ReportType' => 'URL',
553
+ )
554
+ );
555
+
556
+ if ($services == 'CODS') {
557
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
558
+ $codPrice = $package['price'];
559
+ if ($baseCurrencyCode != 'USD') {
560
+ $codPrice = $helper->currencyConvert($package['price'], $baseCurrencyCode, 'USD', 'price', 2);
561
+ }
562
+ $params['Shipments']['Shipment']['Details']['CashOnDeliveryAmount'] = array(
563
+ 'Value' => $codPrice,
564
+ 'CurrencyCode' => 'USD'
565
+ );
566
+ }
567
+
568
+ $params['Shipments']['Shipment']['Details']['Items'][] = array(
569
+ 'PackageType' => 'Box',
570
+ 'Quantity' => $qty,
571
+ 'Weight' => array(
572
+ 'Value' => $package['weight'],
573
+ 'Unit' => $helper->getConfigData('unit_of_measure', 'carriers_aramex')
574
+ ),
575
+ 'Comments' => '-',
576
+ 'Reference' => ''
577
+ );
578
+
579
+ $result = $helper->soapClient('shipping_service', $params);
580
+
581
+ $debugLog = array(
582
+ array('message' => $helper->hideLogPrivacies($params)),
583
+ array('message' => $result)
584
+ );
585
+ $helper->debug($debugLog, 'aramex_create_shipment');
586
+ $helper->sendLogEmail(array('subject' => 'Create Shipment Debug Log', 'content' => $debugLog));
587
+
588
+ $helper->notifySupplier(
589
+ $supplierData['email'],
590
+ array('supplier' => $supplierData['person_name'], 'order_no' => $order->getIncrementId())
591
+ );
592
+
593
+ if ($result != '[SoapFault]') {
594
+ $error = $result->HasErrors;
595
+ $errorMsg = $helper->getServiceErrorMessages($result->Shipments->ProcessedShipment->Notifications->Notification);
596
+ if (!$error) {
597
+ $trackingNo = null;
598
+
599
+ if (Mage::getModel('aramexshipping/carrier_aramex')->isTrackingAvailable()
600
+ && $helper->getConfigData('auto_tracking_no', 'carriers_aramex')) {
601
+ $trackingNo = $result->Shipments->ProcessedShipment->ID;
602
+ }
603
+
604
+ $shipmentInfo = array(
605
+ 'items' => $package['items'],
606
+ 'shipmentFees' => $package['shipmentFees'],
607
+ 'shipmentLabel' => $result->Shipments->ProcessedShipment->ShipmentLabel->LabelURL,
608
+ 'supplier' => array(
609
+ 'name' => $supplierData['person_name'],
610
+ 'email' => $supplierData['email']
611
+ )
612
+ );
613
+
614
+ if (isset($supplierData['identifier'])) {
615
+ $shipmentInfo['supplier']['identifier'] = $supplierData['identifier'];
616
+ }
617
+
618
+ if (isset($codPrice)) {
619
+ $shipmentInfo['cod'] = $codPrice;
620
+ }
621
+
622
+ $this->_saveShipment($object, $shipmentInfo, $trackingNo, $quoteType);
623
+ } else {
624
+ $helper->log($errorMsg, '', 'aramex_create_shipment');
625
+ $userMsg = $helper->__('Shipment could not be created, please contact us to know more about this issue.<br/>Error:&nbsp;%s', $errorMsg);
626
+ $helper->userMessage($userMsg, 'error');
627
+ $helper->sendLogEmail(array('subject' => 'Create Shipment Error Log', 'content' => $errorMsg));
628
+ }
629
+ }
630
+ }
631
+
632
+ public function getTracking($trackingNbs)
633
+ {
634
+ $helper = Mage::helper('aramexshipping');
635
+
636
+ $params = array(
637
+ 'ClientInfo' => $helper->getClientInfo(),
638
+ 'Transaction' => array(
639
+ 'Reference1' => '001'
640
+ ),
641
+ 'Shipments' => $trackingNbs
642
+ );
643
+
644
+ $result = $helper->soapClient('tracking_service', $params);
645
+
646
+ $debugLog = array(
647
+ array('message' => $helper->hideLogPrivacies($params)),
648
+ array('message' => $result)
649
+ );
650
+ $helper->debug($debugLog, 'aramex_tracking');
651
+ $helper->sendLogEmail(array('subject' => 'Tracking Debug Log', 'content' => $debugLog));
652
+
653
+ return $result;
654
+ }
655
+
656
+ private function _saveShipment($object, $shipmentInfo, $trackingNo = null, $quoteType = 'order')
657
+ {
658
+ $result = false;
659
+ $helper = Mage::helper('aramexshipping');
660
+ $objectType = null;
661
+ $shipment = null;
662
+ $order = null;
663
+
664
+ switch (get_class($object)) {
665
+ case 'Mage_Sales_Model_Order':
666
+ $objectType = 'order';
667
+ $order = $object;
668
+ break;
669
+ case 'Mage_Sales_Model_Order_Shipment':
670
+ $objectType = 'shipment';
671
+ $shipment = $object;
672
+ break;
673
+ default:
674
+ return;
675
+ }
676
+
677
+ try {
678
+ $qty = array();
679
+
680
+ if ($objectType == 'order') {
681
+ if ($quoteType == 'quote') {
682
+ $orderItems = $order->getItemsCollection();
683
+ foreach ($orderItems as $oi) {
684
+ foreach ($shipmentInfo['items'] as $itemId => $itemQty) {
685
+ if ($itemId == $oi->getQuoteItemId()) {
686
+ $qty[$oi->getId()] = $itemQty;
687
+ break;
688
+ }
689
+ }
690
+ }
691
+ } else {
692
+ foreach ($shipmentInfo['items'] as $itemId => $itemQty) {
693
+ $qty[$itemId] = $itemQty;
694
+ }
695
+ }
696
+
697
+ $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($qty);
698
+ } else {
699
+ $order = $shipment->getOrder();
700
+ }
701
+
702
+ if ($trackingNo != null) {
703
+ $trackingData = array(
704
+ 'carrier_code' => $order->getShippingCarrier()->getCarrierCode(),
705
+ 'title' => $order->getShippingCarrier()->getConfigData('title'),
706
+ 'number' => $trackingNo
707
+ );
708
+ $track = Mage::getModel('sales/order_shipment_track')->addData($trackingData);
709
+ $shipment->addTrack($track);
710
+ }
711
+
712
+ $shipment->setAramexShipmentData(serialize(array('is_shipped' => true)));
713
+
714
+ if ($objectType == 'order') {
715
+ $shipment->register();
716
+ }
717
+
718
+ $baseCurrencySymbol = Mage::app()->getLocale()->currency(
719
+ Mage::app()->getStore()->getBaseCurrencyCode())->getSymbol();
720
+ $currentCurrencySymbol = Mage::app()->getLocale()->currency(
721
+ Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
722
+
723
+ $shipmentFees = array(
724
+ 'base' => array(
725
+ 'value' => $helper->currencyConvert(
726
+ $shipmentInfo['shipmentFees']['value'],
727
+ $shipmentInfo['shipmentFees']['currency'],
728
+ '_BASE_', 'price', 2
729
+ ),
730
+ 'currency' => $baseCurrencySymbol
731
+ )
732
+ );
733
+
734
+ $displayPrice = '';
735
+ if ($baseCurrencySymbol != $currentCurrencySymbol) {
736
+ $shipmentFees['current'] = array(
737
+ 'value' => $helper->currencyConvert(
738
+ $shipmentInfo['shipmentFees']['value'],
739
+ $shipmentInfo['shipmentFees']['currency'],
740
+ '_CURRENT_', 'price', 2
741
+ ),
742
+ 'currency' => $currentCurrencySymbol
743
+ );
744
+
745
+ $displayPrice = '&nbsp;[' . $shipmentFees['current']['currency'] . $shipmentFees['current']['value'] . ']';
746
+ }
747
+
748
+ $comments = array(
749
+ 'supplier' =>
750
+ sprintf(
751
+ '<strong>' . $helper->__('This shipment is supplied by') . ':</strong>&nbsp;%s&nbsp;(%s)',
752
+ $shipmentInfo['supplier']['name'], $shipmentInfo['supplier']['email']
753
+ ),
754
+ 'shipmentFees' =>
755
+ sprintf(
756
+ '<strong>' . $helper->__('Shipment Fees') . ':</strong>&nbsp;%s%g%s',
757
+ $shipmentFees['base']['currency'], $shipmentFees['base']['value'],
758
+ $displayPrice
759
+ ),
760
+ 'cod' => '',
761
+ 'shipmentLabel' =>
762
+ '<strong>' . $helper->__('Shipment Label') . ':</strong>&nbsp;' . $shipmentInfo['shipmentLabel']
763
+ );
764
+
765
+ if (isset($shipmentInfo['cod'])) {
766
+ $cod = array(
767
+ 'base' => array(
768
+ 'value' => $helper->currencyConvert(
769
+ $shipmentInfo['cod'],
770
+ 'USD', '_BASE_', 'price', 2
771
+ ),
772
+ 'currency' => $baseCurrencySymbol
773
+ )
774
+ );
775
+
776
+ $displayPrice = '';
777
+ if ($baseCurrencySymbol != $currentCurrencySymbol) {
778
+ $cod['current'] = array(
779
+ 'value' => $helper->currencyConvert(
780
+ $shipmentInfo['cod'],
781
+ 'USD', '_CURRENT_', 'price', 2
782
+ ),
783
+ 'currency' => $currentCurrencySymbol
784
+ );
785
+
786
+ $displayPrice = '&nbsp;[' . $cod['current']['currency'] . $cod['current']['value'] . ']';
787
+ }
788
+
789
+ $comments['cod'] = sprintf(
790
+ '<strong>' . $helper->__('Cash on Delivery applied') . ':</strong>&nbsp;%s%g%s',
791
+ $cod['base']['currency'], $cod['base']['value'], $displayPrice
792
+ );
793
+ } else {
794
+ unset($comments['cod']);
795
+ }
796
+
797
+ foreach ($comments as $comment) {
798
+ $shipment->addComment($comment, false, false);
799
+ }
800
+
801
+ Mage::register('skip_shipment_save_after', true);
802
+
803
+ if ($objectType == 'order') {
804
+ $shipment->getOrder()->setIsInProcess(true);
805
+ $transactionSave = Mage::getModel('core/resource_transaction')
806
+ ->addObject($shipment)
807
+ ->addObject($order)
808
+ ->save();
809
+ } else {
810
+ $shipment->save();
811
+ }
812
+
813
+ if (!Mage::registry('aramex_shipment')) {
814
+ Mage::register('aramex_shipment', $shipment);
815
+ }
816
+
817
+ $comments['shipmentLabel'] =
818
+ '<strong>' . $helper->__('Shipment Label') . ':</strong>&nbsp;<a href="'
819
+ . $shipmentInfo['shipmentLabel'] . '">' . $shipmentInfo['shipmentLabel'] . '</a>';
820
+ $comments = '<br/><br/>' . implode('<br/>', $comments);
821
+
822
+ if ($shipmentEmailComments = Mage::registry('aramex_shipments_comments')) {
823
+ Mage::unregister('aramex_shipments_comments');
824
+ Mage::register('aramex_shipments_comments', $shipmentEmailComments . $comments);
825
+ } else {
826
+ Mage::register('aramex_shipments_comments', $comments);
827
+ }
828
+
829
+ $result = true;
830
+ } catch (Exception $e) {
831
+ $helper->log($e, 'exception');
832
+ $helper->log(
833
+ array('message' => $helper->__('Shipment could not be created (Saved), check exception log.')),
834
+ '', 'aramex_create_shipment'
835
+ );
836
+ $helper->userMessage(
837
+ $helper->__('Shipment could not be created, please contact us to look into the issue.'), 'error'
838
+ );
839
+ $helper->sendLogEmail(array('subject' => 'Save Shipment Error Log', 'content' => $e->getMessage()));
840
+ }
841
+
842
+ return $result;
843
+ }
844
+
845
+ private function _sendShipmentEmail()
846
+ {
847
+ $helper = Mage::helper('aramexshipping');
848
+
849
+ try {
850
+ if ($shipment = Mage::registry('aramex_shipment')) {
851
+ if ($shipment->getOrder()->getCustomerEmail() && $shipment->getEmailSent()) {
852
+ if ($comments = Mage::registry('aramex_shipments_comments')) {
853
+ $comments = '<br/><strong>' . $helper->__('Comments') . ':</strong>'
854
+ . $comments;
855
+ $shipment->sendEmail(true, $comments);
856
+ $shipment->setEmailSent(true);
857
+ Mage::unregister('aramex_shipments_comments');
858
+ }
859
+
860
+ Mage::unregister('aramex_shipment');
861
+
862
+ return true;
863
+ }
864
+ Mage::unregister('aramex_shipment');
865
+ }
866
+ } catch (Exception $e) {
867
+ $helper->log($e, 'exception');
868
+ $helper->log(
869
+ array('message' => $helper->__('Shipment email could not be sent, check exception log.')),
870
+ '', 'aramex_create_shipment'
871
+ );
872
+ $helper->userMessage(
873
+ $helper->__('Shipment email could not be sent, please contact us to look into the issue.'), 'error'
874
+ );
875
+ $helper->sendLogEmail(array('subject' => 'Save Shipment Error Log', 'content' => $e->getMessage()));
876
+ }
877
+
878
+ return false;
879
+ }
880
+ }
app/code/community/Shopgo/AramexShipping/Model/Shipping/Info.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_Shipping_Info
4
+ extends Mage_Shipping_Model_Info
5
+ {
6
+ public function getTrackingInfoByOrder()
7
+ {
8
+ $shipTrack = array();
9
+ $order = $this->_initOrder();
10
+ if ($order) {
11
+ $shipments = $order->getShipmentsCollection();
12
+ foreach ($shipments as $shipment){
13
+ $increment_id = $shipment->getIncrementId();
14
+ $tracks = $shipment->getTracksCollection();
15
+
16
+ $trackingInfos=array();
17
+ foreach ($tracks as $track){
18
+ $trackingInfos[] = $track->getNumberDetail();
19
+ }
20
+
21
+ $_trackingInfos = array();
22
+ if ($order->getShippingCarrier()->getCarrierCode() == 'aramex') {
23
+ if (count($trackingInfos) == 1) {
24
+ $_trackingInfos = $trackingInfos[0];
25
+ } else {
26
+ foreach ($trackingInfos as $i => $ti) {
27
+ $gti = array();
28
+ if (isset($trackingInfos[$i + 1])) {
29
+ $gti = array_merge($ti, $trackingInfos[$i + 1]);
30
+ }
31
+ if (!empty($gti)) {
32
+ $_trackingInfos = array_merge($_trackingInfos, $gti);
33
+ }
34
+ }
35
+ }
36
+ } else {
37
+ $_trackingInfos = $trackingInfos;
38
+ }
39
+
40
+ $shipTrack[$increment_id] = $_trackingInfos;
41
+ }
42
+ }
43
+ $this->_trackingInfo = $shipTrack;
44
+ return $this->_trackingInfo;
45
+ }
46
+
47
+ public function getTrackingInfoByShip()
48
+ {
49
+ $shipTrack = array();
50
+ $shipment = $this->_initShipment();
51
+ if ($shipment) {
52
+ $increment_id = $shipment->getIncrementId();
53
+ $tracks = $shipment->getTracksCollection();
54
+
55
+ $trackingInfos=array();
56
+ foreach ($tracks as $track){
57
+ $trackingInfos[] = $track->getNumberDetail();
58
+ }
59
+
60
+ $_trackingInfos = array();
61
+ if ($shipment->getOrder()->getShippingCarrier()->getCarrierCode() == 'aramex') {
62
+ if (count($trackingInfos) == 1) {
63
+ $_trackingInfos = $trackingInfos[0];
64
+ } else {
65
+ foreach ($trackingInfos as $i => $ti) {
66
+ $gti = array();
67
+ if (isset($trackingInfos[$i + 1])) {
68
+ $gti = array_merge($ti, $trackingInfos[$i + 1]);
69
+ }
70
+ if (!empty($gti)) {
71
+ $_trackingInfos = array_merge($_trackingInfos, $gti);
72
+ }
73
+ }
74
+ }
75
+ } else {
76
+ $_trackingInfos = $trackingInfos;
77
+ }
78
+
79
+ $shipTrack[$increment_id] = $_trackingInfos;
80
+
81
+ }
82
+ $this->_trackingInfo = $shipTrack;
83
+ return $this->_trackingInfo;
84
+ }
85
+
86
+ public function getTrackingInfoByTrackId()
87
+ {
88
+ $track = Mage::getModel('sales/order_shipment_track')->load($this->getTrackId());
89
+ if ($track->getId() && $this->getProtectCode() == $track->getProtectCode()) {
90
+ $this->_trackingInfo = $track->getCarrierCode() == 'aramex' ?
91
+ array($track->getNumberDetail()) : array(array($track->getNumberDetail()));
92
+ }
93
+ return $this->_trackingInfo;
94
+ }
95
+ }
app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Activepaymentmethods.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_System_Config_Source_Activepaymentmethods
4
+ {
5
+ public function toOptionArray($isMultiSelect = false)
6
+ {
7
+ $options = Mage::helper('payment')->getPaymentMethodList(true, true, true);
8
+
9
+ if ($isMultiSelect) {
10
+ array_unshift($options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('--Please Select--')));
11
+ }
12
+
13
+ return $options;
14
+ }
15
+ }
app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Producttypes.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_System_Config_Source_Producttypes
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('label' => Mage::helper('aramexshipping')->__('Priority Document Express'),
9
+ 'value' => Shopgo_AramexShipping_Model_Shipping::PRIORITY_DOCUMENT_EXPRESS),
10
+ array('label' => Mage::helper('aramexshipping')->__('Priority Parcel Express'),
11
+ 'value' => Shopgo_AramexShipping_Model_Shipping::PRIORITY_PARCEL_EXPRESS),
12
+ array('label' => Mage::helper('aramexshipping')->__('Priority Letter Express'),
13
+ 'value' => Shopgo_AramexShipping_Model_Shipping::PRIORITY_LETTER_EXPRESS),
14
+ array('label' => Mage::helper('aramexshipping')->__('Deferred Document Express'),
15
+ 'value' => Shopgo_AramexShipping_Model_Shipping::DEFERRED_DOCUMENT_EXPRESS),
16
+ array('label' => Mage::helper('aramexshipping')->__('Deferred Parcel Express'),
17
+ 'value' => Shopgo_AramexShipping_Model_Shipping::DEFERRED_PARCEL_EXPRESS),
18
+ array('label' => Mage::helper('aramexshipping')->__('Ground Document Express'),
19
+ 'value' => Shopgo_AramexShipping_Model_Shipping::GROUND_DOCUMENT_EXPRESS),
20
+ array('label' => Mage::helper('aramexshipping')->__('Ground Parcel Express'),
21
+ 'value' => Shopgo_AramexShipping_Model_Shipping::GROUND_PARCEL_EXPRESS),
22
+ array('label' => Mage::helper('aramexshipping')->__('Economy Parcel Express'),
23
+ 'value' => Shopgo_AramexShipping_Model_Shipping::ECONOMY_PARCEL_EXPRESS)
24
+ );
25
+ }
26
+ }
app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Shippingmode.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_System_Config_Source_Shippingmode
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('label' => Mage::helper('aramexshipping')->__('Auto'),
9
+ 'value' => 'auto'),
10
+ array('label' => Mage::helper('aramexshipping')->__('Manual'),
11
+ 'value' => 'manual')
12
+ );
13
+ }
14
+ }
app/code/community/Shopgo/AramexShipping/Model/System/Config/Source/Unitofmeasure.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Model_System_Config_Source_Unitofmeasure
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $unitArr = Mage::getSingleton('aramexshipping/shipping')->getCode('unit_of_measure');
8
+
9
+ $returnArr = array();
10
+ foreach ($unitArr as $key => $val) {
11
+ $returnArr[] = array('value' => $key, 'label' => $val);
12
+ }
13
+
14
+ return $returnArr;
15
+ }
16
+ }
app/code/community/Shopgo/AramexShipping/controllers/Adminhtml/AramexController.php ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shopgo_AramexShipping_Adminhtml_AramexController
4
+ extends Mage_Adminhtml_Controller_Action
5
+ {
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('aramexshipping_menu/menuitem')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Suppliers Manager'), Mage::helper('adminhtml')->__('Supplier Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction()
15
+ {
16
+ $this->_title($this->__('Suppliers'))
17
+ ->_title($this->__('Manage Suppliers'));
18
+ $this->_initAction()
19
+ ->renderLayout();
20
+ }
21
+
22
+ public function editAction()
23
+ {
24
+ $id = $this->getRequest()->getParam('id');
25
+ $model = Mage::getModel('aramexshipping/shipping')->load($id);
26
+
27
+ if ($model->getId() || $id == 0) {
28
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
29
+ if (!empty($data)) {
30
+ $model->setData($data);
31
+ }
32
+
33
+ Mage::register('aramex_suppliers_data', $model);
34
+
35
+ $this->_title($this->__('Suppliers'))
36
+ ->_title($this->__('Manage Suppliers'));
37
+ if ($model->getId()){
38
+ $this->_title($model->getIdentifier());
39
+ } else {
40
+ $this->_title($this->__('New Supplier'));
41
+ }
42
+
43
+ $this->loadLayout();
44
+ $this->_setActiveMenu('aramexshipping_menu/menuitem');
45
+
46
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Supplier Manager'), Mage::helper('adminhtml')->__('Supplier Manager'));
47
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Supplier News'), Mage::helper('adminhtml')->__('Supplier News'));
48
+
49
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
50
+
51
+ $this->_addContent($this->getLayout()->createBlock('aramexshipping/adminhtml_shipping_edit'))
52
+ ->_addLeft($this->getLayout()->createBlock('aramexshipping/adminhtml_shipping_edit_tabs'));
53
+
54
+ $this->renderLayout();
55
+ } else {
56
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('aramexshipping')->__('Supplier does not exist'));
57
+ $this->_redirect('*/*/');
58
+ }
59
+ }
60
+
61
+ public function newAction()
62
+ {
63
+ $this->_forward('edit');
64
+ }
65
+
66
+ public function saveAction()
67
+ {
68
+ if ($data = $this->getRequest()->getPost()) {
69
+ $suppliersIdentifiers = Mage::getModel('aramexshipping/shipping')->getCollection()
70
+ ->addFieldToFilter('asv_id', array('neq' => $this->getRequest()->getParam('id')))
71
+ ->addFieldToFilter('identifier', $data['identifier']);
72
+
73
+ if (count($suppliersIdentifiers) > 0) {
74
+ Mage::getSingleton('adminhtml/session')->addError($this->__('There is already another supplier with the same "Identifier"'));
75
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
76
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
77
+ return;
78
+ }
79
+
80
+ $accountsNbs = Mage::getModel('aramexshipping/shipping')->getCollection()
81
+ ->addFieldToFilter('asv_id', array('neq' => $this->getRequest()->getParam('id')))
82
+ ->addFieldToFilter('account_number', $data['account_number']);
83
+
84
+ if (count($accountsNbs) > 0) {
85
+ Mage::getSingleton('adminhtml/session')->addError($this->__('There is already another supplier with the same "Account Number"'));
86
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
87
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
88
+ return;
89
+ }
90
+
91
+ if (!Zend_Validate::is($data['email'], 'EmailAddress')) {
92
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Invalid email format'));
93
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
94
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
95
+ return;
96
+ }
97
+
98
+ $supplierByEmail = Mage::getModel('aramexshipping/shipping')->getCollection()
99
+ ->addFieldToFilter('asv_id', array('neq' => $this->getRequest()->getParam('id')))
100
+ ->addFieldToFilter('email', $data['email']);
101
+
102
+ if (count($supplierByEmail) > 0) {
103
+ Mage::getSingleton('adminhtml/session')->addError($this->__('There is already another supplier with the same "Email"'));
104
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
105
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
106
+ return;
107
+ }
108
+
109
+ if ($data['password'] == '******') {
110
+ unset($data['password']);
111
+ }
112
+
113
+ if ($data['account_pin'] == '******') {
114
+ unset($data['account_pin']);
115
+ }
116
+
117
+ $model = Mage::getModel('aramexshipping/shipping');
118
+ $model->setData($data)
119
+ ->setId($this->getRequest()->getParam('id'));
120
+
121
+ try {
122
+ $model->save();
123
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('aramexshipping')->__('Supplier was successfully saved'));
124
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
125
+
126
+ if ($this->getRequest()->getParam('back')) {
127
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
128
+ return;
129
+ }
130
+ $this->_redirect('*/*/');
131
+ return;
132
+ } catch (Exception $e) {
133
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
134
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
135
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
136
+ return;
137
+ }
138
+ }
139
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('aramexshipping')->__('Unable to find supplier to save'));
140
+ $this->_redirect('*/*/');
141
+ }
142
+
143
+ public function deleteAction()
144
+ {
145
+ if ($this->getRequest()->getParam('id') > 0) {
146
+ try {
147
+ $model = Mage::getModel('aramexshipping/shipping');
148
+
149
+ $model->setId($this->getRequest()->getParam('id'))
150
+ ->delete();
151
+
152
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Supplier was successfully deleted'));
153
+ $this->_redirect('*/*/');
154
+ } catch (Exception $e) {
155
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
156
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
157
+ }
158
+ }
159
+ $this->_redirect('*/*/');
160
+ }
161
+
162
+ public function massDeleteAction()
163
+ {
164
+ $suppliersIds = $this->getRequest()->getParam('suppliers_ids');
165
+ if(!is_array($suppliersIds)) {
166
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select supplier(s)'));
167
+ } else {
168
+ try {
169
+ foreach ($suppliersIds as $supplierId) {
170
+ $supplier = Mage::getModel('aramexshipping/shipping')->load($supplierId);
171
+ $supplier->delete();
172
+ }
173
+ Mage::getSingleton('adminhtml/session')->addSuccess(
174
+ Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($suppliersIds))
175
+ );
176
+ } catch (Exception $e) {
177
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
178
+ }
179
+ }
180
+ $this->_redirect('*/*/index');
181
+ }
182
+
183
+ public function exportCsvAction()
184
+ {
185
+ $fileName = 'aramex_shipping_suppliers.csv';
186
+ $content = $this->getLayout()->createBlock('aramexshipping/adminhtml_shipping_grid')
187
+ ->getCsv();
188
+
189
+ $this->_sendUploadResponse($fileName, $content);
190
+ }
191
+
192
+ public function exportXmlAction()
193
+ {
194
+ $fileName = 'aramex_shipping_suppliers.xml';
195
+ $content = $this->getLayout()->createBlock('aramexshipping/adminhtml_shipping_grid')->getXml();
196
+
197
+ $this->_sendUploadResponse($fileName, $content);
198
+ }
199
+
200
+ public function checkAccountAction()
201
+ {
202
+ $params = $this->getRequest()->getPost();
203
+ $helper = Mage::helper('aramexshipping');
204
+
205
+ $validValues = array(
206
+ 'sender' => array('system', 'supplier'),
207
+ 'pass_changed' => array(0, 1),
208
+ 'pin_changed' => array(0, 1)
209
+ );
210
+
211
+ if (!isset($params['sender']) || !isset($params['pass_changed']) || !isset($params['pin_changed'])) {
212
+ Mage::app()->getResponse()->setBody('Bad check request');
213
+ return;
214
+ } elseif (!in_array($params['sender'], $validValues['sender'])
215
+ || !in_array($params['pass_changed'], $validValues['pass_changed'])
216
+ || !in_array($params['pin_changed'], $validValues['pin_changed'])) {
217
+ Mage::app()->getResponse()->setBody('Bad check request');
218
+ return;
219
+ }
220
+
221
+ if ($params['sender'] == 'support' && isset($params['id']) && !$helper->isPositiveInteger($params['id'])) {
222
+ Mage::app()->getResponse()->setBody('Bad check request');
223
+ return;
224
+ }
225
+
226
+ if (!isset($params['username']) || !isset($params['password'])) {
227
+ Mage::app()->getResponse()->setBody('Username and Password are necessary to do the check');
228
+ return;
229
+ } elseif (empty($params['username']) || empty($params['password'])) {
230
+ Mage::app()->getResponse()->setBody('Username and Password are necessary to do the check');
231
+ return;
232
+ }
233
+
234
+ $accountInfo = 4;
235
+
236
+ if (!isset($params['account_country_code'])) {
237
+ $accountInfo--;
238
+ } elseif (empty($params['account_country_code'])) {
239
+ $accountInfo--;
240
+ }
241
+ if (!isset($params['account_entity'])) {
242
+ $accountInfo--;
243
+ } elseif (empty($params['account_entity'])) {
244
+ $accountInfo--;
245
+ }
246
+ if (!isset($params['account_number'])) {
247
+ $accountInfo--;
248
+ } elseif (empty($params['account_number'])) {
249
+ $accountInfo--;
250
+ }
251
+ if (!isset($params['account_pin'])) {
252
+ $accountInfo--;
253
+ } elseif (empty($params['account_pin'])) {
254
+ $accountInfo--;
255
+ }
256
+
257
+ if ($accountInfo > 0 && $accountInfo < 4) {
258
+ Mage::app()->getResponse()->setBody('Please, fill the rest of account information fields');
259
+ return;
260
+ }
261
+
262
+ $supplier = $params['sender'] == 'supplier' ? $helper->getSuppliersCollection($params['id']) : null;
263
+
264
+ if (!$params['pass_changed'] && $params['password'] == '******') {
265
+ if ($params['sender'] == 'system') {
266
+ $params['password'] = $helper->getConfigData('password', 'carriers_aramex');
267
+ $params['password'] = Mage::helper('core')->decrypt($params['password']);
268
+ } else {
269
+ $params['password'] = $supplier ? $supplier->getPassword() : '';
270
+ }
271
+ }
272
+
273
+ if (!$params['pin_changed'] && $params['account_pin'] == '******') {
274
+ if ($params['sender'] == 'system') {
275
+ $params['account_pin'] = $helper->getConfigData('account_pin', 'carriers_aramex');
276
+ $params['account_pin'] = Mage::helper('core')->decrypt($params['account_pin']);
277
+ } else {
278
+ $params['account_pin'] = $supplier ? $supplier->getAccountPin() : '';
279
+ }
280
+ }
281
+
282
+ $result = Mage::getModel('aramexshipping/shipping')->checkAccount($params);
283
+
284
+ Mage::app()->getResponse()->setBody($result['message']);
285
+ }
286
+
287
+ protected function _sendUploadResponse($fileName, $content, $contentType = 'application/octet-stream')
288
+ {
289
+ $response = $this->getResponse();
290
+ $response->setHeader('HTTP/1.1 200 OK', '');
291
+ $response->setHeader('Pragma', 'public', true);
292
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
293
+ $response->setHeader('Content-Disposition', 'attachment; filename='. $fileName);
294
+ $response->setHeader('Last-Modified', date('r'));
295
+ $response->setHeader('Accept-Ranges', 'bytes');
296
+ $response->setHeader('Content-Length', strlen($content));
297
+ $response->setHeader('Content-type', $contentType);
298
+ $response->setBody($content);
299
+ $response->sendResponse();
300
+ die;
301
+ }
302
+ }
app/code/community/Shopgo/AramexShipping/etc/adminhtml.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <aramexshipping_menu translate="title" module="aramexshipping">
5
+ <title>Aramex Shipping</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <menuitem module="aramexshipping">
9
+ <title>Manage Suppliers</title>
10
+ <sort_order>0</sort_order>
11
+ <action>aramexshipping/adminhtml_aramex</action>
12
+ </menuitem>
13
+ </children>
14
+ <depends>
15
+ <config>carriers/aramex/active</config>
16
+ </depends>
17
+ </aramexshipping_menu>
18
+ </menu>
19
+ <acl>
20
+ <resources>
21
+ <admin>
22
+ <children>
23
+ <aramexshipping_menu translate="title" module="aramexshipping">
24
+ <title>Aramex Shipping</title>
25
+ <sort_order>71</sort_order>
26
+ <children>
27
+ <menuitem translate="title" module="aramexshipping">
28
+ <title>Manage Suppliers</title>
29
+ <sort_order>0</sort_order>
30
+ </menuitem>
31
+ </children>
32
+ </aramexshipping_menu>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ </config>
app/code/community/Shopgo/AramexShipping/etc/config.xml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Shopgo_AramexShipping>
5
+ <version>1.0.0</version>
6
+ </Shopgo_AramexShipping>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <aramexshipping>
11
+ <class>Shopgo_AramexShipping_Block</class>
12
+ </aramexshipping>
13
+ </blocks>
14
+ <helpers>
15
+ <aramexshipping>
16
+ <class>Shopgo_AramexShipping_Helper</class>
17
+ </aramexshipping>
18
+ </helpers>
19
+ <models>
20
+ <aramexshipping>
21
+ <class>Shopgo_AramexShipping_Model</class>
22
+ <resourceModel>aramexshipping_mysql4</resourceModel>
23
+ </aramexshipping>
24
+ <aramexshipping_mysql4>
25
+ <class>Shopgo_AramexShipping_Model_Mysql4</class>
26
+ <entities>
27
+ <shipping>
28
+ <table>aramex_shipping_suppliers</table>
29
+ </shipping>
30
+ </entities>
31
+ </aramexshipping_mysql4>
32
+ <aramexshipping>
33
+ <rewrite>
34
+ <info>Shopgo_AramexShipping_Model_Shipping_Info</info>
35
+ </rewrite>
36
+ </aramexshipping>
37
+ </models>
38
+ <resources>
39
+ <aramexshipping_setup>
40
+ <setup>
41
+ <module>Shopgo_AramexShipping</module>
42
+ </setup>
43
+ <connection>
44
+ <use>core_setup</use>
45
+ </connection>
46
+ </aramexshipping_setup>
47
+ <aramexshipping_write>
48
+ <connection>
49
+ <use>core_write</use>
50
+ </connection>
51
+ </aramexshipping_write>
52
+ <aramexshipping_read>
53
+ <connection>
54
+ <use>core_read</use>
55
+ </connection>
56
+ </aramexshipping_read>
57
+ </resources>
58
+ <events>
59
+ <sales_order_shipment_save_after>
60
+ <observers>
61
+ <aramex_shipping_order_observer>
62
+ <type>singleton</type>
63
+ <class>aramexshipping/observer</class>
64
+ <method>salesOrderShipmentSaveAfter</method>
65
+ </aramex_shipping_order_observer>
66
+ </observers>
67
+ </sales_order_shipment_save_after>
68
+ </events>
69
+ <template>
70
+ <email>
71
+ <aramex_shipping_supplier_notification_email_template translate="label" module="aramexshipping">
72
+ <label>Aramex Shipping Supplier Notification Email Template</label>
73
+ <file>aramex/supplier_notification.html</file>
74
+ <type>html</type>
75
+ </aramex_shipping_supplier_notification_email_template>
76
+ <aramex_shipping_log_email_template translate="label" module="aramexshipping">
77
+ <label>Aramex Shipping Log Email Template</label>
78
+ <file>aramex/email_log.html</file>
79
+ <type>html</type>
80
+ </aramex_shipping_log_email_template>
81
+ </email>
82
+ </template>
83
+ </global>
84
+ <frontend>
85
+ <layout>
86
+ <updates>
87
+ <aramexshipping>
88
+ <file>shopgo/aramex_shipping.xml</file>
89
+ </aramexshipping>
90
+ </updates>
91
+ </layout>
92
+ </frontend>
93
+ <admin>
94
+ <routers>
95
+ <aramexshipping>
96
+ <use>admin</use>
97
+ <args>
98
+ <module>Shopgo_AramexShipping</module>
99
+ <frontName>aramexshipping</frontName>
100
+ </args>
101
+ </aramexshipping>
102
+ </routers>
103
+ </admin>
104
+ <adminhtml>
105
+ <layout>
106
+ <updates>
107
+ <aramexshipping>
108
+ <file>shopgo/aramex_shipping.xml</file>
109
+ </aramexshipping>
110
+ </updates>
111
+ </layout>
112
+ </adminhtml>
113
+ <default>
114
+ <carriers>
115
+ <aramex>
116
+ <active>0</active>
117
+ <model>aramexshipping/carrier_aramex</model>
118
+ <title>Aramex</title>
119
+ <product_type>PPX</product_type>
120
+ <unit_of_measure>KG</unit_of_measure>
121
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
122
+ </aramex>
123
+ </carriers>
124
+ </default>
125
+ </config>
app/code/community/Shopgo/AramexShipping/etc/system.xml ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <carriers>
5
+ <groups>
6
+ <aramex translate="label" module="aramexshipping">
7
+ <label>Aramex</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>99</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <username translate="label">
32
+ <label>User Name</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>30</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </username>
39
+ <password translate="label">
40
+ <label>Password</label>
41
+ <comment><![CDATA[
42
+ You can create your own Aramex account here:<br/>
43
+ <a href="https://www.aramex.com/accounts/registration-signup.aspx" target="_blank">https://www.aramex.com/accounts/registration-signup.aspx</a>
44
+ ]]></comment>
45
+ <frontend_type>obscure</frontend_type>
46
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
47
+ <sort_order>40</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </password>
52
+ <account_country_code translate="label">
53
+ <label>Account Country Code</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>50</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>0</show_in_store>
59
+ </account_country_code>
60
+ <account_entity translate="label">
61
+ <label>Account Entity</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>60</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </account_entity>
68
+ <account_number translate="label">
69
+ <label>Account Number</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>70</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </account_number>
76
+ <account_pin translate="label">
77
+ <label>Account PIN</label>
78
+ <comment><![CDATA[
79
+ Aramex Account's Country Code, Entity, Number and PIN can be obtained by contacting Aramex.<br/>
80
+ <strong style="color:#3D5B9C">Note:&nbsp;</strong>Shipping settings origin entries (System > Configuration > Sales > Shipping Settings > Origin) must be filled, otherwise the extension will not function properly.
81
+ ]]></comment>
82
+ <frontend_type>obscure</frontend_type>
83
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
84
+ <sort_order>80</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>0</show_in_store>
88
+ </account_pin>
89
+ <check_account translate="label">
90
+ <frontend_type>button</frontend_type>
91
+ <frontend_model>aramexshipping/adminhtml_system_config_form_button</frontend_model>
92
+ <sort_order>90</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>0</show_in_store>
96
+ </check_account>
97
+ <product_type translate="label">
98
+ <label>Product Type</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>aramexshipping/system_config_source_producttypes</source_model>
101
+ <sort_order>100</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>0</show_in_store>
105
+ </product_type>
106
+ <unit_of_measure translate="label">
107
+ <label>Weight Unit</label>
108
+ <frontend_type>select</frontend_type>
109
+ <source_model>aramexshipping/system_config_source_unitofmeasure</source_model>
110
+ <sort_order>110</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>0</show_in_store>
114
+ </unit_of_measure>
115
+ <shipping_service translate="label">
116
+ <label>Shipping Service</label>
117
+ <comment>If disabled, Aramex shipping service will not be used to register Aramex shipments, whenever store shipments are created.</comment>
118
+ <frontend_type>select</frontend_type>
119
+ <sort_order>120</sort_order>
120
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>0</show_in_store>
124
+ </shipping_service>
125
+ <tracking_service translate="label">
126
+ <label>Tracking Service</label>
127
+ <comment>If disabled, Aramex tracking service will not be used to add/view Aramex tracking numbers in store shipments.</comment>
128
+ <frontend_type>select</frontend_type>
129
+ <sort_order>130</sort_order>
130
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>0</show_in_store>
134
+ <depends><shipping_service>1</shipping_service></depends>
135
+ </tracking_service>
136
+ <auto_tracking_no translate="label">
137
+ <label>Auto Tracking No.</label>
138
+ <comment>Tracking numbers will be added automatically to store shipments when created.</comment>
139
+ <frontend_type>select</frontend_type>
140
+ <sort_order>140</sort_order>
141
+ <source_model>adminhtml/system_config_source_yesno</source_model>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>0</show_in_store>
145
+ <depends>
146
+ <tracking_service>1</tracking_service>
147
+ <shipping_service>1</shipping_service>
148
+ </depends>
149
+ </auto_tracking_no>
150
+ <cod translate="label">
151
+ <label>Cash on Delivery</label>
152
+ <frontend_type>select</frontend_type>
153
+ <sort_order>150</sort_order>
154
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>0</show_in_store>
158
+ <depends><shipping_service>1</shipping_service></depends>
159
+ </cod>
160
+ <cod_methods translate="label">
161
+ <label>Cash on Delivery Methods</label>
162
+ <comment><![CDATA[
163
+ Select Cash on Delivery methods from the above payment methods list.<br/>
164
+ <strong style="color:#3D5B9C">Note:</strong> Cash on Delivery amount must not exceed 1000 USD, otherwise, Aramex shipments creation would fail.<br/>
165
+ <strong style="color:red">Warning!</strong> Cash on Delivery amount can only be in USD, so make sure that currency setup and rates conversion are done properly, in order to produce accurate amounts.
166
+ ]]></comment>
167
+ <frontend_type>multiselect</frontend_type>
168
+ <sort_order>160</sort_order>
169
+ <source_model>aramexshipping/system_config_source_activepaymentmethods</source_model>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>1</show_in_website>
172
+ <show_in_store>0</show_in_store>
173
+ <depends>
174
+ <shipping_service>1</shipping_service>
175
+ <cod>1</cod>
176
+ </depends>
177
+ </cod_methods>
178
+ <alert_suppliers translate="label">
179
+ <label>Alert Suppliers</label>
180
+ <comment>Notify suppliers about orders that contain their products.</comment>
181
+ <frontend_type>select</frontend_type>
182
+ <sort_order>170</sort_order>
183
+ <source_model>adminhtml/system_config_source_yesno</source_model>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>0</show_in_store>
187
+ <depends><shipping_service>1</shipping_service></depends>
188
+ </alert_suppliers>
189
+ <specificerrmsg translate="label">
190
+ <label>Displayed Error Message</label>
191
+ <comment>If specified, it will replace some of the system's default messages.</comment>
192
+ <frontend_type>textarea</frontend_type>
193
+ <sort_order>180</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ </specificerrmsg>
198
+ <sallowspecific translate="label">
199
+ <label>Ship to Applicable Countries</label>
200
+ <frontend_type>select</frontend_type>
201
+ <sort_order>190</sort_order>
202
+ <frontend_class>shipping-applicable-country</frontend_class>
203
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>0</show_in_store>
207
+ </sallowspecific>
208
+ <specificcountry translate="label">
209
+ <label>Ship to Specific Countries</label>
210
+ <frontend_type>multiselect</frontend_type>
211
+ <sort_order>200</sort_order>
212
+ <source_model>adminhtml/system_config_source_country</source_model>
213
+ <show_in_default>1</show_in_default>
214
+ <show_in_website>1</show_in_website>
215
+ <show_in_store>0</show_in_store>
216
+ <can_be_empty>1</can_be_empty>
217
+ </specificcountry>
218
+ <author_reports translate="label">
219
+ <label>Usage and Error Reports</label>
220
+ <comment><![CDATA[
221
+ Help us improve this shipping method, by sending us usage and error reports.<br/>
222
+ <strong style="color:#3D5B9C">Notes:</strong><br/>
223
+ * Reports will <strong>Not</strong> include Aramex accounts sensitive credentials.<br/>
224
+ * This is an <strong>Experimental</strong> feature and is currently done via email, if it proves to be useful, it will be kept and improved.
225
+ ]]></comment>
226
+ <frontend_type>select</frontend_type>
227
+ <sort_order>210</sort_order>
228
+ <source_model>adminhtml/system_config_source_yesno</source_model>
229
+ <show_in_default>1</show_in_default>
230
+ <show_in_website>1</show_in_website>
231
+ <show_in_store>0</show_in_store>
232
+ </author_reports>
233
+ <admin_reports translate="label">
234
+ <label>Admin Reports</label>
235
+ <comment><![CDATA[
236
+ Send usage and error reports to website admin(s).<br/>
237
+ <strong style="color:#3D5B9C">Notes:</strong><br/>
238
+ * Reports will <strong>Not</strong> include Aramex accounts sensitive credentials.<br/>
239
+ * This is an <strong>Experimental</strong> feature and is currently done via email, if it proves to be useful, it will be kept and improved.
240
+ ]]></comment>
241
+ <frontend_type>select</frontend_type>
242
+ <sort_order>220</sort_order>
243
+ <source_model>adminhtml/system_config_source_yesno</source_model>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>0</show_in_store>
247
+ </admin_reports>
248
+ <reports_emails translate="label">
249
+ <label>Reports Emails</label>
250
+ <comment><![CDATA[
251
+ Emails that can receive usage and error reports.<br/>
252
+ <strong style="color:#3D5B9C">Notes:</strong><br/>
253
+ * Each email in a separate line.<br/>
254
+ * If left empty, the general contact email will be used.
255
+ ]]></comment>
256
+ <frontend_type>textarea</frontend_type>
257
+ <sort_order>230</sort_order>
258
+ <show_in_default>1</show_in_default>
259
+ <show_in_website>1</show_in_website>
260
+ <show_in_store>0</show_in_store>
261
+ <depends><admin_reports>1</admin_reports></depends>
262
+ </reports_emails>
263
+ <debug translate="label">
264
+ <label>Debug</label>
265
+ <comment>Make sure that system logging is enabled (System > Configuration > Advanced > Developer > Log Settings) in order to use this feature.</comment>
266
+ <frontend_type>select</frontend_type>
267
+ <sort_order>240</sort_order>
268
+ <source_model>adminhtml/system_config_source_yesno</source_model>
269
+ <show_in_default>1</show_in_default>
270
+ <show_in_website>1</show_in_website>
271
+ <show_in_store>0</show_in_store>
272
+ </debug>
273
+ <showmethod translate="label">
274
+ <label>Show Method if Not Applicable</label>
275
+ <comment>If No, Aramex errors will not appear on the frontend.</comment>
276
+ <frontend_type>select</frontend_type>
277
+ <sort_order>250</sort_order>
278
+ <frontend_class>shipping-skip-hide</frontend_class>
279
+ <source_model>adminhtml/system_config_source_yesno</source_model>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <show_in_store>0</show_in_store>
283
+ </showmethod>
284
+ <sort_order translate="label">
285
+ <label>Sort Order</label>
286
+ <frontend_type>text</frontend_type>
287
+ <sort_order>260</sort_order>
288
+ <show_in_default>1</show_in_default>
289
+ <show_in_website>1</show_in_website>
290
+ <show_in_store>0</show_in_store>
291
+ </sort_order>
292
+ </fields>
293
+ </aramex>
294
+ </groups>
295
+ </carriers>
296
+ <shipping translate="label" module="aramexshipping">
297
+ <groups>
298
+ <origin translate="label">
299
+ <fields>
300
+ <street_line3 translate="label">
301
+ <label>Street Address Line 3</label>
302
+ <frontend_type>text</frontend_type>
303
+ <sort_order>70</sort_order>
304
+ <show_in_default>1</show_in_default>
305
+ <show_in_website>1</show_in_website>
306
+ <show_in_store>0</show_in_store>
307
+ </street_line3>
308
+ <department translate="label">
309
+ <label>Department</label>
310
+ <frontend_type>text</frontend_type>
311
+ <sort_order>80</sort_order>
312
+ <show_in_default>1</show_in_default>
313
+ <show_in_website>1</show_in_website>
314
+ <show_in_store>0</show_in_store>
315
+ </department>
316
+ <person_name translate="label">
317
+ <label>Person Name</label>
318
+ <frontend_type>text</frontend_type>
319
+ <sort_order>90</sort_order>
320
+ <show_in_default>1</show_in_default>
321
+ <show_in_website>1</show_in_website>
322
+ <show_in_store>0</show_in_store>
323
+ </person_name>
324
+ <person_title translate="label">
325
+ <label>Person Title</label>
326
+ <frontend_type>text</frontend_type>
327
+ <sort_order>100</sort_order>
328
+ <show_in_default>1</show_in_default>
329
+ <show_in_website>1</show_in_website>
330
+ <show_in_store>0</show_in_store>
331
+ </person_title>
332
+ <company translate="label">
333
+ <label>Company</label>
334
+ <frontend_type>text</frontend_type>
335
+ <sort_order>110</sort_order>
336
+ <show_in_default>1</show_in_default>
337
+ <show_in_website>1</show_in_website>
338
+ <show_in_store>0</show_in_store>
339
+ </company>
340
+ <phone_number1 translate="label">
341
+ <label>Phone Number 1</label>
342
+ <frontend_type>text</frontend_type>
343
+ <sort_order>120</sort_order>
344
+ <show_in_default>1</show_in_default>
345
+ <show_in_website>1</show_in_website>
346
+ <show_in_store>0</show_in_store>
347
+ </phone_number1>
348
+ <phone_number1_ext translate="label">
349
+ <label>Phone Number 1 Ext</label>
350
+ <frontend_type>text</frontend_type>
351
+ <sort_order>130</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>1</show_in_website>
354
+ <show_in_store>0</show_in_store>
355
+ </phone_number1_ext>
356
+ <phone_number2 translate="label">
357
+ <label>Phone Number 2</label>
358
+ <frontend_type>text</frontend_type>
359
+ <sort_order>140</sort_order>
360
+ <show_in_default>1</show_in_default>
361
+ <show_in_website>1</show_in_website>
362
+ <show_in_store>0</show_in_store>
363
+ </phone_number2>
364
+ <phone_number2_ext translate="label">
365
+ <label>Phone Number 2 Ext</label>
366
+ <frontend_type>text</frontend_type>
367
+ <sort_order>150</sort_order>
368
+ <show_in_default>1</show_in_default>
369
+ <show_in_website>1</show_in_website>
370
+ <show_in_store>0</show_in_store>
371
+ </phone_number2_ext>
372
+ <faxnumber translate="label">
373
+ <label>Fax Number</label>
374
+ <frontend_type>text</frontend_type>
375
+ <sort_order>160</sort_order>
376
+ <show_in_default>1</show_in_default>
377
+ <show_in_website>1</show_in_website>
378
+ <show_in_store>0</show_in_store>
379
+ </faxnumber>
380
+ <email translate="label">
381
+ <label>Email</label>
382
+ <frontend_type>text</frontend_type>
383
+ <sort_order>170</sort_order>
384
+ <show_in_default>1</show_in_default>
385
+ <show_in_website>1</show_in_website>
386
+ <show_in_store>0</show_in_store>
387
+ </email>
388
+ <cellphone translate="label">
389
+ <label>Cellphone</label>
390
+ <frontend_type>text</frontend_type>
391
+ <sort_order>180</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>0</show_in_store>
395
+ </cellphone>
396
+ <type translate="label">
397
+ <label>Type</label>
398
+ <frontend_type>text</frontend_type>
399
+ <sort_order>190</sort_order>
400
+ <show_in_default>1</show_in_default>
401
+ <show_in_website>1</show_in_website>
402
+ <show_in_store>0</show_in_store>
403
+ </type>
404
+ </fields>
405
+ </origin>
406
+ </groups>
407
+ </shipping>
408
+ </sections>
409
+ </config>
app/code/community/Shopgo/AramexShipping/etc/wsdl/aramex_rates_calculator_service.wsdl ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <wsdl:definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:tns="http://ws.aramex.net/ShippingAPI/v1/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" name="Service_1_0">
3
+ <wsdl:types>
4
+ <xsd:schema targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" elementFormDefault="qualified">
5
+ <xsd:element name="RateCalculatorRequest">
6
+ <xsd:complexType>
7
+ <xsd:sequence>
8
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true" minOccurs="0"/>
9
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
10
+ <xsd:element type="tns:Address" name="OriginAddress" nillable="true" minOccurs="0"/>
11
+ <xsd:element type="tns:Address" name="DestinationAddress" nillable="true" minOccurs="0"/>
12
+ <xsd:element type="tns:ShipmentDetails" name="ShipmentDetails" nillable="true" minOccurs="0"/>
13
+ </xsd:sequence>
14
+ </xsd:complexType>
15
+ </xsd:element>
16
+ <xsd:complexType name="ClientInfo">
17
+ <xsd:sequence>
18
+ <xsd:element type="xsd:string" name="UserName" nillable="true"/>
19
+ <xsd:element type="xsd:string" name="Password" nillable="true"/>
20
+ <xsd:element type="xsd:string" name="Version" nillable="true"/>
21
+ <xsd:element type="xsd:string" name="AccountNumber" nillable="true"/>
22
+ <xsd:element type="xsd:string" name="AccountPin" nillable="true"/>
23
+ <xsd:element type="xsd:string" name="AccountEntity" nillable="true"/>
24
+ <xsd:element type="xsd:string" name="AccountCountryCode" nillable="true"/>
25
+ </xsd:sequence>
26
+ </xsd:complexType>
27
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true"/>
28
+ <xsd:complexType name="Transaction">
29
+ <xsd:sequence>
30
+ <xsd:element type="xsd:string" name="Reference1" nillable="true"/>
31
+ <xsd:element type="xsd:string" name="Reference2" nillable="true"/>
32
+ <xsd:element type="xsd:string" name="Reference3" nillable="true"/>
33
+ <xsd:element type="xsd:string" name="Reference4" nillable="true"/>
34
+ <xsd:element type="xsd:string" name="Reference5" nillable="true"/>
35
+ </xsd:sequence>
36
+ </xsd:complexType>
37
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true"/>
38
+ <xsd:complexType name="Address">
39
+ <xsd:sequence>
40
+ <xsd:element type="xsd:string" name="Line1" nillable="true"/>
41
+ <xsd:element type="xsd:string" name="Line2" nillable="true"/>
42
+ <xsd:element type="xsd:string" name="Line3" nillable="true"/>
43
+ <xsd:element type="xsd:string" name="City" nillable="true"/>
44
+ <xsd:element type="xsd:string" name="StateOrProvinceCode" nillable="true" minOccurs="0"/>
45
+ <xsd:element type="xsd:string" name="PostCode" nillable="true"/>
46
+ <xsd:element type="xsd:string" name="CountryCode" nillable="true"/>
47
+ </xsd:sequence>
48
+ </xsd:complexType>
49
+ <xsd:element type="tns:Address" name="Address" nillable="true"/>
50
+ <xsd:complexType name="ShipmentDetails">
51
+ <xsd:sequence>
52
+ <xsd:element type="tns:Dimensions" name="Dimensions" nillable="true"/>
53
+ <xsd:element type="tns:Weight" name="ActualWeight" nillable="true"/>
54
+ <xsd:element type="tns:Weight" name="ChargeableWeight" nillable="true"/>
55
+ <xsd:element type="xsd:string" name="DescriptionOfGoods" nillable="true"/>
56
+ <xsd:element type="xsd:string" name="GoodsOriginCountry" nillable="true"/>
57
+ <xsd:element type="xsd:int" name="NumberOfPieces"/>
58
+ <xsd:element type="xsd:string" name="ProductGroup" nillable="true"/>
59
+ <xsd:element type="xsd:string" name="ProductType" nillable="true"/>
60
+ <xsd:element type="xsd:string" name="PaymentType" nillable="true"/>
61
+ <xsd:element type="xsd:string" name="PaymentOptions" nillable="true"/>
62
+ <xsd:element type="tns:Money" name="CustomsValueAmount" nillable="true" minOccurs="0"/>
63
+ <xsd:element type="tns:Money" name="CashOnDeliveryAmount" nillable="true" minOccurs="0"/>
64
+ <xsd:element type="tns:Money" name="InsuranceAmount" nillable="true" minOccurs="0"/>
65
+ <xsd:element type="tns:Money" name="CashAdditionalAmount" nillable="true" minOccurs="0"/>
66
+ <xsd:element type="tns:Money" name="CollectAmount" nillable="true" minOccurs="0"/>
67
+ <xsd:element type="xsd:string" name="Services" nillable="true" minOccurs="0"/>
68
+ <xsd:element type="tns:ArrayOfShipmentItem" name="Items" nillable="true" minOccurs="0"/>
69
+ </xsd:sequence>
70
+ </xsd:complexType>
71
+ <xsd:element type="tns:ShipmentDetails" name="ShipmentDetails" nillable="true"/>
72
+ <xsd:complexType name="Dimensions">
73
+ <xsd:sequence>
74
+ <xsd:element type="xsd:int" name="Length"/>
75
+ <xsd:element type="xsd:int" name="Width"/>
76
+ <xsd:element type="xsd:int" name="Height"/>
77
+ <xsd:element type="xsd:string" name="Unit" nillable="true"/>
78
+ </xsd:sequence>
79
+ </xsd:complexType>
80
+ <xsd:element type="tns:Dimensions" name="Dimensions" nillable="true"/>
81
+ <xsd:complexType name="Weight">
82
+ <xsd:sequence>
83
+ <xsd:element type="xsd:string" name="Unit" nillable="true"/>
84
+ <xsd:element type="xsd:double" name="Value"/>
85
+ </xsd:sequence>
86
+ </xsd:complexType>
87
+ <xsd:element type="tns:Weight" name="Weight" nillable="true"/>
88
+ <xsd:complexType name="Money">
89
+ <xsd:sequence>
90
+ <xsd:element type="xsd:string" name="CurrencyCode" nillable="true"/>
91
+ <xsd:element type="xsd:double" name="Value"/>
92
+ </xsd:sequence>
93
+ </xsd:complexType>
94
+ <xsd:element type="tns:Money" name="Money" nillable="true"/>
95
+ <xsd:complexType name="ArrayOfShipmentItem">
96
+ <xsd:sequence>
97
+ <xsd:element type="tns:ShipmentItem" name="ShipmentItem" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
98
+ </xsd:sequence>
99
+ </xsd:complexType>
100
+ <xsd:element type="tns:ArrayOfShipmentItem" name="ArrayOfShipmentItem" nillable="true"/>
101
+ <xsd:complexType name="ShipmentItem">
102
+ <xsd:sequence>
103
+ <xsd:element type="xsd:string" name="PackageType" nillable="true"/>
104
+ <xsd:element type="xsd:int" name="Quantity"/>
105
+ <xsd:element type="tns:Weight" name="Weight" nillable="true"/>
106
+ <xsd:element type="xsd:string" name="Comments" nillable="true" minOccurs="0"/>
107
+ <xsd:element type="xsd:string" name="Reference" nillable="true" minOccurs="0"/>
108
+ </xsd:sequence>
109
+ </xsd:complexType>
110
+ <xsd:element type="tns:ShipmentItem" name="ShipmentItem" nillable="true"/>
111
+ <xsd:element name="RateCalculatorResponse">
112
+ <xsd:complexType>
113
+ <xsd:sequence>
114
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
115
+ <xsd:element type="tns:ArrayOfNotification" name="Notifications" nillable="true" minOccurs="0"/>
116
+ <xsd:element type="xsd:boolean" name="HasErrors" minOccurs="0"/>
117
+ <xsd:element type="tns:Money" name="TotalAmount" nillable="true" minOccurs="0"/>
118
+ </xsd:sequence>
119
+ </xsd:complexType>
120
+ </xsd:element>
121
+ <xsd:complexType name="ArrayOfNotification">
122
+ <xsd:sequence>
123
+ <xsd:element type="tns:Notification" name="Notification" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
124
+ </xsd:sequence>
125
+ </xsd:complexType>
126
+ <xsd:element type="tns:ArrayOfNotification" name="ArrayOfNotification" nillable="true"/>
127
+ <xsd:complexType name="Notification">
128
+ <xsd:sequence>
129
+ <xsd:element type="xsd:string" name="Code" nillable="true"/>
130
+ <xsd:element type="xsd:string" name="Message" nillable="true"/>
131
+ </xsd:sequence>
132
+ </xsd:complexType>
133
+ <xsd:element type="tns:Notification" name="Notification" nillable="true"/>
134
+ </xsd:schema>
135
+ <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified">
136
+ <xs:element type="xs:anyType" name="anyType" nillable="true"/>
137
+ <xs:element type="xs:anyURI" name="anyURI" nillable="true"/>
138
+ <xs:element type="xs:base64Binary" name="base64Binary" nillable="true"/>
139
+ <xs:element type="xs:boolean" name="boolean" nillable="true"/>
140
+ <xs:element type="xs:byte" name="byte" nillable="true"/>
141
+ <xs:element type="xs:dateTime" name="dateTime" nillable="true"/>
142
+ <xs:element type="xs:decimal" name="decimal" nillable="true"/>
143
+ <xs:element type="xs:double" name="double" nillable="true"/>
144
+ <xs:element type="xs:float" name="float" nillable="true"/>
145
+ <xs:element type="xs:int" name="int" nillable="true"/>
146
+ <xs:element type="xs:long" name="long" nillable="true"/>
147
+ <xs:element type="xs:QName" name="QName" nillable="true"/>
148
+ <xs:element type="xs:short" name="short" nillable="true"/>
149
+ <xs:element type="xs:string" name="string" nillable="true"/>
150
+ <xs:element type="xs:unsignedByte" name="unsignedByte" nillable="true"/>
151
+ <xs:element type="xs:unsignedInt" name="unsignedInt" nillable="true"/>
152
+ <xs:element type="xs:unsignedLong" name="unsignedLong" nillable="true"/>
153
+ <xs:element type="xs:unsignedShort" name="unsignedShort" nillable="true"/>
154
+ <xs:element type="tns:char" name="char" nillable="true"/>
155
+ <xs:simpleType name="char">
156
+ <xs:restriction base="xs:int"/>
157
+ </xs:simpleType>
158
+ <xs:element type="tns:duration" name="duration" nillable="true"/>
159
+ <xs:simpleType name="duration">
160
+ <xs:restriction base="xs:duration">
161
+ <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
162
+ <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
163
+ <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
164
+ </xs:restriction>
165
+ </xs:simpleType>
166
+ <xs:element type="tns:guid" name="guid" nillable="true"/>
167
+ <xs:simpleType name="guid">
168
+ <xs:restriction base="xs:string">
169
+ <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
170
+ </xs:restriction>
171
+ </xs:simpleType>
172
+ <xs:attribute type="xs:QName" name="FactoryType"/>
173
+ <xs:attribute type="xs:ID" name="Id"/>
174
+ <xs:attribute type="xs:IDREF" name="Ref"/>
175
+ </xs:schema>
176
+ </wsdl:types>
177
+ <wsdl:message name="RateCalculatorRequest">
178
+ <wsdl:part name="parameters" element="tns:RateCalculatorRequest"/>
179
+ </wsdl:message>
180
+ <wsdl:message name="RateCalculatorResponse">
181
+ <wsdl:part name="parameters" element="tns:RateCalculatorResponse"/>
182
+ </wsdl:message>
183
+ <wsdl:portType name="Service_1_0">
184
+ <wsdl:operation name="CalculateRate">
185
+ <wsdl:input name="RateCalculatorRequest" message="tns:RateCalculatorRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CalculateRate"/>
186
+ <wsdl:output name="RateCalculatorResponse" message="tns:RateCalculatorResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CalculateRateResponse"/>
187
+ </wsdl:operation>
188
+ </wsdl:portType>
189
+ <wsdl:binding type="tns:Service_1_0" name="Service_1_0">
190
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
191
+ <wsdl:operation name="CalculateRate">
192
+ <soap:operation style="document" soapAction="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CalculateRate"/>
193
+ <wsdl:input name="RateCalculatorRequest">
194
+ <soap:body use="literal"/>
195
+ </wsdl:input>
196
+ <wsdl:output name="RateCalculatorResponse">
197
+ <soap:body use="literal"/>
198
+ </wsdl:output>
199
+ </wsdl:operation>
200
+ </wsdl:binding>
201
+ <wsdl:service name="Service_1_0">
202
+ <wsdl:port name="Service_1_0" binding="tns:Service_1_0">
203
+ <soap:address location="http://ws.aramex.net/shippingapi/ratecalculator/service_1_0.svc"/>
204
+ </wsdl:port>
205
+ </wsdl:service>
206
+ </wsdl:definitions>
app/code/community/Shopgo/AramexShipping/etc/wsdl/aramex_shipments_tracking_service.wsdl ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <wsdl:definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:i0="http://ws.aramex.net/ShippingAPI/v1" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:tns="http://ws.aramex.net/ShippingAPI/v1/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" name="Service_1_0">
3
+ <wsdl:binding type="i0:Service_1_0" name="BasicHttpBinding_Service_1_0">
4
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
5
+ <wsdl:operation name="TrackShipments">
6
+ <soap:operation style="document" soapAction="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/TrackShipments"/>
7
+ <wsdl:input name="ShipmentTrackingRequest">
8
+ <soap:body use="literal"/>
9
+ </wsdl:input>
10
+ <wsdl:output name="ShipmentTrackingResponse">
11
+ <soap:body use="literal"/>
12
+ </wsdl:output>
13
+ </wsdl:operation>
14
+ </wsdl:binding>
15
+ <wsdl:types>
16
+ <xsd:schema targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" elementFormDefault="qualified">
17
+ <xsd:element name="ShipmentTrackingRequest">
18
+ <xsd:complexType>
19
+ <xsd:sequence>
20
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true" minOccurs="0"/>
21
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
22
+ <xsd:element type="q1:ArrayOfstring" name="Shipments" nillable="true" minOccurs="0" xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
23
+ <xsd:element type="xsd:boolean" name="GetLastTrackingUpdateOnly" minOccurs="0"/>
24
+ </xsd:sequence>
25
+ </xsd:complexType>
26
+ </xsd:element>
27
+ <xsd:complexType name="ClientInfo">
28
+ <xsd:sequence>
29
+ <xsd:element type="xsd:string" name="UserName" nillable="true"/>
30
+ <xsd:element type="xsd:string" name="Password" nillable="true"/>
31
+ <xsd:element type="xsd:string" name="Version" nillable="true"/>
32
+ <xsd:element type="xsd:string" name="AccountNumber" nillable="true"/>
33
+ <xsd:element type="xsd:string" name="AccountPin" nillable="true"/>
34
+ <xsd:element type="xsd:string" name="AccountEntity" nillable="true"/>
35
+ <xsd:element type="xsd:string" name="AccountCountryCode" nillable="true"/>
36
+ </xsd:sequence>
37
+ </xsd:complexType>
38
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true"/>
39
+ <xsd:complexType name="Transaction">
40
+ <xsd:sequence>
41
+ <xsd:element type="xsd:string" name="Reference1" nillable="true"/>
42
+ <xsd:element type="xsd:string" name="Reference2" nillable="true"/>
43
+ <xsd:element type="xsd:string" name="Reference3" nillable="true"/>
44
+ <xsd:element type="xsd:string" name="Reference4" nillable="true"/>
45
+ <xsd:element type="xsd:string" name="Reference5" nillable="true"/>
46
+ </xsd:sequence>
47
+ </xsd:complexType>
48
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true"/>
49
+ <xsd:element name="ShipmentTrackingResponse">
50
+ <xsd:complexType>
51
+ <xsd:sequence>
52
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
53
+ <xsd:element type="tns:ArrayOfNotification" name="Notifications" nillable="true" minOccurs="0"/>
54
+ <xsd:element type="xsd:boolean" name="HasErrors" minOccurs="0"/>
55
+ <xsd:element type="q2:ArrayOfKeyValueOfstringArrayOfTrackingResultmFAkxlpY" name="TrackingResults" nillable="true" minOccurs="0" xmlns:q2="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
56
+ </xsd:sequence>
57
+ </xsd:complexType>
58
+ </xsd:element>
59
+ <xsd:complexType name="ArrayOfNotification">
60
+ <xsd:sequence>
61
+ <xsd:element type="tns:Notification" name="Notification" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
62
+ </xsd:sequence>
63
+ </xsd:complexType>
64
+ <xsd:element type="tns:ArrayOfNotification" name="ArrayOfNotification" nillable="true"/>
65
+ <xsd:complexType name="Notification">
66
+ <xsd:sequence>
67
+ <xsd:element type="xsd:string" name="Code" nillable="true"/>
68
+ <xsd:element type="xsd:string" name="Message" nillable="true"/>
69
+ </xsd:sequence>
70
+ </xsd:complexType>
71
+ <xsd:element type="tns:Notification" name="Notification" nillable="true"/>
72
+ <xsd:complexType name="ArrayOfTrackingResult">
73
+ <xsd:sequence>
74
+ <xsd:element type="tns:TrackingResult" name="TrackingResult" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
75
+ </xsd:sequence>
76
+ </xsd:complexType>
77
+ <xsd:element type="tns:ArrayOfTrackingResult" name="ArrayOfTrackingResult" nillable="true"/>
78
+ <xsd:complexType name="TrackingResult">
79
+ <xsd:sequence>
80
+ <xsd:element type="xsd:string" name="WaybillNumber" nillable="true"/>
81
+ <xsd:element type="xsd:string" name="UpdateCode" nillable="true"/>
82
+ <xsd:element type="xsd:string" name="UpdateDescription" nillable="true"/>
83
+ <xsd:element type="xsd:dateTime" name="UpdateDateTime"/>
84
+ <xsd:element type="xsd:string" name="UpdateLocation" nillable="true"/>
85
+ <xsd:element type="xsd:string" name="Comments" nillable="true"/>
86
+ <xsd:element type="xsd:string" name="ProblemCode" nillable="true"/>
87
+ </xsd:sequence>
88
+ </xsd:complexType>
89
+ <xsd:element type="tns:TrackingResult" name="TrackingResult" nillable="true"/>
90
+ </xsd:schema>
91
+ <xsd:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" elementFormDefault="qualified">
92
+ <xsd:complexType name="ArrayOfstring">
93
+ <xsd:sequence>
94
+ <xsd:element type="xsd:string" name="string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
95
+ </xsd:sequence>
96
+ </xsd:complexType>
97
+ <xsd:element type="tns:ArrayOfstring" name="ArrayOfstring" nillable="true"/>
98
+ <xsd:complexType name="ArrayOfKeyValueOfstringArrayOfTrackingResultmFAkxlpY">
99
+ <xsd:annotation>
100
+ <xsd:appinfo>
101
+ <IsDictionary xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</IsDictionary>
102
+ </xsd:appinfo>
103
+ </xsd:annotation>
104
+ <xsd:sequence>
105
+ <xsd:element name="KeyValueOfstringArrayOfTrackingResultmFAkxlpY" minOccurs="0" maxOccurs="unbounded">
106
+ <xsd:complexType>
107
+ <xsd:sequence>
108
+ <xsd:element type="xsd:string" name="Key" nillable="true"/>
109
+ <xsd:element type="q3:ArrayOfTrackingResult" name="Value" nillable="true" xmlns:q3="http://ws.aramex.net/ShippingAPI/v1/"/>
110
+ </xsd:sequence>
111
+ </xsd:complexType>
112
+ </xsd:element>
113
+ </xsd:sequence>
114
+ </xsd:complexType>
115
+ <xsd:element type="tns:ArrayOfKeyValueOfstringArrayOfTrackingResultmFAkxlpY" name="ArrayOfKeyValueOfstringArrayOfTrackingResultmFAkxlpY" nillable="true"/>
116
+ </xsd:schema>
117
+ <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified">
118
+ <xs:element type="xs:anyType" name="anyType" nillable="true"/>
119
+ <xs:element type="xs:anyURI" name="anyURI" nillable="true"/>
120
+ <xs:element type="xs:base64Binary" name="base64Binary" nillable="true"/>
121
+ <xs:element type="xs:boolean" name="boolean" nillable="true"/>
122
+ <xs:element type="xs:byte" name="byte" nillable="true"/>
123
+ <xs:element type="xs:dateTime" name="dateTime" nillable="true"/>
124
+ <xs:element type="xs:decimal" name="decimal" nillable="true"/>
125
+ <xs:element type="xs:double" name="double" nillable="true"/>
126
+ <xs:element type="xs:float" name="float" nillable="true"/>
127
+ <xs:element type="xs:int" name="int" nillable="true"/>
128
+ <xs:element type="xs:long" name="long" nillable="true"/>
129
+ <xs:element type="xs:QName" name="QName" nillable="true"/>
130
+ <xs:element type="xs:short" name="short" nillable="true"/>
131
+ <xs:element type="xs:string" name="string" nillable="true"/>
132
+ <xs:element type="xs:unsignedByte" name="unsignedByte" nillable="true"/>
133
+ <xs:element type="xs:unsignedInt" name="unsignedInt" nillable="true"/>
134
+ <xs:element type="xs:unsignedLong" name="unsignedLong" nillable="true"/>
135
+ <xs:element type="xs:unsignedShort" name="unsignedShort" nillable="true"/>
136
+ <xs:element type="tns:char" name="char" nillable="true"/>
137
+ <xs:simpleType name="char">
138
+ <xs:restriction base="xs:int"/>
139
+ </xs:simpleType>
140
+ <xs:element type="tns:duration" name="duration" nillable="true"/>
141
+ <xs:simpleType name="duration">
142
+ <xs:restriction base="xs:duration">
143
+ <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
144
+ <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
145
+ <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
146
+ </xs:restriction>
147
+ </xs:simpleType>
148
+ <xs:element type="tns:guid" name="guid" nillable="true"/>
149
+ <xs:simpleType name="guid">
150
+ <xs:restriction base="xs:string">
151
+ <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
152
+ </xs:restriction>
153
+ </xs:simpleType>
154
+ <xs:attribute type="xs:QName" name="FactoryType"/>
155
+ <xs:attribute type="xs:ID" name="Id"/>
156
+ <xs:attribute type="xs:IDREF" name="Ref"/>
157
+ </xs:schema>
158
+ </wsdl:types>
159
+ <wsdl:message name="ShipmentTrackingRequest">
160
+ <wsdl:part name="parameters" element="tns:ShipmentTrackingRequest"/>
161
+ </wsdl:message>
162
+ <wsdl:message name="ShipmentTrackingResponse">
163
+ <wsdl:part name="parameters" element="tns:ShipmentTrackingResponse"/>
164
+ </wsdl:message>
165
+ <wsdl:portType name="Service_1_0">
166
+ <wsdl:operation name="TrackShipments">
167
+ <wsdl:input name="ShipmentTrackingRequest" message="tns:ShipmentTrackingRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/TrackShipments"/>
168
+ <wsdl:output name="ShipmentTrackingResponse" message="tns:ShipmentTrackingResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/TrackShipmentsResponse"/>
169
+ </wsdl:operation>
170
+ </wsdl:portType>
171
+ <wsdl:service name="Service_1_0">
172
+ <wsdl:port name="BasicHttpBinding_Service_1_0" binding="i0:BasicHttpBinding_Service_1_0">
173
+ <soap:address location="http://ws.aramex.net/shippingapi/tracking/service_1_0.svc"/>
174
+ </wsdl:port>
175
+ </wsdl:service>
176
+ </wsdl:definitions>
app/code/community/Shopgo/AramexShipping/etc/wsdl/aramex_shipping_service.wsdl ADDED
@@ -0,0 +1,486 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <wsdl:definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:tns="http://ws.aramex.net/ShippingAPI/v1/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" name="Service_1_0">
3
+ <wsdl:types>
4
+ <xsd:schema targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified">
5
+ <xsd:element name="ShipmentCreationRequest">
6
+ <xsd:complexType>
7
+ <xsd:sequence>
8
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true" minOccurs="0"/>
9
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
10
+ <xsd:element type="tns:ArrayOfShipment" name="Shipments" nillable="true" minOccurs="0"/>
11
+ <xsd:element type="tns:LabelInfo" name="LabelInfo" nillable="true" minOccurs="0"/>
12
+ </xsd:sequence>
13
+ </xsd:complexType>
14
+ </xsd:element>
15
+ <xsd:complexType name="ClientInfo">
16
+ <xsd:sequence>
17
+ <xsd:element type="xsd:string" name="UserName" nillable="true"/>
18
+ <xsd:element type="xsd:string" name="Password" nillable="true"/>
19
+ <xsd:element type="xsd:string" name="Version" nillable="true"/>
20
+ <xsd:element type="xsd:string" name="AccountNumber" nillable="true"/>
21
+ <xsd:element type="xsd:string" name="AccountPin" nillable="true"/>
22
+ <xsd:element type="xsd:string" name="AccountEntity" nillable="true"/>
23
+ <xsd:element type="xsd:string" name="AccountCountryCode" nillable="true"/>
24
+ </xsd:sequence>
25
+ </xsd:complexType>
26
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true"/>
27
+ <xsd:complexType name="Transaction">
28
+ <xsd:sequence>
29
+ <xsd:element type="xsd:string" name="Reference1" nillable="true"/>
30
+ <xsd:element type="xsd:string" name="Reference2" nillable="true"/>
31
+ <xsd:element type="xsd:string" name="Reference3" nillable="true"/>
32
+ <xsd:element type="xsd:string" name="Reference4" nillable="true"/>
33
+ <xsd:element type="xsd:string" name="Reference5" nillable="true"/>
34
+ </xsd:sequence>
35
+ </xsd:complexType>
36
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true"/>
37
+ <xsd:complexType name="ArrayOfShipment">
38
+ <xsd:sequence>
39
+ <xsd:element type="tns:Shipment" name="Shipment" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
40
+ </xsd:sequence>
41
+ </xsd:complexType>
42
+ <xsd:element type="tns:ArrayOfShipment" name="ArrayOfShipment" nillable="true"/>
43
+ <xsd:complexType name="Shipment">
44
+ <xsd:sequence>
45
+ <xsd:element type="xsd:string" name="Reference1" nillable="true" minOccurs="0"/>
46
+ <xsd:element type="xsd:string" name="Reference2" nillable="true" minOccurs="0"/>
47
+ <xsd:element type="xsd:string" name="Reference3" nillable="true" minOccurs="0"/>
48
+ <xsd:element type="tns:Party" name="Shipper" nillable="true"/>
49
+ <xsd:element type="tns:Party" name="Consignee" nillable="true"/>
50
+ <xsd:element type="tns:Party" name="ThirdParty" nillable="true" minOccurs="0"/>
51
+ <xsd:element type="xsd:dateTime" name="ShippingDateTime"/>
52
+ <xsd:element type="xsd:dateTime" name="DueDate" minOccurs="0"/>
53
+ <xsd:element type="xsd:string" name="Comments" nillable="true" minOccurs="0"/>
54
+ <xsd:element type="xsd:string" name="PickupLocation" nillable="true" minOccurs="0"/>
55
+ <xsd:element type="xsd:string" name="OperationsInstructions" nillable="true" minOccurs="0"/>
56
+ <xsd:element type="xsd:string" name="AccountingInstrcutions" nillable="true" minOccurs="0"/>
57
+ <xsd:element type="tns:ShipmentDetails" name="Details" nillable="true" minOccurs="0"/>
58
+ <xsd:element type="tns:ArrayOfAttachment" name="Attachments" nillable="true" minOccurs="0"/>
59
+ <xsd:element type="xsd:string" name="ForeignHAWB" nillable="true" minOccurs="0"/>
60
+ <xsd:element type="xsd:int" name="TransportType_x0020_" minOccurs="0"/>
61
+ <xsd:element type="xsd:string" name="PickupGUID" nillable="true" minOccurs="0"/>
62
+ </xsd:sequence>
63
+ </xsd:complexType>
64
+ <xsd:element type="tns:Shipment" name="Shipment" nillable="true"/>
65
+ <xsd:complexType name="Party">
66
+ <xsd:sequence>
67
+ <xsd:element type="xsd:string" name="Reference1" nillable="true" minOccurs="0"/>
68
+ <xsd:element type="xsd:string" name="Reference2" nillable="true" minOccurs="0"/>
69
+ <xsd:element type="xsd:string" name="AccountNumber" nillable="true" minOccurs="0"/>
70
+ <xsd:element type="tns:Address" name="PartyAddress" nillable="true"/>
71
+ <xsd:element type="tns:Contact" name="Contact" nillable="true"/>
72
+ </xsd:sequence>
73
+ </xsd:complexType>
74
+ <xsd:element type="tns:Party" name="Party" nillable="true"/>
75
+ <xsd:complexType name="Address">
76
+ <xsd:sequence>
77
+ <xsd:element type="xsd:string" name="Line1" nillable="true"/>
78
+ <xsd:element type="xsd:string" name="Line2" nillable="true"/>
79
+ <xsd:element type="xsd:string" name="Line3" nillable="true"/>
80
+ <xsd:element type="xsd:string" name="City" nillable="true"/>
81
+ <xsd:element type="xsd:string" name="StateOrProvinceCode" nillable="true" minOccurs="0"/>
82
+ <xsd:element type="xsd:string" name="PostCode" nillable="true"/>
83
+ <xsd:element type="xsd:string" name="CountryCode" nillable="true"/>
84
+ </xsd:sequence>
85
+ </xsd:complexType>
86
+ <xsd:element type="tns:Address" name="Address" nillable="true"/>
87
+ <xsd:complexType name="Contact">
88
+ <xsd:sequence>
89
+ <xsd:element type="xsd:string" name="Department" nillable="true" minOccurs="0"/>
90
+ <xsd:element type="xsd:string" name="PersonName" nillable="true"/>
91
+ <xsd:element type="xsd:string" name="Title" nillable="true" minOccurs="0"/>
92
+ <xsd:element type="xsd:string" name="CompanyName" nillable="true" minOccurs="0"/>
93
+ <xsd:element type="xsd:string" name="PhoneNumber1" nillable="true"/>
94
+ <xsd:element type="xsd:string" name="PhoneNumber1Ext" nillable="true" minOccurs="0"/>
95
+ <xsd:element type="xsd:string" name="PhoneNumber2" nillable="true"/>
96
+ <xsd:element type="xsd:string" name="PhoneNumber2Ext" nillable="true" minOccurs="0"/>
97
+ <xsd:element type="xsd:string" name="FaxNumber" nillable="true" minOccurs="0"/>
98
+ <xsd:element type="xsd:string" name="CellPhone" nillable="true" minOccurs="0"/>
99
+ <xsd:element type="xsd:string" name="EmailAddress" nillable="true" minOccurs="0"/>
100
+ <xsd:element type="xsd:string" name="Type" nillable="true"/>
101
+ </xsd:sequence>
102
+ </xsd:complexType>
103
+ <xsd:element type="tns:Contact" name="Contact" nillable="true"/>
104
+ <xsd:complexType name="ShipmentDetails">
105
+ <xsd:sequence>
106
+ <xsd:element type="tns:Dimensions" name="Dimensions" nillable="true"/>
107
+ <xsd:element type="tns:Weight" name="ActualWeight" nillable="true"/>
108
+ <xsd:element type="tns:Weight" name="ChargeableWeight" nillable="true"/>
109
+ <xsd:element type="xsd:string" name="DescriptionOfGoods" nillable="true"/>
110
+ <xsd:element type="xsd:string" name="GoodsOriginCountry" nillable="true"/>
111
+ <xsd:element type="xsd:int" name="NumberOfPieces"/>
112
+ <xsd:element type="xsd:string" name="ProductGroup" nillable="true"/>
113
+ <xsd:element type="xsd:string" name="ProductType" nillable="true"/>
114
+ <xsd:element type="xsd:string" name="PaymentType" nillable="true"/>
115
+ <xsd:element type="xsd:string" name="PaymentOptions" nillable="true"/>
116
+ <xsd:element type="tns:Money" name="CustomsValueAmount" nillable="true" minOccurs="0"/>
117
+ <xsd:element type="tns:Money" name="CashOnDeliveryAmount" nillable="true" minOccurs="0"/>
118
+ <xsd:element type="tns:Money" name="InsuranceAmount" nillable="true" minOccurs="0"/>
119
+ <xsd:element type="tns:Money" name="CashAdditionalAmount" nillable="true" minOccurs="0"/>
120
+ <xsd:element type="xsd:string" name="CashAdditionalAmountDescription" nillable="true" minOccurs="0"/>
121
+ <xsd:element type="tns:Money" name="CollectAmount" nillable="true" minOccurs="0"/>
122
+ <xsd:element type="xsd:string" name="Services" nillable="true" minOccurs="0"/>
123
+ <xsd:element type="tns:ArrayOfShipmentItem" name="Items" nillable="true" minOccurs="0"/>
124
+ </xsd:sequence>
125
+ </xsd:complexType>
126
+ <xsd:element type="tns:ShipmentDetails" name="ShipmentDetails" nillable="true"/>
127
+ <xsd:complexType name="Dimensions">
128
+ <xsd:sequence>
129
+ <xsd:element type="xsd:double" name="Length"/>
130
+ <xsd:element type="xsd:double" name="Width"/>
131
+ <xsd:element type="xsd:double" name="Height"/>
132
+ <xsd:element type="xsd:string" name="Unit" nillable="true"/>
133
+ </xsd:sequence>
134
+ </xsd:complexType>
135
+ <xsd:element type="tns:Dimensions" name="Dimensions" nillable="true"/>
136
+ <xsd:complexType name="Weight">
137
+ <xsd:sequence>
138
+ <xsd:element type="xsd:string" name="Unit" nillable="true"/>
139
+ <xsd:element type="xsd:double" name="Value"/>
140
+ </xsd:sequence>
141
+ </xsd:complexType>
142
+ <xsd:element type="tns:Weight" name="Weight" nillable="true"/>
143
+ <xsd:complexType name="Money">
144
+ <xsd:sequence>
145
+ <xsd:element type="xsd:string" name="CurrencyCode" nillable="true"/>
146
+ <xsd:element type="xsd:double" name="Value"/>
147
+ </xsd:sequence>
148
+ </xsd:complexType>
149
+ <xsd:element type="tns:Money" name="Money" nillable="true"/>
150
+ <xsd:complexType name="ArrayOfShipmentItem">
151
+ <xsd:sequence>
152
+ <xsd:element type="tns:ShipmentItem" name="ShipmentItem" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
153
+ </xsd:sequence>
154
+ </xsd:complexType>
155
+ <xsd:element type="tns:ArrayOfShipmentItem" name="ArrayOfShipmentItem" nillable="true"/>
156
+ <xsd:complexType name="ShipmentItem">
157
+ <xsd:sequence>
158
+ <xsd:element type="xsd:string" name="PackageType" nillable="true"/>
159
+ <xsd:element type="xsd:int" name="Quantity"/>
160
+ <xsd:element type="tns:Weight" name="Weight" nillable="true"/>
161
+ <xsd:element type="xsd:string" name="Comments" nillable="true" minOccurs="0"/>
162
+ <xsd:element type="xsd:string" name="Reference" nillable="true" minOccurs="0"/>
163
+ </xsd:sequence>
164
+ </xsd:complexType>
165
+ <xsd:element type="tns:ShipmentItem" name="ShipmentItem" nillable="true"/>
166
+ <xsd:complexType name="ArrayOfAttachment">
167
+ <xsd:sequence>
168
+ <xsd:element type="tns:Attachment" name="Attachment" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
169
+ </xsd:sequence>
170
+ </xsd:complexType>
171
+ <xsd:element type="tns:ArrayOfAttachment" name="ArrayOfAttachment" nillable="true"/>
172
+ <xsd:complexType name="Attachment">
173
+ <xsd:sequence>
174
+ <xsd:element type="xsd:string" name="FileName" nillable="true"/>
175
+ <xsd:element type="xsd:string" name="FileExtension" nillable="true"/>
176
+ <xsd:element type="xsd:base64Binary" name="FileContents" nillable="true"/>
177
+ </xsd:sequence>
178
+ </xsd:complexType>
179
+ <xsd:element type="tns:Attachment" name="Attachment" nillable="true"/>
180
+ <xsd:complexType name="LabelInfo">
181
+ <xsd:sequence>
182
+ <xsd:element type="xsd:int" name="ReportID"/>
183
+ <xsd:element type="xsd:string" name="ReportType" nillable="true"/>
184
+ </xsd:sequence>
185
+ </xsd:complexType>
186
+ <xsd:element type="tns:LabelInfo" name="LabelInfo" nillable="true"/>
187
+ <xsd:element name="ShipmentCreationResponse">
188
+ <xsd:complexType>
189
+ <xsd:sequence>
190
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
191
+ <xsd:element type="tns:ArrayOfNotification" name="Notifications" nillable="true" minOccurs="0"/>
192
+ <xsd:element type="xsd:boolean" name="HasErrors" minOccurs="0"/>
193
+ <xsd:element type="tns:ArrayOfProcessedShipment" name="Shipments" nillable="true" minOccurs="0"/>
194
+ </xsd:sequence>
195
+ </xsd:complexType>
196
+ </xsd:element>
197
+ <xsd:complexType name="ArrayOfNotification">
198
+ <xsd:sequence>
199
+ <xsd:element type="tns:Notification" name="Notification" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
200
+ </xsd:sequence>
201
+ </xsd:complexType>
202
+ <xsd:element type="tns:ArrayOfNotification" name="ArrayOfNotification" nillable="true"/>
203
+ <xsd:complexType name="Notification">
204
+ <xsd:sequence>
205
+ <xsd:element type="xsd:string" name="Code" nillable="true"/>
206
+ <xsd:element type="xsd:string" name="Message" nillable="true"/>
207
+ </xsd:sequence>
208
+ </xsd:complexType>
209
+ <xsd:element type="tns:Notification" name="Notification" nillable="true"/>
210
+ <xsd:complexType name="ArrayOfProcessedShipment">
211
+ <xsd:sequence>
212
+ <xsd:element type="tns:ProcessedShipment" name="ProcessedShipment" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
213
+ </xsd:sequence>
214
+ </xsd:complexType>
215
+ <xsd:element type="tns:ArrayOfProcessedShipment" name="ArrayOfProcessedShipment" nillable="true"/>
216
+ <xsd:complexType name="ProcessedShipment">
217
+ <xsd:sequence>
218
+ <xsd:element type="xsd:string" name="ID" nillable="true"/>
219
+ <xsd:element type="xsd:string" name="Reference1" nillable="true"/>
220
+ <xsd:element type="xsd:string" name="Reference2" nillable="true"/>
221
+ <xsd:element type="xsd:string" name="Reference3" nillable="true"/>
222
+ <xsd:element type="xsd:string" name="ForeignHAWB" nillable="true"/>
223
+ <xsd:element type="xsd:boolean" name="HasErrors"/>
224
+ <xsd:element type="tns:ArrayOfNotification" name="Notifications" nillable="true"/>
225
+ <xsd:element type="tns:ShipmentLabel" name="ShipmentLabel" nillable="true"/>
226
+ </xsd:sequence>
227
+ </xsd:complexType>
228
+ <xsd:element type="tns:ProcessedShipment" name="ProcessedShipment" nillable="true"/>
229
+ <xsd:complexType name="ShipmentLabel">
230
+ <xsd:sequence>
231
+ <xsd:element type="xsd:string" name="LabelURL" nillable="true"/>
232
+ <xsd:element type="xsd:base64Binary" name="LabelFileContents" nillable="true"/>
233
+ </xsd:sequence>
234
+ </xsd:complexType>
235
+ <xsd:element type="tns:ShipmentLabel" name="ShipmentLabel" nillable="true"/>
236
+ <xsd:element name="LabelPrintingRequest">
237
+ <xsd:complexType>
238
+ <xsd:sequence>
239
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true" minOccurs="0"/>
240
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
241
+ <xsd:element type="xsd:string" name="ShipmentNumber" nillable="true" minOccurs="0"/>
242
+ <xsd:element type="xsd:string" name="ProductGroup" nillable="true" minOccurs="0"/>
243
+ <xsd:element type="xsd:string" name="OriginEntity" nillable="true" minOccurs="0"/>
244
+ <xsd:element type="tns:LabelInfo" name="LabelInfo" nillable="true" minOccurs="0"/>
245
+ </xsd:sequence>
246
+ </xsd:complexType>
247
+ </xsd:element>
248
+ <xsd:element name="LabelPrintingResponse">
249
+ <xsd:complexType>
250
+ <xsd:sequence>
251
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
252
+ <xsd:element type="tns:ArrayOfNotification" name="Notifications" nillable="true" minOccurs="0"/>
253
+ <xsd:element type="xsd:boolean" name="HasErrors" minOccurs="0"/>
254
+ <xsd:element type="xsd:string" name="ShipmentNumber" nillable="true" minOccurs="0"/>
255
+ <xsd:element type="tns:ShipmentLabel" name="ShipmentLabel" nillable="true" minOccurs="0"/>
256
+ </xsd:sequence>
257
+ </xsd:complexType>
258
+ </xsd:element>
259
+ <xsd:element name="PickupCreationRequest">
260
+ <xsd:complexType>
261
+ <xsd:sequence>
262
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true" minOccurs="0"/>
263
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
264
+ <xsd:element type="tns:Pickup" name="Pickup" nillable="true" minOccurs="0"/>
265
+ <xsd:element type="tns:LabelInfo" name="LabelInfo" nillable="true" minOccurs="0"/>
266
+ </xsd:sequence>
267
+ </xsd:complexType>
268
+ </xsd:element>
269
+ <xsd:complexType name="Pickup">
270
+ <xsd:sequence>
271
+ <xsd:element type="tns:Address" name="PickupAddress" nillable="true"/>
272
+ <xsd:element type="tns:Contact" name="PickupContact" nillable="true"/>
273
+ <xsd:element type="xsd:string" name="PickupLocation" nillable="true"/>
274
+ <xsd:element type="xsd:dateTime" name="PickupDate"/>
275
+ <xsd:element type="xsd:dateTime" name="ReadyTime"/>
276
+ <xsd:element type="xsd:dateTime" name="LastPickupTime"/>
277
+ <xsd:element type="xsd:dateTime" name="ClosingTime"/>
278
+ <xsd:element type="xsd:string" name="Comments" nillable="true"/>
279
+ <xsd:element type="xsd:string" name="Reference1" nillable="true" minOccurs="0"/>
280
+ <xsd:element type="xsd:string" name="Reference2" nillable="true" minOccurs="0"/>
281
+ <xsd:element type="xsd:string" name="Vehicle" nillable="true"/>
282
+ <xsd:element type="tns:ArrayOfShipment" name="Shipments" nillable="true" minOccurs="0"/>
283
+ <xsd:element type="tns:ArrayOfPickupItemDetail" name="PickupItems" nillable="true"/>
284
+ <xsd:element type="xsd:string" name="Status" nillable="true" minOccurs="0"/>
285
+ </xsd:sequence>
286
+ </xsd:complexType>
287
+ <xsd:element type="tns:Pickup" name="Pickup" nillable="true"/>
288
+ <xsd:complexType name="ArrayOfPickupItemDetail">
289
+ <xsd:sequence>
290
+ <xsd:element type="tns:PickupItemDetail" name="PickupItemDetail" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
291
+ </xsd:sequence>
292
+ </xsd:complexType>
293
+ <xsd:element type="tns:ArrayOfPickupItemDetail" name="ArrayOfPickupItemDetail" nillable="true"/>
294
+ <xsd:complexType name="PickupItemDetail">
295
+ <xsd:sequence>
296
+ <xsd:element type="xsd:string" name="ProductGroup" nillable="true"/>
297
+ <xsd:element type="xsd:string" name="ProductType" nillable="true"/>
298
+ <xsd:element type="xsd:int" name="NumberOfShipments"/>
299
+ <xsd:element type="xsd:string" name="PackageType" nillable="true"/>
300
+ <xsd:element type="xsd:string" name="Payment" nillable="true"/>
301
+ <xsd:element type="tns:Weight" name="ShipmentWeight" nillable="true"/>
302
+ <xsd:element type="tns:Volume" name="ShipmentVolume" nillable="true"/>
303
+ <xsd:element type="xsd:int" name="NumberOfPieces"/>
304
+ <xsd:element type="tns:Money" name="CashAmount" nillable="true"/>
305
+ <xsd:element type="tns:Money" name="ExtraCharges" nillable="true"/>
306
+ <xsd:element type="tns:Dimensions" name="ShipmentDimensions" nillable="true"/>
307
+ <xsd:element type="xsd:string" name="Comments" nillable="true"/>
308
+ </xsd:sequence>
309
+ </xsd:complexType>
310
+ <xsd:element type="tns:PickupItemDetail" name="PickupItemDetail" nillable="true"/>
311
+ <xsd:complexType name="Volume">
312
+ <xsd:sequence>
313
+ <xsd:element type="xsd:string" name="Unit" nillable="true"/>
314
+ <xsd:element type="xsd:double" name="Value"/>
315
+ </xsd:sequence>
316
+ </xsd:complexType>
317
+ <xsd:element type="tns:Volume" name="Volume" nillable="true"/>
318
+ <xsd:element name="PickupCreationResponse">
319
+ <xsd:complexType>
320
+ <xsd:sequence>
321
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
322
+ <xsd:element type="tns:ArrayOfNotification" name="Notifications" nillable="true" minOccurs="0"/>
323
+ <xsd:element type="xsd:boolean" name="HasErrors" minOccurs="0"/>
324
+ <xsd:element type="tns:ProcessedPickup" name="ProcessedPickup" nillable="true" minOccurs="0"/>
325
+ </xsd:sequence>
326
+ </xsd:complexType>
327
+ </xsd:element>
328
+ <xsd:complexType name="ProcessedPickup">
329
+ <xsd:sequence>
330
+ <xsd:element type="xsd:string" name="ID" nillable="true"/>
331
+ <xsd:element type="ser:guid" name="GUID"/>
332
+ <xsd:element type="xsd:string" name="Reference1" nillable="true"/>
333
+ <xsd:element type="xsd:string" name="Reference2" nillable="true"/>
334
+ <xsd:element type="tns:ArrayOfProcessedShipment" name="ProcessedShipments" nillable="true"/>
335
+ </xsd:sequence>
336
+ </xsd:complexType>
337
+ <xsd:element type="tns:ProcessedPickup" name="ProcessedPickup" nillable="true"/>
338
+ <xsd:element name="PickupCancelationRequest">
339
+ <xsd:complexType>
340
+ <xsd:sequence>
341
+ <xsd:element type="tns:ClientInfo" name="ClientInfo" nillable="true" minOccurs="0"/>
342
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
343
+ <xsd:element type="xsd:string" name="PickupGUID" nillable="true" minOccurs="0"/>
344
+ <xsd:element type="xsd:string" name="Comments" nillable="true" minOccurs="0"/>
345
+ </xsd:sequence>
346
+ </xsd:complexType>
347
+ </xsd:element>
348
+ <xsd:element name="PickupCancelationResponse">
349
+ <xsd:complexType>
350
+ <xsd:sequence>
351
+ <xsd:element type="tns:Transaction" name="Transaction" nillable="true" minOccurs="0"/>
352
+ <xsd:element type="tns:ArrayOfNotification" name="Notifications" nillable="true" minOccurs="0"/>
353
+ <xsd:element type="xsd:boolean" name="HasErrors" minOccurs="0"/>
354
+ </xsd:sequence>
355
+ </xsd:complexType>
356
+ </xsd:element>
357
+ </xsd:schema>
358
+ <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified">
359
+ <xs:element type="xs:anyType" name="anyType" nillable="true"/>
360
+ <xs:element type="xs:anyURI" name="anyURI" nillable="true"/>
361
+ <xs:element type="xs:base64Binary" name="base64Binary" nillable="true"/>
362
+ <xs:element type="xs:boolean" name="boolean" nillable="true"/>
363
+ <xs:element type="xs:byte" name="byte" nillable="true"/>
364
+ <xs:element type="xs:dateTime" name="dateTime" nillable="true"/>
365
+ <xs:element type="xs:decimal" name="decimal" nillable="true"/>
366
+ <xs:element type="xs:double" name="double" nillable="true"/>
367
+ <xs:element type="xs:float" name="float" nillable="true"/>
368
+ <xs:element type="xs:int" name="int" nillable="true"/>
369
+ <xs:element type="xs:long" name="long" nillable="true"/>
370
+ <xs:element type="xs:QName" name="QName" nillable="true"/>
371
+ <xs:element type="xs:short" name="short" nillable="true"/>
372
+ <xs:element type="xs:string" name="string" nillable="true"/>
373
+ <xs:element type="xs:unsignedByte" name="unsignedByte" nillable="true"/>
374
+ <xs:element type="xs:unsignedInt" name="unsignedInt" nillable="true"/>
375
+ <xs:element type="xs:unsignedLong" name="unsignedLong" nillable="true"/>
376
+ <xs:element type="xs:unsignedShort" name="unsignedShort" nillable="true"/>
377
+ <xs:element type="tns:char" name="char" nillable="true"/>
378
+ <xs:simpleType name="char">
379
+ <xs:restriction base="xs:int"/>
380
+ </xs:simpleType>
381
+ <xs:element type="tns:duration" name="duration" nillable="true"/>
382
+ <xs:simpleType name="duration">
383
+ <xs:restriction base="xs:duration">
384
+ <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
385
+ <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
386
+ <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
387
+ </xs:restriction>
388
+ </xs:simpleType>
389
+ <xs:element type="tns:guid" name="guid" nillable="true"/>
390
+ <xs:simpleType name="guid">
391
+ <xs:restriction base="xs:string">
392
+ <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
393
+ </xs:restriction>
394
+ </xs:simpleType>
395
+ <xs:attribute type="xs:QName" name="FactoryType"/>
396
+ <xs:attribute type="xs:ID" name="Id"/>
397
+ <xs:attribute type="xs:IDREF" name="Ref"/>
398
+ </xs:schema>
399
+ </wsdl:types>
400
+ <wsdl:message name="ShipmentCreationRequest">
401
+ <wsdl:part name="parameters" element="tns:ShipmentCreationRequest"/>
402
+ </wsdl:message>
403
+ <wsdl:message name="ShipmentCreationResponse">
404
+ <wsdl:part name="parameters" element="tns:ShipmentCreationResponse"/>
405
+ </wsdl:message>
406
+ <wsdl:message name="LabelPrintingRequest">
407
+ <wsdl:part name="parameters" element="tns:LabelPrintingRequest"/>
408
+ </wsdl:message>
409
+ <wsdl:message name="LabelPrintingResponse">
410
+ <wsdl:part name="parameters" element="tns:LabelPrintingResponse"/>
411
+ </wsdl:message>
412
+ <wsdl:message name="PickupCreationRequest">
413
+ <wsdl:part name="parameters" element="tns:PickupCreationRequest"/>
414
+ </wsdl:message>
415
+ <wsdl:message name="PickupCreationResponse">
416
+ <wsdl:part name="parameters" element="tns:PickupCreationResponse"/>
417
+ </wsdl:message>
418
+ <wsdl:message name="PickupCancelationRequest">
419
+ <wsdl:part name="parameters" element="tns:PickupCancelationRequest"/>
420
+ </wsdl:message>
421
+ <wsdl:message name="PickupCancelationResponse">
422
+ <wsdl:part name="parameters" element="tns:PickupCancelationResponse"/>
423
+ </wsdl:message>
424
+ <wsdl:portType name="Service_1_0">
425
+ <wsdl:operation name="CreateShipments">
426
+ <wsdl:input name="ShipmentCreationRequest" message="tns:ShipmentCreationRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreateShipments"/>
427
+ <wsdl:output name="ShipmentCreationResponse" message="tns:ShipmentCreationResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreateShipmentsResponse"/>
428
+ </wsdl:operation>
429
+ <wsdl:operation name="PrintLabel">
430
+ <wsdl:input name="LabelPrintingRequest" message="tns:LabelPrintingRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/PrintLabel"/>
431
+ <wsdl:output name="LabelPrintingResponse" message="tns:LabelPrintingResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/PrintLabelResponse"/>
432
+ </wsdl:operation>
433
+ <wsdl:operation name="CreatePickup">
434
+ <wsdl:input name="PickupCreationRequest" message="tns:PickupCreationRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreatePickup"/>
435
+ <wsdl:output name="PickupCreationResponse" message="tns:PickupCreationResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreatePickupResponse"/>
436
+ </wsdl:operation>
437
+ <wsdl:operation name="CancelPickup">
438
+ <wsdl:input name="PickupCancelationRequest" message="tns:PickupCancelationRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CancelPickup"/>
439
+ <wsdl:output name="PickupCancelationResponse" message="tns:PickupCancelationResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CancelPickupResponse"/>
440
+ </wsdl:operation>
441
+ </wsdl:portType>
442
+ <wsdl:binding type="tns:Service_1_0" name="Service_1_0">
443
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
444
+ <wsdl:operation name="CreateShipments">
445
+ <soap:operation style="document" soapAction="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreateShipments"/>
446
+ <wsdl:input name="ShipmentCreationRequest">
447
+ <soap:body use="literal"/>
448
+ </wsdl:input>
449
+ <wsdl:output name="ShipmentCreationResponse">
450
+ <soap:body use="literal"/>
451
+ </wsdl:output>
452
+ </wsdl:operation>
453
+ <wsdl:operation name="PrintLabel">
454
+ <soap:operation style="document" soapAction="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/PrintLabel"/>
455
+ <wsdl:input name="LabelPrintingRequest">
456
+ <soap:body use="literal"/>
457
+ </wsdl:input>
458
+ <wsdl:output name="LabelPrintingResponse">
459
+ <soap:body use="literal"/>
460
+ </wsdl:output>
461
+ </wsdl:operation>
462
+ <wsdl:operation name="CreatePickup">
463
+ <soap:operation style="document" soapAction="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreatePickup"/>
464
+ <wsdl:input name="PickupCreationRequest">
465
+ <soap:body use="literal"/>
466
+ </wsdl:input>
467
+ <wsdl:output name="PickupCreationResponse">
468
+ <soap:body use="literal"/>
469
+ </wsdl:output>
470
+ </wsdl:operation>
471
+ <wsdl:operation name="CancelPickup">
472
+ <soap:operation style="document" soapAction="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CancelPickup"/>
473
+ <wsdl:input name="PickupCancelationRequest">
474
+ <soap:body use="literal"/>
475
+ </wsdl:input>
476
+ <wsdl:output name="PickupCancelationResponse">
477
+ <soap:body use="literal"/>
478
+ </wsdl:output>
479
+ </wsdl:operation>
480
+ </wsdl:binding>
481
+ <wsdl:service name="Service_1_0">
482
+ <wsdl:port name="Service_1_0" binding="tns:Service_1_0">
483
+ <soap:address location="https://ws.aramex.net/shippingapi/shipping/service_1_0.svc"/>
484
+ </wsdl:port>
485
+ </wsdl:service>
486
+ </wsdl:definitions>
app/code/community/Shopgo/AramexShipping/sql/aramexshipping_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('aramex_shipping_suppliers')};
10
+ CREATE TABLE {$this->getTable('aramex_shipping_suppliers')} (
11
+ `asv_id` int(11) unsigned NOT NULL auto_increment,
12
+ `identifier` varchar(255) NOT NULL,
13
+ `username` varchar(255) NOT NULL,
14
+ `password` varchar(255) NOT NULL,
15
+ `account_country_code` varchar(2) NULL,
16
+ `account_entity` varchar(3) NULL,
17
+ `account_number` int(11) unsigned NULL,
18
+ `account_pin` int(11) unsigned NULL,
19
+ `address_line1` varchar(255) NOT NULL,
20
+ `address_line2` varchar(255) NULL,
21
+ `address_line3` varchar(255) NULL,
22
+ `city` varchar(255) NOT NULL,
23
+ `state_or_province_code` varchar(255) NULL,
24
+ `post_code` varchar(255) NOT NULL,
25
+ `country_code` varchar(2) NOT NULL,
26
+ `department` varchar(255) NULL,
27
+ `person_name` varchar(255) NOT NULL,
28
+ `person_title` varchar(255) NULL,
29
+ `company_name` varchar(255) NOT NULL,
30
+ `phone_number1` varchar(255) NOT NULL,
31
+ `phone_number1_ext` varchar(255) NOT NULL,
32
+ `phone_number2` varchar(255) NULL,
33
+ `phone_number2_ext` varchar(255) NULL,
34
+ `fax_number` varchar(255) NULL,
35
+ `cellphone` varchar(255) NOT NULL,
36
+ `email` varchar(255) NOT NULL,
37
+ `type` varchar(255) NULL,
38
+ PRIMARY KEY (`asv_id`)
39
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
40
+
41
+ ");
42
+
43
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
44
+ if (!$setup->getAttributeId(Mage_Catalog_Model_Product::ENTITY, 'aramex_supplier')) {
45
+ $setup->addAttribute('catalog_product', 'aramex_supplier', array(
46
+ 'attribute_set' => 'Default',
47
+ 'group' => 'General',
48
+ 'input' => 'select',
49
+ 'type' => 'text',
50
+ 'label' => 'Aramex Supplier',
51
+ 'backend' => '',
52
+ 'visible' => 1,
53
+ 'required' => 0,
54
+ 'user_defined' => 1,
55
+ 'searchable' => 1,
56
+ 'filterable' => 0,
57
+ 'comparable' => 1,
58
+ 'visible_on_front' => 1,
59
+ 'visible_in_advanced_search' => 0,
60
+ 'is_html_allowed_on_front' => 0,
61
+ 'source' => 'aramexshipping/product_attribute_source_suppliers',
62
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
63
+ ));
64
+ }
65
+
66
+ if (version_compare(Mage::getVersion(), '1.4.1.0', '>=')) {
67
+ $setup = $this->_conn;
68
+ $setup->addColumn($this->getTable('sales_flat_shipment'), 'aramex_shipment_data', 'text');
69
+ } else {
70
+ $setup = new Mage_Eav_Model_Entity_Setup('sales_setup');
71
+ $setup->addAttribute('shipment', 'aramex_shipment_data', array('type' => 'text'));
72
+ }
73
+
74
+ $installer->endSetup();
app/code/community/Shopgo/AramexShipping/sql/aramexshipping_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('aramex_shipping_suppliers')};
10
+ CREATE TABLE {$this->getTable('aramex_shipping_suppliers')} (
11
+ `asv_id` int(11) unsigned NOT NULL auto_increment,
12
+ `identifier` varchar(255) NOT NULL,
13
+ `username` varchar(255) NOT NULL,
14
+ `password` varchar(255) NOT NULL,
15
+ `account_country_code` varchar(2) NULL,
16
+ `account_entity` varchar(3) NULL,
17
+ `account_number` int(11) unsigned NULL,
18
+ `account_pin` int(11) unsigned NULL,
19
+ `address_line1` varchar(255) NOT NULL,
20
+ `address_line2` varchar(255) NULL,
21
+ `address_line3` varchar(255) NULL,
22
+ `city` varchar(255) NOT NULL,
23
+ `state_or_province_code` varchar(255) NULL,
24
+ `post_code` varchar(255) NOT NULL,
25
+ `country_code` varchar(2) NOT NULL,
26
+ `department` varchar(255) NULL,
27
+ `person_name` varchar(255) NOT NULL,
28
+ `person_title` varchar(255) NULL,
29
+ `company_name` varchar(255) NOT NULL,
30
+ `phone_number1` varchar(255) NOT NULL,
31
+ `phone_number1_ext` varchar(255) NOT NULL,
32
+ `phone_number2` varchar(255) NULL,
33
+ `phone_number2_ext` varchar(255) NULL,
34
+ `fax_number` varchar(255) NULL,
35
+ `cellphone` varchar(255) NOT NULL,
36
+ `email` varchar(255) NOT NULL,
37
+ `type` varchar(255) NULL,
38
+ PRIMARY KEY (`asv_id`)
39
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
40
+
41
+ ");
42
+
43
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
44
+ if (!$setup->getAttributeId(Mage_Catalog_Model_Product::ENTITY, 'aramex_supplier')) {
45
+ $setup->addAttribute('catalog_product', 'aramex_supplier', array(
46
+ 'attribute_set' => 'Default',
47
+ 'group' => 'General',
48
+ 'input' => 'select',
49
+ 'type' => 'text',
50
+ 'label' => 'Aramex Supplier',
51
+ 'backend' => '',
52
+ 'visible' => 1,
53
+ 'required' => 0,
54
+ 'user_defined' => 1,
55
+ 'searchable' => 1,
56
+ 'filterable' => 0,
57
+ 'comparable' => 1,
58
+ 'visible_on_front' => 1,
59
+ 'visible_in_advanced_search' => 0,
60
+ 'is_html_allowed_on_front' => 0,
61
+ 'source' => 'aramexshipping/product_attribute_source_suppliers',
62
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
63
+ ));
64
+ }
65
+
66
+ if (version_compare(Mage::getVersion(), '1.4.1.0', '>=')) {
67
+ $setup = $this->_conn;
68
+ $setup->addColumn($this->getTable('sales_flat_shipment'), 'aramex_shipment_data', 'text');
69
+ } else {
70
+ $setup = new Mage_Eav_Model_Entity_Setup('sales_setup');
71
+ $setup->addAttribute('shipment', 'aramex_shipment_data', array('type' => 'text'));
72
+ }
73
+
74
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/shopgo/aramex_shipping.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <aramexshipping_adminhtml_aramex_index>
4
+ <reference name="content">
5
+ <block type="aramexshipping/adminhtml_shipping" name="aramexshipping" />
6
+ </reference>
7
+ </aramexshipping_adminhtml_aramex_index>
8
+ </layout>
app/design/adminhtml/default/default/template/shopgo/aramex_shipping/system/config/button.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">//<![CDATA[
2
+ var aramex = {
3
+ passChanged: 0,
4
+ pinChanged: 0,
5
+ elmClassPrefix: '',
6
+ checkSender: 'system',
7
+ supplierId: '<?php echo $this->getData('id') ?>'
8
+ }
9
+
10
+ document.observe("dom:loaded", function() {
11
+ if ($(document.body).hasClassName('adminhtml-system-config-edit')) {
12
+ aramex.elmClassPrefix = 'carriers_aramex_';
13
+ } else if ($(document.body).hasClassName('aramexshipping-adminhtml-aramex-edit')) {
14
+ aramex.checkSender = 'supplier';
15
+ }
16
+ $(aramex.elmClassPrefix + 'password').observe('change', function(event) {
17
+ aramex.passChanged = 1;
18
+ });
19
+ });
20
+
21
+ function checkAramexAccount() {
22
+ var _params = {
23
+ username: $(aramex.elmClassPrefix + 'username').value,
24
+ password: $(aramex.elmClassPrefix + 'password').value,
25
+ account_country_code: $(aramex.elmClassPrefix + 'account_country_code').value,
26
+ account_entity: $(aramex.elmClassPrefix + 'account_entity').value,
27
+ account_number: $(aramex.elmClassPrefix + 'account_number').value,
28
+ account_pin: $(aramex.elmClassPrefix + 'account_pin').value,
29
+ sender: aramex.checkSender,
30
+ pass_changed: aramex.passChanged,
31
+ pin_changed: aramex.pinChanged
32
+ };
33
+ if (aramex.checkSender == 'supplier') {
34
+ _params.id = aramex.supplierId;
35
+ }
36
+ new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
37
+ parameters: _params,
38
+ onSuccess: function(transport) {
39
+ if (transport.responseText) {
40
+ alert(transport.responseText);
41
+ }
42
+ }
43
+ });
44
+ }
45
+ //]]></script>
46
+
47
+ <?php echo $this->getButtonHtml() ?>
app/design/frontend/base/default/layout/shopgo/aramex_shipping.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <shipping_tracking_popup translate="label">
4
+ <reference name="shipping.tracking.popup">
5
+ <action method="setTemplate"><template>shopgo/aramex_shipping/tracking/popup.phtml</template></action>
6
+ </reference>
7
+ </shipping_tracking_popup>
8
+ <checkout_cart_index>
9
+ <reference name="checkout.cart.shipping">
10
+ <action method="setTemplate"><template>shopgo/aramex_shipping/checkout/cart/shipping.phtml</template></action>
11
+ </reference>
12
+ </checkout_cart_index>
13
+ </layout>
app/design/frontend/base/default/template/shopgo/aramex_shipping/checkout/cart/shipping.phtml ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Checkout_Block_Cart_Shipping */ ?>
28
+ <div class="shipping">
29
+ <h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
30
+ <div class="shipping-form">
31
+ <form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
32
+ <p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
33
+ <ul class="form-list">
34
+ <li>
35
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
36
+ <div class="input-box">
37
+ <?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
38
+ </div>
39
+ </li>
40
+ <?php //if($this->getStateActive()): ?>
41
+ <li>
42
+ <label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
43
+ <div class="input-box">
44
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
45
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
46
+ </select>
47
+ <script type="text/javascript">
48
+ //<![CDATA[
49
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
50
+ //]]>
51
+ </script>
52
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getEstimateRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
53
+ </div>
54
+ </li>
55
+ <?php //endif; ?>
56
+ <?php //if($this->getCityActive()): ?>
57
+ <li>
58
+ <label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
59
+ <div class="input-box">
60
+ <input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->escapeHtml($this->getEstimateCity()) ?>" />
61
+ </div>
62
+ </li>
63
+ <?php //endif; ?>
64
+ <li>
65
+ <label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
66
+ <div class="input-box">
67
+ <input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />
68
+ </div>
69
+ </li>
70
+ </ul>
71
+ <div class="buttons-set">
72
+ <button type="button" title="<?php echo $this->__('Get a Quote') ?>" onclick="coShippingMethodForm.submit()" class="button"><span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
73
+ </div>
74
+ </form>
75
+ <script type="text/javascript">
76
+ //<![CDATA[
77
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
78
+ //]]>
79
+ </script>
80
+
81
+ <?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
82
+ <form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
83
+ <dl class="sp-methods">
84
+ <?php foreach ($_shippingRateGroups as $code => $_rates): ?>
85
+ <dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
86
+ <dd>
87
+ <ul>
88
+ <?php foreach ($_rates as $_rate): ?>
89
+ <li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
90
+ <?php if ($_rate->getErrorMessage()): ?>
91
+ <?php echo $this->escapeHtml($_rate->getErrorMessage()) ?>
92
+ <?php else: ?>
93
+ <input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
94
+ <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
95
+ <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
96
+ <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
97
+ <?php echo $_excl; ?>
98
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
99
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
100
+ <?php endif; ?>
101
+ </label>
102
+ <?php endif ?>
103
+ </li>
104
+ <?php endforeach; ?>
105
+ </ul>
106
+ </dd>
107
+ <?php endforeach; ?>
108
+ </dl>
109
+ <div class="buttons-set">
110
+ <button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do" value="<?php echo $this->__('Update Total') ?>"><span><span><?php echo $this->__('Update Total') ?></span></span></button>
111
+ </div>
112
+ </form>
113
+ <?php endif; ?>
114
+ <script type="text/javascript">
115
+ //<![CDATA[
116
+ var coShippingMethodForm = new VarienForm('shipping-zip-form');
117
+ var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
118
+
119
+ coShippingMethodForm.submit = function () {
120
+ var country = $F('country');
121
+ var optionalZip = false;
122
+
123
+ for (i=0; i < countriesWithOptionalZip.length; i++) {
124
+ if (countriesWithOptionalZip[i] == country) {
125
+ optionalZip = true;
126
+ }
127
+ }
128
+ if (optionalZip) {
129
+ $('postcode').removeClassName('required-entry');
130
+ }
131
+ else {
132
+ $('postcode').addClassName('required-entry');
133
+ }
134
+ return VarienForm.prototype.submit.bind(coShippingMethodForm)();
135
+ }
136
+ //]]>
137
+ </script>
138
+ </div>
139
+ </div>
app/design/frontend/base/default/template/shopgo/aramex_shipping/tracking/popup.phtml ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @var $this Mage_Shipping_Block_Tracking_Popup */ ?>
2
+ <?php $_results = $this->getTrackingInfo(); ?>
3
+ <div class="page-title title-buttons">
4
+ <h1><?php echo $this->__('Tracking Information'); ?></h1>
5
+ <button class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
6
+ </div>
7
+ <?php if(sizeof($_results)>0): ?>
8
+ <?php foreach($_results as $shipid => $_result): ?>
9
+ <?php if($shipid): ?>
10
+ <h2 class="sub-title"><?php echo $this->__('Shipment #').$shipid; ?></h2>
11
+ <?php endif; ?>
12
+ <?php if(sizeof($_result)>0): ?>
13
+ <?php $rowCount = sizeof($_result); $counter = 1; ?>
14
+ <?php $_id = 0; foreach($_result as $track): ?>
15
+ <table class="tracking-table-popup data-table" id="tracking-table-popup-<?php echo $_id ?>">
16
+ <col width="15%" />
17
+ <col />
18
+ <tbody>
19
+ <?php if(is_object($track)): ?>
20
+ <tr>
21
+ <th class="label"><?php echo $this->__('Tracking Number:'); ?></th>
22
+ <td class="value"><?php echo $this->escapeHtml($track->getTracking()); ?></td>
23
+ </tr>
24
+ <?php if ($track->getCarrierTitle()): ?>
25
+ <tr>
26
+ <th class="label"><?php echo $this->__('Carrier:'); ?></th>
27
+ <td class="value"><?php echo $this->escapeHtml($track->getCarrierTitle()); ?></td>
28
+ </tr>
29
+ <?php endif; ?>
30
+ <?php if($track->getErrorMessage()): ?>
31
+ <tr>
32
+ <th class="label"><?php echo $this->__('Error:'); ?></th>
33
+ <td class="error"><?php echo $this->__('Tracking information is currently not available. Please '); if ($this->getContactUsEnabled()) : ?><a href="<?php echo $this->getContactUs() ?>" title="<?php echo $this->__('contact us') ?>" onclick="this.target='_blank'"><?php echo $this->__('contact us') ?></a><?php echo $this->__(' for more information or '); endif; echo $this->__('email us at '); ?><a href="mailto:<?php echo $this->getStoreSupportEmail() ?>"><?php echo $this->getStoreSupportEmail() ?></a></td>
34
+ </tr>
35
+ <?php elseif($track->getTrackSummary()): ?>
36
+ <tr>
37
+ <th class="label"><?php echo $this->__('Info:'); ?></th>
38
+ <td class="value"><?php echo $track->getTrackSummary(); ?></td>
39
+ </tr>
40
+ <?php elseif($track->getUrl()): ?>
41
+ <tr>
42
+ <th class="label"><?php echo $this->__('Track:'); ?></th>
43
+ <td class="value"><a href="<?php echo $this->escapeHtml($track->getUrl()); ?>" onclick="this.target='_blank'"><?php echo $this->escapeHtml($track->getUrl()); ?></a></td>
44
+ </tr>
45
+ <?php else: ?>
46
+ <?php if ($track->getStatus()): ?>
47
+ <tr>
48
+ <th class="label"><?php echo $this->__('Status:'); ?></th>
49
+ <td class="value"><?php echo $track->getStatus(); ?></td>
50
+ </tr>
51
+ <?php endif; ?>
52
+
53
+ <?php if ($track->getComment()): ?>
54
+ <tr>
55
+ <th class="label"><?php echo $this->__('Comment:'); ?></th>
56
+ <td class="value"><?php echo $track->getComment(); ?></td>
57
+ </tr>
58
+ <?php endif; ?>
59
+
60
+ <?php if ($track->getDeliverydate()): ?>
61
+ <tr>
62
+ <th class="label"><?php echo $this->__('Delivered on:'); ?></th>
63
+ <td class="value"><?php echo $this->formatDeliveryDateTime($track->getDeliverydate(),$track->getDeliverytime()); ?></td>
64
+ </tr>
65
+ <?php endif; ?>
66
+
67
+ <?php if ($track->getSignedby()): ?>
68
+ <tr>
69
+ <th class="label"><?php echo $this->__('Signed by:'); ?></th>
70
+ <td class="value"><?php echo $track->getSignedby(); ?></td>
71
+ </tr>
72
+ <?php endif; ?>
73
+
74
+ <?php if ($track->getDeliveryLocation()): ?>
75
+ <tr>
76
+ <th class="label"><?php echo $this->__('Delivered to:'); ?></th>
77
+ <td class="value"><?php echo $track->getDeliveryLocation(); ?></td>
78
+ </tr>
79
+ <?php endif; ?>
80
+
81
+ <?php if ($track->getShippedDate()): ?>
82
+ <tr>
83
+ <th class="label"><?php echo $this->__('Shipped or billed on:'); ?></th>
84
+ <td class="value"><?php echo $track->getShippedDate(); ?></td>
85
+ </tr>
86
+ <?php endif; ?>
87
+
88
+ <?php if ($track->getService()): ?>
89
+ <tr>
90
+ <th class="label"><?php echo $this->__('Service Type:'); ?></th>
91
+ <td class="value"><?php echo $track->getService(); ?></td>
92
+ </tr>
93
+ <?php endif; ?>
94
+
95
+ <?php if ($track->getWeight()): ?>
96
+ <tr>
97
+ <th class="label"><?php echo $this->__('Weight:'); ?></th>
98
+ <td class="value"><?php echo $track->getWeight(); ?></td>
99
+ </tr>
100
+ <?php endif; ?>
101
+ <?php endif; ?>
102
+ <?php elseif(isset($track['title']) && isset($track['number']) && $track['number']): ?>
103
+ <!--if the tracking is custom value-->
104
+ <tr>
105
+ <th class="label"><?php echo ($track['title'] ? $this->escapeHtml($track['title']) : $this->__('N/A')); ?>:</th>
106
+ <td class="value"><?php echo (isset($track['number']) ? $this->escapeHtml($track['number']) : ''); ?></td>
107
+ </tr>
108
+ <?php endif; ?>
109
+ </tbody>
110
+ </table>
111
+ <script type="text/javascript">decorateTable('tracking-table-popup-<?php echo $_id++ ?>');</script>
112
+ <?php if (is_object($track) && sizeof($track->getProgressdetail())>0): ?>
113
+ <br />
114
+ <table class="data-table" id="track-history-table-<?php echo $track->getTracking(); ?>">
115
+ <col />
116
+ <col width="1" />
117
+ <col width="1" />
118
+ <col />
119
+ <thead>
120
+ <tr>
121
+ <th><?php echo $this->__('Location') ?></th>
122
+ <th><?php echo $this->__('Date') ?></th>
123
+ <th><?php echo $this->__('Local Time') ?></th>
124
+ <th><?php echo $this->__('Description') ?></th>
125
+ </tr>
126
+ </thead>
127
+ <tbody>
128
+ <?php foreach($track->getProgressdetail() as $_detail): ?>
129
+ <?php $_detailDate = (isset($_detail['deliverydate']) ? $this->formatDeliveryDate($_detail['deliverydate']) : '') ?>
130
+ <?php $_detailTime = (isset($_detail['deliverytime']) ? $this->formatDeliveryTime($_detail['deliverytime'], $_detail['deliverydate']) : '') ?>
131
+ <tr>
132
+ <td><?php echo (isset($_detail['deliverylocation']) ? $_detail['deliverylocation'] : ''); ?></td>
133
+ <td><span class="nobr"><?php echo $_detailDate ?></span></td>
134
+ <td><span class="nobr"><?php echo $_detailTime ?></span></td>
135
+ <td><?php echo (isset($_detail['activity']) ? $_detail['activity'] : '') ?></td>
136
+ </tr>
137
+ <?php endforeach; ?>
138
+ </tbody>
139
+ </table>
140
+ <script type="text/javascript">decorateTable('track-history-table-<?php echo $track->getTracking(); ?>');</script>
141
+ <?php endif; ?>
142
+ <div class="divider"></div>
143
+ <?php if($counter!=$rowCount): ?>
144
+ <?php endif; ?>
145
+ <?php $counter++; ?>
146
+ <!--end for each tracking information-->
147
+ <?php endforeach; ?>
148
+ <?php else: ?>
149
+ <p><?php echo $this->__('There is no tracking available for this shipment.'); ?></p>
150
+ <?php endif; ?>
151
+
152
+ <?php endforeach; ?>
153
+ <?php else: ?>
154
+ <p><?php echo $this->__('There is no tracking available.'); ?></p>
155
+ <?php endif; ?>
156
+ <div class="buttons-set">
157
+ <button type="button" title="<?php echo $this->__('Close Window') ?>" class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
158
+ </div>
app/etc/modules/Shopgo_AramexShipping.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Shopgo_AramexShipping>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Shopgo_AramexShipping>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Shopgo_AramexShipping</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Aramex shipping allows to calculate Aramex shipping rates, create Aramex shipments and track them.</summary>
10
+ <description>Aramex shipping allows to calculate Aramex shipping rates, create Aramex shipments and track them. It also provides extra features like adding multiple Aramex accounts.</description>
11
+ <notes>Aramex shipping allows to calculate Aramex shipping rates, create Aramex shipments and track them.</notes>
12
+ <authors><author><name>Moe Ghashim</name><user>ShopGo</user><email>moe@shopgo.me</email></author></authors>
13
+ <date>2013-07-24</date>
14
+ <time>13:14:37</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Shopgo_AramexShipping.xml" hash="e44330663c0b8e95367061e15a1ed182"/></dir></target><target name="magecommunity"><dir name="Shopgo"><dir name="AramexShipping"><dir name="Block"><dir name="Adminhtml"><dir name="Shipping"><dir name="Edit"><file name="Form.php" hash="0caa14bbcf147bd066e6b9f0b45c61cd"/><dir name="Tab"><file name="Aramexaccountform.php" hash="65631ff8a99b2ee7fe615b2be98a2f4d"/><file name="Generalinfoform.php" hash="e50af4d7ffe7a5b89e8bb68155b6acf7"/></dir><file name="Tabs.php" hash="3719bd1c4de7f2702ea704f71aaabf13"/></dir><file name="Edit.php" hash="8e698cac556bca85c4d83fdce6292ec9"/><file name="Grid.php" hash="855d7949a5c208f8aab7af1534652214"/></dir><file name="Shipping.php" hash="04e853d0200f6c070fba573567b53926"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="7854cd25e45b7d384944340977980f4e"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8b98cc69cd1548d788d40bd22d4a4e5b"/></dir><dir name="Model"><dir name="Carrier"><file name="Aramex.php" hash="8fc32eacde284fe61d8ee7f16b9fca5c"/></dir><dir name="Mysql4"><dir name="Shipping"><file name="Collection.php" hash="d355d21ea31c6cb7a910cddb98254067"/></dir><file name="Shipping.php" hash="68bf7145e6f56efdcad1c66a0f1d4462"/></dir><file name="Observer.php" hash="e812356a5a0c8e77da25833d077556c2"/><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="Suppliers.php" hash="08d1e039a63b3fcec7ed05915f0187ef"/></dir></dir></dir><dir name="Shipping"><file name="Info.php" hash="77df8fe0be40dc874d0aeea8676cb41f"/></dir><file name="Shipping.php" hash="1c1e808799005ca8167d6b8a5e03c44a"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Activepaymentmethods.php" hash="494e7176a1a6d7fd32c90aa663f0903a"/><file name="Producttypes.php" hash="bfc2db6d039b61ab1d1a0792ae3cdb8b"/><file name="Shippingmode.php" hash="b85451548ff68c09eda8ede7582c753b"/><file name="Unitofmeasure.php" hash="98425e146fb1273b3ac8b8ed3e572b47"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AramexController.php" hash="fe303b2092e14c85bae7100c9a4bfb6f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35c83a882707b398f6e33ed89db66483"/><file name="config.xml" hash="7690d14bf12d14a329b9d44e0e197ff9"/><file name="system.xml" hash="1d5d5923d92396c122c5929b6b44492e"/><dir name="wsdl"><file name="aramex_rates_calculator_service.wsdl" hash="2bfdb74b712a406966f990e5700fd4a8"/><file name="aramex_shipments_tracking_service.wsdl" hash="d0a3decaa902f3f2b6d463c790071da8"/><file name="aramex_shipping_service.wsdl" hash="c3321b8924b1a9050324f7a46e18ba5d"/></dir></dir><dir name="sql"><dir name="aramexshipping_setup"><file name="mysql4-install-0.1.0.php" hash="73aee79dcddd0a6a8fcf55c74b769753"/><file name="mysql4-install-1.0.0.php" hash="73aee79dcddd0a6a8fcf55c74b769753"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="shopgo"><file name="aramex_shipping.xml" hash="cd056a0014d4b9772ab33f2703fd3e6f"/></dir></dir><dir name="template"><dir name="shopgo"><dir name="aramex_shipping"><dir name="system"><dir name="config"><file name="button.phtml" hash="9df0309c25cc5d44528b6421da796480"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="shopgo"><file name="aramex_shipping.xml" hash="a631f32fe139a1f993e332971230d260"/></dir></dir><dir name="template"><dir name="shopgo"><dir name="aramex_shipping"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="836471b0740d4baaa13ec3d9f33d4b7d"/></dir></dir><dir name="tracking"><file name="popup.phtml" hash="ed33c71cd3baaa67611d2427327842e1"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>