Version Notes
version 2.0.1
Download this release
Release Info
| Developer | Aramex |
| Extension | Aramex_Shipping_Tracking_API |
| Version | 2.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.0 to 2.0.1
- app/code/community/Aramex/Core/Helper/Data.php +8 -1
- app/code/community/Aramex/Core/etc/config.xml +17 -0
- app/code/community/Aramex/Core/etc/system.xml +39 -1
- app/code/community/Aramex/Shipment/controllers/ShipmentController.php +97 -38
- app/code/community/Aramex/Shipping/Model/Carrier/Aramex.php +2 -1
- app/design/adminhtml/default/default/template/aramex/shipment.phtml +1 -1
- app/locale/en_US/template/email/aramex/shipment_email.html +53 -0
- package.xml +5 -5
app/code/community/Aramex/Core/Helper/Data.php
CHANGED
|
@@ -2,5 +2,12 @@
|
|
| 2 |
class Aramex_Core_Helper_Data
|
| 3 |
{
|
| 4 |
public function __(){}
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
}
|
| 2 |
class Aramex_Core_Helper_Data
|
| 3 |
{
|
| 4 |
public function __(){}
|
| 5 |
+
public function getEmails($configPath,$storeId)
|
| 6 |
+
{
|
| 7 |
+
$data = Mage::getStoreConfig($configPath,$storeId);
|
| 8 |
+
if (!empty($data)) {
|
| 9 |
+
return explode(',', $data);
|
| 10 |
+
}
|
| 11 |
+
return false;
|
| 12 |
+
}
|
| 13 |
}
|
app/code/community/Aramex/Core/etc/config.xml
CHANGED
|
@@ -11,6 +11,15 @@
|
|
| 11 |
<class>Aramex_Core_Helper</class>
|
| 12 |
</aramex_core>
|
| 13 |
</helpers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
</global>
|
| 15 |
<adminhtml>
|
| 16 |
<acl>
|
|
@@ -33,4 +42,12 @@
|
|
| 33 |
</resources>
|
| 34 |
</acl>
|
| 35 |
</adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
</config>
|
| 11 |
<class>Aramex_Core_Helper</class>
|
| 12 |
</aramex_core>
|
| 13 |
</helpers>
|
| 14 |
+
<template>
|
| 15 |
+
<email>
|
| 16 |
+
<aramexsettings_template_shipment_template translate="label" module="sales">
|
| 17 |
+
<label>Aramex Shipment</label>
|
| 18 |
+
<file>aramex/shipment_email.html</file>
|
| 19 |
+
<type>html</type>
|
| 20 |
+
</aramexsettings_template_shipment_template>
|
| 21 |
+
</email>
|
| 22 |
+
</template>
|
| 23 |
</global>
|
| 24 |
<adminhtml>
|
| 25 |
<acl>
|
| 42 |
</resources>
|
| 43 |
</acl>
|
| 44 |
</adminhtml>
|
| 45 |
+
<default>
|
| 46 |
+
<aramexsettings>
|
| 47 |
+
<template>
|
| 48 |
+
<shipment_template>aramexsettings_template_shipment_template</shipment_template>
|
| 49 |
+
<copy_method>bcc</copy_method>
|
| 50 |
+
</template>
|
| 51 |
+
</aramexsettings>
|
| 52 |
+
</default>
|
| 53 |
</config>
|
app/code/community/Aramex/Core/etc/system.xml
CHANGED
|
@@ -73,7 +73,45 @@
|
|
| 73 |
<show_in_store>1</show_in_store>
|
| 74 |
</password>
|
| 75 |
</fields>
|
| 76 |
-
</settings> <shipperdetail translate="label"> <label>Shipper Details</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <fields> <name> <label>Name</label> <frontend_type>text</frontend_type> <sort_order>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </name> <email> <label>Email</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </email> <company> <label>Company</label> <frontend_type>text</frontend_type> <sort_order>3</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </company> <address> <label>Address</label> <frontend_type>text</frontend_type> <sort_order>4</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </address> <country> <label>Country Code</label> <frontend_type>text</frontend_type> <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </country> <city> <label>City</label> <frontend_type>text</frontend_type> <sort_order>6</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </city> <postalcode> <label>Postal Code</label> <frontend_type>text</frontend_type> <sort_order>7</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </postalcode> <state> <label>State</label> <frontend_type>text</frontend_type> <sort_order>8</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </state> <phone> <label>Phone</label> <frontend_type>text</frontend_type> <sort_order>9</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </phone> </fields> </shipperdetail>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
</aramexsettings>
|
| 78 |
</sections>
|
| 79 |
</config>
|
| 73 |
<show_in_store>1</show_in_store>
|
| 74 |
</password>
|
| 75 |
</fields>
|
| 76 |
+
</settings> <shipperdetail translate="label"> <label>Shipper Details</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <fields> <name> <label>Name</label> <frontend_type>text</frontend_type> <sort_order>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </name> <email> <label>Email</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </email> <company> <label>Company</label> <frontend_type>text</frontend_type> <sort_order>3</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </company> <address> <label>Address</label> <frontend_type>text</frontend_type> <sort_order>4</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </address> <country> <label>Country Code</label> <frontend_type>text</frontend_type> <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </country> <city> <label>City</label> <frontend_type>text</frontend_type> <sort_order>6</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </city> <postalcode> <label>Postal Code</label> <frontend_type>text</frontend_type> <sort_order>7</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </postalcode> <state> <label>State</label> <frontend_type>text</frontend_type> <sort_order>8</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </state> <phone> <label>Phone</label> <frontend_type>text</frontend_type> <sort_order>9</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </phone> </fields> </shipperdetail>
|
| 77 |
+
<template>
|
| 78 |
+
<label>Shipment Email Template</label>
|
| 79 |
+
<frontend_type>text</frontend_type>
|
| 80 |
+
<sort_order>3</sort_order>
|
| 81 |
+
<show_in_default>1</show_in_default>
|
| 82 |
+
<show_in_website>1</show_in_website>
|
| 83 |
+
<show_in_store>1</show_in_store>
|
| 84 |
+
<fields>
|
| 85 |
+
<shipment_template translate="label">
|
| 86 |
+
<label>Aramex Shipment</label>
|
| 87 |
+
<frontend_type>select</frontend_type>
|
| 88 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 89 |
+
<sort_order>1</sort_order>
|
| 90 |
+
<show_in_default>1</show_in_default>
|
| 91 |
+
<show_in_website>1</show_in_website>
|
| 92 |
+
<show_in_store>1</show_in_store>
|
| 93 |
+
</shipment_template>
|
| 94 |
+
<copy_to translate="label comment">
|
| 95 |
+
<label>Shipment Email Copy To</label>
|
| 96 |
+
<frontend_type>text</frontend_type>
|
| 97 |
+
<sort_order>4</sort_order>
|
| 98 |
+
<show_in_default>1</show_in_default>
|
| 99 |
+
<show_in_website>1</show_in_website>
|
| 100 |
+
<show_in_store>1</show_in_store>
|
| 101 |
+
<comment>Comma-separated.</comment>
|
| 102 |
+
</copy_to>
|
| 103 |
+
<copy_method translate="label">
|
| 104 |
+
<label>Shipment Email Copy Method</label>
|
| 105 |
+
<frontend_type>select</frontend_type>
|
| 106 |
+
<source_model>adminhtml/system_config_source_email_method</source_model>
|
| 107 |
+
<sort_order>5</sort_order>
|
| 108 |
+
<show_in_default>1</show_in_default>
|
| 109 |
+
<show_in_website>1</show_in_website>
|
| 110 |
+
<show_in_store>1</show_in_store>
|
| 111 |
+
</copy_method>
|
| 112 |
+
</fields>
|
| 113 |
+
</template>
|
| 114 |
+
</groups>
|
| 115 |
</aramexsettings>
|
| 116 |
</sections>
|
| 117 |
</config>
|
app/code/community/Aramex/Shipment/controllers/ShipmentController.php
CHANGED
|
@@ -1,6 +1,13 @@
|
|
| 1 |
<?php
|
| 2 |
class Aramex_Shipment_ShipmentController extends Mage_Adminhtml_Controller_Action
|
| 3 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
public function postAction()
|
| 6 |
{
|
|
@@ -9,6 +16,7 @@
|
|
| 9 |
$soapClient = new SoapClient($baseUrl . 'shipping.wsdl');
|
| 10 |
$aramex_errors = false;
|
| 11 |
$post = $this->getRequest()->getPost();
|
|
|
|
| 12 |
|
| 13 |
$flag = true;
|
| 14 |
$error = "";
|
|
@@ -62,10 +70,12 @@
|
|
| 62 |
//attachment
|
| 63 |
for($i=1;$i<=3;$i++){
|
| 64 |
$fileName = $_FILES['file'.$i]['name'];
|
| 65 |
-
if(isset($fileName)){
|
| 66 |
$fileName = explode('.', $fileName);
|
| 67 |
$fileName = $fileName[0]; //filename without extension
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
//$fileData = base64_encode($fileData); //base64binary encode
|
| 70 |
$ext = pathinfo($_FILES['file'.$i]['name'], PATHINFO_EXTENSION); //file extension
|
| 71 |
if($fileName&&$ext&&$fileData)
|
|
@@ -87,7 +97,7 @@
|
|
| 87 |
|
| 88 |
//Party Address
|
| 89 |
'PartyAddress' => array(
|
| 90 |
-
'Line1' =>
|
| 91 |
'Line2' => '',
|
| 92 |
'Line3' => '',
|
| 93 |
'City' => $post['aramex_shipment_shipper_city'], //'Dubai',
|
|
@@ -157,7 +167,7 @@
|
|
| 157 |
|
| 158 |
//Party Address
|
| 159 |
'PartyAddress' => array(
|
| 160 |
-
'Line1' =>
|
| 161 |
'Line2' => '',
|
| 162 |
'Line3' => '',
|
| 163 |
'City' => Mage::getStoreConfig('aramexsettings/shipperdetail/city'), //'Dubai',
|
|
@@ -288,38 +298,67 @@
|
|
| 288 |
//sending mail
|
| 289 |
if($ship){
|
| 290 |
// if($post['aramex_email_customer'] == 'yes'){
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
$
|
| 301 |
-
|
| 302 |
-
$
|
| 303 |
-
$mail->setBodyText($body);
|
| 304 |
-
$fromEmail=Mage::getStoreConfig('trans_email/ident_general/email');
|
| 305 |
-
$fromName=Mage::getStoreConfig('trans_email/ident_general/name');
|
| 306 |
-
$mail->setFrom($fromEmail, $fromName);
|
| 307 |
-
$toEmail=$order->getCustomerEmail();
|
| 308 |
-
$toName=$order->getCustomerName();
|
| 309 |
-
$mail->addTo($toEmail, $toName);
|
| 310 |
-
$mail->setSubject($subject);
|
| 311 |
-
|
| 312 |
-
try {
|
| 313 |
-
$mail->send();
|
| 314 |
}
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
// }
|
| 322 |
-
}
|
| 323 |
|
| 324 |
Mage::getSingleton('core/session')->addSuccess('Aramex Shipment Number: '.$auth_call->Shipments->ProcessedShipment->ID.' has been created.');
|
| 325 |
//$order->setState('warehouse_pickup_shipped', true);
|
|
@@ -350,17 +389,24 @@
|
|
| 350 |
$previuosUrl=Mage::getSingleton('core/session')->getPreviousUrl();
|
| 351 |
|
| 352 |
if($_order->getId()){
|
| 353 |
-
$baseUrl = Mage::helper('aramexshipment')->getWsdlPath();
|
| 354 |
$soapClient = new SoapClient($baseUrl . 'shipping.wsdl');
|
| 355 |
$clientInfo = Mage::helper('aramexshipment')->getClientInfo();
|
| 356 |
$commentTable= Mage::getSingleton('core/resource')->getTableName('sales/shipment_comment');
|
| 357 |
$shipments = Mage::getResourceModel('sales/order_shipment_collection')
|
| 358 |
->addAttributeToSelect('*')
|
| 359 |
->addFieldToFilter("order_id",$_order->getId())->join("sales/shipment_comment",'main_table.entity_id=parent_id','comment')->addFieldToFilter('comment', array('like'=>"%{$_order->getIncrementId()}%"))->load();
|
|
|
|
|
|
|
| 360 |
if($shipments->count()){
|
| 361 |
foreach($shipments as $key=>$comment){
|
| 362 |
-
|
| 363 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 364 |
break;
|
| 365 |
}
|
| 366 |
$params = array(
|
|
@@ -380,10 +426,22 @@
|
|
| 380 |
),
|
| 381 |
);
|
| 382 |
$params['ShipmentNumber']=$awbno;
|
| 383 |
-
|
|
|
|
| 384 |
try {
|
| 385 |
$auth_call = $soapClient->PrintLabel($params);
|
| 386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
$name="{$_order->getIncrementId()}-shipment-label.pdf";
|
| 388 |
header('Content-type: application/pdf');
|
| 389 |
header('Content-Disposition: attachment; filename="'.$name.'"');
|
|
@@ -402,5 +460,6 @@
|
|
| 402 |
$this->_redirectUrl($previuosUrl);
|
| 403 |
}
|
| 404 |
}
|
|
|
|
| 405 |
}
|
| 406 |
?>
|
| 1 |
<?php
|
| 2 |
class Aramex_Shipment_ShipmentController extends Mage_Adminhtml_Controller_Action
|
| 3 |
{
|
| 4 |
+
|
| 5 |
+
const XML_PATH_TRANS_IDENTITY_EMAIL = 'trans_email/ident_general/email';
|
| 6 |
+
const XML_PATH_TRANS_IDENTITY_NAME = 'trans_email/ident_general/name';
|
| 7 |
+
const XML_PATH_SHIPMENT_EMAIL_TEMPLATE = 'aramexsettings/template/shipment_template';
|
| 8 |
+
const XML_PATH_SHIPMENT_EMAIL_COPY_TO = 'aramexsettings/template/copy_to';
|
| 9 |
+
const XML_PATH_SHIPMENT_EMAIL_COPY_METHOD = 'aramexsettings/template/copy_method';
|
| 10 |
+
|
| 11 |
|
| 12 |
public function postAction()
|
| 13 |
{
|
| 16 |
$soapClient = new SoapClient($baseUrl . 'shipping.wsdl');
|
| 17 |
$aramex_errors = false;
|
| 18 |
$post = $this->getRequest()->getPost();
|
| 19 |
+
|
| 20 |
|
| 21 |
$flag = true;
|
| 22 |
$error = "";
|
| 70 |
//attachment
|
| 71 |
for($i=1;$i<=3;$i++){
|
| 72 |
$fileName = $_FILES['file'.$i]['name'];
|
| 73 |
+
if(isset($fileName)!=''){
|
| 74 |
$fileName = explode('.', $fileName);
|
| 75 |
$fileName = $fileName[0]; //filename without extension
|
| 76 |
+
$fileData ='';
|
| 77 |
+
if($_FILES['file'.$i]['tmp_name']!='')
|
| 78 |
+
$fileData = file_get_contents($_FILES['file'.$i]['tmp_name']);
|
| 79 |
//$fileData = base64_encode($fileData); //base64binary encode
|
| 80 |
$ext = pathinfo($_FILES['file'.$i]['name'], PATHINFO_EXTENSION); //file extension
|
| 81 |
if($fileName&&$ext&&$fileData)
|
| 97 |
|
| 98 |
//Party Address
|
| 99 |
'PartyAddress' => array(
|
| 100 |
+
'Line1' => addslashes($post['aramex_shipment_shipper_street']), //'13 Mecca St',
|
| 101 |
'Line2' => '',
|
| 102 |
'Line3' => '',
|
| 103 |
'City' => $post['aramex_shipment_shipper_city'], //'Dubai',
|
| 167 |
|
| 168 |
//Party Address
|
| 169 |
'PartyAddress' => array(
|
| 170 |
+
'Line1' => addslashes(Mage::getStoreConfig('aramexsettings/shipperdetail/address')), //'13 Mecca St',
|
| 171 |
'Line2' => '',
|
| 172 |
'Line3' => '',
|
| 173 |
'City' => Mage::getStoreConfig('aramexsettings/shipperdetail/city'), //'Dubai',
|
| 298 |
//sending mail
|
| 299 |
if($ship){
|
| 300 |
// if($post['aramex_email_customer'] == 'yes'){
|
| 301 |
+
|
| 302 |
+
/* send shipment mail */
|
| 303 |
+
$storeId = $order->getStore()->getId();
|
| 304 |
+
$copyTo = Mage::helper('aramex_core')->getEmails(self:: XML_PATH_SHIPMENT_EMAIL_COPY_TO,$storeId);
|
| 305 |
+
$copyMethod = Mage::getStoreConfig(self::XML_PATH_SHIPMENT_EMAIL_COPY_METHOD, $storeId);
|
| 306 |
+
|
| 307 |
+
$templateId = Mage::getStoreConfig(self::XML_PATH_SHIPMENT_EMAIL_TEMPLATE, $storeId);
|
| 308 |
+
|
| 309 |
+
if ($order->getCustomerIsGuest()) {
|
| 310 |
+
$customerName = $order->getBillingAddress()->getName();
|
| 311 |
+
} else {
|
| 312 |
+
$customerName = $order->getCustomerName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
}
|
| 314 |
+
$shipments_id = $auth_call->Shipments->ProcessedShipment->ID;
|
| 315 |
+
|
| 316 |
+
$mailer = Mage::getModel('core/email_template_mailer');
|
| 317 |
+
|
| 318 |
+
$emailInfo = Mage::getModel('core/email_info');
|
| 319 |
+
$emailInfo->addTo($order->getCustomerEmail(), $customerName);
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
if ($copyTo && $copyMethod == 'bcc') {
|
| 325 |
+
// Add bcc to customer email
|
| 326 |
+
foreach ($copyTo as $email) {
|
| 327 |
+
$emailInfo->addBcc($email);
|
| 328 |
+
}
|
| 329 |
}
|
| 330 |
+
$mailer->addEmailInfo($emailInfo);
|
| 331 |
+
// Email copies are sent as separated emails if their copy method is 'copy'
|
| 332 |
+
if ($copyTo && $copyMethod == 'copy') {
|
| 333 |
+
foreach ($copyTo as $email) {
|
| 334 |
+
$emailInfo = Mage::getModel('core/email_info');
|
| 335 |
+
$emailInfo->addTo($email);
|
| 336 |
+
$mailer->addEmailInfo($emailInfo);
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
$senderName=Mage::getStoreConfig(self::XML_PATH_TRANS_IDENTITY_NAME,$storeId);
|
| 342 |
+
$senderEmail=Mage::getStoreConfig(self::XML_PATH_TRANS_IDENTITY_EMAIL,$storeId);
|
| 343 |
+
|
| 344 |
+
// Set all required params and send emails
|
| 345 |
+
$mailer->setSender(array('name' => $senderName, 'email' =>$senderEmail));
|
| 346 |
+
$mailer->setStoreId($storeId);
|
| 347 |
+
$mailer->setTemplateId($templateId);
|
| 348 |
+
$mailer->setTemplateParams(array(
|
| 349 |
+
'order' => $order,
|
| 350 |
+
'shipments_id' => $shipments_id
|
| 351 |
+
)
|
| 352 |
+
);
|
| 353 |
+
try {
|
| 354 |
+
$mailer->send();
|
| 355 |
+
}
|
| 356 |
+
catch(Exception $ex) {
|
| 357 |
+
Mage::getSingleton('core/session')
|
| 358 |
+
->addError('Unable to send email.');
|
| 359 |
+
}
|
| 360 |
// }
|
| 361 |
+
}
|
| 362 |
|
| 363 |
Mage::getSingleton('core/session')->addSuccess('Aramex Shipment Number: '.$auth_call->Shipments->ProcessedShipment->ID.' has been created.');
|
| 364 |
//$order->setState('warehouse_pickup_shipped', true);
|
| 389 |
$previuosUrl=Mage::getSingleton('core/session')->getPreviousUrl();
|
| 390 |
|
| 391 |
if($_order->getId()){
|
| 392 |
+
$baseUrl = Mage::helper('aramexshipment')->getWsdlPath();
|
| 393 |
$soapClient = new SoapClient($baseUrl . 'shipping.wsdl');
|
| 394 |
$clientInfo = Mage::helper('aramexshipment')->getClientInfo();
|
| 395 |
$commentTable= Mage::getSingleton('core/resource')->getTableName('sales/shipment_comment');
|
| 396 |
$shipments = Mage::getResourceModel('sales/order_shipment_collection')
|
| 397 |
->addAttributeToSelect('*')
|
| 398 |
->addFieldToFilter("order_id",$_order->getId())->join("sales/shipment_comment",'main_table.entity_id=parent_id','comment')->addFieldToFilter('comment', array('like'=>"%{$_order->getIncrementId()}%"))->load();
|
| 399 |
+
|
| 400 |
+
|
| 401 |
if($shipments->count()){
|
| 402 |
foreach($shipments as $key=>$comment){
|
| 403 |
+
if (version_compare(PHP_VERSION, '5.3.0') <= 0) {
|
| 404 |
+
$awbno=substr($comment->getComment(),0, strpos($comment->getComment(),"- Order No"));
|
| 405 |
+
}
|
| 406 |
+
else{
|
| 407 |
+
$awbno=strstr($comment->getComment(),"- Order No",true);
|
| 408 |
+
}
|
| 409 |
+
$awbno=trim($awbno,"AWB No.");
|
| 410 |
break;
|
| 411 |
}
|
| 412 |
$params = array(
|
| 426 |
),
|
| 427 |
);
|
| 428 |
$params['ShipmentNumber']=$awbno;
|
| 429 |
+
/* print_r($params);
|
| 430 |
+
exit; */
|
| 431 |
try {
|
| 432 |
$auth_call = $soapClient->PrintLabel($params);
|
| 433 |
+
/* bof PDF demaged Fixes debug */
|
| 434 |
+
if($auth_call->HasErrors){
|
| 435 |
+
if(count($auth_call->Notifications->Notification) > 1){
|
| 436 |
+
foreach($auth_call->Notifications->Notification as $notify_error){
|
| 437 |
+
Mage::throwException($this->__('Aramex: ' . $notify_error->Code .' - '. $notify_error->Message));
|
| 438 |
+
}
|
| 439 |
+
} else {
|
| 440 |
+
Mage::throwException($this->__('Aramex: ' . $auth_call->Notifications->Notification->Code . ' - '. $auth_call->Notifications->Notification->Message));
|
| 441 |
+
}
|
| 442 |
+
}
|
| 443 |
+
/* eof PDF demaged Fixes */
|
| 444 |
+
$filepath=$auth_call->ShipmentLabel->LabelURL;
|
| 445 |
$name="{$_order->getIncrementId()}-shipment-label.pdf";
|
| 446 |
header('Content-type: application/pdf');
|
| 447 |
header('Content-Disposition: attachment; filename="'.$name.'"');
|
| 460 |
$this->_redirectUrl($previuosUrl);
|
| 461 |
}
|
| 462 |
}
|
| 463 |
+
|
| 464 |
}
|
| 465 |
?>
|
app/code/community/Aramex/Shipping/Model/Carrier/Aramex.php
CHANGED
|
@@ -33,7 +33,7 @@ class Aramex_Shipping_Model_Carrier_Aramex extends Mage_Usa_Model_Shipping_Carri
|
|
| 33 |
|
| 34 |
function __construct()
|
| 35 |
{
|
| 36 |
-
$this->_defaultGatewayUrl = Mage::
|
| 37 |
}
|
| 38 |
|
| 39 |
protected function _doShipmentRequest(Varien_Object $request)
|
|
@@ -234,6 +234,7 @@ class Aramex_Shipping_Model_Carrier_Aramex extends Mage_Usa_Model_Shipping_Carri
|
|
| 234 |
//$url = 'http://localhost:8080/soap_test/wsdl/Tracking.wsdl';
|
| 235 |
//if (!$url) {
|
| 236 |
$url = $this->_defaultGatewayUrl;
|
|
|
|
| 237 |
//}
|
| 238 |
|
| 239 |
$clientAramex = new SoapClient($url);
|
| 33 |
|
| 34 |
function __construct()
|
| 35 |
{
|
| 36 |
+
$this->_defaultGatewayUrl = Mage::helper('aramexshipment')->getWsdlPath().'Tracking.wsdl';
|
| 37 |
}
|
| 38 |
|
| 39 |
protected function _doShipmentRequest(Varien_Object $request)
|
| 234 |
//$url = 'http://localhost:8080/soap_test/wsdl/Tracking.wsdl';
|
| 235 |
//if (!$url) {
|
| 236 |
$url = $this->_defaultGatewayUrl;
|
| 237 |
+
|
| 238 |
//}
|
| 239 |
|
| 240 |
$clientAramex = new SoapClient($url);
|
app/design/adminhtml/default/default/template/aramex/shipment.phtml
CHANGED
|
@@ -117,7 +117,7 @@ $payment = $_order->getPayment();
|
|
| 117 |
</div>
|
| 118 |
<div class="text_short">
|
| 119 |
|
| 120 |
-
<?php $company_name = ($billing) ? $billing->getData('company') : '';?>
|
| 121 |
<?php $_company=($session)?$formData['aramex_shipment_shipper_company']:Mage::getStoreConfig('aramexsettings/shipperdetail/company');?>
|
| 122 |
<label>Company</label><input type="text" id="aramex_shipment_shipper_company" name="aramex_shipment_shipper_company" value="<?php echo $_company; ?>"/>
|
| 123 |
</div>
|
| 117 |
</div>
|
| 118 |
<div class="text_short">
|
| 119 |
|
| 120 |
+
<?php $company_name = isset($billing) ? $billing->getData('company') : '';?>
|
| 121 |
<?php $_company=($session)?$formData['aramex_shipment_shipper_company']:Mage::getStoreConfig('aramexsettings/shipperdetail/company');?>
|
| 122 |
<label>Company</label><input type="text" id="aramex_shipment_shipper_company" name="aramex_shipment_shipper_company" value="<?php echo $_company; ?>"/>
|
| 123 |
</div>
|
app/locale/en_US/template/email/aramex/shipment_email.html
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--@subject {{var store.getFrontendName()}}: Aramex Shipment # {{var shipments_id}} @-->
|
| 2 |
+
<!--@vars
|
| 3 |
+
{"store url=\"\"":"Store Url",
|
| 4 |
+
"var logo_url":"Email Logo Image Url",
|
| 5 |
+
"var logo_alt":"Email Logo Image Alt",
|
| 6 |
+
"htmlescape var=$order.getCustomerName()":"Customer Name",
|
| 7 |
+
"var order.increment_id":"Order Id",
|
| 8 |
+
"var order.getStatusLabel()":"Order Status",
|
| 9 |
+
"var shipments_id":"Airway bill number",
|
| 10 |
+
"var store.getFrontendName()":"Store Name"}
|
| 11 |
+
@-->
|
| 12 |
+
<!--@styles
|
| 13 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
| 14 |
+
@-->
|
| 15 |
+
|
| 16 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 17 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
| 18 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
| 19 |
+
<tr>
|
| 20 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
| 21 |
+
<!-- [ header starts here] -->
|
| 22 |
+
<table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
| 23 |
+
<tr>
|
| 24 |
+
<td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
|
| 25 |
+
</tr>
|
| 26 |
+
<!-- [ middle starts here] -->
|
| 27 |
+
<tr>
|
| 28 |
+
<td valign="top">
|
| 29 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{htmlescape var=$order.getCustomerName()}},</h1>
|
| 30 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
|
| 31 |
+
Your order is # {{var order.increment_id}}.
|
| 32 |
+
</p>
|
| 33 |
+
|
| 34 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">Airway bill number: {{var shipments_id}}.</p>
|
| 35 |
+
|
| 36 |
+
<p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can track shipment on <a href="http://www.aramex.com/express/track.aspx">http://www.aramex.com/express/track.aspx</a></p>
|
| 37 |
+
|
| 38 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
| 39 |
+
If you have any questions, please feel free to contact us at
|
| 40 |
+
<a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a>
|
| 41 |
+
or by phone at {{config path='general/store_information/phone'}}.
|
| 42 |
+
</p>
|
| 43 |
+
</td>
|
| 44 |
+
</tr>
|
| 45 |
+
<tr>
|
| 46 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
|
| 47 |
+
</tr>
|
| 48 |
+
</table>
|
| 49 |
+
</td>
|
| 50 |
+
</tr>
|
| 51 |
+
</table>
|
| 52 |
+
</div>
|
| 53 |
+
</body>
|
package.xml
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Aramex_Shipping_Tracking_API</name>
|
| 4 |
-
<version>2.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Aramex Shipping Extension for magento</summary>
|
| 10 |
<description>Aramex Shipping Extension for magento</description>
|
| 11 |
-
<notes>version 2.0.
|
| 12 |
<authors><author><name>Aramex</name><user>aramexdev</user><email>portalsthirdparty@aramex.com</email></author></authors>
|
| 13 |
-
<date>
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Aramex"><dir name="Adminhtml"><dir name="controllers"><dir name="Sales"><file name="OrderController.php" hash="d897c576f9b082f60b85e62770586145"/></dir></dir><dir name="etc"><file name="config.xml" hash="8551ea941ec563a3d87f7db474f2eeb5"/></dir></dir><dir name="Core"><dir name="Helper"><file name="Data.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.0.1</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6</min><max>1.8.1</max></package></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Aramex_Shipping_Tracking_API</name>
|
| 4 |
+
<version>2.0.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Aramex Shipping Extension for magento</summary>
|
| 10 |
<description>Aramex Shipping Extension for magento</description>
|
| 11 |
+
<notes>version 2.0.1</notes>
|
| 12 |
<authors><author><name>Aramex</name><user>aramexdev</user><email>portalsthirdparty@aramex.com</email></author></authors>
|
| 13 |
+
<date>2014-02-12</date>
|
| 14 |
+
<time>09:25:43</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Aramex"><dir name="Adminhtml"><dir name="controllers"><dir name="Sales"><file name="OrderController.php" hash="d897c576f9b082f60b85e62770586145"/></dir></dir><dir name="etc"><file name="config.xml" hash="8551ea941ec563a3d87f7db474f2eeb5"/></dir></dir><dir name="Core"><dir name="Helper"><file name="Data.php" hash="2c2bd86a7476d7e9838f4422d799c35b"/></dir><dir name="etc"><file name="config.xml" hash="45ba7c64f7e1ca2fb637c540e5c3b0a4"/><file name="system.xml" hash="fa61f2f2cc8bd1729dd671c2b5839322"/></dir></dir><dir name="Shipment"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="View.php" hash="923a4bc9e8e53c912b894f9f30a9d24b"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="169ce609224658e762e5c07df2de8342"/></dir><dir name="Model"><dir name="Carrier"><dir name="Aramex"><dir name="Source"><file name="Dropoff.php" hash="e707cd809c802f3efb698d0e36721e05"/><file name="Freemethod.php" hash="6579a3c5c0cbf8828c2752b6e0d108ee"/><file name="Method.php" hash="db122d66069148186f5c224dd943d059"/><file name="Packaging.php" hash="50e551b6e52a190f47f969ae70dc7b22"/></dir></dir><file name="Aramex.php" hash="2d4847f66a4fb7a3232d520e9a978d12"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="e3a6cdad35fe8d49fec3ad36d0c5f5cf"/><file name="RateController.php" hash="ed30e5328fb6bc5d34a7ccd44ee295ae"/><file name="SchedulepickupController.php" hash="2788b9013887295bcc9cb84799440057"/><file name="ShipmentController.php" hash="33c6b8cc1781d2a47a33a78eeb100223"/></dir><dir name="etc"><file name="config.xml" hash="227cffe70c4cc075c8e10da17861662b"/><dir name="wsdl"><dir name="Aramex"><file name="Tracking.wsdl" hash="d0a3decaa902f3f2b6d463c790071da8"/><file name="aramex-rates-calculator-wsdl.wsdl" hash="efd091f022ea4b28fc41eae0b156f9fc"/><file name="shipping.wsdl" hash="3d13e21363413243d5c70f171ef9b121"/></dir></dir></dir></dir><dir name="Shipping"><dir name="Model"><dir name="Carrier"><dir name="Aramex"><dir name="Source"><file name="Dropoff.php" hash="e707cd809c802f3efb698d0e36721e05"/><file name="Freemethod.php" hash="6579a3c5c0cbf8828c2752b6e0d108ee"/><file name="Method.php" hash="db122d66069148186f5c224dd943d059"/><file name="Packaging.php" hash="50e551b6e52a190f47f969ae70dc7b22"/></dir></dir><file name="Aramex.php" hash="b02eed98ea8f8660bd79c9a96cbd7885"/></dir></dir><dir name="etc"><file name="config.xml" hash="987cf2182f827cebe8865c14b21b922e"/><file name="system.xml" hash="35b6412240e0cd6e2f5fecf6eaf05cc0"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="aramex"><file name="calculate_rate.phtml" hash="94ae86d7e8580bf848f5cbe3887d400a"/><file name="print_label.phtml" hash="61de8abf8aa383cbdc7f7b64a8be4ae2"/><dir name="sales"><dir name="order"><dir name="comments"><file name="view.phtml" hash="7e2e3243c12ef7fafead569c5918d130"/></dir><dir name="view"><dir name="tab"><file name="history.phtml" hash="35e4f4f8ab3d7c00993f8c3ccd5a81f2"/></dir></dir></dir></dir><file name="schedule_puckup.phtml" hash="9b1fb85b928bcbb97673a1c9257a1fae"/><file name="shipment.phtml" hash="5e5f4b5fb5559cb91d5e9f4f39bdfa17"/></dir></dir><dir name="layout"><file name="aramex.xml" hash="49460aae3f0f7d7d470dfafe0c104f94"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aramex_Adminhtml.xml" hash="d7d6bae0800edb5ad632ffb9a73ee78d"/><file name="Aramex_Core.xml" hash="f3ef092ca056636b4d6bedad36dabaf7"/><file name="Aramex_Shipment.xml" hash="44273c772ecb4ad2ceade7e5f0e49775"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="aramex"><dir name="css"><file name="aramex.css" hash="e44b92da4fe65b7a8eec5635d792cdfe"/></dir><dir name="js"><file name="common.js" hash="8e744a69845908527041314cc75b8ff1"/><file name="jquery.min.js" hash="b8d64d0bc142b3f670cc0611b0aebcae"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="aramex"><file name="shipment_email.html" hash="3f3e4e5e8220437debb8e65c1f8c1738"/></dir></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.0.1</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6</min><max>1.8.1</max></package></required></dependencies>
|
| 18 |
</package>
|
