Version Notes
CedCommerce Ecom Express Shipping Addon-Magento Global Addon
Release Notes:
*Added new features:
* Ecom Express Shipping Addon allows the admin to integrate it with their product .
* Since this is a Magento standard shipping Addon so no need to install any supporting Addon.
* Admin can manage the handling Charge and display the handling charge at checkout time.
*Admin can generate the Manual and automatic AWB number.
*Admin can track the order status and cancel the shipment.
*Auto Print Shipping Label generation when Shipment created.
Download this release
Release Info
| Developer | Cedcommerce |
| Extension | Ecom_Express |
| Version | 0.3.2 |
| Comparing to | |
| See all releases | |
Version 0.3.2
- app/code/local/Ecom/Express/Block/Adminhtml/Awb.php +63 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Awb/Grid.php +132 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Pincode.php +42 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Pincode/Grid.php +113 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Renderer/Orderid.php +40 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Renderer/Orderstatus.php +41 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Renderer/Shipmentid.php +51 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Sales/Order/Shipment/View.php +152 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Sales/Shipment/Grid.php +194 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Widget/Grid.php +40 -0
- app/code/local/Ecom/Express/Block/Adminhtml/Widget/Grid/Column.php +53 -0
- app/code/local/Ecom/Express/Helper/Data.php +93 -0
- app/code/local/Ecom/Express/Model/Automaticawb.php +149 -0
- app/code/local/Ecom/Express/Model/Awb.php +37 -0
- app/code/local/Ecom/Express/Model/Carrier/Ecomexpress.php +92 -0
- app/code/local/Ecom/Express/Model/Mysql4/Awb.php +27 -0
- app/code/local/Ecom/Express/Model/Mysql4/Awb/Collection.php +30 -0
- app/code/local/Ecom/Express/Model/Mysql4/Pincode.php +27 -0
- app/code/local/Ecom/Express/Model/Mysql4/Pincode/Collection.php +29 -0
- app/code/local/Ecom/Express/Model/Observer.php +304 -0
- app/code/local/Ecom/Express/Model/Order/Pdf/Shipment.php +756 -0
- app/code/local/Ecom/Express/Model/Order/Pdf/Shipment_backup.php +731 -0
- app/code/local/Ecom/Express/Model/Pincode.php +51 -0
- app/code/local/Ecom/Express/controllers/Adminhtml/AwbController.php +204 -0
- app/code/local/Ecom/Express/controllers/Adminhtml/CancelController.php +115 -0
- app/code/local/Ecom/Express/controllers/Adminhtml/IndexController.php +38 -0
- app/code/local/Ecom/Express/controllers/Adminhtml/PincodeController.php +147 -0
- app/code/local/Ecom/Express/controllers/Adminhtml/TrackController.php +172 -0
- app/code/local/Ecom/Express/controllers/AjaxController.php +63 -0
- app/code/local/Ecom/Express/controllers/IndexController.php +167 -0
- app/code/local/Ecom/Express/controllers/StatusController.php +67 -0
- app/code/local/Ecom/Express/etc/adminhtml.xml +72 -0
- app/code/local/Ecom/Express/etc/config.xml +197 -0
- app/code/local/Ecom/Express/etc/system.xml +170 -0
- app/code/local/Ecom/Express/sql/ecomexpress_setup/mysql4-install-0.1.0.php +58 -0
- app/code/local/Ecom/Express/sql/ecomexpress_setup/mysql4-upgrade-0.1.0-0.2.0.php +32 -0
- app/code/local/Ecom/Express/sql/ecomexpress_setup/mysql4-upgrade-0.2.0-0.3.0.php +89 -0
- app/design/adminhtml/default/default/layout/ecom/express/ecomexpress.xml +48 -0
- app/design/frontend/base/default/layout/ecom/express/ecomexpress.xml +34 -0
- app/design/frontend/base/default/template/ecomexpress/sales/order/print.phtml +105 -0
- app/design/frontend/base/default/template/ecomexpress/shipping/tracking/popup.phtml +202 -0
- app/etc/modules/Ecom_Express.xml +27 -0
- js/ecom/ecomexpress.js +43 -0
- lib/LinLibertineFont/ecomexpress/DejaVuSans.ttf +0 -0
- media/ecomexpress/font/FRE3OF9X.TTF +0 -0
- package.xml +43 -0
app/code/local/Ecom/Express/Block/Adminhtml/Awb.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Ecom_Express_Block_Adminhtml_Awb extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
*
|
| 23 |
+
* prepare button here
|
| 24 |
+
* @return void
|
| 25 |
+
* */
|
| 26 |
+
public function __construct() {
|
| 27 |
+
|
| 28 |
+
$this->_controller = 'adminhtml_awb';
|
| 29 |
+
$this->_blockGroup = 'ecomexpress';
|
| 30 |
+
$this->_headerText = Mage::helper('ecomexpress')->__('AWB Manager');
|
| 31 |
+
|
| 32 |
+
$confirmationMessage = Mage::helper('core')->jsQuoteEscape(
|
| 33 |
+
Mage::helper('ecomexpress')->__('Are you sure you want to flush the AWB no?')
|
| 34 |
+
);
|
| 35 |
+
|
| 36 |
+
$this->_addButton('flushAwb', array(
|
| 37 |
+
'name' => 'FLUSH AWB',
|
| 38 |
+
'value' => 'FLUSH AWB',
|
| 39 |
+
'label' => Mage::helper('ecomexpress')->__('Flush AWB'),
|
| 40 |
+
'onclick' => "deleteConfirm('" . $confirmationMessage . "', '" . $this->getUrl('*/*/flushAwb') . "')"
|
| 41 |
+
|
| 42 |
+
));
|
| 43 |
+
|
| 44 |
+
$this->_addButton('COD', array(
|
| 45 |
+
'name' => 'COD',
|
| 46 |
+
'value' => 'COD',
|
| 47 |
+
'label' => Mage::helper('ecomexpress')->__('Import COD AWB'),
|
| 48 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/fetch').'awb/COD'.'\')',
|
| 49 |
+
'class' => 'add',
|
| 50 |
+
|
| 51 |
+
));
|
| 52 |
+
$this->_addButton('PPD', array(
|
| 53 |
+
'name' =>'POD',
|
| 54 |
+
'value' => 'POD',
|
| 55 |
+
'label' => Mage::helper('ecomexpress')->__('Import PPD AWB'),
|
| 56 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/fetch') .'awb/PPD'. '\')',
|
| 57 |
+
'class' => 'add'
|
| 58 |
+
));
|
| 59 |
+
parent::__construct();
|
| 60 |
+
$this->_removeButton('add');
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
app/code/local/Ecom/Express/Block/Adminhtml/Awb/Grid.php
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Block_Adminhtml_Awb_Grid extends Ecom_Express_Block_Adminhtml_Widget_Grid {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
*
|
| 22 |
+
* setting grid parameter
|
| 23 |
+
* @return void
|
| 24 |
+
* */
|
| 25 |
+
public function __construct() {
|
| 26 |
+
parent::__construct();
|
| 27 |
+
$this->setId('awbGrid');
|
| 28 |
+
$this->setDefaultSort('awb_id');
|
| 29 |
+
$this->setDefaultDir('ASC');
|
| 30 |
+
$this->setSaveParametersInSession(true);
|
| 31 |
+
$this->setUseAjax(true);
|
| 32 |
+
}
|
| 33 |
+
/**
|
| 34 |
+
* returning grid url
|
| 35 |
+
*
|
| 36 |
+
* */
|
| 37 |
+
public function getGridUrl()
|
| 38 |
+
{
|
| 39 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
| 40 |
+
}
|
| 41 |
+
/**
|
| 42 |
+
*
|
| 43 |
+
* preparing collection and setting collection to grid
|
| 44 |
+
* @return Ecom_Express_Block_Adminhtml_AWB_Grid
|
| 45 |
+
*/
|
| 46 |
+
protected function _prepareCollection() {
|
| 47 |
+
$collection = Mage::getModel('ecomexpress/awb')->getCollection();
|
| 48 |
+
$this->setCollection($collection);
|
| 49 |
+
$this->setDefaultFilter(array('state'=>1));
|
| 50 |
+
return parent::_prepareCollection();
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
*
|
| 55 |
+
* preparing columns for grid
|
| 56 |
+
* @return Ecom_Express_Block_Adminhtml_AWB_Grid
|
| 57 |
+
*/
|
| 58 |
+
protected function _prepareColumns() {
|
| 59 |
+
|
| 60 |
+
$this->addColumn('awb_id', array(
|
| 61 |
+
'header' => Mage::helper('ecomexpress')->__('Awb ID'),
|
| 62 |
+
'align' => 'center',
|
| 63 |
+
'width' => '30px',
|
| 64 |
+
'index' => 'awb_id',
|
| 65 |
+
));
|
| 66 |
+
|
| 67 |
+
$this->addColumn('awb', array(
|
| 68 |
+
'header' => Mage::helper('ecomexpress')->__('AWB'),
|
| 69 |
+
'index' => 'awb',
|
| 70 |
+
));
|
| 71 |
+
$this->addColumn('shipment_to', array(
|
| 72 |
+
'header' => Mage::helper('ecomexpress')->__('Ship to'),
|
| 73 |
+
'index' => 'shipment_to',
|
| 74 |
+
));
|
| 75 |
+
$this->addColumn('shipment_id', array(
|
| 76 |
+
'header' => Mage::helper('ecomexpress')->__('Shipment#'),
|
| 77 |
+
'index' => 'shipment_id',
|
| 78 |
+
'renderer' => 'Ecom_Express_Block_Adminhtml_Renderer_Shipmentid'
|
| 79 |
+
|
| 80 |
+
));
|
| 81 |
+
$this->addColumn('state', array(
|
| 82 |
+
'header' => Mage::helper('ecomexpress')->__('State'),
|
| 83 |
+
'align' => 'left',
|
| 84 |
+
'width' => '80px',
|
| 85 |
+
'index' => 'state',
|
| 86 |
+
'type' => 'options',
|
| 87 |
+
'options' => array(
|
| 88 |
+
1 => 'Used',
|
| 89 |
+
0 => 'UnUsed',
|
| 90 |
+
),
|
| 91 |
+
));
|
| 92 |
+
$this->addColumn('status', array(
|
| 93 |
+
'header' => Mage::helper('ecomexpress')->__('Status'),
|
| 94 |
+
'align' => 'left',
|
| 95 |
+
'width' => '80px',
|
| 96 |
+
'index' => 'status',
|
| 97 |
+
'type' => 'options',
|
| 98 |
+
'options' => array(
|
| 99 |
+
"Manifested"=>'Manifested',
|
| 100 |
+
"Assigned" => 'Assigned',
|
| 101 |
+
"InTransit" => 'In Transit',
|
| 102 |
+
"Dispatched" => 'Dispatched',
|
| 103 |
+
"Pending" => 'Pending',
|
| 104 |
+
"Cancelled"=>'Cancelled',
|
| 105 |
+
"Delivered" => 'Delivered',
|
| 106 |
+
"Returned" => 'Returned',
|
| 107 |
+
"RTO" => 'RTO',
|
| 108 |
+
"DL" => 'DL',
|
| 109 |
+
"UD" => 'UD',
|
| 110 |
+
"RT" => 'RT',
|
| 111 |
+
"RTO" => 'RTO',
|
| 112 |
+
|
| 113 |
+
),
|
| 114 |
+
));
|
| 115 |
+
$this->addColumn('orderid', array(
|
| 116 |
+
'header' => Mage::helper('ecomexpress')->__('Order#'),
|
| 117 |
+
//'index'=>'orderid',
|
| 118 |
+
'renderer' => 'Ecom_Express_Block_Adminhtml_Renderer_Orderid'
|
| 119 |
+
|
| 120 |
+
));
|
| 121 |
+
$this->addColumn('awb_type', array(
|
| 122 |
+
'header' => Mage::helper('ecomexpress')->__('AWB Type'),
|
| 123 |
+
'index'=>'awb_type',
|
| 124 |
+
|
| 125 |
+
));
|
| 126 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('ecomexpress')->__('CSV'));
|
| 127 |
+
$this->addExportType('*/*/exportXml', Mage::helper('ecomexpress')->__('XML'));
|
| 128 |
+
|
| 129 |
+
return parent::_prepareColumns();
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Pincode.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Block_Adminhtml_Pincode extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 19 |
+
{
|
| 20 |
+
/**
|
| 21 |
+
* prepare button over here
|
| 22 |
+
*
|
| 23 |
+
* */
|
| 24 |
+
public function __construct() {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
$this->_controller = 'adminhtml_pincode';
|
| 28 |
+
$this->_blockGroup = 'ecomexpress';
|
| 29 |
+
$this->_headerText = Mage::helper('ecomexpress')->__('Pincode Manager');
|
| 30 |
+
$this->_addButtonLabel = Mage::helper('ecomexpress')->__('Import Pincode');
|
| 31 |
+
|
| 32 |
+
$this->_addButton('Pincode', array(
|
| 33 |
+
'label' => Mage::helper('ecomexpress')->__('Import Pincode'),
|
| 34 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/fetch') . '\')',
|
| 35 |
+
'class' => 'add'
|
| 36 |
+
));
|
| 37 |
+
parent::__construct();
|
| 38 |
+
$this->_removeButton('add');
|
| 39 |
+
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Pincode/Grid.php
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Ecom_Express_Block_Adminhtml_Pincode_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
*
|
| 23 |
+
* setting grid parameter
|
| 24 |
+
* @return void
|
| 25 |
+
*/
|
| 26 |
+
public function __construct() {
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
parent::__construct();
|
| 30 |
+
$this->setId('pincodeGrid');
|
| 31 |
+
$this->setDefaultSort('pincode_id');
|
| 32 |
+
$this->setDefaultDir('ASC');
|
| 33 |
+
$this->setSaveParametersInSession(true);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
*
|
| 38 |
+
* preparing collection and setting collection to grid
|
| 39 |
+
* @return Ecom_Express_Block_Adminhtml_Pincode_Grid
|
| 40 |
+
*/
|
| 41 |
+
protected function _prepareCollection() {
|
| 42 |
+
|
| 43 |
+
$collection = Mage::getModel('ecomexpress/pincode')->getCollection();
|
| 44 |
+
$this->setCollection($collection);
|
| 45 |
+
return parent::_prepareCollection();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
*
|
| 50 |
+
* preparing column of grid
|
| 51 |
+
* @return Ecom_Express_Block_Adminhtml_Pincode_Grid
|
| 52 |
+
*/
|
| 53 |
+
protected function _prepareColumns() {
|
| 54 |
+
$this->addColumn('pincode_id', array(
|
| 55 |
+
'header' => Mage::helper('ecomexpress')->__('Pincode ID'),
|
| 56 |
+
'align' => 'right',
|
| 57 |
+
'width' => '50px',
|
| 58 |
+
'index' => 'pincode_id',
|
| 59 |
+
));
|
| 60 |
+
|
| 61 |
+
$this->addColumn('pincode', array(
|
| 62 |
+
'header' => Mage::helper('ecomexpress')->__('Pincode'),
|
| 63 |
+
'index' => 'pincode',
|
| 64 |
+
));
|
| 65 |
+
|
| 66 |
+
$this->addColumn('city', array(
|
| 67 |
+
'header' => Mage::helper('ecomexpress')->__('City'),
|
| 68 |
+
'width' => '100px',
|
| 69 |
+
'index' => 'city',
|
| 70 |
+
));
|
| 71 |
+
$this->addColumn('state', array(
|
| 72 |
+
'header' => Mage::helper('ecomexpress')->__('State'),
|
| 73 |
+
'width' => '100px',
|
| 74 |
+
'index' => 'state',
|
| 75 |
+
));
|
| 76 |
+
$this->addColumn('dccode', array(
|
| 77 |
+
'header' => Mage::helper('ecomexpress')->__('DCcode'),
|
| 78 |
+
'width' => '100px',
|
| 79 |
+
'index' => 'dccode',
|
| 80 |
+
));
|
| 81 |
+
|
| 82 |
+
$this->addColumn('created_at', array(
|
| 83 |
+
'header' => Mage::helper('ecomexpress')->__('Created Date & Time'),
|
| 84 |
+
'width' => '100px',
|
| 85 |
+
'index' => 'created_at',
|
| 86 |
+
));
|
| 87 |
+
|
| 88 |
+
$this->addColumn('city_code', array(
|
| 89 |
+
'header' => Mage::helper('ecomexpress')->__('City Code'),
|
| 90 |
+
'width' => '150px',
|
| 91 |
+
'align' => 'left',
|
| 92 |
+
'index' => 'city_code',
|
| 93 |
+
));
|
| 94 |
+
$this->addColumn('state_code', array(
|
| 95 |
+
'header' => Mage::helper('ecomexpress')->__('State Code'),
|
| 96 |
+
'width' => '150px',
|
| 97 |
+
'align' => 'left',
|
| 98 |
+
'index' => 'state_code',
|
| 99 |
+
));
|
| 100 |
+
return parent::_prepareColumns();
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
*
|
| 105 |
+
* preparing mass action for grid
|
| 106 |
+
* @return Ecom_Express_Block_Adminhtml_Pincode_Grid
|
| 107 |
+
*/
|
| 108 |
+
protected function _prepareMassaction() {
|
| 109 |
+
$this->setMassactionIdField('pincode_id');
|
| 110 |
+
$this->getMassactionBlock()->setFormFieldName('pincode');
|
| 111 |
+
return $this;
|
| 112 |
+
}
|
| 113 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Renderer/Orderid.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Block_Adminhtml_Renderer_Orderid extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
*
|
| 22 |
+
* @param Varien_Object $row
|
| 23 |
+
* @see Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract::render()
|
| 24 |
+
* @return integer
|
| 25 |
+
*/
|
| 26 |
+
public function render(Varien_Object $row)
|
| 27 |
+
{
|
| 28 |
+
|
| 29 |
+
if($row->getOrderid() != NULL)
|
| 30 |
+
{
|
| 31 |
+
$order = Mage::getModel('sales/order')->load($row->getOrderid());
|
| 32 |
+
$order_url = Mage::helper("adminhtml")->getUrl("adminhtml/sales_order/view/",['order_id' => $row->getOrderid()]);
|
| 33 |
+
$link = '<a href="'. $order_url .'">'.$order->getData('increment_id').'</a>';
|
| 34 |
+
return $link;
|
| 35 |
+
}
|
| 36 |
+
else
|
| 37 |
+
return "";
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Renderer/Orderstatus.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Ecom_Express_Block_Adminhtml_Renderer_Orderstatus extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
*
|
| 23 |
+
* @param Varien_Object $row
|
| 24 |
+
* @see Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract::render()
|
| 25 |
+
* @return string
|
| 26 |
+
*/
|
| 27 |
+
public function render(Varien_Object $row)
|
| 28 |
+
{
|
| 29 |
+
|
| 30 |
+
if($row->getOrderid() != NULL)
|
| 31 |
+
{
|
| 32 |
+
$order = Mage::getModel('sales/order')->load($row->getOrderid());
|
| 33 |
+
|
| 34 |
+
return $order->getStatus();
|
| 35 |
+
}
|
| 36 |
+
else
|
| 37 |
+
return "";
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Renderer/Shipmentid.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Ecom_Express_Block_Adminhtml_Renderer_Shipmentid extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
*
|
| 23 |
+
* @param Varien_Object $row
|
| 24 |
+
* @see Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract::render()
|
| 25 |
+
* @return integer
|
| 26 |
+
*/
|
| 27 |
+
public function render(Varien_Object $row)
|
| 28 |
+
{
|
| 29 |
+
|
| 30 |
+
if($row->getOrderid() != NULL)
|
| 31 |
+
{
|
| 32 |
+
|
| 33 |
+
$order =Mage::getModel('sales/order')->load($row->getOrderid());
|
| 34 |
+
$shipmentCollection = $order->getShipmentsCollection()->getData();
|
| 35 |
+
|
| 36 |
+
foreach ($shipmentCollection as $ship){
|
| 37 |
+
|
| 38 |
+
$shipment_id = $ship['entity_id'];
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
$shipment_url = Mage::helper("adminhtml")->getUrl("adminhtml/sales_shipment/view/",[ 'shipment_id'=> $shipment_id]);
|
| 42 |
+
|
| 43 |
+
$link = '<a href="'. $shipment_url .'">'.$order->getData('entity_id').'</a>';
|
| 44 |
+
|
| 45 |
+
return $link;
|
| 46 |
+
}
|
| 47 |
+
else
|
| 48 |
+
return "";
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Sales/Order/Shipment/View.php
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
*
|
| 20 |
+
* Sales_Order_Shipment_View grid
|
| 21 |
+
*/
|
| 22 |
+
class Ecom_Express_Block_Adminhtml_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View
|
| 23 |
+
{
|
| 24 |
+
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
$this->_objectId = 'shipment_id';
|
| 28 |
+
$this->_controller = 'sales_order_shipment';
|
| 29 |
+
$this->_mode = 'view';
|
| 30 |
+
|
| 31 |
+
parent::__construct();
|
| 32 |
+
|
| 33 |
+
$this->_removeButton('reset');
|
| 34 |
+
$this->_removeButton('delete');
|
| 35 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/emails')) {
|
| 36 |
+
$this->_updateButton('save', 'label', Mage::helper('sales')->__('Send Tracking Information'));
|
| 37 |
+
$confirmationMessage = Mage::helper('core')->jsQuoteEscape(
|
| 38 |
+
Mage::helper('sales')->__('Are you sure you want to send Shipment email to customer?')
|
| 39 |
+
);
|
| 40 |
+
$this->_updateButton('save',
|
| 41 |
+
'onclick', "deleteConfirm('" . $confirmationMessage . "', '" . $this->getEmailUrl() . "')"
|
| 42 |
+
);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($this->getRequest()->getParam('shipment_id'));
|
| 47 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 48 |
+
->load($shipment->getData('order_id'))
|
| 49 |
+
->getShippingMethod();
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
if ($this->getShipment()->getId()) {
|
| 53 |
+
$this->_addButton('print', array(
|
| 54 |
+
'label' => Mage::helper('sales')->__('Print'),
|
| 55 |
+
'class' => 'save',
|
| 56 |
+
'onclick' => 'setLocation(\''.$this->getPrintUrl().'\')'
|
| 57 |
+
)
|
| 58 |
+
);
|
| 59 |
+
|
| 60 |
+
if(strpos($current_shipping_method, 'ecomexpress') !== false)
|
| 61 |
+
{
|
| 62 |
+
$url =$this->getUrl('*/adminhtml_track/trackingAWB/',array('shipment_ids'=>$this->getShipment()->getId()));
|
| 63 |
+
|
| 64 |
+
$this->_addButton('ecom_shipping_label', array(
|
| 65 |
+
'label' => Mage::helper('sales')->__('Ecom Shipping Label'),
|
| 66 |
+
'class' => 'save',
|
| 67 |
+
'onclick' => 'setLocation(\''.$this->getPrintUrl().'\')'
|
| 68 |
+
)
|
| 69 |
+
);
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
$this->_addButton('track_order', array(
|
| 73 |
+
'label' => Mage::helper('sales')->__('Track Order'),
|
| 74 |
+
'class' => 'save',
|
| 75 |
+
'onclick' =>'javascript:popup(\''.$url.'\')'
|
| 76 |
+
|
| 77 |
+
)
|
| 78 |
+
);
|
| 79 |
+
$this->_addButton('cancel_order', array(
|
| 80 |
+
'label' => Mage::helper('sales')->__('Cancel Order'),
|
| 81 |
+
'class' => 'save',
|
| 82 |
+
'onclick' => 'setLocation(\''. $this->getUrl('*/adminhtml_cancel/cancelAWB/',array('shipment_ids'=>$this->getShipment()->getId())).'\')'
|
| 83 |
+
|
| 84 |
+
)
|
| 85 |
+
);
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Retrieve shipment model instance
|
| 92 |
+
*
|
| 93 |
+
* @return Mage_Sales_Model_Order_Shipment
|
| 94 |
+
*/
|
| 95 |
+
public function getShipment()
|
| 96 |
+
{
|
| 97 |
+
return Mage::registry('current_shipment');
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
public function getHeaderText()
|
| 101 |
+
{
|
| 102 |
+
if ($this->getShipment()->getEmailSent()) {
|
| 103 |
+
$emailSent = Mage::helper('sales')->__('the shipment email was sent');
|
| 104 |
+
}
|
| 105 |
+
else {
|
| 106 |
+
$emailSent = Mage::helper('sales')->__('the shipment email is not sent');
|
| 107 |
+
}
|
| 108 |
+
return Mage::helper('sales')->__('Shipment #%1$s | %3$s (%2$s)', $this->getShipment()->getIncrementId(), $emailSent, $this->formatDate($this->getShipment()->getCreatedAtDate(), 'medium', true));
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
public function getBackUrl()
|
| 112 |
+
{
|
| 113 |
+
return $this->getUrl(
|
| 114 |
+
'*/sales_order/view',
|
| 115 |
+
array(
|
| 116 |
+
'order_id' => $this->getShipment()->getOrderId(),
|
| 117 |
+
'active_tab'=> 'order_shipments'
|
| 118 |
+
));
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
public function getEmailUrl()
|
| 122 |
+
{
|
| 123 |
+
return $this->getUrl('*/sales_order_shipment/email', array('shipment_id' => $this->getShipment()->getId()));
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
public function getPrintUrl()
|
| 128 |
+
{
|
| 129 |
+
return $this->getUrl('*/*/print', array(
|
| 130 |
+
'invoice_id' => $this->getShipment()->getId()
|
| 131 |
+
));
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
public function getPrintshipUrl()
|
| 135 |
+
{
|
| 136 |
+
return $this->getUrl('*/*/print', array(
|
| 137 |
+
'invoice_id' => $this->getShipment()->getId()
|
| 138 |
+
));
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
public function updateBackButtonUrl($flag)
|
| 142 |
+
{
|
| 143 |
+
if ($flag) {
|
| 144 |
+
if ($this->getShipment()->getBackUrl()) {
|
| 145 |
+
return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getShipment()->getBackUrl()
|
| 146 |
+
. '\')');
|
| 147 |
+
}
|
| 148 |
+
return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/sales_shipment/') . '\')');
|
| 149 |
+
}
|
| 150 |
+
return $this;
|
| 151 |
+
}
|
| 152 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Sales/Shipment/Grid.php
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Block_Adminhtml_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 19 |
+
{
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Initialization
|
| 24 |
+
*/
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
|
| 28 |
+
parent::__construct();
|
| 29 |
+
$this->setId('sales_shipment_grid');
|
| 30 |
+
$this->setDefaultSort('created_at');
|
| 31 |
+
$this->setDefaultDir('DESC');
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Retrieve collection class
|
| 36 |
+
*
|
| 37 |
+
* @return string
|
| 38 |
+
*/
|
| 39 |
+
protected function _getCollectionClass()
|
| 40 |
+
{
|
| 41 |
+
return 'sales/order_shipment_grid_collection';
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Prepare and set collection of grid
|
| 46 |
+
*
|
| 47 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
| 48 |
+
*/
|
| 49 |
+
protected function _prepareCollection()
|
| 50 |
+
{
|
| 51 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
| 52 |
+
$this->setCollection($collection);
|
| 53 |
+
return parent::_prepareCollection();
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Prepare and add columns to grid
|
| 58 |
+
*
|
| 59 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
| 60 |
+
*/
|
| 61 |
+
protected function _prepareColumns()
|
| 62 |
+
{
|
| 63 |
+
$this->addColumn('increment_id', array(
|
| 64 |
+
'header' => Mage::helper('sales')->__('Shipment #'),
|
| 65 |
+
'index' => 'increment_id',
|
| 66 |
+
'type' => 'text',
|
| 67 |
+
));
|
| 68 |
+
|
| 69 |
+
$this->addColumn('created_at', array(
|
| 70 |
+
'header' => Mage::helper('sales')->__('Date Shipped'),
|
| 71 |
+
'index' => 'created_at',
|
| 72 |
+
'type' => 'datetime',
|
| 73 |
+
));
|
| 74 |
+
|
| 75 |
+
$this->addColumn('order_increment_id', array(
|
| 76 |
+
'header' => Mage::helper('sales')->__('Order #'),
|
| 77 |
+
'index' => 'order_increment_id',
|
| 78 |
+
'type' => 'text',
|
| 79 |
+
));
|
| 80 |
+
|
| 81 |
+
$this->addColumn('order_created_at', array(
|
| 82 |
+
'header' => Mage::helper('sales')->__('Order Date'),
|
| 83 |
+
'index' => 'order_created_at',
|
| 84 |
+
'type' => 'datetime',
|
| 85 |
+
));
|
| 86 |
+
|
| 87 |
+
$this->addColumn('shipping_name', array(
|
| 88 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
| 89 |
+
'index' => 'shipping_name',
|
| 90 |
+
));
|
| 91 |
+
|
| 92 |
+
$this->addColumn('total_qty', array(
|
| 93 |
+
'header' => Mage::helper('sales')->__('Total Qty'),
|
| 94 |
+
'index' => 'total_qty',
|
| 95 |
+
'type' => 'number',
|
| 96 |
+
));
|
| 97 |
+
|
| 98 |
+
$this->addColumn('action',
|
| 99 |
+
array(
|
| 100 |
+
'header' => Mage::helper('sales')->__('Action'),
|
| 101 |
+
'width' => '50px',
|
| 102 |
+
'type' => 'action',
|
| 103 |
+
'getter' => 'getId',
|
| 104 |
+
'actions' => array(
|
| 105 |
+
array(
|
| 106 |
+
'caption' => Mage::helper('sales')->__('View'),
|
| 107 |
+
'url' => array('base'=>'*/sales_shipment/view'),
|
| 108 |
+
'field' => 'shipment_id'
|
| 109 |
+
)
|
| 110 |
+
),
|
| 111 |
+
'filter' => false,
|
| 112 |
+
'sortable' => false,
|
| 113 |
+
'is_system' => true
|
| 114 |
+
));
|
| 115 |
+
|
| 116 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
| 117 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
| 118 |
+
|
| 119 |
+
return parent::_prepareColumns();
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* Get url for row
|
| 124 |
+
*
|
| 125 |
+
* @param string $row
|
| 126 |
+
* @return string
|
| 127 |
+
*/
|
| 128 |
+
public function getRowUrl($row)
|
| 129 |
+
{
|
| 130 |
+
if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
|
| 131 |
+
return false;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
return $this->getUrl('*/sales_shipment/view',
|
| 135 |
+
array(
|
| 136 |
+
'shipment_id'=> $row->getId(),
|
| 137 |
+
)
|
| 138 |
+
);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* Prepare and set options for massaction
|
| 143 |
+
*
|
| 144 |
+
* @return Mage_Adminhtml_Block_Sales_Shipment_Grid
|
| 145 |
+
*/
|
| 146 |
+
protected function _prepareMassaction()
|
| 147 |
+
{
|
| 148 |
+
$order= Mage::getModel('sales/order')->getCollection()->getData();
|
| 149 |
+
foreach($order as $key=>$val){
|
| 150 |
+
$shipping_method =$val['shipping_method'];
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
$this->setMassactionIdField('entity_id');
|
| 154 |
+
$this->getMassactionBlock()->setFormFieldName('shipment_ids');
|
| 155 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
| 156 |
+
|
| 157 |
+
if(strpos($shipping_method, 'ecomexpress') !== false)
|
| 158 |
+
{
|
| 159 |
+
|
| 160 |
+
$this->getMassactionBlock()->addItem('track_order', array(
|
| 161 |
+
'label'=> Mage::helper('sales')->__('Track Order'),
|
| 162 |
+
'url' => $this->getUrl('*/adminhtml_track/trackingAWB/'),
|
| 163 |
+
|
| 164 |
+
));
|
| 165 |
+
$this->getMassactionBlock()->addItem('cancel_order', array(
|
| 166 |
+
'label'=> Mage::helper('sales')->__('Cancel Order'),
|
| 167 |
+
'url' => $this->getUrl('*/adminhtml_cancel/cancelAWB'),
|
| 168 |
+
));
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
| 172 |
+
'label'=> Mage::helper('sales')->__('PDF Packingslips'),
|
| 173 |
+
'url' => $this->getUrl('*/sales_shipment/pdfshipments'),
|
| 174 |
+
));
|
| 175 |
+
|
| 176 |
+
$this->getMassactionBlock()->addItem('print_shipping_label', array(
|
| 177 |
+
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
|
| 178 |
+
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
|
| 179 |
+
));
|
| 180 |
+
|
| 181 |
+
return $this;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/**
|
| 185 |
+
* Get url of grid
|
| 186 |
+
*
|
| 187 |
+
* @return string
|
| 188 |
+
*/
|
| 189 |
+
public function getGridUrl()
|
| 190 |
+
{
|
| 191 |
+
return $this->getUrl('*/*/*', array('_current' => true));
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Widget/Grid.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Block_Adminhtml_Widget_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
*
|
| 22 |
+
* @see Mage_Adminhtml_Block_Widget_Grid::addColumn()
|
| 23 |
+
*/
|
| 24 |
+
public function addColumn($columnId, $column) {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
if (is_array($column)) {
|
| 28 |
+
$this->_columns[$columnId] = $this->getLayout()->createBlock('ecomexpress/adminhtml_widget_grid_column')
|
| 29 |
+
->setData($column)
|
| 30 |
+
->setGrid($this);
|
| 31 |
+
}
|
| 32 |
+
else {
|
| 33 |
+
throw new Exception(Mage::helper('adminhtml')->__('Wrong column format'));
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
$this->_columns[$columnId]->setId($columnId);
|
| 37 |
+
$this->_lastColumnId = $columnId;
|
| 38 |
+
return $this;
|
| 39 |
+
}
|
| 40 |
+
}
|
app/code/local/Ecom/Express/Block/Adminhtml/Widget/Grid/Column.php
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Block_Adminhtml_Widget_Grid_Column extends Mage_Adminhtml_Block_Widget_Grid_Column {
|
| 19 |
+
/**
|
| 20 |
+
*
|
| 21 |
+
*
|
| 22 |
+
* @see Mage_Adminhtml_Block_Widget_Grid_Column::_getRendererByType()
|
| 23 |
+
*/
|
| 24 |
+
protected function _getRendererByType() {
|
| 25 |
+
switch (strtolower($this->getType())) {
|
| 26 |
+
case 'awb':
|
| 27 |
+
$rendererClass = 'ecomexpress/adminhtml_widget_grid_column_renderer_awb';
|
| 28 |
+
break;
|
| 29 |
+
default:
|
| 30 |
+
$rendererClass = parent::_getRendererByType();
|
| 31 |
+
break;
|
| 32 |
+
}
|
| 33 |
+
return $rendererClass;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
*
|
| 38 |
+
*
|
| 39 |
+
* @see Mage_Adminhtml_Block_Widget_Grid_Column::_getFilterByType()
|
| 40 |
+
*/
|
| 41 |
+
protected function _getFilterByType() {
|
| 42 |
+
switch (strtolower($this->getType())) {
|
| 43 |
+
case 'awb':
|
| 44 |
+
$filterClass = 'ecomexpress/adminhtml_widget_grid_column_filter_awb';
|
| 45 |
+
break;
|
| 46 |
+
default:
|
| 47 |
+
$filterClass = parent::_getFilterByType();
|
| 48 |
+
break;
|
| 49 |
+
}
|
| 50 |
+
return $filterClass;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
}
|
app/code/local/Ecom/Express/Helper/Data.php
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class Ecom_Express_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 22 |
+
|
| 23 |
+
/*
|
| 24 |
+
* Function to execute curl
|
| 25 |
+
* @return API response
|
| 26 |
+
*/
|
| 27 |
+
|
| 28 |
+
public function executeCurl($url,$type,$params)
|
| 29 |
+
{
|
| 30 |
+
try {
|
| 31 |
+
|
| 32 |
+
$ch = curl_init();
|
| 33 |
+
curl_setopt($ch,CURLOPT_URL,$url);
|
| 34 |
+
curl_setopt($ch,CURLOPT_FAILONERROR,1);
|
| 35 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
| 36 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
| 37 |
+
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);
|
| 38 |
+
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
|
| 39 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
|
| 40 |
+
|
| 41 |
+
if($type == 'post'):
|
| 42 |
+
|
| 43 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
| 44 |
+
curl_setopt($ch, CURLOPT_POST, TRUE);
|
| 45 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($params));
|
| 46 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
|
| 47 |
+
|
| 48 |
+
endif;
|
| 49 |
+
|
| 50 |
+
$retValue = curl_exec($ch);
|
| 51 |
+
$info_code = curl_getinfo($ch);
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if (!curl_errno($ch))
|
| 55 |
+
{
|
| 56 |
+
switch ($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) {
|
| 57 |
+
case 200:
|
| 58 |
+
if(!strcmp($retValue,"Unauthorised Request"))
|
| 59 |
+
{
|
| 60 |
+
|
| 61 |
+
$myMsg ="Unauthorised username and Password";
|
| 62 |
+
Mage::getSingleton('core/session')->setMyMsg($myMsg);
|
| 63 |
+
}
|
| 64 |
+
if(!strcmp($retValue,"You are not authorised!"))
|
| 65 |
+
{
|
| 66 |
+
$myMsg ="Unauthorised Username and Password";
|
| 67 |
+
Mage::getSingleton('core/session')->setMyMsg($myMsg);
|
| 68 |
+
}
|
| 69 |
+
if(!$retValue)
|
| 70 |
+
{
|
| 71 |
+
return false;
|
| 72 |
+
}
|
| 73 |
+
curl_close($ch);
|
| 74 |
+
return $retValue;
|
| 75 |
+
break;
|
| 76 |
+
default:
|
| 77 |
+
if($errno = curl_errno($ch)) {
|
| 78 |
+
$error_message = curl_strerror($errno);
|
| 79 |
+
break;
|
| 80 |
+
}
|
| 81 |
+
$infoMsg="Ecom service is currently Unavilable , please try after Sometime";
|
| 82 |
+
Mage::getSingleton(‘core/session’)->setInfoMsg($myMsg);
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
}
|
| 87 |
+
catch(Exception $e)
|
| 88 |
+
{
|
| 89 |
+
return $e->getMessage();
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
}
|
app/code/local/Ecom/Express/Model/Automaticawb.php
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Automaticawb extends Mage_Core_Model_Abstract {
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Function to fetch more waybills dynamically
|
| 23 |
+
*/
|
| 24 |
+
public function authenticateAwb($order,$pay_type, $awbno)
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
$params = array();
|
| 28 |
+
$type = 'post';
|
| 29 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 30 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 31 |
+
$params['json_input']['AWB_NUMBER']=$awbno;
|
| 32 |
+
$params['json_input']['ORDER_NUMBER']= $order['increment_id'];
|
| 33 |
+
$params['json_input']['PRODUCT'] = $pay_type;
|
| 34 |
+
|
| 35 |
+
$address = Mage::getModel('sales/order_address')->load($order['shipping_address_id']);
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if(isset($address['middlename'])){
|
| 39 |
+
$params['json_input']['CONSIGNEE'] = $address['firstname']." ".$address['middlename']." ".$address['lastname'];
|
| 40 |
+
}
|
| 41 |
+
else{
|
| 42 |
+
$params['json_input']['CONSIGNEE'] = $address['firstname']." ".$address['lastname'];
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
$params['json_input']['CONSIGNEE_ADDRESS1']=$address['street'];
|
| 46 |
+
$params['json_input']['CONSIGNEE_ADDRESS2']=$address['postcode'];
|
| 47 |
+
$params['json_input']['CONSIGNEE_ADDRESS3']=$address['city'];
|
| 48 |
+
$params['json_input']['DESTINATION_CITY']=$address['city'];
|
| 49 |
+
$params['json_input']['PINCODE']=$address['postcode'];
|
| 50 |
+
$params['json_input']['STATE'] = $address['region'];
|
| 51 |
+
$params['json_input']['MOBILE']=$address['telephone'];
|
| 52 |
+
$params['json_input']['TELEPHONE']=$address['telephone'];
|
| 53 |
+
|
| 54 |
+
$item = $order->getAllItems();
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
$description = array();
|
| 58 |
+
foreach($item as $item_description)
|
| 59 |
+
{
|
| 60 |
+
$params['json_input']['ITEM_DESCRIPTION'] = $item_description->getName();
|
| 61 |
+
$item_description['weight']= $item_description['weight'];
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
$params['json_input']['ACTUAL_WEIGHT'] = $item_description['weight'];
|
| 65 |
+
$params['json_input']['PIECES'] = $order['total_item_count'];
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
if($pay_type=='COD')
|
| 69 |
+
$params['json_input']['COLLECTABLE_VALUE'] = $order['grand_total'];
|
| 70 |
+
else
|
| 71 |
+
$params['json_input']['COLLECTABLE_VALUE'] = 0;
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
$params['json_input']['DECLARED_VALUE'] = $order['grand_total'];
|
| 75 |
+
$params['json_input']['VOLUMETRIC_WEIGHT']=0;
|
| 76 |
+
|
| 77 |
+
$package_collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')
|
| 78 |
+
->addAttributeToFilter('ecom_length', array('notnull' => true))
|
| 79 |
+
->addAttributeToFilter('ecom_height',array('notnull' => true))
|
| 80 |
+
->addAttributeToFilter('ecom_width',array('notnull' => true))
|
| 81 |
+
->addAttributeToFilter('sku', array('in' => $item_description->getData('sku')));
|
| 82 |
+
|
| 83 |
+
foreach($package_collection as $packge_dimension){
|
| 84 |
+
$params['json_input']['LENGTH'] = $packge_dimension->getData('ecom_length');
|
| 85 |
+
$params['json_input']['BREADTH'] = $packge_dimension->getData('ecom_width');
|
| 86 |
+
$params['json_input']['HEIGHT'] = $packge_dimension->getData('ecom_height');
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
$params['json_input']['PICKUP_NAME'] = Mage::getStoreConfig('general/store_information/name');
|
| 90 |
+
$params['json_input']['PICKUP_ADDRESS_LINE1'] = Mage::getStoreConfig('shipping/origin/street_line1');
|
| 91 |
+
$params['json_input']['PICKUP_ADDRESS_LINE2'] = Mage::getStoreConfig('shipping/origin/street_line2');
|
| 92 |
+
$params['json_input']['PICKUP_PINCODE'] = Mage::getStoreConfig('shipping/origin/postcode');
|
| 93 |
+
$params['json_input']['PICKUP_PHONE'] = Mage::getStoreConfig('general/store_information/phone');
|
| 94 |
+
$params['json_input']['PICKUP_MOBILE'] = Mage::getStoreConfig('general/store_information/phone');
|
| 95 |
+
$params['json_input']['RETURN_PINCODE'] = Mage::getStoreConfig('shipping/origin/postcode');
|
| 96 |
+
$params['json_input']['RETURN_NAME'] = Mage::getStoreConfig('general/store_information/name');
|
| 97 |
+
$params['json_input']['RETURN_ADDRESS_LINE1'] = Mage::getStoreConfig('shipping/origin/street_line1');
|
| 98 |
+
$params['json_input']['RETURN_ADDRESS_LINE2'] = Mage::getStoreConfig('shipping/origin/street_line2');
|
| 99 |
+
$params['json_input']['RETURN_PHONE'] = Mage::getStoreConfig('general/store_information/phone');
|
| 100 |
+
$params['json_input']['RETURN_MOBILE'] = Mage::getStoreConfig('general/store_information/phone');
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1)
|
| 104 |
+
$url = 'http://ecomm.prtouch.com/apiv2/manifest_awb/';
|
| 105 |
+
else
|
| 106 |
+
$url = 'http://api.ecomexpress.in/apiv2/manifest_awb/';
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
if($params)
|
| 110 |
+
{
|
| 111 |
+
$params['json_input'] = json_encode($params['json_input'],true);
|
| 112 |
+
$params['json_input'] = "[ ".$params['json_input']."]";
|
| 113 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 114 |
+
$getSessionInfo = Mage::getSingleton('core/session')->getInfoMsg();
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
if(isset($getSessionInfo)){
|
| 118 |
+
|
| 119 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionInfo));
|
| 120 |
+
Mage::getSingleton('core/session')->unsInfoMsg();
|
| 121 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 122 |
+
return ;
|
| 123 |
+
}
|
| 124 |
+
$getSessionMsg = Mage::getSingleton('core/session')->getMyMsg();
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if(isset($getSessionMsg)){
|
| 128 |
+
|
| 129 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionMsg));
|
| 130 |
+
Mage::getSingleton('core/session')->unsMyMsg();
|
| 131 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 132 |
+
return;
|
| 133 |
+
|
| 134 |
+
}
|
| 135 |
+
$awb_codes = Mage::helper('core')->jsonDecode($retValue);
|
| 136 |
+
|
| 137 |
+
if(empty($awb_codes))
|
| 138 |
+
{
|
| 139 |
+
|
| 140 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('Please add valid Username,Password and Count in plugin configuration'));
|
| 141 |
+
}
|
| 142 |
+
return $awb_codes;
|
| 143 |
+
}
|
| 144 |
+
else
|
| 145 |
+
{
|
| 146 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('Please add valid Username and Password in plugin configuration'));
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
}
|
app/code/local/Ecom/Express/Model/Awb.php
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Awb extends Mage_Core_Model_Abstract {
|
| 19 |
+
|
| 20 |
+
public function _construct() {
|
| 21 |
+
parent::_construct();
|
| 22 |
+
$this->_init('ecomexpress/awb');
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Function to get waybill details if waybill number is supplied
|
| 27 |
+
*/
|
| 28 |
+
public function loadByAwb($awb)
|
| 29 |
+
{
|
| 30 |
+
$resource = Mage::getSingleton('core/resource');
|
| 31 |
+
$readConnection = $resource->getConnection('core_read');
|
| 32 |
+
$query = "SELECT * FROM " . $resource->getTableName('ecomexpress/awb')." WHERE awb = $awb";
|
| 33 |
+
mage::log("$query");
|
| 34 |
+
$data = $readConnection->fetchOne($query);
|
| 35 |
+
return $data;
|
| 36 |
+
}
|
| 37 |
+
}
|
app/code/local/Ecom/Express/Model/Carrier/Ecomexpress.php
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Carrier_Ecomexpress extends Mage_Shipping_Model_Carrier_Abstract
|
| 19 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
| 20 |
+
{
|
| 21 |
+
|
| 22 |
+
protected $_code = 'ecomexpress';
|
| 23 |
+
protected $price = 0;
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Bluedart Shipping Rates Collector
|
| 27 |
+
*
|
| 28 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
| 29 |
+
* @return Mage_Shipping_Model_Rate_Result
|
| 30 |
+
*/
|
| 31 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 32 |
+
{
|
| 33 |
+
$price = 0;
|
| 34 |
+
if (!Mage::getStoreConfig('carriers/ecomexpress/active')) {
|
| 35 |
+
|
| 36 |
+
return false;
|
| 37 |
+
}
|
| 38 |
+
$result = Mage::getModel('shipping/rate_result');
|
| 39 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 40 |
+
$shippingAddress = $quote->getShippingAddress();
|
| 41 |
+
$to_country = $shippingAddress->getCountryId();
|
| 42 |
+
$to_city = $shippingAddress->getCity();
|
| 43 |
+
$to_zipcode = $shippingAddress->getPostcode();
|
| 44 |
+
$allowed_country = array();
|
| 45 |
+
$allowed_country = explode(',',Mage::getStoreConfig('carriers/ecomexpress/specificcountry'));
|
| 46 |
+
if($to_zipcode)
|
| 47 |
+
$model = Mage ::getModel('ecomexpress/pincode')->loadByPincode($to_zipcode);
|
| 48 |
+
|
| 49 |
+
if(isset($model) && in_array($to_country,$allowed_country)== true)
|
| 50 |
+
{
|
| 51 |
+
|
| 52 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/handling') == true){
|
| 53 |
+
$price = Mage::getStoreConfig("carriers/ecomexpress/handling_charge");
|
| 54 |
+
}
|
| 55 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
| 56 |
+
$method->setCarrier($this->_code);
|
| 57 |
+
$method->setCarrierTitle($this->_code);
|
| 58 |
+
$method->setMethod($this->_code);
|
| 59 |
+
$method->setMethodTitle(Mage::getStoreConfig('carriers/ecomexpress/name'));
|
| 60 |
+
$method->setPrice($price);
|
| 61 |
+
$method->setCost($price);
|
| 62 |
+
$result->append($method);
|
| 63 |
+
}
|
| 64 |
+
else{
|
| 65 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
| 66 |
+
$error->setCarrier($this->_code);
|
| 67 |
+
$error->setCarrierTitle($this->_code);
|
| 68 |
+
$error->setErrorMessage(Mage::getStoreConfig('carriers/ecomexpress/specificerrmsg'));
|
| 69 |
+
$result->append($error);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
return $result;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Get Allowed Methods
|
| 77 |
+
*
|
| 78 |
+
* @return array
|
| 79 |
+
*/
|
| 80 |
+
public function getAllowedMethods()
|
| 81 |
+
{
|
| 82 |
+
return array('ecomexpress'=>$this->getConfigData('title'));
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* show Allowed Methods
|
| 87 |
+
*/
|
| 88 |
+
public function isTrackingAvailable(){
|
| 89 |
+
|
| 90 |
+
return true;
|
| 91 |
+
}
|
| 92 |
+
}
|
app/code/local/Ecom/Express/Model/Mysql4/Awb.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Mysql4_Awb extends Mage_Core_Model_Mysql4_Abstract
|
| 19 |
+
{
|
| 20 |
+
/**
|
| 21 |
+
* construct mysql resource model for waybills table and set primary key
|
| 22 |
+
*/
|
| 23 |
+
public function _construct()
|
| 24 |
+
{
|
| 25 |
+
$this->_init('ecomexpress/awb', 'awb_id');
|
| 26 |
+
}
|
| 27 |
+
}
|
app/code/local/Ecom/Express/Model/Mysql4/Awb/Collection.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Ecom_Express_Model_Mysql4_Awb_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* construct mysql collection object for pincode
|
| 23 |
+
*/
|
| 24 |
+
public function _construct() {
|
| 25 |
+
|
| 26 |
+
parent::_construct();
|
| 27 |
+
$this->_init('ecomexpress/awb');
|
| 28 |
+
|
| 29 |
+
}
|
| 30 |
+
}
|
app/code/local/Ecom/Express/Model/Mysql4/Pincode.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Mysql4_Pincode extends Mage_Core_Model_Mysql4_Abstract {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* construct mysql resource model for pincode table and set primary key
|
| 22 |
+
*/
|
| 23 |
+
public function _construct() {
|
| 24 |
+
$this->_init('ecomexpress/pincode', 'pincode_id');
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
}
|
app/code/local/Ecom/Express/Model/Mysql4/Pincode/Collection.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Mysql4_Pincode_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* construct mysql collection object for pincode
|
| 22 |
+
*/
|
| 23 |
+
public function _construct() {
|
| 24 |
+
|
| 25 |
+
parent::_construct();
|
| 26 |
+
$this->_init('ecomexpress/pincode');
|
| 27 |
+
|
| 28 |
+
}
|
| 29 |
+
}
|
app/code/local/Ecom/Express/Model/Observer.php
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Observer
|
| 19 |
+
{
|
| 20 |
+
/**
|
| 21 |
+
* Function to add waybill if shipping method is of Ecomexpress
|
| 22 |
+
*/
|
| 23 |
+
public function salesOrderShipmentSaveBefore($observer)
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
if(empty(Mage::app()->getRequest()->getParam("manual"))){
|
| 28 |
+
|
| 29 |
+
$invoice = $observer->getEvent()->getInvoice();
|
| 30 |
+
$shipment = $observer->getEvent()->getShipment();
|
| 31 |
+
$order = $shipment->getOrder();
|
| 32 |
+
$shipping_method= $order->getShippingMethod();
|
| 33 |
+
|
| 34 |
+
if(strpos($shipping_method, 'ecomexpress') !== false)
|
| 35 |
+
{
|
| 36 |
+
$order = Mage::getModel('sales/order')->load($order->getEntityId());
|
| 37 |
+
$payment = $order->getPayment()->getMethodInstance()->getCode();
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
if($payment == 'cashondelivery'){
|
| 41 |
+
$pay_type = 'COD';
|
| 42 |
+
$model = Mage::getModel('ecomexpress/awb')->getCollection()
|
| 43 |
+
->addFieldToFilter('state',0)
|
| 44 |
+
->addFieldToFilter('awb_type','COD')->getData();
|
| 45 |
+
}
|
| 46 |
+
else{
|
| 47 |
+
|
| 48 |
+
$pay_type = 'PPD';
|
| 49 |
+
$model = Mage::getModel('ecomexpress/awb')->getCollection()
|
| 50 |
+
->addFieldToFilter('state',0)
|
| 51 |
+
->addFieldToFilter('awb_type','PPD')->getData();
|
| 52 |
+
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
if(count($model)>0){
|
| 56 |
+
|
| 57 |
+
foreach($model as $models)
|
| 58 |
+
{
|
| 59 |
+
$awbno = $models['awb'];
|
| 60 |
+
break;
|
| 61 |
+
}
|
| 62 |
+
$response = Mage::getModel('ecomexpress/automaticawb')->authenticateAwb($order,$pay_type,$awbno);
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
foreach($response as $res) {
|
| 67 |
+
foreach ($res as $value){
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
if(isset($value['success']) && $value['success']==1){
|
| 71 |
+
|
| 72 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
| 73 |
+
->setNumber($awbno)
|
| 74 |
+
->setCarrierCode('ecomexpress')
|
| 75 |
+
->setTitle('ecomexpress');
|
| 76 |
+
$shipment->addTrack($track);
|
| 77 |
+
}
|
| 78 |
+
else {
|
| 79 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
| 80 |
+
->setNumber($value['awb'])
|
| 81 |
+
->setCarrierCode('ecomexpress')
|
| 82 |
+
->setTitle('ecomexpress');
|
| 83 |
+
$shipment->addTrack($track);
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
else {
|
| 87 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('AWB number is not available'));
|
| 88 |
+
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Function to update waybill if order tracking is of Ecomexpress
|
| 99 |
+
*/
|
| 100 |
+
public function salesOrderShipmentTrackSaveAfter($observer)
|
| 101 |
+
{
|
| 102 |
+
if(empty(Mage::app()->getRequest()->getParam("manual"))){
|
| 103 |
+
|
| 104 |
+
$track = $observer->getEvent()->getTrack();
|
| 105 |
+
$order = $track->getShipment()->getOrder();
|
| 106 |
+
$shippingMethod = $order->getShippingMethod();
|
| 107 |
+
|
| 108 |
+
if(!$shippingMethod)
|
| 109 |
+
{
|
| 110 |
+
return;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
if($track->getCarrierCode() !='ecomexpress')
|
| 114 |
+
{
|
| 115 |
+
return ;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
$model = Mage::getModel('ecomexpress/awb');
|
| 119 |
+
$awbobj = $model->loadByAwb($track->getNumber());
|
| 120 |
+
$awb_data=array();
|
| 121 |
+
$awb_data['status']='Assigned';
|
| 122 |
+
$awb_data['state'] = 1;
|
| 123 |
+
$awb_data['orderid'] = $order->getId();
|
| 124 |
+
$awb_data['shipment_to'] = $order->getShippingAddress()->getName();
|
| 125 |
+
$awb_data['shipment_id'] = $track->getShipment()->getEntityId();
|
| 126 |
+
$awb_data['updated_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 127 |
+
$model->setData($awb_data);
|
| 128 |
+
$model->setId($awbobj);
|
| 129 |
+
$model->save();
|
| 130 |
+
return;
|
| 131 |
+
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
else{
|
| 135 |
+
|
| 136 |
+
$track = $observer->getEvent()->getTrack();
|
| 137 |
+
$order = $track->getShipment()->getOrder();
|
| 138 |
+
$shippingMethod = $order->getShippingMethod();
|
| 139 |
+
|
| 140 |
+
if(!$shippingMethod)
|
| 141 |
+
{
|
| 142 |
+
return;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
if($track->getCarrierCode() !='ecomexpress')
|
| 146 |
+
{
|
| 147 |
+
return ;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
$model = Mage::getModel('ecomexpress/awb');
|
| 151 |
+
$awbobj = $model->loadByAwb($track->getNumber());
|
| 152 |
+
$awb_data=array();
|
| 153 |
+
$awb_data['status']='Assigned';
|
| 154 |
+
$awb_data['state'] = 1;
|
| 155 |
+
$awb_data['orderid'] = $order->getId();
|
| 156 |
+
$awb_data['shipment_to'] = $order->getShippingAddress()->getName();
|
| 157 |
+
$awb_data['shipment_id'] = $track->getShipment()->getEntityId();
|
| 158 |
+
$awb_data['updated_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 159 |
+
$model->setData($awb_data);
|
| 160 |
+
$model->setId($awbobj);
|
| 161 |
+
$model->save();
|
| 162 |
+
return;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
/**
|
| 169 |
+
* Execute function for fetchAWB of COD and PPD type through CRON
|
| 170 |
+
*/
|
| 171 |
+
|
| 172 |
+
public function fetchAwb()
|
| 173 |
+
{
|
| 174 |
+
|
| 175 |
+
$params = array();
|
| 176 |
+
$params['type'] = 'COD';
|
| 177 |
+
$count = count(Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('awb_type',$params['type'])->addFieldToFilter('state',0)->getData());
|
| 178 |
+
$fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/fetch_awb');
|
| 179 |
+
$max_fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/max_fetch_awb');
|
| 180 |
+
$min_fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/min_fetch_awb');
|
| 181 |
+
|
| 182 |
+
if($count < $min_fetch_awb){
|
| 183 |
+
return false;
|
| 184 |
+
}
|
| 185 |
+
else {
|
| 186 |
+
if($fetch_awb <= $max_fetch_awb) {
|
| 187 |
+
|
| 188 |
+
$type = 'post';
|
| 189 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 190 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 191 |
+
$params['count'] = $fetch_awb;
|
| 192 |
+
|
| 193 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1){
|
| 194 |
+
$url = 'http://ecomm.prtouch.com/apiv2/fetch_awb/';
|
| 195 |
+
}
|
| 196 |
+
else {
|
| 197 |
+
$url = 'http://api.ecomexpress.in/apiv2/fetch_awb/';
|
| 198 |
+
}
|
| 199 |
+
if($params)
|
| 200 |
+
{
|
| 201 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 202 |
+
$awb_codes = Mage::helper('core')->jsonDecode($retValue);
|
| 203 |
+
if(empty($awb_codes))
|
| 204 |
+
{
|
| 205 |
+
return false;
|
| 206 |
+
}
|
| 207 |
+
foreach ($awb_codes['awb'] as $key => $item)
|
| 208 |
+
{
|
| 209 |
+
try{
|
| 210 |
+
$model = Mage::getModel('ecomexpress/awb');
|
| 211 |
+
$data = array();
|
| 212 |
+
$data['awb'] = $item;
|
| 213 |
+
$data['state'] = 0;
|
| 214 |
+
$data['awb_type'] = $params['type'];
|
| 215 |
+
$data['created_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 216 |
+
$data['updated_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 217 |
+
$model->setData($data);
|
| 218 |
+
$model->save();
|
| 219 |
+
}
|
| 220 |
+
catch (Exception $e)
|
| 221 |
+
{
|
| 222 |
+
echo 'Caught exception: ', $e->getMessage(), "\n";
|
| 223 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
else
|
| 228 |
+
{
|
| 229 |
+
return false;
|
| 230 |
+
}
|
| 231 |
+
return;
|
| 232 |
+
}
|
| 233 |
+
else {
|
| 234 |
+
return false;
|
| 235 |
+
}
|
| 236 |
+
return;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
$params['type'] = 'PPD';
|
| 240 |
+
$count = count(Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('awb_type',$params['type'])->addFieldToFilter('state',0)->getData());
|
| 241 |
+
$fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/fetch_awb');
|
| 242 |
+
$max_fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/max_fetch_awb');
|
| 243 |
+
$min_fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/min_fetch_awb');
|
| 244 |
+
|
| 245 |
+
if($count < $min_fetch_awb){
|
| 246 |
+
return false;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
else {
|
| 250 |
+
if($fetch_awb <= $max_fetch_awb) {
|
| 251 |
+
$type = 'post';
|
| 252 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 253 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 254 |
+
$params['count'] = $fetch_awb;
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1){
|
| 258 |
+
$url = 'http://ecomm.prtouch.com/apiv2/fetch_awb/';
|
| 259 |
+
}
|
| 260 |
+
else {
|
| 261 |
+
$url = 'http://api.ecomexpress.in/apiv2/fetch_awb/';
|
| 262 |
+
}
|
| 263 |
+
if($params)
|
| 264 |
+
{
|
| 265 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 266 |
+
$awb_codes = Mage::helper('core')->jsonDecode($retValue);
|
| 267 |
+
if(empty($awb_codes))
|
| 268 |
+
{
|
| 269 |
+
return false;
|
| 270 |
+
}
|
| 271 |
+
foreach ($awb_codes['awb'] as $key => $item)
|
| 272 |
+
{
|
| 273 |
+
try{
|
| 274 |
+
$model = Mage::getModel('ecomexpress/awb');
|
| 275 |
+
$data = array();
|
| 276 |
+
$data['awb'] = $item;
|
| 277 |
+
$data['state'] = 0;
|
| 278 |
+
$data['awb_type'] = $params['type'];
|
| 279 |
+
$data['created_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 280 |
+
$data['updated_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 281 |
+
$model->setData($data);
|
| 282 |
+
$model->save();
|
| 283 |
+
}
|
| 284 |
+
catch (Exception $e)
|
| 285 |
+
{
|
| 286 |
+
echo 'Caught exception: ', $e->getMessage(), "\n";
|
| 287 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
}
|
| 291 |
+
else
|
| 292 |
+
{
|
| 293 |
+
return false;
|
| 294 |
+
}
|
| 295 |
+
return;
|
| 296 |
+
}
|
| 297 |
+
else {
|
| 298 |
+
return false;
|
| 299 |
+
}
|
| 300 |
+
return;
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
}
|
app/code/local/Ecom/Express/Model/Order/Pdf/Shipment.php
ADDED
|
@@ -0,0 +1,756 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Sales Order Shipment PDF model
|
| 21 |
+
*
|
| 22 |
+
*/
|
| 23 |
+
class Ecom_Express_Model_Order_Pdf_Shipment extends Mage_Sales_Model_Order_Pdf_Abstract
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* Draw table header for product items
|
| 27 |
+
*
|
| 28 |
+
* @param Zend_Pdf_Page $page
|
| 29 |
+
* @return void
|
| 30 |
+
*/
|
| 31 |
+
|
| 32 |
+
public $y;
|
| 33 |
+
public $ax1=40;
|
| 34 |
+
public $zshipments=0;
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
protected function _drawHeader(Zend_Pdf_Page $page)
|
| 38 |
+
{
|
| 39 |
+
|
| 40 |
+
/* Add table head */
|
| 41 |
+
$this->_setFontRegular($page, 10);
|
| 42 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
|
| 43 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
|
| 44 |
+
$page->setLineWidth(0.5);
|
| 45 |
+
$page->drawRectangle(25, $this->y, 570, $this->y-15);
|
| 46 |
+
$this->y -= 10;
|
| 47 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
|
| 48 |
+
$invoice_id = Mage::app()->getRequest()->getParam('invoice_id');
|
| 49 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($invoice_id);
|
| 50 |
+
|
| 51 |
+
$my_order = Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('orderid',$shipment->getData('order_id'))->getData();
|
| 52 |
+
|
| 53 |
+
foreach($my_order as $order_data)
|
| 54 |
+
{
|
| 55 |
+
$waybill_no = $order_data['awb'];
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
$admin_address= $this->_formatAddress(Mage::getStoreConfig('shipping/origin/street_line1').",".Mage::getStoreConfig('shipping/origin/street_line2'));
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
if(strlen(Mage::getStoreConfig('shipping/origin/street_line1').",".Mage::getStoreConfig('shipping/origin/street_line2'))< 30){
|
| 62 |
+
$i=0;
|
| 63 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('shipping/origin/street_line1').",".Mage::getStoreConfig('shipping/origin/street_line2')),410, ($this->y+310), 'UTF-8');
|
| 64 |
+
|
| 65 |
+
}
|
| 66 |
+
else{
|
| 67 |
+
$line = 822;
|
| 68 |
+
$i=20;
|
| 69 |
+
foreach ($admin_address as $value){
|
| 70 |
+
|
| 71 |
+
$textChunk = wordwrap(trim($value), 45, "\n");
|
| 72 |
+
foreach(explode("\n", $textChunk) as $textLine){
|
| 73 |
+
if ($textLine!=='') {
|
| 74 |
+
$page->drawText(strip_tags(ltrim($textLine)), 340, $line, 'UTF-8');
|
| 75 |
+
$line -=10;
|
| 76 |
+
}
|
| 77 |
+
}$i++;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
$page->drawText(Mage::helper('sales')->__('Email: '.Mage::getStoreConfig('trans_email/ident_general/email')), 410, $this->y+284-$i, 'UTF-8');
|
| 81 |
+
$page->drawText(Mage::helper('sales')->__('Phone: '.Mage::getStoreConfig('general/store_information/phone')), 410, $this->y+273-$i, 'UTF-8');
|
| 82 |
+
|
| 83 |
+
$this->_setFontBold($page, 15);
|
| 84 |
+
$page->drawText(Mage::helper('sales')->__('ECOM EXPRESS'), 240, $this->y+265, 'UTF-8');
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
$fontPath = Mage::getBaseDir() . '/media/ecomexpress/font/FRE3OF9X.TTF';
|
| 88 |
+
$page->setFont(Zend_Pdf_Font::fontWithPath($fontPath), 30);
|
| 89 |
+
$barcodeImage = "*".trim($waybill_no)."*";
|
| 90 |
+
$page->drawText($barcodeImage, 230,$this->y+230);
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
$this->_setFontRegular($page, 10);
|
| 94 |
+
$page->drawText(Mage::helper('sales')->__($waybill_no), 255, $this->y+218, 'UTF-8');
|
| 95 |
+
$this->_setFontBold($page, 12);
|
| 96 |
+
$page->drawText(Mage::helper('sales')->__('Dimension:'), 40, $this->y+210, 'UTF-8');
|
| 97 |
+
$this->_setFontRegular($page, 10);
|
| 98 |
+
$this->_setFontBold($page, 12);
|
| 99 |
+
$page->drawText(Mage::helper('sales')->__('Actual Weight:'), 440, $this->y+210, 'UTF-8');
|
| 100 |
+
$this->_setFontRegular($page, 10);
|
| 101 |
+
$this->_setFontBold($page, 12);
|
| 102 |
+
$page->drawText(Mage::helper('sales')->__('SHIPPER:'), 200, $this->y+190, 'UTF-8');
|
| 103 |
+
$this->_setFontRegular($page, 10);
|
| 104 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('general/store_information/name')), 250, $this->y+190, 'UTF-8');
|
| 105 |
+
|
| 106 |
+
$this->_setFontBold($page, 12);
|
| 107 |
+
$page->drawText(Mage::helper('sales')->__('CONSIGNEE ADDRESS:'), 40, $this->y+170, 'UTF-8');
|
| 108 |
+
$this->_setFontRegular($page, 10);
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 112 |
+
->load($shipment->getData('order_id'))
|
| 113 |
+
->getShippingMethod();
|
| 114 |
+
|
| 115 |
+
//columns headers
|
| 116 |
+
|
| 117 |
+
if(strpos($current_shipping_method, 'ecomexpress') !== false)
|
| 118 |
+
{
|
| 119 |
+
|
| 120 |
+
$lines[0][] = array(
|
| 121 |
+
'text' => Mage::helper('sales')->__('Order number'),
|
| 122 |
+
'feed' => 110,
|
| 123 |
+
'align' => 'right'
|
| 124 |
+
);
|
| 125 |
+
|
| 126 |
+
$lines[0][] = array(
|
| 127 |
+
'text' => Mage::helper('sales')->__('Order Date'),
|
| 128 |
+
'feed' => 190,
|
| 129 |
+
'align' => 'right'
|
| 130 |
+
);
|
| 131 |
+
$lines[0][] = array(
|
| 132 |
+
'text' => Mage::helper('sales')->__('Product Type'),
|
| 133 |
+
'feed' => 320,
|
| 134 |
+
'align' => 'right'
|
| 135 |
+
);
|
| 136 |
+
|
| 137 |
+
$lines[0][] = array(
|
| 138 |
+
'text' => Mage::helper('sales')->__('Quantity'),
|
| 139 |
+
'feed' => 450,
|
| 140 |
+
'align' => 'right'
|
| 141 |
+
);
|
| 142 |
+
$lines[0][] = array(
|
| 143 |
+
'text' => Mage::helper('sales')->__('value'),
|
| 144 |
+
'feed' => 560,
|
| 145 |
+
'align' => 'right'
|
| 146 |
+
);
|
| 147 |
+
}else {
|
| 148 |
+
$lines[0][] = array(
|
| 149 |
+
'text' => Mage::helper('sales')->__('Products'),
|
| 150 |
+
'feed' => 100,
|
| 151 |
+
);
|
| 152 |
+
|
| 153 |
+
$lines[0][] = array(
|
| 154 |
+
'text' => Mage::helper('sales')->__('Qty'),
|
| 155 |
+
'feed' => 35
|
| 156 |
+
);
|
| 157 |
+
|
| 158 |
+
$lines[0][] = array(
|
| 159 |
+
'text' => Mage::helper('sales')->__('SKU'),
|
| 160 |
+
'feed' => 565,
|
| 161 |
+
'align' => 'right'
|
| 162 |
+
);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
$lineBlock = array(
|
| 166 |
+
'lines' => $lines,
|
| 167 |
+
'height' => 10
|
| 168 |
+
);
|
| 169 |
+
|
| 170 |
+
$this->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
|
| 171 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 172 |
+
$this->y -= 20;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
/**
|
| 176 |
+
* Return PDF document
|
| 177 |
+
*
|
| 178 |
+
* @param array $shipments
|
| 179 |
+
* @return Zend_Pdf
|
| 180 |
+
*/
|
| 181 |
+
|
| 182 |
+
public function getPdf($shipments = array())
|
| 183 |
+
{
|
| 184 |
+
|
| 185 |
+
$invoice_id = Mage::app()->getRequest()->getParam('invoice_id');
|
| 186 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($invoice_id);
|
| 187 |
+
|
| 188 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 189 |
+
->load($shipment->getData('order_id'))
|
| 190 |
+
->getShippingMethod();
|
| 191 |
+
|
| 192 |
+
if(strcmp($current_shipping_method, 'ecomexpress_ecomexpress') == true)
|
| 193 |
+
{
|
| 194 |
+
return Mage::getModel('sales/order_pdf_Shipment')->getPdf($shipments);
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
$this->_beforeGetPdf();
|
| 198 |
+
$this->_initRenderer('shipment');
|
| 199 |
+
|
| 200 |
+
$pdf = new Zend_Pdf();
|
| 201 |
+
$this->_setPdf($pdf);
|
| 202 |
+
$style = new Zend_Pdf_Style();
|
| 203 |
+
$this->_setFontBold($style, 10);
|
| 204 |
+
foreach ($shipments as $shipment) {
|
| 205 |
+
if ($shipment->getStoreId()) {
|
| 206 |
+
Mage::app()->getLocale()->emulate($shipment->getStoreId());
|
| 207 |
+
Mage::app()->setCurrentStore($shipment->getStoreId());
|
| 208 |
+
}
|
| 209 |
+
$page = $this->newPage();
|
| 210 |
+
$order = $shipment->getOrder();
|
| 211 |
+
$pdf_logo_name = Mage::getStoreConfig('carriers/ecomexpress/logo_image');
|
| 212 |
+
$pdf_logo_url = Mage::getBaseUrl('media').'ecomexpress-logo-images/' .$pdf_logo_name;
|
| 213 |
+
|
| 214 |
+
/* Add image */
|
| 215 |
+
|
| 216 |
+
$this->insertEcomLogo($page, $shipment->getStore());
|
| 217 |
+
|
| 218 |
+
/* Add address */
|
| 219 |
+
$this->insertEcomAddress($page, $shipment->getStore());
|
| 220 |
+
/* Add head */
|
| 221 |
+
$this->insertEcomOrder(
|
| 222 |
+
$page,
|
| 223 |
+
$shipment,
|
| 224 |
+
|
| 225 |
+
Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, $order->getStoreId())
|
| 226 |
+
);
|
| 227 |
+
|
| 228 |
+
/* Add table */
|
| 229 |
+
$this->_drawHeader($page);
|
| 230 |
+
/* Add body */
|
| 231 |
+
foreach ($shipment->getAllItems() as $item) {
|
| 232 |
+
if ($item->getOrderItem()->getParentItem()) {
|
| 233 |
+
continue;
|
| 234 |
+
}
|
| 235 |
+
$cartitem=array();
|
| 236 |
+
foreach($shipment->getAllItems() as $item){
|
| 237 |
+
$cartitem[]=$item->getData();
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
$yShipments = $this->y;
|
| 241 |
+
$topMargin = 15;
|
| 242 |
+
$yShipments -= $topMargin-10;
|
| 243 |
+
$subtotal = 0;
|
| 244 |
+
$weight = 0;
|
| 245 |
+
$prod_length =array();
|
| 246 |
+
$prod_width =array();
|
| 247 |
+
$prod_height =array();
|
| 248 |
+
|
| 249 |
+
$length_yship = array();
|
| 250 |
+
foreach($cartitem as $key=>$value){
|
| 251 |
+
|
| 252 |
+
$weight += ($value['weight'] * $value['qty']) ;
|
| 253 |
+
|
| 254 |
+
$package_collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')
|
| 255 |
+
->addAttributeToFilter('ecom_length', array('notnull' => true))
|
| 256 |
+
->addAttributeToFilter('ecom_height',array('notnull' => true))
|
| 257 |
+
->addAttributeToFilter('ecom_width',array('notnull' => true))
|
| 258 |
+
->addAttributeToFilter('sku', array('in' => $value['sku']));
|
| 259 |
+
|
| 260 |
+
foreach($package_collection as $product_data) {
|
| 261 |
+
$prod_length['length'][] = $product_data['ecom_length'];
|
| 262 |
+
$prod_width['width'][]= $product_data['ecom_width'];
|
| 263 |
+
$prod_height['height'][] = $product_data['ecom_height'];
|
| 264 |
+
}
|
| 265 |
+
$page->drawText($order->getRealOrderId(), 41, $yShipments, 'UTF-8');
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
$date = Mage::helper('core')->formatDate($order->getCreatedAt());
|
| 269 |
+
$page->drawText(date("d.m.Y", strtotime($date)), 140, $yShipments, 'UTF-8');
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
if(strlen($value['name']) > 15){
|
| 273 |
+
|
| 274 |
+
$productName = substr($value['name'],0,15).' ...';
|
| 275 |
+
}else{
|
| 276 |
+
$productName = $value['name'];
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
$text = array();
|
| 280 |
+
foreach (Mage::helper('core/string')->str_split($productName, 25, true, true) as $_value){
|
| 281 |
+
$text[] = $_value;
|
| 282 |
+
}
|
| 283 |
+
$addressy = $yShipments;
|
| 284 |
+
foreach ($text as $part){
|
| 285 |
+
$page->drawText(strip_tags(ltrim($part)), 230, $addressy , 'UTF-8');
|
| 286 |
+
$addressy -= 10;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
$page->drawText((int)$value["qty"], 410, $yShipments, 'UTF-8');
|
| 290 |
+
$paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
|
| 291 |
+
->setIsSecureMode(true)
|
| 292 |
+
->toPdf();
|
| 293 |
+
$paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
|
| 294 |
+
$payment = explode('{{pdf_row_separator}}', $paymentInfo);
|
| 295 |
+
|
| 296 |
+
$grand_total= $order->getTaxAmount() + $order->getGrandTotal();
|
| 297 |
+
$page->drawText(Mage::helper('sales')->__('₹') .$value["price"] * $value["qty"], 535, ($yShipments), 'UTF-8');
|
| 298 |
+
|
| 299 |
+
$subtotal+=$value["price"]*$value["qty"];
|
| 300 |
+
$page->drawLine(120, $yShipments + 45, 120, $yShipments+30); //left
|
| 301 |
+
$page->drawLine(220, $yShipments + 45, 220, $yShipments+30); //left
|
| 302 |
+
$page->drawLine(360, $yShipments + 45, 360, $yShipments+30); //left
|
| 303 |
+
$page->drawLine(490, $yShipments + 45, 490, $yShipments+30); //left
|
| 304 |
+
|
| 305 |
+
$page->drawLine(25, $yShipments-10, 25, $yShipments+30); //left
|
| 306 |
+
$page->drawLine(120, $yShipments-10, 120, $yShipments+30); //left
|
| 307 |
+
$page->drawLine(220, $yShipments-10, 220, $yShipments+30); //left
|
| 308 |
+
$page->drawLine(360, $yShipments-10, 360, $yShipments+30); //left
|
| 309 |
+
$page->drawLine(490, $yShipments-10, 490, $yShipments+30); //left
|
| 310 |
+
$page->drawLine(570, $yShipments-10, 570, $yShipments+30); //left
|
| 311 |
+
$page->drawLine(25, $yShipments-10, 570, $yShipments-10); //bottom
|
| 312 |
+
|
| 313 |
+
$yShipments -= $topMargin + 10;
|
| 314 |
+
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
$page->drawText(($weight), 520, $this->y+240, 'UTF-8');
|
| 318 |
+
$page->drawText((max($prod_length['length'])."*".array_sum($prod_width['width'])."*".max($prod_height['height'])), 105, $this->y+240, 'UTF-8');
|
| 319 |
+
if($order->getShippingAmount())
|
| 320 |
+
$page->drawText(Mage::helper('sales')->__('Shipping & Handling Charge : ₹') .round($order->getShippingAmount(),2),190, $yShipments-45, 'UTF-8');
|
| 321 |
+
if(strcmp($payment[0] ,'Cash On Delivery')==0){
|
| 322 |
+
$grand_total= $order->getTaxAmount() + $order->getGrandTotal();
|
| 323 |
+
$this->_setFontBold($page, 12);
|
| 324 |
+
$page->drawText(Mage::helper('sales')->__('COLLECT ONLY') ." (".strtoupper($payment[0]).") : ",190, ($yShipments-60), 'UTF-8');
|
| 325 |
+
$this->_setFontRegular($page, 10);
|
| 326 |
+
$page->drawText(Mage::helper('sales')->__('₹').$grand_total,405, ($yShipments-60), 'UTF-8');
|
| 327 |
+
$length_yship[] =$yShipments;
|
| 328 |
+
}
|
| 329 |
+
else
|
| 330 |
+
{
|
| 331 |
+
$this->_setFontBold($page, 12);
|
| 332 |
+
$page->drawText(Mage::helper('sales')->__('PRE - PAID'),210, ($yShipments-70), 'UTF-8');
|
| 333 |
+
$this->_setFontRegular($page, 10);
|
| 334 |
+
$length_yship[] =$yShipments;
|
| 335 |
+
|
| 336 |
+
}
|
| 337 |
+
$this->_setFontBold($page, 12);
|
| 338 |
+
$page->drawText(Mage::helper('sales')->__('IF UNDELIVERD RETURN TO'),35, ($yShipments-85), 'UTF-8');
|
| 339 |
+
$this->_setFontRegular($page, 10);
|
| 340 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('general/store_information/name')),35, ($yShipments-105), 'UTF-8');
|
| 341 |
+
|
| 342 |
+
$admin_add = $this->_formatAddress(Mage::getStoreConfig('shipping/origin/street_line1').",".Mage::getStoreConfig('shipping/origin/street_line2').",".Mage::getStoreConfig('shipping/origin/city').
|
| 343 |
+
",".Mage::getStoreConfig('shipping/origin/region_id').",".Mage::getStoreConfig('shipping/origin/postcode').
|
| 344 |
+
",".Mage::helper('sales')->__(Mage::app()->getLocale()->getCountryTranslation(Mage::getStoreConfig('shipping/origin/country_id'))));
|
| 345 |
+
|
| 346 |
+
$newline=$yShipments-125;
|
| 347 |
+
foreach ($admin_add as $add_value){
|
| 348 |
+
|
| 349 |
+
$add_textChunk = wordwrap($add_value, 45, "\n");
|
| 350 |
+
foreach(explode("\n", $add_textChunk) as $add_textLine){
|
| 351 |
+
if ($add_textLine!=='') {
|
| 352 |
+
$page->drawText(strip_tags(ltrim($add_textLine)), 35, $newline, 'UTF-8');
|
| 353 |
+
$newline -=14;
|
| 354 |
+
}
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
$page = end($pdf->pages);
|
| 359 |
+
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
}
|
| 363 |
+
$this->zShipments -= 15;
|
| 364 |
+
$yShipments -= 15;
|
| 365 |
+
$this->_afterGetPdf();
|
| 366 |
+
if ($shipment->getStoreId()) {
|
| 367 |
+
Mage::app()->getLocale()->revert();
|
| 368 |
+
}
|
| 369 |
+
return $pdf;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
/**
|
| 373 |
+
* Create new page and assign to PDF object
|
| 374 |
+
*
|
| 375 |
+
* @param array $settings
|
| 376 |
+
* @return Zend_Pdf_Page
|
| 377 |
+
*/
|
| 378 |
+
public function newPage(array $settings = array())
|
| 379 |
+
{
|
| 380 |
+
/* Add new table head */
|
| 381 |
+
$page = $this->_getPdf()->newPage(Zend_Pdf_Page::SIZE_A4);
|
| 382 |
+
$this->_getPdf()->pages[] = $page;
|
| 383 |
+
$this->y = 800;
|
| 384 |
+
if (!empty($settings['table_header'])) {
|
| 385 |
+
$this->_drawHeader($page);
|
| 386 |
+
}
|
| 387 |
+
return $page;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
/**
|
| 393 |
+
* Set font as regular
|
| 394 |
+
*
|
| 395 |
+
* @param Zend_Pdf_Page $object
|
| 396 |
+
* @param int $size
|
| 397 |
+
* @return Zend_Pdf_Resource_Font
|
| 398 |
+
*/
|
| 399 |
+
protected function _setFontRegular($object, $size = 7)
|
| 400 |
+
{
|
| 401 |
+
$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf');
|
| 402 |
+
$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/ecomexpress/DejaVuSans.ttf');
|
| 403 |
+
$object->setFont($font, $size);
|
| 404 |
+
return $font;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
/**
|
| 410 |
+
* Insert logo to pdf page
|
| 411 |
+
*
|
| 412 |
+
* @param Zend_Pdf_Page $page
|
| 413 |
+
* @param null $store
|
| 414 |
+
*/
|
| 415 |
+
|
| 416 |
+
protected function insertEcomLogo(&$page, $store = null){
|
| 417 |
+
$this->y = $this->y ? $this->y : 815;
|
| 418 |
+
$image = Mage::getStoreConfig('carriers/ecomexpress/logo_image', $store);
|
| 419 |
+
|
| 420 |
+
if ($image) {
|
| 421 |
+
|
| 422 |
+
$image = Mage::getBaseDir('media') . '/ecomexpress-logo-images/' . $image;
|
| 423 |
+
|
| 424 |
+
if (is_file($image)) {
|
| 425 |
+
$image = Zend_Pdf_Image::imageWithPath($image);
|
| 426 |
+
$top = 830; //top border of the page
|
| 427 |
+
$widthLimit = 270; //half of the page width
|
| 428 |
+
$heightLimit = 270; //assuming the image is not a "skyscraper"
|
| 429 |
+
$width = $image->getPixelWidth();
|
| 430 |
+
$height = $image->getPixelHeight();
|
| 431 |
+
|
| 432 |
+
//preserving aspect ratio (proportions)
|
| 433 |
+
$ratio = $width / $height;
|
| 434 |
+
if ($ratio > 1 && $width > $widthLimit) {
|
| 435 |
+
$width = $widthLimit;
|
| 436 |
+
$height = $width / $ratio;
|
| 437 |
+
} elseif ($ratio < 1 && $height > $heightLimit) {
|
| 438 |
+
$height = $heightLimit;
|
| 439 |
+
$width = $height * $ratio;
|
| 440 |
+
} elseif ($ratio == 1 && $height > $heightLimit) {
|
| 441 |
+
$height = $heightLimit;
|
| 442 |
+
$width = $widthLimit;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
$y1 = $top - $height;
|
| 446 |
+
$y2 = $top;
|
| 447 |
+
$x1 = 25;
|
| 448 |
+
$x2 = $x1 + $width;
|
| 449 |
+
|
| 450 |
+
//coordinates after transformation are rounded by Zend
|
| 451 |
+
$page->drawImage($image, $x1, $y1, $x2, $y2);
|
| 452 |
+
|
| 453 |
+
$this->y = $y1 - 10;
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
/**
|
| 460 |
+
* Insert address to pdf page
|
| 461 |
+
*
|
| 462 |
+
* @param Zend_Pdf_Page $page
|
| 463 |
+
* @param null $store
|
| 464 |
+
*/
|
| 465 |
+
protected function insertEcomAddress(&$page, $store = null)
|
| 466 |
+
{
|
| 467 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 468 |
+
$font = $this->_setFontRegular($page, 10);
|
| 469 |
+
$page->setLineWidth(0);
|
| 470 |
+
$this->y = $this->y ? $this->y : 815;
|
| 471 |
+
$top = 815;
|
| 472 |
+
|
| 473 |
+
foreach (explode("\n", Mage::getStoreConfig('sales/identity/address', $store)) as $value){
|
| 474 |
+
if ($value !== '') {
|
| 475 |
+
$value = preg_replace('/<br[^>]*>/i', "\n", $value);
|
| 476 |
+
foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
|
| 477 |
+
$page->drawText(trim(strip_tags($_value)),
|
| 478 |
+
$this->getAlignRight($_value, 130, 440, $font, 10),
|
| 479 |
+
$top,
|
| 480 |
+
'UTF-8');
|
| 481 |
+
$top -= 10;
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
$this->y = ($this->y > $top) ? $top : $this->y;
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
/**
|
| 490 |
+
* Format address
|
| 491 |
+
*
|
| 492 |
+
* @param string $address
|
| 493 |
+
* @return array
|
| 494 |
+
*/
|
| 495 |
+
protected function _formatAddress($address)
|
| 496 |
+
{
|
| 497 |
+
$return = array();
|
| 498 |
+
foreach (explode('|', $address) as $str) {
|
| 499 |
+
foreach (Mage::helper('core/string')->str_split($str, 45, true, true) as $part) {
|
| 500 |
+
if (empty($part)) {
|
| 501 |
+
continue;
|
| 502 |
+
}
|
| 503 |
+
$return[] = $part;
|
| 504 |
+
}
|
| 505 |
+
}
|
| 506 |
+
return $return;
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
/**
|
| 510 |
+
* Calculate address height
|
| 511 |
+
*
|
| 512 |
+
* @param array $address
|
| 513 |
+
* @return int Height
|
| 514 |
+
*/
|
| 515 |
+
protected function _calcAddressHeight($address)
|
| 516 |
+
{
|
| 517 |
+
$y = 0;
|
| 518 |
+
foreach ($address as $value){
|
| 519 |
+
if ($value !== '') {
|
| 520 |
+
$text = array();
|
| 521 |
+
foreach (Mage::helper('core/string')->str_split($value, 55, true, true) as $_value) {
|
| 522 |
+
$text[] = $_value;
|
| 523 |
+
}
|
| 524 |
+
foreach ($text as $part) {
|
| 525 |
+
$y += 15;
|
| 526 |
+
}
|
| 527 |
+
}
|
| 528 |
+
}
|
| 529 |
+
return $y;
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
/**
|
| 533 |
+
* Insert order to pdf page
|
| 534 |
+
*
|
| 535 |
+
* @param Zend_Pdf_Page $page
|
| 536 |
+
* @param Mage_Sales_Model_Order $obj
|
| 537 |
+
* @param bool $putOrderId
|
| 538 |
+
*/
|
| 539 |
+
protected function insertEcomOrder(&$page, $obj, $putOrderId = true)
|
| 540 |
+
{
|
| 541 |
+
$yShipments =60;
|
| 542 |
+
if ($obj instanceof Mage_Sales_Model_Order) {
|
| 543 |
+
$shipment = null;
|
| 544 |
+
$order = $obj;
|
| 545 |
+
} elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
|
| 546 |
+
$shipment = $obj;
|
| 547 |
+
$order = $shipment->getOrder();
|
| 548 |
+
}
|
| 549 |
+
$this->y = $this->y ? $this->y : 815;
|
| 550 |
+
$top = $this->y;
|
| 551 |
+
$margin = $this->ax1 =100;
|
| 552 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
|
| 553 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
|
| 554 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 555 |
+
$this->setDocHeaderCoordinates(array(25, $top, 570, $top - 55));
|
| 556 |
+
$this->_setFontRegular($page, 10);
|
| 557 |
+
$page->drawText(Mage::helper('sales')->__() , 35, ($top -= 30), 'UTF-8');
|
| 558 |
+
$page->drawText(Mage::helper('sales')->__(),35,($top -= 15),'UTF-8');
|
| 559 |
+
$top -= 10;
|
| 560 |
+
$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
|
| 561 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
|
| 562 |
+
$page->setLineWidth(0.5);
|
| 563 |
+
|
| 564 |
+
/* Calculate blocks info */
|
| 565 |
+
|
| 566 |
+
/* Billing Address */
|
| 567 |
+
|
| 568 |
+
$billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
|
| 569 |
+
|
| 570 |
+
/* Payment */
|
| 571 |
+
$paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
|
| 572 |
+
->setIsSecureMode(true)
|
| 573 |
+
->toPdf();
|
| 574 |
+
$paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
|
| 575 |
+
$payment = explode('{{pdf_row_separator}}', $paymentInfo);
|
| 576 |
+
|
| 577 |
+
foreach ($payment as $key=>$value){
|
| 578 |
+
if (strip_tags(trim($value)) == '') {
|
| 579 |
+
unset($payment[$key]);
|
| 580 |
+
}
|
| 581 |
+
}
|
| 582 |
+
reset($payment);
|
| 583 |
+
|
| 584 |
+
/* Shipping Address and Method */
|
| 585 |
+
if (!$order->getIsVirtual()) {
|
| 586 |
+
/* Shipping Address */
|
| 587 |
+
$shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
|
| 588 |
+
$shippingMethod = $order->getShippingDescription();
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 592 |
+
|
| 593 |
+
$addressesHeight = $this->_calcAddressHeight($billingAddress);
|
| 594 |
+
if (isset($shippingAddress)) {
|
| 595 |
+
$addressesHeight = max($addressesHeight, $this->_calcAddressHeight($shippingAddress));
|
| 596 |
+
}
|
| 597 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 598 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 599 |
+
$this->_setFontRegular($page, 10);
|
| 600 |
+
$this->y = $top - 40;
|
| 601 |
+
$addressesStartY = $this->y;
|
| 602 |
+
$this->_setFontBold($page, 12);
|
| 603 |
+
$this->_setFontRegular($page, 10);
|
| 604 |
+
$yShipments +=55;
|
| 605 |
+
|
| 606 |
+
|
| 607 |
+
$addressesEndY = $this->y;
|
| 608 |
+
if (!$order->getIsVirtual()) {
|
| 609 |
+
|
| 610 |
+
$this->y = $addressesStartY;
|
| 611 |
+
$shippingAddress = $order->getShippingAddress()->getData();
|
| 612 |
+
$this->_setFontBold($page, 12);
|
| 613 |
+
$page->drawText(Mage::helper('sales')->__('MOBILE NO:'),40, $this->y-60, 'UTF-8');
|
| 614 |
+
$this->_setFontRegular($page, 10);
|
| 615 |
+
$page->drawText(Mage::helper('sales')->__($shippingAddress['telephone']),110, $this->y-60, 'UTF-8');
|
| 616 |
+
$this->y -= 15;
|
| 617 |
+
if(isset($shippingAddress['middlename'])){
|
| 618 |
+
$page->drawText($shippingAddress['firstname']." ".$shippingAddress['middlename']." ".$shippingAddress['lastname'], 40, $this->y-65, 'UTF-8');
|
| 619 |
+
}
|
| 620 |
+
else{
|
| 621 |
+
$page->drawText($shippingAddress['firstname']." ".$shippingAddress['lastname'], 40, $this->y-65, 'UTF-8');
|
| 622 |
+
}
|
| 623 |
+
$this->y -= 25;
|
| 624 |
+
$page->drawText(preg_replace('/\s+/', ' ', $shippingAddress['street']. " " .trim($shippingAddress['city'])) , $this->ax1-60 , $this->y-65, 'UTF-8');
|
| 625 |
+
|
| 626 |
+
$this->y -= 25;
|
| 627 |
+
$this->_setFontBold($page, 12);
|
| 628 |
+
$page->drawText(Mage::helper('sales')->__('Destination: ' ),$this->ax1-60, $this->y-60, 'UTF-8');
|
| 629 |
+
$this->_setFontRegular($page, 10);
|
| 630 |
+
$page->drawText(Mage::helper('sales')->__($shippingAddress['city'].",".$shippingAddress['region'].",".$shippingAddress['postcode']),$this->ax1+5, $this->y-60, 'UTF-8');
|
| 631 |
+
$this->_setFontBold($page, 15);
|
| 632 |
+
$page->drawText(Mage::helper('sales')->__('ORDER DETAILS:'),260, $this->y-100, 'UTF-8');
|
| 633 |
+
$this->_setFontRegular($page, 10);
|
| 634 |
+
|
| 635 |
+
$addressesEndY = min($addressesEndY, $this->y);
|
| 636 |
+
$this->y = $addressesEndY;
|
| 637 |
+
$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
|
| 638 |
+
$page->setLineWidth(0.5);
|
| 639 |
+
|
| 640 |
+
$this->y -= 15;
|
| 641 |
+
$this->_setFontBold($page, 12);
|
| 642 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 643 |
+
|
| 644 |
+
$this->y -=10;
|
| 645 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 646 |
+
$this->_setFontRegular($page, 10);
|
| 647 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 648 |
+
$paymentLeft = 35;
|
| 649 |
+
$yPayments = $this->y - 15;
|
| 650 |
+
}
|
| 651 |
+
else {
|
| 652 |
+
$yPayments = $addressesStartY;
|
| 653 |
+
$paymentLeft = 285;
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
foreach ($payment as $value){
|
| 657 |
+
if (trim($value) != '') {
|
| 658 |
+
//Printing "Payment Method" lines
|
| 659 |
+
$value = preg_replace('/<br[^>]*>/i', "\n", $value);
|
| 660 |
+
|
| 661 |
+
foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
|
| 662 |
+
$yPayments -= 15;
|
| 663 |
+
}
|
| 664 |
+
}
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
if ($order->getIsVirtual()) {
|
| 668 |
+
// replacement of Shipments-Payments rectangle block
|
| 669 |
+
$yPayments = min($addressesEndY, $yPayments);
|
| 670 |
+
$page->drawLine(25, ($top - 25), 25, $yPayments);
|
| 671 |
+
$page->drawLine(570, ($top - 25), 570, $yPayments);
|
| 672 |
+
$page->drawLine(25, $yPayments, 570, $yPayments);
|
| 673 |
+
|
| 674 |
+
$this->y = $yPayments - 15;
|
| 675 |
+
} else {
|
| 676 |
+
$topMargin = 15;
|
| 677 |
+
$methodStartY = $this->y;
|
| 678 |
+
$this->y -= 15;
|
| 679 |
+
|
| 680 |
+
foreach (Mage::helper('core/string')->str_split($shippingMethod, 45, true, true) as $_value) {
|
| 681 |
+
$this->y -= 15;
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
$yShipments = $this->y;
|
| 685 |
+
$yShipments -= $topMargin + 10;
|
| 686 |
+
$tracks = array();
|
| 687 |
+
if ($shipment) {
|
| 688 |
+
$tracks = $shipment->getAllTracks();
|
| 689 |
+
}
|
| 690 |
+
if (count($tracks)) {
|
| 691 |
+
$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
|
| 692 |
+
$page->setLineWidth(0.5);
|
| 693 |
+
|
| 694 |
+
$this->_setFontRegular($page, 9);
|
| 695 |
+
$yShipments -= 20;
|
| 696 |
+
$this->_setFontRegular($page, 8);
|
| 697 |
+
foreach ($tracks as $track) {
|
| 698 |
+
|
| 699 |
+
$CarrierCode = $track->getCarrierCode();
|
| 700 |
+
if ($CarrierCode != 'custom') {
|
| 701 |
+
$carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($CarrierCode);
|
| 702 |
+
$carrierTitle = $carrier->getConfigData('title');
|
| 703 |
+
} else {
|
| 704 |
+
$carrierTitle = Mage::helper('sales')->__('Custom Value');
|
| 705 |
+
}
|
| 706 |
+
$maxTitleLen = 45;
|
| 707 |
+
$endOfTitle = strlen($track->getTitle()) > $maxTitleLen ? '...' : '';
|
| 708 |
+
$truncatedTitle = substr($track->getTitle(), 0, $maxTitleLen) . $endOfTitle;
|
| 709 |
+
|
| 710 |
+
$yShipments -= $topMargin - 5;
|
| 711 |
+
}
|
| 712 |
+
} else {
|
| 713 |
+
$yShipments -= $topMargin - 5;
|
| 714 |
+
}
|
| 715 |
+
$currentY = min($yPayments, $yShipments);
|
| 716 |
+
$this->y = $currentY;
|
| 717 |
+
$this->y -= 15;
|
| 718 |
+
}
|
| 719 |
+
$yShipments -=20;
|
| 720 |
+
}
|
| 721 |
+
|
| 722 |
+
/**
|
| 723 |
+
* Insert title and number for concrete document type
|
| 724 |
+
*
|
| 725 |
+
* @param Zend_Pdf_Page $page
|
| 726 |
+
* @param string $text
|
| 727 |
+
* @return void
|
| 728 |
+
*/
|
| 729 |
+
public function insertEcomDocumentNumber(Zend_Pdf_Page $page, $text)
|
| 730 |
+
{
|
| 731 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 732 |
+
$this->_setFontRegular($page, 10);
|
| 733 |
+
$docHeader = $this->getDocHeaderCoordinates();
|
| 734 |
+
$page->drawText($text, 35, $docHeader[1] - 15, 'UTF-8');
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
/**
|
| 738 |
+
* Sort totals list
|
| 739 |
+
*
|
| 740 |
+
* @param array $a
|
| 741 |
+
* @param array $b
|
| 742 |
+
* @return int
|
| 743 |
+
*/
|
| 744 |
+
protected function _sortTotalsList($a, $b) {
|
| 745 |
+
if (!isset($a['sort_order']) || !isset($b['sort_order'])) {
|
| 746 |
+
return 0;
|
| 747 |
+
}
|
| 748 |
+
|
| 749 |
+
if ($a['sort_order'] == $b['sort_order']) {
|
| 750 |
+
return 0;
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
return ($a['sort_order'] > $b['sort_order']) ? 1 : -1;
|
| 754 |
+
}
|
| 755 |
+
}
|
| 756 |
+
|
app/code/local/Ecom/Express/Model/Order/Pdf/Shipment_backup.php
ADDED
|
@@ -0,0 +1,731 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Sales Order Shipment PDF model
|
| 21 |
+
*
|
| 22 |
+
*/
|
| 23 |
+
class Ecom_Express_Model_Order_Pdf_Shipment extends Mage_Sales_Model_Order_Pdf_Abstract
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* Draw table header for product items
|
| 27 |
+
*
|
| 28 |
+
* @param Zend_Pdf_Page $page
|
| 29 |
+
* @return void
|
| 30 |
+
*/
|
| 31 |
+
|
| 32 |
+
public $y;
|
| 33 |
+
public $ax1=40;
|
| 34 |
+
public $zshipments=0;
|
| 35 |
+
|
| 36 |
+
protected function _drawHeader(Zend_Pdf_Page $page)
|
| 37 |
+
{
|
| 38 |
+
|
| 39 |
+
/* Add table head */
|
| 40 |
+
$this->_setFontRegular($page, 10);
|
| 41 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
|
| 42 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
|
| 43 |
+
$page->setLineWidth(0.5);
|
| 44 |
+
$page->drawRectangle(25, $this->y, 570, $this->y-15);
|
| 45 |
+
$this->y -= 10;
|
| 46 |
+
$page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
|
| 47 |
+
$invoice_id = Mage::app()->getRequest()->getParam('invoice_id');
|
| 48 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($invoice_id);
|
| 49 |
+
$my_order = Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('orderid',$shipment->getData('order_id'))->getData();
|
| 50 |
+
|
| 51 |
+
foreach($my_order as $order_data)
|
| 52 |
+
{
|
| 53 |
+
$waybill_no = $order_data['awb'];
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('shipping/origin/street_line1')),305, ($this->y+310), 'UTF-8');
|
| 57 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('shipping/origin/street_line2')." ".Mage::getStoreConfig('shipping/origin/city')." ".Mage::getStoreConfig('shipping/origin/postcode')),305, ($this->y+297), 'UTF-8');
|
| 58 |
+
$page->drawText(Mage::helper('sales')->__('Email: '.Mage::getStoreConfig('trans_email/ident_general/email')), 410, $this->y+284, 'UTF-8');
|
| 59 |
+
$page->drawText(Mage::helper('sales')->__('Phone: '.Mage::getStoreConfig('general/store_information/phone')), 410, $this->y+273, 'UTF-8');
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
$this->_setFontBold($page, 15);
|
| 65 |
+
$page->drawText(Mage::helper('sales')->__('ECOM EXPRESS'), 260, $this->y+265, 'UTF-8');
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
$fontPath = Mage::getBaseDir() . '/media/ecomexpress/font/FRE3OF9X.TTF';
|
| 69 |
+
$page->setFont(Zend_Pdf_Font::fontWithPath($fontPath), 30);
|
| 70 |
+
$barcodeImage = "*".trim($waybill_no)."*";
|
| 71 |
+
$page->drawText($barcodeImage, 250,$this->y+230);
|
| 72 |
+
$this->_setFontRegular($page, 10);
|
| 73 |
+
$page->drawText(Mage::helper('sales')->__($waybill_no), 275, $this->y+218, 'UTF-8');
|
| 74 |
+
$this->_setFontBold($page, 12);
|
| 75 |
+
$page->drawText(Mage::helper('sales')->__('Dimension:'), 40, $this->y+210, 'UTF-8');
|
| 76 |
+
$this->_setFontRegular($page, 10);
|
| 77 |
+
$this->_setFontBold($page, 12);
|
| 78 |
+
$page->drawText(Mage::helper('sales')->__('Actual Weight:'), 440, $this->y+210, 'UTF-8');
|
| 79 |
+
$this->_setFontRegular($page, 10);
|
| 80 |
+
$this->_setFontBold($page, 12);
|
| 81 |
+
$page->drawText(Mage::helper('sales')->__('SHIPPER:'), 200, $this->y+190, 'UTF-8');
|
| 82 |
+
$this->_setFontRegular($page, 10);
|
| 83 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('general/store_information/name')), 250, $this->y+190, 'UTF-8');
|
| 84 |
+
|
| 85 |
+
$this->_setFontBold($page, 12);
|
| 86 |
+
$page->drawText(Mage::helper('sales')->__('CONSIGNEE ADDRESS:'), 40, $this->y+170, 'UTF-8');
|
| 87 |
+
$this->_setFontRegular($page, 10);
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 91 |
+
->load($shipment->getData('order_id'))
|
| 92 |
+
->getShippingMethod();
|
| 93 |
+
|
| 94 |
+
//columns headers
|
| 95 |
+
|
| 96 |
+
if(strpos($current_shipping_method, 'ecomexpress') !== false)
|
| 97 |
+
{
|
| 98 |
+
|
| 99 |
+
$lines[0][] = array(
|
| 100 |
+
'text' => Mage::helper('sales')->__('Order number'),
|
| 101 |
+
'feed' => 110,
|
| 102 |
+
'align' => 'right'
|
| 103 |
+
);
|
| 104 |
+
|
| 105 |
+
$lines[0][] = array(
|
| 106 |
+
'text' => Mage::helper('sales')->__('Order Date'),
|
| 107 |
+
'feed' => 190,
|
| 108 |
+
'align' => 'right'
|
| 109 |
+
);
|
| 110 |
+
$lines[0][] = array(
|
| 111 |
+
'text' => Mage::helper('sales')->__('Product Type'),
|
| 112 |
+
'feed' => 320,
|
| 113 |
+
'align' => 'right'
|
| 114 |
+
);
|
| 115 |
+
|
| 116 |
+
$lines[0][] = array(
|
| 117 |
+
'text' => Mage::helper('sales')->__('Quantity'),
|
| 118 |
+
'feed' => 450,
|
| 119 |
+
'align' => 'right'
|
| 120 |
+
);
|
| 121 |
+
$lines[0][] = array(
|
| 122 |
+
'text' => Mage::helper('sales')->__('value'),
|
| 123 |
+
'feed' => 560,
|
| 124 |
+
'align' => 'right'
|
| 125 |
+
);
|
| 126 |
+
}else {
|
| 127 |
+
$lines[0][] = array(
|
| 128 |
+
'text' => Mage::helper('sales')->__('Products'),
|
| 129 |
+
'feed' => 100,
|
| 130 |
+
);
|
| 131 |
+
|
| 132 |
+
$lines[0][] = array(
|
| 133 |
+
'text' => Mage::helper('sales')->__('Qty'),
|
| 134 |
+
'feed' => 35
|
| 135 |
+
);
|
| 136 |
+
|
| 137 |
+
$lines[0][] = array(
|
| 138 |
+
'text' => Mage::helper('sales')->__('SKU'),
|
| 139 |
+
'feed' => 565,
|
| 140 |
+
'align' => 'right'
|
| 141 |
+
);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
$lineBlock = array(
|
| 145 |
+
'lines' => $lines,
|
| 146 |
+
'height' => 10
|
| 147 |
+
);
|
| 148 |
+
|
| 149 |
+
$this->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
|
| 150 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 151 |
+
$this->y -= 20;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
/**
|
| 155 |
+
* Return PDF document
|
| 156 |
+
*
|
| 157 |
+
* @param array $shipments
|
| 158 |
+
* @return Zend_Pdf
|
| 159 |
+
*/
|
| 160 |
+
|
| 161 |
+
public function getPdf($shipments = array())
|
| 162 |
+
{
|
| 163 |
+
|
| 164 |
+
$invoice_id = Mage::app()->getRequest()->getParam('invoice_id');
|
| 165 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($invoice_id);
|
| 166 |
+
|
| 167 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 168 |
+
->load($shipment->getData('order_id'))
|
| 169 |
+
->getShippingMethod();
|
| 170 |
+
|
| 171 |
+
if(strcmp($current_shipping_method, 'ecomexpress_ecomexpress') == true)
|
| 172 |
+
{
|
| 173 |
+
return Mage::getModel('sales/order_pdf_Shipment')->getPdf($shipments);
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
$this->_beforeGetPdf();
|
| 177 |
+
$this->_initRenderer('shipment');
|
| 178 |
+
|
| 179 |
+
$pdf = new Zend_Pdf();
|
| 180 |
+
$this->_setPdf($pdf);
|
| 181 |
+
$style = new Zend_Pdf_Style();
|
| 182 |
+
$this->_setFontBold($style, 10);
|
| 183 |
+
foreach ($shipments as $shipment) {
|
| 184 |
+
if ($shipment->getStoreId()) {
|
| 185 |
+
Mage::app()->getLocale()->emulate($shipment->getStoreId());
|
| 186 |
+
Mage::app()->setCurrentStore($shipment->getStoreId());
|
| 187 |
+
}
|
| 188 |
+
$page = $this->newPage();
|
| 189 |
+
$order = $shipment->getOrder();
|
| 190 |
+
$pdf_logo_name = Mage::getStoreConfig('carriers/ecomexpress/logo_image');
|
| 191 |
+
$pdf_logo_url = Mage::getBaseUrl('media').'ecomexpress-logo-images/' .$pdf_logo_name;
|
| 192 |
+
|
| 193 |
+
/* Add image */
|
| 194 |
+
|
| 195 |
+
$this->insertEcomLogo($page, $shipment->getStore());
|
| 196 |
+
|
| 197 |
+
/* Add address */
|
| 198 |
+
$this->insertEcomAddress($page, $shipment->getStore());
|
| 199 |
+
/* Add head */
|
| 200 |
+
$this->insertEcomOrder(
|
| 201 |
+
$page,
|
| 202 |
+
$shipment,
|
| 203 |
+
|
| 204 |
+
Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, $order->getStoreId())
|
| 205 |
+
);
|
| 206 |
+
|
| 207 |
+
/* Add table */
|
| 208 |
+
$this->_drawHeader($page);
|
| 209 |
+
/* Add body */
|
| 210 |
+
foreach ($shipment->getAllItems() as $item) {
|
| 211 |
+
if ($item->getOrderItem()->getParentItem()) {
|
| 212 |
+
continue;
|
| 213 |
+
}
|
| 214 |
+
$cartitem=array();
|
| 215 |
+
foreach($shipment->getAllItems() as $item){
|
| 216 |
+
$cartitem[]=$item->getData();
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
$yShipments = $this->y;
|
| 220 |
+
$topMargin = 15;
|
| 221 |
+
$yShipments -= $topMargin-10;
|
| 222 |
+
$subtotal = 0;
|
| 223 |
+
$weight = 0;
|
| 224 |
+
$prod_length =array();
|
| 225 |
+
$prod_width =array();
|
| 226 |
+
$prod_height =array();
|
| 227 |
+
|
| 228 |
+
$length_yship = array();
|
| 229 |
+
foreach($cartitem as $key=>$value){
|
| 230 |
+
|
| 231 |
+
$weight += ($value['weight'] * $value['qty']) ;
|
| 232 |
+
|
| 233 |
+
$package_collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')
|
| 234 |
+
->addAttributeToFilter('ecom_length', array('notnull' => true))
|
| 235 |
+
->addAttributeToFilter('ecom_height',array('notnull' => true))
|
| 236 |
+
->addAttributeToFilter('ecom_width',array('notnull' => true))
|
| 237 |
+
->addAttributeToFilter('sku', array('in' => $value['sku']));
|
| 238 |
+
|
| 239 |
+
foreach($package_collection as $product_data) {
|
| 240 |
+
$prod_length['length'][] = $product_data['ecom_length'];
|
| 241 |
+
$prod_width['width'][]= $product_data['ecom_width'];
|
| 242 |
+
$prod_height['height'][] = $product_data['ecom_height'];
|
| 243 |
+
}
|
| 244 |
+
$page->drawText($order->getRealOrderId(), 41, $yShipments, 'UTF-8');
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
$date = Mage::helper('core')->formatDate($order->getCreatedAt());
|
| 248 |
+
$page->drawText(date("d.m.Y", strtotime($date)), 140, $yShipments, 'UTF-8');
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
if(strlen($value['name']) > 15){
|
| 252 |
+
|
| 253 |
+
$productName = substr($value['name'],0,15).' ...';
|
| 254 |
+
}else{
|
| 255 |
+
$productName = $value['name'];
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
$text = array();
|
| 259 |
+
foreach (Mage::helper('core/string')->str_split($productName, 25, true, true) as $_value){
|
| 260 |
+
$text[] = $_value;
|
| 261 |
+
}
|
| 262 |
+
$addressy = $yShipments;
|
| 263 |
+
foreach ($text as $part){
|
| 264 |
+
$page->drawText(strip_tags(ltrim($part)), 230, $addressy , 'UTF-8');
|
| 265 |
+
$addressy -= 10;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
$page->drawText((int)$value["qty"], 410, $yShipments, 'UTF-8');
|
| 269 |
+
$paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
|
| 270 |
+
->setIsSecureMode(true)
|
| 271 |
+
->toPdf();
|
| 272 |
+
$paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
|
| 273 |
+
$payment = explode('{{pdf_row_separator}}', $paymentInfo);
|
| 274 |
+
|
| 275 |
+
$grand_total= $order->getTaxAmount() + $order->getGrandTotal();
|
| 276 |
+
$page->drawText(Mage::helper('sales')->__('₹') .$value["price"] * $value["qty"], 535, ($yShipments), 'UTF-8');
|
| 277 |
+
|
| 278 |
+
$subtotal+=$value["price"]*$value["qty"];
|
| 279 |
+
$page->drawLine(120, $yShipments + 45, 120, $yShipments+30); //left
|
| 280 |
+
$page->drawLine(220, $yShipments + 45, 220, $yShipments+30); //left
|
| 281 |
+
$page->drawLine(360, $yShipments + 45, 360, $yShipments+30); //left
|
| 282 |
+
$page->drawLine(490, $yShipments + 45, 490, $yShipments+30); //left
|
| 283 |
+
|
| 284 |
+
$page->drawLine(25, $yShipments-10, 25, $yShipments+30); //left
|
| 285 |
+
$page->drawLine(120, $yShipments-10, 120, $yShipments+30); //left
|
| 286 |
+
$page->drawLine(220, $yShipments-10, 220, $yShipments+30); //left
|
| 287 |
+
$page->drawLine(360, $yShipments-10, 360, $yShipments+30); //left
|
| 288 |
+
$page->drawLine(490, $yShipments-10, 490, $yShipments+30); //left
|
| 289 |
+
$page->drawLine(570, $yShipments-10, 570, $yShipments+30); //left
|
| 290 |
+
$page->drawLine(25, $yShipments-10, 570, $yShipments-10); //bottom
|
| 291 |
+
|
| 292 |
+
$yShipments -= $topMargin + 10;
|
| 293 |
+
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
$page->drawText(($weight), 520, $this->y+240, 'UTF-8');
|
| 297 |
+
$page->drawText((max($prod_length['length'])."*".array_sum($prod_width['width'])."*".max($prod_height['height'])), 105, $this->y+240, 'UTF-8');
|
| 298 |
+
if($order->getShippingAmount())
|
| 299 |
+
$page->drawText(Mage::helper('sales')->__('Shipping & Handling Charge : ₹') .round($order->getShippingAmount(),2),190, $yShipments-45, 'UTF-8');
|
| 300 |
+
if(strcmp($payment[0] ,'Cash On Delivery')==0){
|
| 301 |
+
$grand_total= $order->getTaxAmount() + $order->getGrandTotal();
|
| 302 |
+
$this->_setFontBold($page, 12);
|
| 303 |
+
$page->drawText(Mage::helper('sales')->__('COLLECT ONLY') ." (".strtoupper($payment[0]).") : ",190, ($yShipments-60), 'UTF-8');
|
| 304 |
+
$this->_setFontRegular($page, 10);
|
| 305 |
+
$page->drawText(Mage::helper('sales')->__('₹').$grand_total,405, ($yShipments-60), 'UTF-8');
|
| 306 |
+
$length_yship[] =$yShipments;
|
| 307 |
+
}
|
| 308 |
+
else
|
| 309 |
+
{
|
| 310 |
+
$this->_setFontBold($page, 12);
|
| 311 |
+
$page->drawText(Mage::helper('sales')->__('PRE - PAID'),210, ($yShipments-70), 'UTF-8');
|
| 312 |
+
$this->_setFontRegular($page, 10);
|
| 313 |
+
$length_yship[] =$yShipments;
|
| 314 |
+
|
| 315 |
+
}
|
| 316 |
+
$this->_setFontBold($page, 12);
|
| 317 |
+
$page->drawText(Mage::helper('sales')->__('IF UNDELIVERD RETURN TO'),35, ($yShipments-85), 'UTF-8');
|
| 318 |
+
$this->_setFontRegular($page, 10);
|
| 319 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('general/store_information/name')),35, ($yShipments-105), 'UTF-8');
|
| 320 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('shipping/origin/street_line1')."," .Mage::getStoreConfig('shipping/origin/street_line2'). " , " .Mage::getStoreConfig('shipping/origin/city')),35, ($yShipments-125), 'UTF-8');
|
| 321 |
+
$page->drawText(Mage::helper('sales')->__(Mage::getStoreConfig('shipping/origin/region_id').",".Mage::getStoreConfig('shipping/origin/postcode')),35, ($yShipments-145), 'UTF-8');
|
| 322 |
+
$page->drawText(Mage::helper('sales')->__(Mage::app()->getLocale()->getCountryTranslation(Mage::getStoreConfig('shipping/origin/country_id'))),35, ($yShipments-165), 'UTF-8');
|
| 323 |
+
$page = end($pdf->pages);
|
| 324 |
+
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
}
|
| 328 |
+
$this->zShipments -= 15;
|
| 329 |
+
$yShipments -= 15;
|
| 330 |
+
$this->_afterGetPdf();
|
| 331 |
+
if ($shipment->getStoreId()) {
|
| 332 |
+
Mage::app()->getLocale()->revert();
|
| 333 |
+
}
|
| 334 |
+
return $pdf;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
/**
|
| 338 |
+
* Create new page and assign to PDF object
|
| 339 |
+
*
|
| 340 |
+
* @param array $settings
|
| 341 |
+
* @return Zend_Pdf_Page
|
| 342 |
+
*/
|
| 343 |
+
public function newPage(array $settings = array())
|
| 344 |
+
{
|
| 345 |
+
/* Add new table head */
|
| 346 |
+
$page = $this->_getPdf()->newPage(Zend_Pdf_Page::SIZE_A4);
|
| 347 |
+
$this->_getPdf()->pages[] = $page;
|
| 348 |
+
$this->y = 800;
|
| 349 |
+
if (!empty($settings['table_header'])) {
|
| 350 |
+
$this->_drawHeader($page);
|
| 351 |
+
}
|
| 352 |
+
return $page;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
/**
|
| 358 |
+
* Set font as regular
|
| 359 |
+
*
|
| 360 |
+
* @param Zend_Pdf_Page $object
|
| 361 |
+
* @param int $size
|
| 362 |
+
* @return Zend_Pdf_Resource_Font
|
| 363 |
+
*/
|
| 364 |
+
protected function _setFontRegular($object, $size = 7)
|
| 365 |
+
{
|
| 366 |
+
$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf');
|
| 367 |
+
$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/ecomexpress/DejaVuSans.ttf');
|
| 368 |
+
$object->setFont($font, $size);
|
| 369 |
+
return $font;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
/**
|
| 375 |
+
* Insert logo to pdf page
|
| 376 |
+
*
|
| 377 |
+
* @param Zend_Pdf_Page $page
|
| 378 |
+
* @param null $store
|
| 379 |
+
*/
|
| 380 |
+
|
| 381 |
+
protected function insertEcomLogo(&$page, $store = null){
|
| 382 |
+
$this->y = $this->y ? $this->y : 815;
|
| 383 |
+
$image = Mage::getStoreConfig('carriers/ecomexpress/logo_image', $store);
|
| 384 |
+
|
| 385 |
+
if ($image) {
|
| 386 |
+
|
| 387 |
+
$image = Mage::getBaseDir('media') . '/ecomexpress-logo-images/' . $image;
|
| 388 |
+
|
| 389 |
+
if (is_file($image)) {
|
| 390 |
+
$image = Zend_Pdf_Image::imageWithPath($image);
|
| 391 |
+
$top = 830; //top border of the page
|
| 392 |
+
$widthLimit = 270; //half of the page width
|
| 393 |
+
$heightLimit = 270; //assuming the image is not a "skyscraper"
|
| 394 |
+
$width = $image->getPixelWidth();
|
| 395 |
+
$height = $image->getPixelHeight();
|
| 396 |
+
|
| 397 |
+
//preserving aspect ratio (proportions)
|
| 398 |
+
$ratio = $width / $height;
|
| 399 |
+
if ($ratio > 1 && $width > $widthLimit) {
|
| 400 |
+
$width = $widthLimit;
|
| 401 |
+
$height = $width / $ratio;
|
| 402 |
+
} elseif ($ratio < 1 && $height > $heightLimit) {
|
| 403 |
+
$height = $heightLimit;
|
| 404 |
+
$width = $height * $ratio;
|
| 405 |
+
} elseif ($ratio == 1 && $height > $heightLimit) {
|
| 406 |
+
$height = $heightLimit;
|
| 407 |
+
$width = $widthLimit;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
$y1 = $top - $height;
|
| 411 |
+
$y2 = $top;
|
| 412 |
+
$x1 = 25;
|
| 413 |
+
$x2 = $x1 + $width;
|
| 414 |
+
|
| 415 |
+
//coordinates after transformation are rounded by Zend
|
| 416 |
+
$page->drawImage($image, $x1, $y1, $x2, $y2);
|
| 417 |
+
|
| 418 |
+
$this->y = $y1 - 10;
|
| 419 |
+
}
|
| 420 |
+
}
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
|
| 424 |
+
/**
|
| 425 |
+
* Insert address to pdf page
|
| 426 |
+
*
|
| 427 |
+
* @param Zend_Pdf_Page $page
|
| 428 |
+
* @param null $store
|
| 429 |
+
*/
|
| 430 |
+
protected function insertEcomAddress(&$page, $store = null)
|
| 431 |
+
{
|
| 432 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 433 |
+
$font = $this->_setFontRegular($page, 10);
|
| 434 |
+
$page->setLineWidth(0);
|
| 435 |
+
$this->y = $this->y ? $this->y : 815;
|
| 436 |
+
$top = 815;
|
| 437 |
+
|
| 438 |
+
foreach (explode("\n", Mage::getStoreConfig('sales/identity/address', $store)) as $value){
|
| 439 |
+
if ($value !== '') {
|
| 440 |
+
$value = preg_replace('/<br[^>]*>/i', "\n", $value);
|
| 441 |
+
foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
|
| 442 |
+
$page->drawText(trim(strip_tags($_value)),
|
| 443 |
+
$this->getAlignRight($_value, 130, 440, $font, 10),
|
| 444 |
+
$top,
|
| 445 |
+
'UTF-8');
|
| 446 |
+
$top -= 10;
|
| 447 |
+
}
|
| 448 |
+
}
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
$this->y = ($this->y > $top) ? $top : $this->y;
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
/**
|
| 455 |
+
* Format address
|
| 456 |
+
*
|
| 457 |
+
* @param string $address
|
| 458 |
+
* @return array
|
| 459 |
+
*/
|
| 460 |
+
protected function _formatAddress($address)
|
| 461 |
+
{
|
| 462 |
+
$return = array();
|
| 463 |
+
foreach (explode('|', $address) as $str) {
|
| 464 |
+
foreach (Mage::helper('core/string')->str_split($str, 45, true, true) as $part) {
|
| 465 |
+
if (empty($part)) {
|
| 466 |
+
continue;
|
| 467 |
+
}
|
| 468 |
+
$return[] = $part;
|
| 469 |
+
}
|
| 470 |
+
}
|
| 471 |
+
return $return;
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
/**
|
| 475 |
+
* Calculate address height
|
| 476 |
+
*
|
| 477 |
+
* @param array $address
|
| 478 |
+
* @return int Height
|
| 479 |
+
*/
|
| 480 |
+
protected function _calcAddressHeight($address)
|
| 481 |
+
{
|
| 482 |
+
$y = 0;
|
| 483 |
+
foreach ($address as $value){
|
| 484 |
+
if ($value !== '') {
|
| 485 |
+
$text = array();
|
| 486 |
+
foreach (Mage::helper('core/string')->str_split($value, 55, true, true) as $_value) {
|
| 487 |
+
$text[] = $_value;
|
| 488 |
+
}
|
| 489 |
+
foreach ($text as $part) {
|
| 490 |
+
$y += 15;
|
| 491 |
+
}
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
return $y;
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
/**
|
| 498 |
+
* Insert order to pdf page
|
| 499 |
+
*
|
| 500 |
+
* @param Zend_Pdf_Page $page
|
| 501 |
+
* @param Mage_Sales_Model_Order $obj
|
| 502 |
+
* @param bool $putOrderId
|
| 503 |
+
*/
|
| 504 |
+
protected function insertEcomOrder(&$page, $obj, $putOrderId = true)
|
| 505 |
+
{
|
| 506 |
+
$yShipments =60;
|
| 507 |
+
if ($obj instanceof Mage_Sales_Model_Order) {
|
| 508 |
+
$shipment = null;
|
| 509 |
+
$order = $obj;
|
| 510 |
+
} elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
|
| 511 |
+
$shipment = $obj;
|
| 512 |
+
$order = $shipment->getOrder();
|
| 513 |
+
}
|
| 514 |
+
$this->y = $this->y ? $this->y : 815;
|
| 515 |
+
$top = $this->y;
|
| 516 |
+
$margin = $this->ax1 =100;
|
| 517 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
|
| 518 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
|
| 519 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 520 |
+
$this->setDocHeaderCoordinates(array(25, $top, 570, $top - 55));
|
| 521 |
+
$this->_setFontRegular($page, 10);
|
| 522 |
+
$page->drawText(Mage::helper('sales')->__() , 35, ($top -= 30), 'UTF-8');
|
| 523 |
+
$page->drawText(Mage::helper('sales')->__(),35,($top -= 15),'UTF-8');
|
| 524 |
+
$top -= 10;
|
| 525 |
+
$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
|
| 526 |
+
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
|
| 527 |
+
$page->setLineWidth(0.5);
|
| 528 |
+
|
| 529 |
+
/* Calculate blocks info */
|
| 530 |
+
|
| 531 |
+
/* Billing Address */
|
| 532 |
+
|
| 533 |
+
$billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
|
| 534 |
+
|
| 535 |
+
/* Payment */
|
| 536 |
+
$paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
|
| 537 |
+
->setIsSecureMode(true)
|
| 538 |
+
->toPdf();
|
| 539 |
+
$paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
|
| 540 |
+
$payment = explode('{{pdf_row_separator}}', $paymentInfo);
|
| 541 |
+
|
| 542 |
+
foreach ($payment as $key=>$value){
|
| 543 |
+
if (strip_tags(trim($value)) == '') {
|
| 544 |
+
unset($payment[$key]);
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
reset($payment);
|
| 548 |
+
|
| 549 |
+
/* Shipping Address and Method */
|
| 550 |
+
if (!$order->getIsVirtual()) {
|
| 551 |
+
/* Shipping Address */
|
| 552 |
+
$shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
|
| 553 |
+
$shippingMethod = $order->getShippingDescription();
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 557 |
+
|
| 558 |
+
$addressesHeight = $this->_calcAddressHeight($billingAddress);
|
| 559 |
+
if (isset($shippingAddress)) {
|
| 560 |
+
$addressesHeight = max($addressesHeight, $this->_calcAddressHeight($shippingAddress));
|
| 561 |
+
}
|
| 562 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 563 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 564 |
+
$this->_setFontRegular($page, 10);
|
| 565 |
+
$this->y = $top - 40;
|
| 566 |
+
$addressesStartY = $this->y;
|
| 567 |
+
$this->_setFontBold($page, 12);
|
| 568 |
+
$this->_setFontRegular($page, 10);
|
| 569 |
+
$yShipments +=55;
|
| 570 |
+
foreach ($shipping_from as $value){
|
| 571 |
+
if ($value !== '') {
|
| 572 |
+
$text = array();
|
| 573 |
+
foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
|
| 574 |
+
$text[] = $_value;
|
| 575 |
+
}
|
| 576 |
+
foreach ($text as $part) {
|
| 577 |
+
$this->y -= 15;
|
| 578 |
+
}
|
| 579 |
+
}
|
| 580 |
+
}
|
| 581 |
+
|
| 582 |
+
$addressesEndY = $this->y;
|
| 583 |
+
if (!$order->getIsVirtual()) {
|
| 584 |
+
|
| 585 |
+
$this->y = $addressesStartY;
|
| 586 |
+
$shippingAddress = $order->getShippingAddress()->getData();
|
| 587 |
+
$this->_setFontBold($page, 12);
|
| 588 |
+
$page->drawText(Mage::helper('sales')->__('MOBILE NO:'),40, $this->y-60, 'UTF-8');
|
| 589 |
+
$this->_setFontRegular($page, 10);
|
| 590 |
+
$page->drawText(Mage::helper('sales')->__($shippingAddress['telephone']),110, $this->y-60, 'UTF-8');
|
| 591 |
+
$this->y -= 15;
|
| 592 |
+
if(isset($shippingAddress['middlename'])){
|
| 593 |
+
$page->drawText($shippingAddress['firstname']." ".$shippingAddress['middlename']." ".$shippingAddress['lastname'], 40, $this->y-65, 'UTF-8');
|
| 594 |
+
}
|
| 595 |
+
else{
|
| 596 |
+
$page->drawText($shippingAddress['firstname']." ".$shippingAddress['lastname'], 40, $this->y-65, 'UTF-8');
|
| 597 |
+
}
|
| 598 |
+
$this->y -= 25;
|
| 599 |
+
$page->drawText(preg_replace('/\s+/', ' ', $shippingAddress['street']. " " .trim($shippingAddress['city'])) , $this->ax1-60 , $this->y-65, 'UTF-8');
|
| 600 |
+
|
| 601 |
+
$this->y -= 25;
|
| 602 |
+
$this->_setFontBold($page, 12);
|
| 603 |
+
$page->drawText(Mage::helper('sales')->__('Destination: ' ),$this->ax1-60, $this->y-60, 'UTF-8');
|
| 604 |
+
$this->_setFontRegular($page, 10);
|
| 605 |
+
$page->drawText(Mage::helper('sales')->__($shippingAddress['city'].",".$shippingAddress['region'].",".$shippingAddress['postcode']),$this->ax1+5, $this->y-60, 'UTF-8');
|
| 606 |
+
$this->_setFontBold($page, 15);
|
| 607 |
+
$page->drawText(Mage::helper('sales')->__('ORDER DETAILS:'),260, $this->y-100, 'UTF-8');
|
| 608 |
+
$this->_setFontRegular($page, 10);
|
| 609 |
+
|
| 610 |
+
$addressesEndY = min($addressesEndY, $this->y);
|
| 611 |
+
$this->y = $addressesEndY;
|
| 612 |
+
$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
|
| 613 |
+
$page->setLineWidth(0.5);
|
| 614 |
+
|
| 615 |
+
$this->y -= 15;
|
| 616 |
+
$this->_setFontBold($page, 12);
|
| 617 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 618 |
+
|
| 619 |
+
$this->y -=10;
|
| 620 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 621 |
+
$this->_setFontRegular($page, 10);
|
| 622 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
|
| 623 |
+
$paymentLeft = 35;
|
| 624 |
+
$yPayments = $this->y - 15;
|
| 625 |
+
}
|
| 626 |
+
else {
|
| 627 |
+
$yPayments = $addressesStartY;
|
| 628 |
+
$paymentLeft = 285;
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
foreach ($payment as $value){
|
| 632 |
+
if (trim($value) != '') {
|
| 633 |
+
//Printing "Payment Method" lines
|
| 634 |
+
$value = preg_replace('/<br[^>]*>/i', "\n", $value);
|
| 635 |
+
|
| 636 |
+
foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
|
| 637 |
+
$yPayments -= 15;
|
| 638 |
+
}
|
| 639 |
+
}
|
| 640 |
+
}
|
| 641 |
+
|
| 642 |
+
if ($order->getIsVirtual()) {
|
| 643 |
+
// replacement of Shipments-Payments rectangle block
|
| 644 |
+
$yPayments = min($addressesEndY, $yPayments);
|
| 645 |
+
$page->drawLine(25, ($top - 25), 25, $yPayments);
|
| 646 |
+
$page->drawLine(570, ($top - 25), 570, $yPayments);
|
| 647 |
+
$page->drawLine(25, $yPayments, 570, $yPayments);
|
| 648 |
+
|
| 649 |
+
$this->y = $yPayments - 15;
|
| 650 |
+
} else {
|
| 651 |
+
$topMargin = 15;
|
| 652 |
+
$methodStartY = $this->y;
|
| 653 |
+
$this->y -= 15;
|
| 654 |
+
|
| 655 |
+
foreach (Mage::helper('core/string')->str_split($shippingMethod, 45, true, true) as $_value) {
|
| 656 |
+
$this->y -= 15;
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
$yShipments = $this->y;
|
| 660 |
+
$yShipments -= $topMargin + 10;
|
| 661 |
+
$tracks = array();
|
| 662 |
+
if ($shipment) {
|
| 663 |
+
$tracks = $shipment->getAllTracks();
|
| 664 |
+
}
|
| 665 |
+
if (count($tracks)) {
|
| 666 |
+
$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
|
| 667 |
+
$page->setLineWidth(0.5);
|
| 668 |
+
|
| 669 |
+
$this->_setFontRegular($page, 9);
|
| 670 |
+
$yShipments -= 20;
|
| 671 |
+
$this->_setFontRegular($page, 8);
|
| 672 |
+
foreach ($tracks as $track) {
|
| 673 |
+
|
| 674 |
+
$CarrierCode = $track->getCarrierCode();
|
| 675 |
+
if ($CarrierCode != 'custom') {
|
| 676 |
+
$carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($CarrierCode);
|
| 677 |
+
$carrierTitle = $carrier->getConfigData('title');
|
| 678 |
+
} else {
|
| 679 |
+
$carrierTitle = Mage::helper('sales')->__('Custom Value');
|
| 680 |
+
}
|
| 681 |
+
$maxTitleLen = 45;
|
| 682 |
+
$endOfTitle = strlen($track->getTitle()) > $maxTitleLen ? '...' : '';
|
| 683 |
+
$truncatedTitle = substr($track->getTitle(), 0, $maxTitleLen) . $endOfTitle;
|
| 684 |
+
|
| 685 |
+
$yShipments -= $topMargin - 5;
|
| 686 |
+
}
|
| 687 |
+
} else {
|
| 688 |
+
$yShipments -= $topMargin - 5;
|
| 689 |
+
}
|
| 690 |
+
$currentY = min($yPayments, $yShipments);
|
| 691 |
+
$this->y = $currentY;
|
| 692 |
+
$this->y -= 15;
|
| 693 |
+
}
|
| 694 |
+
$yShipments -=20;
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
/**
|
| 698 |
+
* Insert title and number for concrete document type
|
| 699 |
+
*
|
| 700 |
+
* @param Zend_Pdf_Page $page
|
| 701 |
+
* @param string $text
|
| 702 |
+
* @return void
|
| 703 |
+
*/
|
| 704 |
+
public function insertEcomDocumentNumber(Zend_Pdf_Page $page, $text)
|
| 705 |
+
{
|
| 706 |
+
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
|
| 707 |
+
$this->_setFontRegular($page, 10);
|
| 708 |
+
$docHeader = $this->getDocHeaderCoordinates();
|
| 709 |
+
$page->drawText($text, 35, $docHeader[1] - 15, 'UTF-8');
|
| 710 |
+
}
|
| 711 |
+
|
| 712 |
+
/**
|
| 713 |
+
* Sort totals list
|
| 714 |
+
*
|
| 715 |
+
* @param array $a
|
| 716 |
+
* @param array $b
|
| 717 |
+
* @return int
|
| 718 |
+
*/
|
| 719 |
+
protected function _sortTotalsList($a, $b) {
|
| 720 |
+
if (!isset($a['sort_order']) || !isset($b['sort_order'])) {
|
| 721 |
+
return 0;
|
| 722 |
+
}
|
| 723 |
+
|
| 724 |
+
if ($a['sort_order'] == $b['sort_order']) {
|
| 725 |
+
return 0;
|
| 726 |
+
}
|
| 727 |
+
|
| 728 |
+
return ($a['sort_order'] > $b['sort_order']) ? 1 : -1;
|
| 729 |
+
}
|
| 730 |
+
}
|
| 731 |
+
|
app/code/local/Ecom/Express/Model/Pincode.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Model_Pincode extends Mage_Core_Model_Abstract {
|
| 19 |
+
|
| 20 |
+
public function _construct() {
|
| 21 |
+
parent::_construct();
|
| 22 |
+
$this->_init('ecomexpress/pincode');
|
| 23 |
+
}
|
| 24 |
+
/**
|
| 25 |
+
* Function to load pincode details by pincode number
|
| 26 |
+
*
|
| 27 |
+
* @return pincode object
|
| 28 |
+
*/
|
| 29 |
+
public function loadByPincode($pincode)
|
| 30 |
+
{
|
| 31 |
+
|
| 32 |
+
$resource = Mage::getSingleton('core/resource');
|
| 33 |
+
$readConnection = $resource->getConnection('core_read');
|
| 34 |
+
$query = "SELECT * FROM " . $resource->getTableName('ecomexpress/pincode')." WHERE pincode = $pincode";
|
| 35 |
+
$data = $readConnection->fetchOne($query);
|
| 36 |
+
return $data;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Function to delete all pincode
|
| 41 |
+
*
|
| 42 |
+
*/
|
| 43 |
+
public function delete_pinocdeAll()
|
| 44 |
+
{
|
| 45 |
+
|
| 46 |
+
$resource = Mage::getSingleton('core/resource');
|
| 47 |
+
$readConnection = $resource->getConnection('core_read');
|
| 48 |
+
$query = "TRUNCATE TABLE ".$resource->getTableName('ecomexpress/pincode');
|
| 49 |
+
$readConnection->query($query);
|
| 50 |
+
}
|
| 51 |
+
}
|
app/code/local/Ecom/Express/controllers/Adminhtml/AwbController.php
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Adminhtml_AwbController extends Mage_Adminhtml_Controller_Action {
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Init Action to specify active menu and breadcrumb of the module
|
| 23 |
+
*/
|
| 24 |
+
protected function _initAction() {
|
| 25 |
+
$this->loadLayout()
|
| 26 |
+
->_setActiveMenu('ecomexpress/items')
|
| 27 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
| 28 |
+
|
| 29 |
+
return $this;
|
| 30 |
+
}
|
| 31 |
+
/**
|
| 32 |
+
* Function to render waybill layout block
|
| 33 |
+
*/
|
| 34 |
+
public function indexAction() {
|
| 35 |
+
$this->_initAction()
|
| 36 |
+
->renderLayout();
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Loads default grid view of admin module
|
| 41 |
+
*/
|
| 42 |
+
|
| 43 |
+
public function gridAction()
|
| 44 |
+
{
|
| 45 |
+
$this->loadLayout();
|
| 46 |
+
$this->getResponse()->setBody(
|
| 47 |
+
$this->getLayout()->createBlock('ecomexpress/adminhtml_awb_grid')->toHtml());
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Function to fetch more waybills for the current client
|
| 52 |
+
*/
|
| 53 |
+
|
| 54 |
+
public function fetchAction()
|
| 55 |
+
{
|
| 56 |
+
$params = array();
|
| 57 |
+
$params['type'] = $this->getRequest()->getParam('awb');
|
| 58 |
+
|
| 59 |
+
$count = count(Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('awb_type',$params['type'])->addFieldToFilter('state',0)->getData());
|
| 60 |
+
$fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/fetch_awb');
|
| 61 |
+
$max_fetch_awb = Mage::getStoreConfig('carriers/ecomexpress/max_fetch_awb');
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
if($fetch_awb <= $max_fetch_awb) {
|
| 65 |
+
|
| 66 |
+
$type = 'post';
|
| 67 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 68 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 69 |
+
$params['count'] = $fetch_awb;
|
| 70 |
+
|
| 71 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1){
|
| 72 |
+
$url = 'http://ecomm.prtouch.com/apiv2/fetch_awb/';
|
| 73 |
+
}
|
| 74 |
+
else {
|
| 75 |
+
$url = 'http://api.ecomexpress.in/apiv2/fetch_awb/';
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
if($params)
|
| 79 |
+
{
|
| 80 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 81 |
+
$getSessionInfo = Mage::getSingleton('core/session')->getInfoMsg();
|
| 82 |
+
|
| 83 |
+
if(isset($getSessionInfo)){
|
| 84 |
+
|
| 85 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionInfo));
|
| 86 |
+
Mage::getSingleton('core/session')->unsInfoMsg();
|
| 87 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 88 |
+
return ;
|
| 89 |
+
}
|
| 90 |
+
$getSessionMsg = Mage::getSingleton('core/session')->getMyMsg();
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
if(isset($getSessionMsg)){
|
| 94 |
+
|
| 95 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionMsg));
|
| 96 |
+
Mage::getSingleton('core/session')->unsMyMsg();
|
| 97 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 98 |
+
return;
|
| 99 |
+
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
$awb_codes = Mage::helper('core')->jsonDecode($retValue);
|
| 103 |
+
if(empty($awb_codes))
|
| 104 |
+
{
|
| 105 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('Please add valid Username,Password and Count in plugin configuration'));
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
foreach ($awb_codes['awb'] as $key => $item)
|
| 109 |
+
{
|
| 110 |
+
try{
|
| 111 |
+
$model = Mage::getModel('ecomexpress/awb');
|
| 112 |
+
$data = array();
|
| 113 |
+
$data['awb'] = $item;
|
| 114 |
+
$data['state'] = 0;
|
| 115 |
+
$data['awb_type'] = $params['type'];
|
| 116 |
+
$data['created_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 117 |
+
$data['updated_at'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 118 |
+
$model->setData($data);
|
| 119 |
+
$model->save();
|
| 120 |
+
}
|
| 121 |
+
catch (Exception $e)
|
| 122 |
+
{
|
| 123 |
+
echo 'Caught exception: ', $e->getMessage(), "\n";
|
| 124 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ecomexpress')->__('AWB Downloaded Successfully'));
|
| 130 |
+
}
|
| 131 |
+
else
|
| 132 |
+
{ Mage::log('cron fired', null , 'mylog.log' , true );
|
| 133 |
+
|
| 134 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('Please add valid Username,Password and Count in plugin configuration'));
|
| 135 |
+
}
|
| 136 |
+
$this->_redirect('*/*/');
|
| 137 |
+
|
| 138 |
+
}
|
| 139 |
+
else {
|
| 140 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('AWB Fetch cross the maximum limit'));
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
public function flushAwbAction(){
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
$resource = Mage::getSingleton('core/resource');
|
| 150 |
+
$readConnection = $resource->getConnection('core_read');
|
| 151 |
+
$query = "TRUNCATE TABLE ".$resource->getTableName('ecomexpress/awb');
|
| 152 |
+
$readConnection->query($query);
|
| 153 |
+
|
| 154 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ecomexpress')->__('AWB Flush Successfully'));
|
| 155 |
+
|
| 156 |
+
$this->_redirect('adminhtml/adminhtml_awb/index/');
|
| 157 |
+
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/**
|
| 161 |
+
* Function to export grid rows in CSV format
|
| 162 |
+
*/
|
| 163 |
+
public function exportCsvAction() {
|
| 164 |
+
$fileName = 'awb.csv';
|
| 165 |
+
$content = $this->getLayout()->createBlock('ecomexpress/adminhtml_awb_grid')
|
| 166 |
+
->getCsv();
|
| 167 |
+
|
| 168 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 169 |
+
}
|
| 170 |
+
/**
|
| 171 |
+
* Function to export grid rows in XML format
|
| 172 |
+
*/
|
| 173 |
+
public function exportXmlAction() {
|
| 174 |
+
$fileName = 'awb.xml';
|
| 175 |
+
$content = $this->getLayout()->createBlock('ecomexpress/adminhtml_awb_grid')
|
| 176 |
+
->getXml();
|
| 177 |
+
|
| 178 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
*
|
| 183 |
+
* @param $fileName
|
| 184 |
+
* @param $content
|
| 185 |
+
* @param string $contentType
|
| 186 |
+
*/
|
| 187 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
$response = $this->getResponse();
|
| 191 |
+
$response->setHeader('HTTP/1.1 200 OK', '');
|
| 192 |
+
$response->setHeader('Pragma', 'public', true);
|
| 193 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 194 |
+
$response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
|
| 195 |
+
$response->setHeader('Last-Modified', date('r'));
|
| 196 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
| 197 |
+
$response->setHeader('Content-Length', strlen($content));
|
| 198 |
+
$response->setHeader('Content-type', $contentType);
|
| 199 |
+
$response->setBody($content);
|
| 200 |
+
$response->sendResponse();
|
| 201 |
+
die;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
}
|
app/code/local/Ecom/Express/controllers/Adminhtml/CancelController.php
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Adminhtml_CancelController extends Mage_Adminhtml_Controller_Action {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
*
|
| 22 |
+
* Function to cancel AWB
|
| 23 |
+
*/
|
| 24 |
+
public function cancelAWBAction()
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
$params= array();
|
| 28 |
+
$shipment_ids = $this->getRequest()->getParam('shipment_ids');
|
| 29 |
+
|
| 30 |
+
if($shipment_ids)
|
| 31 |
+
{
|
| 32 |
+
$track_awb= Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('shipment_id',$shipment_ids)->getData();
|
| 33 |
+
$type = 'post';
|
| 34 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 35 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 36 |
+
$params_info =array();
|
| 37 |
+
|
| 38 |
+
foreach($track_awb as $awb){
|
| 39 |
+
$params_info['awb'][] = $awb['awb'];
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
$params['awbs'] = implode(",",$params_info['awb']);
|
| 43 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1){
|
| 44 |
+
$url = 'http://ecomm.prtouch.com/apiv2/cancel_awb/';
|
| 45 |
+
}
|
| 46 |
+
else {
|
| 47 |
+
$url = 'http://api.ecomexpress.in/apiv2/cancel_awb/';
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
if($params)
|
| 51 |
+
{
|
| 52 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 53 |
+
$getSessionInfo = Mage::getSingleton('core/session')->getInfoMsg();
|
| 54 |
+
|
| 55 |
+
if(isset($getSessionInfo)){
|
| 56 |
+
|
| 57 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionInfo));
|
| 58 |
+
Mage::getSingleton('core/session')->unsInfoMsg();
|
| 59 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 60 |
+
return ;
|
| 61 |
+
}
|
| 62 |
+
$getSessionMsg = Mage::getSingleton('core/session')->getMyMsg();
|
| 63 |
+
if(isset($getSessionMsg)){
|
| 64 |
+
|
| 65 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionMsg));
|
| 66 |
+
Mage::getSingleton('core/session')->unsMyMsg();
|
| 67 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 68 |
+
return;
|
| 69 |
+
|
| 70 |
+
}
|
| 71 |
+
$awb_codes = Mage::helper('core')->jsonDecode($retValue);
|
| 72 |
+
$params_response =array();
|
| 73 |
+
foreach($awb_codes as $awb_msg)
|
| 74 |
+
{
|
| 75 |
+
$params_response['reason']= $awb_msg['reason'];
|
| 76 |
+
$params_response['order_number']= $awb_msg['order_number'];
|
| 77 |
+
$params_response['awb'] = $awb_msg['awb'];
|
| 78 |
+
|
| 79 |
+
if($awb_msg['success'] !=1)
|
| 80 |
+
{
|
| 81 |
+
$params_response['success'] = 'Cancelled Failure';
|
| 82 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ecomexpress')->__("Shipment for the AWB number " . $params_response['awb']. " is ". $params_response['success']." ". $params_response['reason']));
|
| 83 |
+
|
| 84 |
+
}
|
| 85 |
+
else {
|
| 86 |
+
|
| 87 |
+
$params_response['success'] = 'Cancelled Successfully';
|
| 88 |
+
$model = Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('shipment_id',$shipment_ids)->getData();
|
| 89 |
+
|
| 90 |
+
$cancel_model = Mage::getModel('ecomexpress/awb');
|
| 91 |
+
|
| 92 |
+
foreach($model as $cancel){
|
| 93 |
+
|
| 94 |
+
$cancel['status']='Cancelled';
|
| 95 |
+
$cancel_data = $cancel_model->getCollection()->addFieldToFilter('awb',$cancel['awb'])->getFirstItem()->getData();
|
| 96 |
+
$cancel_model->load($cancel_data['awb_id'])->setData('status',$cancel['status']);
|
| 97 |
+
$cancel_model->save();
|
| 98 |
+
}
|
| 99 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ecomexpress')->__("Shipment for the order number " .$params_response['order_number']. " and AWB number " . $params_response['awb']. " is ". $params_response['success']));
|
| 100 |
+
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
if(empty($awb_codes))
|
| 104 |
+
{
|
| 105 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('Please add valid Username,Password and AWB in plugin configuration'));
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
else
|
| 110 |
+
{
|
| 111 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('Shipment is not Canceled'));
|
| 112 |
+
}
|
| 113 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 114 |
+
}
|
| 115 |
+
}
|
app/code/local/Ecom/Express/controllers/Adminhtml/IndexController.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
class Ecom_Express_IndexController extends Mage_Core_Controller_Front_Action {
|
| 20 |
+
|
| 21 |
+
public function printAction()
|
| 22 |
+
{
|
| 23 |
+
|
| 24 |
+
/** @see Mage_Adminhtml_Sales_Order_InvoiceController */
|
| 25 |
+
if ($shipmentId = $this->getRequest()->getParam('invoice_id')) { // invoice_id o_0
|
| 26 |
+
if ($shipment = Mage::getModel('sales/order_shipment')->load($shipmentId)) {
|
| 27 |
+
$pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf(array($shipment));
|
| 28 |
+
$this->_prepareDownloadResponse('packingslip'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf', $pdf->render(), 'application/pdf');
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
else {
|
| 32 |
+
$this->_forward('noRoute');
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
}
|
app/code/local/Ecom/Express/controllers/Adminhtml/PincodeController.php
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Adminhtml_PincodeController extends Mage_Adminhtml_Controller_Action {
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Init Action to specify active menu and breadcrumb of the module
|
| 23 |
+
*/
|
| 24 |
+
protected function _initAction() {
|
| 25 |
+
|
| 26 |
+
$this->loadLayout()
|
| 27 |
+
->_setActiveMenu('ecomexpress/items')
|
| 28 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
| 29 |
+
$id = $this->getRequest()->getParam('id');
|
| 30 |
+
$model = Mage::getModel('ecomexpress/pincode')->load($id);
|
| 31 |
+
if ($model->getId() || $id == 0) {
|
| 32 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
| 33 |
+
if (!empty($data)) {
|
| 34 |
+
$model->setData($data);
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
Mage::register('pincode_data', $model);
|
| 38 |
+
return $this;
|
| 39 |
+
}
|
| 40 |
+
/**
|
| 41 |
+
* Function to render pincode layout block
|
| 42 |
+
*/
|
| 43 |
+
public function indexAction() {
|
| 44 |
+
$this->_initAction()
|
| 45 |
+
->renderLayout();
|
| 46 |
+
}
|
| 47 |
+
/**
|
| 48 |
+
* Loads default grid view of admin module
|
| 49 |
+
*/
|
| 50 |
+
public function pincodegridAction() {
|
| 51 |
+
$this->_initAction();
|
| 52 |
+
$this->getResponse()->setBody(
|
| 53 |
+
$this->getLayout()->createBlock('ecomexpress/adminhtml_pincode_edit_tab_pincode')->toHtml()
|
| 54 |
+
);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Function to download Ecomexpress serviceable pincodes
|
| 59 |
+
*/
|
| 60 |
+
public function fetchAction()
|
| 61 |
+
{
|
| 62 |
+
$params = array();
|
| 63 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 64 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 65 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1){
|
| 66 |
+
$url = 'http://ecomm.prtouch.com/apiv2/pincodes/';
|
| 67 |
+
}
|
| 68 |
+
else {
|
| 69 |
+
$url = 'http://api.ecomexpress.in/apiv2/pincodes/';
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
if($params)
|
| 73 |
+
{
|
| 74 |
+
$type = 'post';
|
| 75 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 76 |
+
$getSessionInfo = Mage::getSingleton('core/session')->getInfoMsg();
|
| 77 |
+
|
| 78 |
+
if(isset($getSessionInfo)){
|
| 79 |
+
|
| 80 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionInfo));
|
| 81 |
+
Mage::getSingleton('core/session')->unsInfoMsg();
|
| 82 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 83 |
+
return ;
|
| 84 |
+
}
|
| 85 |
+
$getSessionMsg = Mage::getSingleton('core/session')->getMyMsg();
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
if(isset($getSessionMsg)){
|
| 89 |
+
|
| 90 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionMsg));
|
| 91 |
+
Mage::getSingleton('core/session')->unsMyMsg();
|
| 92 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 93 |
+
return;
|
| 94 |
+
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
$pin_codes = Mage::helper('core')->jsonDecode($retValue);
|
| 98 |
+
$sort_pincodes = array();
|
| 99 |
+
foreach ($pin_codes as $key => $row)
|
| 100 |
+
{
|
| 101 |
+
$sort_pincodes[$key] = $row['pincode'];
|
| 102 |
+
}
|
| 103 |
+
array_multisort($sort_pincodes,SORT_ASC, $pin_codes);
|
| 104 |
+
if(empty($pin_codes))
|
| 105 |
+
{
|
| 106 |
+
return false;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
// Delete all pincodes
|
| 110 |
+
$delete = Mage::getModel('ecomexpress/pincode')->delete_pinocdeAll();
|
| 111 |
+
if(sizeof($pin_codes))
|
| 112 |
+
{
|
| 113 |
+
foreach ($pin_codes as $key => $item) {
|
| 114 |
+
|
| 115 |
+
try {
|
| 116 |
+
$model = Mage::getModel('ecomexpress/pincode');
|
| 117 |
+
$data = array();
|
| 118 |
+
$data['pincode'] = $item['pincode'];
|
| 119 |
+
$data['city'] = $item['city'];
|
| 120 |
+
$data['state'] = $item['state'];
|
| 121 |
+
$data['dccode'] = $item['dccode'];
|
| 122 |
+
$data['city_code'] = $item['city_code'];
|
| 123 |
+
$data['state_code'] = $item['state_code'];
|
| 124 |
+
$data['date_of_discontinuance'] = $item['date_of_discontinuance'];
|
| 125 |
+
$data['created_at']=Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 126 |
+
$data['updated_at']=Mage::getModel('core/date')->date('Y-m-d H:i:s');
|
| 127 |
+
$model->setData($data);
|
| 128 |
+
$model->save();
|
| 129 |
+
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
catch (Exception $e)
|
| 133 |
+
{
|
| 134 |
+
echo 'Caught exception: ', $e->getMessage(), "\n";
|
| 135 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ecomexpress')->__('Pincode Updated Successfully'));
|
| 140 |
+
}
|
| 141 |
+
else
|
| 142 |
+
{
|
| 143 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__('Please add valid Username and Password'));
|
| 144 |
+
}
|
| 145 |
+
$this->_redirect('*/*/');
|
| 146 |
+
}
|
| 147 |
+
}
|
app/code/local/Ecom/Express/controllers/Adminhtml/TrackController.php
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_Adminhtml_TrackController extends Mage_Adminhtml_Controller_Action {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Function to fetch the track status
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
public function trackingAWBAction()
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
$params= array();
|
| 28 |
+
$shipment_ids = $this->getRequest()->getParam('shipment_ids');
|
| 29 |
+
|
| 30 |
+
if($shipment_ids){
|
| 31 |
+
|
| 32 |
+
$track_awb= Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('shipment_id',$shipment_ids)->getData();
|
| 33 |
+
$type = 'post';
|
| 34 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 35 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 36 |
+
$params_info = array();
|
| 37 |
+
|
| 38 |
+
foreach($track_awb as $awb){
|
| 39 |
+
|
| 40 |
+
$order= Mage::getModel('sales/order')->load($awb['orderid'])->getData();
|
| 41 |
+
$params_info['awb'][] = $awb['awb'];
|
| 42 |
+
$params_info['orderid'][] = $order['increment_id'];
|
| 43 |
+
// $params_info['orderid'][] = $awb['orderid'];
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
$params['awb'] = implode(",",$params_info['awb']);
|
| 48 |
+
$params['orderid'] = implode(",",$params_info['orderid']);
|
| 49 |
+
|
| 50 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1){
|
| 51 |
+
|
| 52 |
+
$url = 'http://ecomm.prtouch.com/track_me/api/mawbd/';
|
| 53 |
+
|
| 54 |
+
}
|
| 55 |
+
else {
|
| 56 |
+
$url = 'http://api.ecomexpress.in/track_me/api/mawbd/';
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if($params)
|
| 60 |
+
{
|
| 61 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 62 |
+
$getSessionInfo = Mage::getSingleton('core/session')->getInfoMsg();
|
| 63 |
+
|
| 64 |
+
$xml = simplexml_load_string($retValue, 'SimpleXMLElement', LIBXML_NOCDATA);
|
| 65 |
+
$array = json_decode(json_encode($xml), TRUE);
|
| 66 |
+
|
| 67 |
+
if(empty($array['object'])){
|
| 68 |
+
echo '<h4>Ecom service is currently Unavilable , please try after Sometime !!!<h4>';
|
| 69 |
+
return ;
|
| 70 |
+
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
if(isset($getSessionInfo)){
|
| 74 |
+
|
| 75 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionInfo));
|
| 76 |
+
Mage::getSingleton('core/session')->unsInfoMsg();
|
| 77 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 78 |
+
return ;
|
| 79 |
+
}
|
| 80 |
+
$getSessionMsg = Mage::getSingleton('core/session')->getMyMsg();
|
| 81 |
+
|
| 82 |
+
if(isset($getSessionMsg)){
|
| 83 |
+
|
| 84 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionMsg));
|
| 85 |
+
Mage::getSingleton('core/session')->unsMyMsg();
|
| 86 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 87 |
+
return;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
echo" <h2> Track Order Status</h2>
|
| 91 |
+
<table border=\"5\" cellpadding=\"5\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#808080\" width=\"100%\" id=\"AutoNumber2\" bgcolor=\"#C0C0C0\">
|
| 92 |
+
<tr>
|
| 93 |
+
<td>S.No</td>
|
| 94 |
+
<td>AWB</td>
|
| 95 |
+
<td>OrderId</td>
|
| 96 |
+
<td>Weight</td>
|
| 97 |
+
<td>Origin</td>
|
| 98 |
+
<td>Destination</td>
|
| 99 |
+
<td>Location Name</td>
|
| 100 |
+
<td>Current Location Name</td>
|
| 101 |
+
<td>Zip Code</td>
|
| 102 |
+
<td>Shipping Name</td>
|
| 103 |
+
<td>Consignee Name</td>
|
| 104 |
+
<td>Pick up Date</td>
|
| 105 |
+
<td>Status</td>
|
| 106 |
+
<td>Expected Date</td>
|
| 107 |
+
<td>Last Date</td>
|
| 108 |
+
</tr>";
|
| 109 |
+
$i=1;
|
| 110 |
+
foreach($array['object'] as $key => $val){
|
| 111 |
+
if (!is_int($key) && $key == 'field'){
|
| 112 |
+
if($val[15] =='Shipment RTO Lock') {
|
| 113 |
+
$val[10]= 'Cancelled';
|
| 114 |
+
}
|
| 115 |
+
echo "<tr>
|
| 116 |
+
<td>".$i."</td>
|
| 117 |
+
<td>".$val[0]."</td>
|
| 118 |
+
<td>".$val[1]."</td>
|
| 119 |
+
<td>".$val[2]."</td>
|
| 120 |
+
<td>".$val[3]."</td>
|
| 121 |
+
<td>".$val[4]."</td>
|
| 122 |
+
<td>".$val[5]."</td>
|
| 123 |
+
<td>".$val[6]."</td>
|
| 124 |
+
<td>".$val[25]."</td>
|
| 125 |
+
<td>".$val[7]."</td>
|
| 126 |
+
<td>".$val[8]."</td>
|
| 127 |
+
<td>".$val[9]."</td>
|
| 128 |
+
<td>".$val[10]."</td>
|
| 129 |
+
<td>".$val[17]."</td>
|
| 130 |
+
<td>".$val[18]."</td>
|
| 131 |
+
</tr>";
|
| 132 |
+
} else if(is_int($key)){
|
| 133 |
+
if($val['field'][15] =='Shipment RTO Lock') {
|
| 134 |
+
$val['field'][10]= 'Cancelled';
|
| 135 |
+
}
|
| 136 |
+
echo "<tr>
|
| 137 |
+
<td>".$i."</td>
|
| 138 |
+
<td>".$val['field'][0]."</td>
|
| 139 |
+
<td>".$val['field'][1]."</td>
|
| 140 |
+
<td>".$val['field'][2]."</td>
|
| 141 |
+
<td>".$val['field'][3]."</td>
|
| 142 |
+
<td>".$val['field'][4]."</td>
|
| 143 |
+
<td>".$val['field'][5]."</td>
|
| 144 |
+
<td>".$val['field'][6]."</td>
|
| 145 |
+
<td>".$val['field'][25]."</td>
|
| 146 |
+
<td>".$val['field'][7]."</td>
|
| 147 |
+
<td>".$val['field'][8]."</td>
|
| 148 |
+
<td>".$val['field'][9]."</td>
|
| 149 |
+
<td>".$val['field'][10]."</td>
|
| 150 |
+
<td>".$val['field'][17]."</td>
|
| 151 |
+
<td>".$val['field'][18]."</td>
|
| 152 |
+
</tr>";
|
| 153 |
+
$i =$i+1;
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
echo"</tr></table>";
|
| 157 |
+
|
| 158 |
+
if(empty($retValue))
|
| 159 |
+
{
|
| 160 |
+
echo "Please add valid Username,Password ,AWB and Order_id in plugin configuration";
|
| 161 |
+
}
|
| 162 |
+
else {
|
| 163 |
+
echo "<br> AWB Tracked Successfully";
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
else
|
| 168 |
+
{
|
| 169 |
+
echo "AWB is not Tracked";
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
}
|
app/code/local/Ecom/Express/controllers/AjaxController.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_AjaxController extends Mage_Core_Controller_Front_Action {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Function to fetch the awb no
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
public function ajaxTrackAction()
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($this->getRequest()->getParam('id'));
|
| 28 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 29 |
+
->load($shipment->getData('order_id'))
|
| 30 |
+
->getShippingMethod();
|
| 31 |
+
|
| 32 |
+
if(strpos($current_shipping_method, 'ecomexpress') !== false)
|
| 33 |
+
{
|
| 34 |
+
$order = Mage::getModel('sales/order')->load($this->getRequest()->getParam('id'));
|
| 35 |
+
$payment = $order->getPayment()->getMethodInstance()->getCode();
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if($payment == 'cashondelivery'){
|
| 39 |
+
$pay_type = 'COD';
|
| 40 |
+
$model = Mage::getModel('ecomexpress/awb')->getCollection()
|
| 41 |
+
->addFieldToFilter('state',0)
|
| 42 |
+
->addFieldToFilter('awb_type','COD')->getData();
|
| 43 |
+
}
|
| 44 |
+
else{
|
| 45 |
+
|
| 46 |
+
$pay_type = 'PPD';
|
| 47 |
+
$model = Mage::getModel('ecomexpress/awb')->getCollection()
|
| 48 |
+
->addFieldToFilter('state',0)
|
| 49 |
+
->addFieldToFilter('awb_type','PPD')->getData();
|
| 50 |
+
|
| 51 |
+
}
|
| 52 |
+
if(count($model)>0){
|
| 53 |
+
|
| 54 |
+
foreach($model as $models)
|
| 55 |
+
{
|
| 56 |
+
$awbno = $models['awb'];
|
| 57 |
+
break;
|
| 58 |
+
}
|
| 59 |
+
return $awbno;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
app/code/local/Ecom/Express/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_IndexController extends Mage_Core_Controller_Front_Action {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Function to fetch the track status
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
public function trackAction()
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
$params= array();
|
| 28 |
+
$shipment_ids = $this->getRequest()->getParam('shipment_ids');
|
| 29 |
+
|
| 30 |
+
if($shipment_ids){
|
| 31 |
+
|
| 32 |
+
$track_awb= Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('shipment_id',$shipment_ids)->getData();
|
| 33 |
+
$type = 'post';
|
| 34 |
+
$params['username'] = Mage::getStoreConfig('carriers/ecomexpress/username');
|
| 35 |
+
$params['password'] = Mage::getStoreConfig('carriers/ecomexpress/password');
|
| 36 |
+
$params_info = array();
|
| 37 |
+
|
| 38 |
+
foreach($track_awb as $awb){
|
| 39 |
+
|
| 40 |
+
$params_info['awb'][] = $awb['awb'];
|
| 41 |
+
$params_info['orderid'][] = $awb['orderid'];
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
$params['awb'] = implode(",",$params_info['awb']);
|
| 45 |
+
$params['orderid'] = implode(",",$params_info['orderid']);
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
if(Mage::getStoreConfig('carriers/ecomexpress/sanbox') ==1){
|
| 49 |
+
$url = 'http://ecomm.prtouch.com/track_me/api/mawbd/';
|
| 50 |
+
}
|
| 51 |
+
else {
|
| 52 |
+
$url = 'http://api.ecomexpress.in/track_me/api/mawbd/';
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
if($params)
|
| 56 |
+
{
|
| 57 |
+
$retValue = Mage::helper('ecomexpress')->executeCurl($url,$type,$params);
|
| 58 |
+
$getSessionInfo = Mage::getSingleton('core/session')->getInfoMsg();
|
| 59 |
+
|
| 60 |
+
$xml = simplexml_load_string($retValue, 'SimpleXMLElement', LIBXML_NOCDATA);
|
| 61 |
+
$array = json_decode(json_encode($xml), TRUE);
|
| 62 |
+
|
| 63 |
+
if(empty($array['object'])){
|
| 64 |
+
echo '<h4>Ecom service is currently Unavilable , please try after Sometime !!!<h4>';
|
| 65 |
+
return ;
|
| 66 |
+
|
| 67 |
+
}
|
| 68 |
+
if(isset($getSessionInfo)){
|
| 69 |
+
|
| 70 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionInfo));
|
| 71 |
+
Mage::getSingleton('core/session')->unsInfoMsg();
|
| 72 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 73 |
+
return ;
|
| 74 |
+
}
|
| 75 |
+
$getSessionMsg = Mage::getSingleton('core/session')->getMyMsg();
|
| 76 |
+
|
| 77 |
+
if(isset($getSessionMsg)){
|
| 78 |
+
|
| 79 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ecomexpress')->__($getSessionMsg));
|
| 80 |
+
Mage::getSingleton('core/session')->unsMyMsg();
|
| 81 |
+
$this->_redirect('adminhtml/sales_shipment/index/');
|
| 82 |
+
return;
|
| 83 |
+
|
| 84 |
+
}
|
| 85 |
+
echo" <h2> Track Order Status</h2>
|
| 86 |
+
<table border=\"5\" cellpadding=\"5\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#808080\" width=\"100%\" id=\"AutoNumber2\" bgcolor=\"#C0C0C0\">
|
| 87 |
+
<tr>
|
| 88 |
+
<td>S.No</td>
|
| 89 |
+
<td>AWB</td>
|
| 90 |
+
<td>OrderId</td>
|
| 91 |
+
<td>Weight</td>
|
| 92 |
+
<td>Origin</td>
|
| 93 |
+
<td>Destination</td>
|
| 94 |
+
<td>Location Name</td>
|
| 95 |
+
<td>Current Location Name</td>
|
| 96 |
+
<td>Zip Code</td>
|
| 97 |
+
<td>Shipping Name</td>
|
| 98 |
+
<td>Consignee Name</td>
|
| 99 |
+
<td>Pick up Date</td>
|
| 100 |
+
<td>Status</td>
|
| 101 |
+
<td>Expected Date</td>
|
| 102 |
+
<td>Last Date</td>
|
| 103 |
+
</tr>";
|
| 104 |
+
$i=1;
|
| 105 |
+
foreach($array['object'] as $key => $val){
|
| 106 |
+
if (!is_int($key) && $key == 'field'){
|
| 107 |
+
if($val[15] =='Shipment RTO Lock') {
|
| 108 |
+
$val[10]= 'Cancelled';
|
| 109 |
+
}
|
| 110 |
+
echo "<tr>
|
| 111 |
+
<td>".$i."</td>
|
| 112 |
+
<td>".$val[0]."</td>
|
| 113 |
+
<td>".$val[1]."</td>
|
| 114 |
+
<td>".$val[2]."</td>
|
| 115 |
+
<td>".$val[3]."</td>
|
| 116 |
+
<td>".$val[4]."</td>
|
| 117 |
+
<td>".$val[5]."</td>
|
| 118 |
+
<td>".$val[6]."</td>
|
| 119 |
+
<td>".$val[25]."</td>
|
| 120 |
+
<td>".$val[7]."</td>
|
| 121 |
+
<td>".$val[8]."</td>
|
| 122 |
+
<td>".$val[9]."</td>
|
| 123 |
+
<td>".$val[10]."</td>
|
| 124 |
+
<td>".$val[17]."</td>
|
| 125 |
+
<td>".$val[18]."</td>
|
| 126 |
+
</tr>";
|
| 127 |
+
} else if(is_int($key)){
|
| 128 |
+
if($val['field'][15] =='Shipment RTO Lock') {
|
| 129 |
+
$val['field'][10]= 'Cancelled';
|
| 130 |
+
}
|
| 131 |
+
echo "<tr>
|
| 132 |
+
<td>".$i."</td>
|
| 133 |
+
<td>".$val['field'][0]."</td>
|
| 134 |
+
<td>".$val['field'][1]."</td>
|
| 135 |
+
<td>".$val['field'][2]."</td>
|
| 136 |
+
<td>".$val['field'][3]."</td>
|
| 137 |
+
<td>".$val['field'][4]."</td>
|
| 138 |
+
<td>".$val['field'][5]."</td>
|
| 139 |
+
<td>".$val['field'][6]."</td>
|
| 140 |
+
<td>".$val['field'][25]."</td>
|
| 141 |
+
<td>".$val['field'][7]."</td>
|
| 142 |
+
<td>".$val['field'][8]."</td>
|
| 143 |
+
<td>".$val['field'][9]."</td>
|
| 144 |
+
<td>".$val['field'][10]."</td>
|
| 145 |
+
<td>".$val['field'][17]."</td>
|
| 146 |
+
<td>".$val['field'][18]."</td>
|
| 147 |
+
</tr>";
|
| 148 |
+
$i =$i+1;
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
echo"</tr></table>";
|
| 152 |
+
|
| 153 |
+
if(empty($retValue))
|
| 154 |
+
{
|
| 155 |
+
echo "Please add valid Username,Password ,AWB and Order_id in plugin configuration";
|
| 156 |
+
}
|
| 157 |
+
else {
|
| 158 |
+
echo "<br> AWB Tracked Successfully";
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
else
|
| 163 |
+
{
|
| 164 |
+
echo "AWB is not Tracked";
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
}
|
app/code/local/Ecom/Express/controllers/StatusController.php
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Ecom_Express_StatusController extends Mage_Core_Controller_Front_Action {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
*
|
| 22 |
+
* Checking the Status and Update the current Status
|
| 23 |
+
*/
|
| 24 |
+
public function updateAction()
|
| 25 |
+
{
|
| 26 |
+
$params= array();
|
| 27 |
+
$type = 'post';
|
| 28 |
+
$params['username'] = $this->getRequest()->getParams('username');
|
| 29 |
+
$params['password'] = $this->getRequest()->getParams('password');
|
| 30 |
+
$params['awb'] = $this->getRequest()->getParams('awb');
|
| 31 |
+
$params['status'] = $this->getRequest()->getParams('status');
|
| 32 |
+
$msg = '';
|
| 33 |
+
|
| 34 |
+
if(($params['username'] != Mage::getStoreConfig('carriers/ecomexpress/username')) || ($params['password'] != Mage::getStoreConfig('carriers/ecomexpress/password')))
|
| 35 |
+
{
|
| 36 |
+
$msg = "User Authentication is incorrect";
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
else{
|
| 40 |
+
$model = Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('state',1)->getData();
|
| 41 |
+
$flag = false;
|
| 42 |
+
|
| 43 |
+
foreach ($model as $val)
|
| 44 |
+
{
|
| 45 |
+
if($val['awb']==$params['awbs'])
|
| 46 |
+
{
|
| 47 |
+
if($val['status']==$params['status']){
|
| 48 |
+
$msg = "Status is already Updated";
|
| 49 |
+
$flag= true;
|
| 50 |
+
}
|
| 51 |
+
else {
|
| 52 |
+
$awb_model = Mage::getModel('ecomexpress/awb');
|
| 53 |
+
$awb_data = $awb_model->getCollection()->addFieldToFilter('awb',$val['awb'])->getFirstItem()->getData();
|
| 54 |
+
$awb_model->load($awb_data['awb_id'])->setData('status',$params['status']);
|
| 55 |
+
$awb_model->save();
|
| 56 |
+
$flag = true;
|
| 57 |
+
$msg= "Status is Updated Successfully";
|
| 58 |
+
break;
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
if($flag == false)
|
| 63 |
+
$msg= " Wrong AWB Number";
|
| 64 |
+
}
|
| 65 |
+
return $msg;
|
| 66 |
+
}
|
| 67 |
+
}
|
app/code/local/Ecom/Express/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/-->
|
| 17 |
+
|
| 18 |
+
<config>
|
| 19 |
+
<menu>
|
| 20 |
+
<ecomexpress module="ecomexpress">
|
| 21 |
+
<title>Ecom Express</title>
|
| 22 |
+
<sort_order>75</sort_order>
|
| 23 |
+
<children>
|
| 24 |
+
<pincode>
|
| 25 |
+
<title>Manage Pincode</title>
|
| 26 |
+
<sort_order>0</sort_order>
|
| 27 |
+
<action>adminhtml/adminhtml_pincode</action>
|
| 28 |
+
</pincode>
|
| 29 |
+
<awb>
|
| 30 |
+
<title>Manage AWB</title>
|
| 31 |
+
<sort_order>2</sort_order>
|
| 32 |
+
<action>adminhtml/adminhtml_awb</action>
|
| 33 |
+
</awb>
|
| 34 |
+
</children>
|
| 35 |
+
</ecomexpress>
|
| 36 |
+
</menu>
|
| 37 |
+
|
| 38 |
+
<acl>
|
| 39 |
+
<resources>
|
| 40 |
+
<all>
|
| 41 |
+
<title>Allow Everything</title>
|
| 42 |
+
</all>
|
| 43 |
+
<admin>
|
| 44 |
+
<children>
|
| 45 |
+
<ecomexpress>
|
| 46 |
+
<title>Ecom Express</title>
|
| 47 |
+
<sort_order>11</sort_order>
|
| 48 |
+
<children>
|
| 49 |
+
<pincode>
|
| 50 |
+
<title>Manage Pincode</title>
|
| 51 |
+
</pincode>
|
| 52 |
+
<awb>
|
| 53 |
+
<title>Manage AWB</title>
|
| 54 |
+
</awb>
|
| 55 |
+
</children>
|
| 56 |
+
</ecomexpress>
|
| 57 |
+
<system>
|
| 58 |
+
<children>
|
| 59 |
+
<config>
|
| 60 |
+
<children>
|
| 61 |
+
<ecomexpress>
|
| 62 |
+
<title>Ecom Express Settings</title>
|
| 63 |
+
</ecomexpress>
|
| 64 |
+
</children>
|
| 65 |
+
</config>
|
| 66 |
+
</children>
|
| 67 |
+
</system>
|
| 68 |
+
</children>
|
| 69 |
+
</admin>
|
| 70 |
+
</resources>
|
| 71 |
+
</acl>
|
| 72 |
+
</config>
|
app/code/local/Ecom/Express/etc/config.xml
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!-- /**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/ -->
|
| 17 |
+
|
| 18 |
+
<config>
|
| 19 |
+
<modules>
|
| 20 |
+
<Ecom_Express>
|
| 21 |
+
<version>0.3.0</version>
|
| 22 |
+
<parent_product_name>Ecom Express</parent_product_name>
|
| 23 |
+
<author>CedCommerce Core Team (connect@cedcommerce.com)</author>
|
| 24 |
+
</Ecom_Express>
|
| 25 |
+
</modules>
|
| 26 |
+
<frontend>
|
| 27 |
+
<routers>
|
| 28 |
+
<ecomexpress>
|
| 29 |
+
<use>standard</use>
|
| 30 |
+
<args>
|
| 31 |
+
<module>Ecom_Express</module>
|
| 32 |
+
<frontName>ecomexpress</frontName>
|
| 33 |
+
</args>
|
| 34 |
+
</ecomexpress>
|
| 35 |
+
</routers>
|
| 36 |
+
<layout>
|
| 37 |
+
<updates>
|
| 38 |
+
<ecomexpress>
|
| 39 |
+
<file>ecom/express/ecomexpress.xml</file>
|
| 40 |
+
</ecomexpress>
|
| 41 |
+
</updates>
|
| 42 |
+
</layout>
|
| 43 |
+
<translate>
|
| 44 |
+
<modules>
|
| 45 |
+
<Ecom_Express>
|
| 46 |
+
<files>
|
| 47 |
+
<default>Ecom_Express.csv</default>
|
| 48 |
+
</files>
|
| 49 |
+
</Ecom_Express>
|
| 50 |
+
</modules>
|
| 51 |
+
</translate>
|
| 52 |
+
</frontend>
|
| 53 |
+
|
| 54 |
+
<admin>
|
| 55 |
+
<routers>
|
| 56 |
+
<adminhtml>
|
| 57 |
+
<use>admin</use>
|
| 58 |
+
<args>
|
| 59 |
+
<modules>
|
| 60 |
+
<ecomexpress after="Mage_Adminhtml">Ecom_Express</ecomexpress>
|
| 61 |
+
</modules>
|
| 62 |
+
</args>
|
| 63 |
+
</adminhtml>
|
| 64 |
+
</routers>
|
| 65 |
+
</admin>
|
| 66 |
+
|
| 67 |
+
<adminhtml>
|
| 68 |
+
<layout>
|
| 69 |
+
<updates>
|
| 70 |
+
<ecomexpress>
|
| 71 |
+
<file>ecom/express/ecomexpress.xml</file>
|
| 72 |
+
</ecomexpress>
|
| 73 |
+
</updates>
|
| 74 |
+
</layout>
|
| 75 |
+
</adminhtml>
|
| 76 |
+
|
| 77 |
+
<global>
|
| 78 |
+
<models>
|
| 79 |
+
<ecomexpress>
|
| 80 |
+
<class>Ecom_Express_Model</class>
|
| 81 |
+
<resourceModel>ecomexpress_mysql4</resourceModel>
|
| 82 |
+
</ecomexpress>
|
| 83 |
+
<sales>
|
| 84 |
+
<rewrite>
|
| 85 |
+
<order_pdf_shipment>Ecom_Express_Model_Order_Pdf_Shipment</order_pdf_shipment>
|
| 86 |
+
</rewrite>
|
| 87 |
+
</sales>
|
| 88 |
+
|
| 89 |
+
<ecomexpress_mysql4>
|
| 90 |
+
<class>Ecom_Express_Model_Mysql4</class>
|
| 91 |
+
<entities>
|
| 92 |
+
<awb>
|
| 93 |
+
<table>ecomexpress_awb</table>
|
| 94 |
+
</awb>
|
| 95 |
+
<pincode>
|
| 96 |
+
<table>ecomexpress_pincode</table>
|
| 97 |
+
</pincode>
|
| 98 |
+
</entities>
|
| 99 |
+
</ecomexpress_mysql4>
|
| 100 |
+
</models>
|
| 101 |
+
|
| 102 |
+
<blocks>
|
| 103 |
+
<ecomexpress>
|
| 104 |
+
<class>Ecom_Express_Block</class>
|
| 105 |
+
</ecomexpress>
|
| 106 |
+
<adminhtml>
|
| 107 |
+
<rewrite>
|
| 108 |
+
<sales_shipment_grid>Ecom_Express_Block_Adminhtml_Sales_Shipment_Grid</sales_shipment_grid>
|
| 109 |
+
</rewrite>
|
| 110 |
+
</adminhtml>
|
| 111 |
+
<adminhtml>
|
| 112 |
+
<rewrite>
|
| 113 |
+
<sales_order_shipment_view>Ecom_Express_Block_Adminhtml_Sales_Order_Shipment_View</sales_order_shipment_view>
|
| 114 |
+
</rewrite>
|
| 115 |
+
|
| 116 |
+
</adminhtml>
|
| 117 |
+
</blocks>
|
| 118 |
+
<helpers>
|
| 119 |
+
<ecomexpress>
|
| 120 |
+
<class>Ecom_Express_Helper</class>
|
| 121 |
+
</ecomexpress>
|
| 122 |
+
</helpers>
|
| 123 |
+
<resources>
|
| 124 |
+
<ecomexpress_setup>
|
| 125 |
+
<setup>
|
| 126 |
+
<module>Ecom_Express</module>
|
| 127 |
+
</setup>
|
| 128 |
+
<connection>
|
| 129 |
+
<use>core_setup</use>
|
| 130 |
+
</connection>
|
| 131 |
+
</ecomexpress_setup>
|
| 132 |
+
<ecomexpress_write>
|
| 133 |
+
<connection>
|
| 134 |
+
<use>core_write</use>
|
| 135 |
+
</connection>
|
| 136 |
+
</ecomexpress_write>
|
| 137 |
+
<ecomexpress_read>
|
| 138 |
+
<connection>
|
| 139 |
+
<use>core_read</use>
|
| 140 |
+
</connection>
|
| 141 |
+
</ecomexpress_read>
|
| 142 |
+
</resources>
|
| 143 |
+
|
| 144 |
+
<events>
|
| 145 |
+
<sales_order_shipment_save_before>
|
| 146 |
+
<observers>
|
| 147 |
+
<ecom_express_sales_order_shipment_save_before>
|
| 148 |
+
<type>singleton</type>
|
| 149 |
+
<class>Ecom_Express_Model_Observer</class>
|
| 150 |
+
<method>salesOrderShipmentSaveBefore</method>
|
| 151 |
+
</ecom_express_sales_order_shipment_save_before>
|
| 152 |
+
</observers>
|
| 153 |
+
</sales_order_shipment_save_before>
|
| 154 |
+
<sales_order_shipment_track_save_after>
|
| 155 |
+
<observers>
|
| 156 |
+
<ecom_express_sales_order_shipment_track_save_after>
|
| 157 |
+
<type>singleton</type>
|
| 158 |
+
<class>Ecom_Express_Model_Observer</class>
|
| 159 |
+
<method>salesOrderShipmentTrackSaveAfter</method>
|
| 160 |
+
</ecom_express_sales_order_shipment_track_save_after>
|
| 161 |
+
</observers>
|
| 162 |
+
</sales_order_shipment_track_save_after>
|
| 163 |
+
</events>
|
| 164 |
+
</global>
|
| 165 |
+
|
| 166 |
+
<crontab>
|
| 167 |
+
<jobs>
|
| 168 |
+
<ecomexpress>
|
| 169 |
+
<schedule>
|
| 170 |
+
<cron_expr>0 0 * * *</cron_expr>
|
| 171 |
+
</schedule>
|
| 172 |
+
<run>
|
| 173 |
+
<model>ecomexpress/observer::fetchAwb</model>
|
| 174 |
+
</run>
|
| 175 |
+
</ecomexpress>
|
| 176 |
+
</jobs>
|
| 177 |
+
</crontab>
|
| 178 |
+
<default>
|
| 179 |
+
<ecomexpress>
|
| 180 |
+
<ecomexpress>
|
| 181 |
+
<ecomexpress_time_delay>3000</ecomexpress_time_delay>
|
| 182 |
+
<ecomexpress_autoplay>1</ecomexpress_autoplay>
|
| 183 |
+
<ecomexpress_toplink_enabled>1</ecomexpress_toplink_enabled>
|
| 184 |
+
</ecomexpress>
|
| 185 |
+
</ecomexpress>
|
| 186 |
+
<carriers>
|
| 187 |
+
<ecomexpress>
|
| 188 |
+
<active>0</active>
|
| 189 |
+
<showmethod>1</showmethod>
|
| 190 |
+
<model>ecomexpress/carrier_ecomexpress</model>
|
| 191 |
+
<name>Ecom Express</name>
|
| 192 |
+
<title>Ecom Express</title>
|
| 193 |
+
<specificerrmsg>This shipping method is currently unavailable in this pincode.</specificerrmsg>
|
| 194 |
+
</ecomexpress>
|
| 195 |
+
</carriers>
|
| 196 |
+
</default>
|
| 197 |
+
</config>
|
app/code/local/Ecom/Express/etc/system.xml
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
|
| 20 |
+
<config>
|
| 21 |
+
<sections>
|
| 22 |
+
<carriers>
|
| 23 |
+
<groups>
|
| 24 |
+
<ecomexpress translate="label" module="ecomexpress">
|
| 25 |
+
<label>Ecom Express</label>
|
| 26 |
+
<frontend_type>text</frontend_type>
|
| 27 |
+
<sort_order>295</sort_order>
|
| 28 |
+
<show_in_default>1</show_in_default>
|
| 29 |
+
<show_in_website>1</show_in_website>
|
| 30 |
+
<show_in_store>1</show_in_store>
|
| 31 |
+
<fields>
|
| 32 |
+
<active translate="label">
|
| 33 |
+
<label>Enabled</label>
|
| 34 |
+
<frontend_type>select</frontend_type>
|
| 35 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 36 |
+
<sort_order>1</sort_order>
|
| 37 |
+
<show_in_default>1</show_in_default>
|
| 38 |
+
<show_in_website>1</show_in_website>
|
| 39 |
+
<show_in_store>1</show_in_store>
|
| 40 |
+
</active>
|
| 41 |
+
<name label="translate">
|
| 42 |
+
<label>Method Name</label>
|
| 43 |
+
<frontend_type>text</frontend_type>
|
| 44 |
+
<sort_order>2</sort_order>
|
| 45 |
+
<show_in_default>1</show_in_default>
|
| 46 |
+
<show_in_website>1</show_in_website>
|
| 47 |
+
<show_in_store>1</show_in_store>
|
| 48 |
+
</name>
|
| 49 |
+
<title label="translate">
|
| 50 |
+
<label>Carrier Title</label>
|
| 51 |
+
<frontend_type>text</frontend_type>
|
| 52 |
+
<sort_order>3</sort_order>
|
| 53 |
+
<show_in_default>1</show_in_default>
|
| 54 |
+
<show_in_website>1</show_in_website>
|
| 55 |
+
<show_in_store>1</show_in_store>
|
| 56 |
+
</title>
|
| 57 |
+
<username translate="label">
|
| 58 |
+
<label>Username</label>
|
| 59 |
+
<frontend_type>text</frontend_type>
|
| 60 |
+
<validate>required-entry</validate>
|
| 61 |
+
<sort_order>4</sort_order>
|
| 62 |
+
<show_in_default>1</show_in_default>
|
| 63 |
+
<show_in_website>1</show_in_website>
|
| 64 |
+
<show_in_store>1</show_in_store>
|
| 65 |
+
</username>
|
| 66 |
+
<password translate="label">
|
| 67 |
+
<label>Password</label>
|
| 68 |
+
<frontend_type>password</frontend_type>
|
| 69 |
+
<validate>required-entry</validate>
|
| 70 |
+
<sort_order>5</sort_order>
|
| 71 |
+
<show_in_default>1</show_in_default>
|
| 72 |
+
<show_in_website>1</show_in_website>
|
| 73 |
+
<show_in_store>1</show_in_store>
|
| 74 |
+
</password>
|
| 75 |
+
<sanbox label="translate">
|
| 76 |
+
<label>Sandbox Mode</label>
|
| 77 |
+
<frontend_type>select</frontend_type>
|
| 78 |
+
<sort_order>7</sort_order>
|
| 79 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 80 |
+
<show_in_default>1</show_in_default>
|
| 81 |
+
<show_in_website>1</show_in_website>
|
| 82 |
+
<show_in_store>1</show_in_store>
|
| 83 |
+
</sanbox>
|
| 84 |
+
<fetch_awb translate="label">
|
| 85 |
+
<label>Fetch AWB</label>
|
| 86 |
+
<frontend_type>text</frontend_type>
|
| 87 |
+
<validate>required-entry</validate>
|
| 88 |
+
<comment>Fetch AWB must be less then or equal to Max Fetch AWB</comment>
|
| 89 |
+
<sort_order>8</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 |
+
</fetch_awb>
|
| 94 |
+
<max_fetch_awb translate="label">
|
| 95 |
+
<label>Maximum Fetch AWB</label>
|
| 96 |
+
<frontend_type>text</frontend_type>
|
| 97 |
+
<comment>Max Fetch AWB must be greater then or equal to Fetch AWB </comment>
|
| 98 |
+
<validate>required-entry</validate>
|
| 99 |
+
<sort_order>9</sort_order>
|
| 100 |
+
<show_in_default>1</show_in_default>
|
| 101 |
+
<show_in_website>1</show_in_website>
|
| 102 |
+
<show_in_store>1</show_in_store>
|
| 103 |
+
</max_fetch_awb>
|
| 104 |
+
|
| 105 |
+
<handling label="translate">
|
| 106 |
+
<label>Handling</label>
|
| 107 |
+
<frontend_type>select</frontend_type>
|
| 108 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 109 |
+
<sort_order>11</sort_order>
|
| 110 |
+
<show_in_default>1</show_in_default>
|
| 111 |
+
<show_in_website>1</show_in_website>
|
| 112 |
+
<show_in_store>1</show_in_store>
|
| 113 |
+
</handling>
|
| 114 |
+
<handling_charge>
|
| 115 |
+
<depends>
|
| 116 |
+
<handling>1</handling>
|
| 117 |
+
</depends>
|
| 118 |
+
</handling_charge>
|
| 119 |
+
<handling_charge label="translate">
|
| 120 |
+
<label>Handling Charge</label>
|
| 121 |
+
<frontend_type>text</frontend_type>
|
| 122 |
+
<sort_order>12</sort_order>
|
| 123 |
+
<show_in_default>1</show_in_default>
|
| 124 |
+
<show_in_website>1</show_in_website>
|
| 125 |
+
<show_in_store>1</show_in_store>
|
| 126 |
+
</handling_charge>
|
| 127 |
+
<sallowspecific translate="label">
|
| 128 |
+
<label>Ship to Applicable Countries</label>
|
| 129 |
+
<frontend_type>select</frontend_type>
|
| 130 |
+
<sort_order>13</sort_order>
|
| 131 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
| 132 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
| 133 |
+
<show_in_default>1</show_in_default>
|
| 134 |
+
<show_in_website>1</show_in_website>
|
| 135 |
+
<show_in_store>0</show_in_store>
|
| 136 |
+
</sallowspecific>
|
| 137 |
+
<specificcountry translate="label">
|
| 138 |
+
<label>Ship to Specific Countries</label>
|
| 139 |
+
<frontend_type>multiselect</frontend_type>
|
| 140 |
+
<sort_order>14</sort_order>
|
| 141 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
| 142 |
+
<validate>validate-select</validate>
|
| 143 |
+
<show_in_default>1</show_in_default>
|
| 144 |
+
<show_in_website>1</show_in_website>
|
| 145 |
+
<show_in_store>0</show_in_store>
|
| 146 |
+
<can_be_empty>1</can_be_empty>
|
| 147 |
+
</specificcountry>
|
| 148 |
+
<specificerrmsg translate="label">
|
| 149 |
+
<label>Error Message</label>
|
| 150 |
+
<frontend_type>text</frontend_type>
|
| 151 |
+
<sort_order>15</sort_order>
|
| 152 |
+
<show_in_default>1</show_in_default>
|
| 153 |
+
<show_in_website>1</show_in_website>
|
| 154 |
+
<show_in_store>1</show_in_store>
|
| 155 |
+
</specificerrmsg>
|
| 156 |
+
<showmethod translate="label">
|
| 157 |
+
<label>Show Method if Not Applicable</label>
|
| 158 |
+
<frontend_type>select</frontend_type>
|
| 159 |
+
<sort_order>16</sort_order>
|
| 160 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 161 |
+
<show_in_default>1</show_in_default>
|
| 162 |
+
<show_in_website>1</show_in_website>
|
| 163 |
+
<show_in_store>0</show_in_store>
|
| 164 |
+
</showmethod>
|
| 165 |
+
</fields>
|
| 166 |
+
</ecomexpress>
|
| 167 |
+
</groups>
|
| 168 |
+
</carriers>
|
| 169 |
+
</sections>
|
| 170 |
+
</config>
|
app/code/local/Ecom/Express/sql/ecomexpress_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
$installer = $this;
|
| 20 |
+
$installer->startSetup();
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* installer query to setup database table at the time of module installation
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
$installer->run("
|
| 27 |
+
|
| 28 |
+
-- DROP TABLE IF EXISTS {$this->getTable('ecomexpress_awb')};
|
| 29 |
+
CREATE TABLE {$this->getTable('ecomexpress_awb')} (
|
| 30 |
+
`awb_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
| 31 |
+
`awb` varchar(255) NOT NULL DEFAULT '',
|
| 32 |
+
`shipment_id` int(11) DEFAULT NULL,
|
| 33 |
+
`shipment_to` varchar(255) NOT NULL DEFAULT '',
|
| 34 |
+
`state` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0= Unused, 1= Used',
|
| 35 |
+
`orderid` varchar(20) DEFAULT NULL,
|
| 36 |
+
`status` varchar(50) DEFAULT NULL,
|
| 37 |
+
`created_at` DATETIME NULL,
|
| 38 |
+
`updated_at` DATETIME NULL,
|
| 39 |
+
PRIMARY KEY (`awb_id`)
|
| 40 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 41 |
+
|
| 42 |
+
-- DROP TABLE IF EXISTS {$this->getTable('ecomexpress_pincode')};
|
| 43 |
+
CREATE TABLE {$this->getTable('ecomexpress_pincode')} (
|
| 44 |
+
`pincode_id` int(11) unsigned NOT NULL auto_increment,
|
| 45 |
+
`pincode` varchar(20) NOT NULL default '',
|
| 46 |
+
`city` varchar(20) NOT NULL default '',
|
| 47 |
+
`state` varchar(5) NOT NULL default '',
|
| 48 |
+
`state_code` varchar(5) NOT NULL default '',
|
| 49 |
+
`city_code` varchar(5) NOT NULL default '',
|
| 50 |
+
`dccode` varchar(5) NOT NULL default '',
|
| 51 |
+
`date_of_discontinuance` varchar(5) NOT NULL default '',
|
| 52 |
+
`created_at` DATETIME NULL,
|
| 53 |
+
`updated_at` DATETIME NULL,
|
| 54 |
+
PRIMARY KEY (`pincode_id`)
|
| 55 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 56 |
+
|
| 57 |
+
");
|
| 58 |
+
$installer->endSetup();
|
app/code/local/Ecom/Express/sql/ecomexpress_setup/mysql4-upgrade-0.1.0-0.2.0.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
$installer = $this;
|
| 20 |
+
$installer->startSetup();
|
| 21 |
+
$installer->getConnection()
|
| 22 |
+
->addColumn($installer->getTable('ecomexpress/awb'), 'awb_type',
|
| 23 |
+
array
|
| 24 |
+
(
|
| 25 |
+
'nullable' => false,
|
| 26 |
+
'length' => 255,
|
| 27 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
| 28 |
+
'comment' => 'type COD/PPD'
|
| 29 |
+
)
|
| 30 |
+
);
|
| 31 |
+
$installer->endSetup();
|
| 32 |
+
?>
|
app/code/local/Ecom/Express/sql/ecomexpress_setup/mysql4-upgrade-0.2.0-0.3.0.php
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$installer = $this;
|
| 19 |
+
$installer->startSetup();
|
| 20 |
+
$installer->getConnection();
|
| 21 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
| 22 |
+
|
| 23 |
+
if(!Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','ecom_length')->getId()) {
|
| 24 |
+
|
| 25 |
+
$setup->addAttribute('catalog_product', 'ecom_length', array(
|
| 26 |
+
'group' => 'general',
|
| 27 |
+
'input' => 'text',
|
| 28 |
+
'type' => 'int',
|
| 29 |
+
'label' => 'Length',
|
| 30 |
+
'backend' => '',
|
| 31 |
+
'visible' => 1,
|
| 32 |
+
'required' => true,
|
| 33 |
+
'user_defined' => 1,
|
| 34 |
+
'searchable' => 1,
|
| 35 |
+
'filterable' => 0,
|
| 36 |
+
'comparable' => 0,
|
| 37 |
+
'visible_on_front' => 0,
|
| 38 |
+
'visible_in_advanced_search' => 0,
|
| 39 |
+
'is_html_allowed_on_front' => 0,
|
| 40 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
| 41 |
+
));
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if(!Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','ecom_width')->getId()) {
|
| 45 |
+
|
| 46 |
+
$setup->addAttribute('catalog_product', 'ecom_width', array(
|
| 47 |
+
'group' => 'general',
|
| 48 |
+
'input' => 'text',
|
| 49 |
+
'type' => 'int',
|
| 50 |
+
'label' => 'Width',
|
| 51 |
+
'backend' => '',
|
| 52 |
+
'visible' => 1,
|
| 53 |
+
'required' => true,
|
| 54 |
+
'user_defined' => 1,
|
| 55 |
+
'searchable' => 1,
|
| 56 |
+
'filterable' => 0,
|
| 57 |
+
'comparable' => 0,
|
| 58 |
+
'visible_on_front' => 0,
|
| 59 |
+
'visible_in_advanced_search' => 0,
|
| 60 |
+
'is_html_allowed_on_front' => 0,
|
| 61 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
| 62 |
+
));
|
| 63 |
+
|
| 64 |
+
}
|
| 65 |
+
if(!Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','ecom_height')->getId()) {
|
| 66 |
+
|
| 67 |
+
$setup->addAttribute('catalog_product', 'ecom_height', array(
|
| 68 |
+
'group' => 'general',
|
| 69 |
+
'input' => 'text',
|
| 70 |
+
'type' => 'int',
|
| 71 |
+
'label' => 'Height',
|
| 72 |
+
'backend' => '',
|
| 73 |
+
'visible' => 1,
|
| 74 |
+
'required' => true,
|
| 75 |
+
'user_defined' => 1,
|
| 76 |
+
'searchable' => 1,
|
| 77 |
+
'filterable' => 0,
|
| 78 |
+
'comparable' => 0,
|
| 79 |
+
'visible_on_front' => 0,
|
| 80 |
+
'visible_in_advanced_search' => 0,
|
| 81 |
+
'is_html_allowed_on_front' => 0,
|
| 82 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
| 83 |
+
));
|
| 84 |
+
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
$installer->endSetup();
|
| 89 |
+
?>
|
app/design/adminhtml/default/default/layout/ecom/express/ecomexpress.xml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!-- /**
|
| 3 |
+
* EcomExpress
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
*
|
| 11 |
+
* @category Ecom
|
| 12 |
+
* @package Ecom_Express
|
| 13 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 14 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
-->
|
| 18 |
+
|
| 19 |
+
<layout version="0.1.1">
|
| 20 |
+
<adminhtml_adminhtml_pincode_index>
|
| 21 |
+
<update handle="editor"/>
|
| 22 |
+
<reference name="content">
|
| 23 |
+
<block type="ecomexpress/adminhtml_pincode" name="pincode" />
|
| 24 |
+
</reference>
|
| 25 |
+
</adminhtml_adminhtml_pincode_index>
|
| 26 |
+
|
| 27 |
+
<adminhtml_adminhtml_awb_index>
|
| 28 |
+
<update handle="editor"/>
|
| 29 |
+
<reference name="content">
|
| 30 |
+
<block type="ecomexpress/adminhtml_awb" name="awb" />
|
| 31 |
+
</reference>
|
| 32 |
+
</adminhtml_adminhtml_awb_index>
|
| 33 |
+
|
| 34 |
+
<adminhtml_sales_order_shipment_view>
|
| 35 |
+
<reference name="head">
|
| 36 |
+
<action method="addJs"><file>ecom/ecomexpress.js</file><params>async="async"</params></action>
|
| 37 |
+
</reference>
|
| 38 |
+
<reference name="head">
|
| 39 |
+
<action method="addItem">
|
| 40 |
+
<type>js_css</type>
|
| 41 |
+
<name>prototype/windows/themes/default.css</name>
|
| 42 |
+
</action>
|
| 43 |
+
<action method="addCss">
|
| 44 |
+
<name>lib/prototype/windows/themes/magento.css</name>
|
| 45 |
+
</action>
|
| 46 |
+
</reference>
|
| 47 |
+
</adminhtml_sales_order_shipment_view>
|
| 48 |
+
</layout>
|
app/design/frontend/base/default/layout/ecom/express/ecomexpress.xml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
|
| 3 |
+
<!--/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
|
| 20 |
+
<layout>
|
| 21 |
+
<sales_order_print>
|
| 22 |
+
<reference name="sales.order.print">
|
| 23 |
+
<action method="setTemplate">
|
| 24 |
+
<template>ecomexpress/sales/order/print.phtml</template>
|
| 25 |
+
</action>
|
| 26 |
+
</reference>
|
| 27 |
+
</sales_order_print>
|
| 28 |
+
|
| 29 |
+
<shipping_tracking_popup>
|
| 30 |
+
<reference name="content">
|
| 31 |
+
<block type="shipping/tracking_popup" name="shipping.tracking.popup" template="ecomexpress/shipping/tracking/popup.phtml" />
|
| 32 |
+
</reference>
|
| 33 |
+
</shipping_tracking_popup>
|
| 34 |
+
</layout>
|
app/design/frontend/base/default/template/ecomexpress/sales/order/print.phtml
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
?>
|
| 21 |
+
<?php
|
| 22 |
+
|
| 23 |
+
$order_id = Mage::app()->getRequest()->getParam('order_id');
|
| 24 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 25 |
+
->load($order_id)
|
| 26 |
+
->getShippingMethod();
|
| 27 |
+
|
| 28 |
+
?>
|
| 29 |
+
<?php $_order = $this->getOrder() ;
|
| 30 |
+
?>
|
| 31 |
+
<h1><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h1>
|
| 32 |
+
<p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
|
| 33 |
+
<div class="col2-set">
|
| 34 |
+
|
| 35 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
| 36 |
+
<div class="col-1">
|
| 37 |
+
<?php if(strcmp($current_shipping_method, 'ecomexpress_ecomexpress') == true){ ?>
|
| 38 |
+
<h2><?php echo $this->__('Shipping Address'); } else {?></h2>
|
| 39 |
+
<h2><?php echo $this->__('Ship From'); }?></h2>
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
<?php if(strcmp($current_shipping_method, 'ecomexpress_ecomexpress') == true){ ?>
|
| 43 |
+
<address><?php echo $_order->getShippingAddress()->format('html');} else{ ?></address>
|
| 44 |
+
|
| 45 |
+
<address><?php
|
| 46 |
+
echo Mage::getStoreConfig('general/store_information/name'); echo"<br/>";
|
| 47 |
+
echo Mage::getStoreConfig('shipping/origin/street_line1').", " .Mage::getStoreConfig('shipping/origin/street_line2');echo"<br/>";
|
| 48 |
+
echo Mage::getStoreConfig('shipping/origin/city').", ".Mage::getStoreConfig('shipping/origin/region_id').", ".Mage::getStoreConfig('shipping/origin/postcode');echo"<br/>";
|
| 49 |
+
echo Mage::app()->getLocale()->getCountryTranslation(Mage::getStoreConfig('shipping/origin/country_id'));echo"<br/>";
|
| 50 |
+
echo "T:".Mage::getStoreConfig('general/store_information/phone');echo"<br/>";
|
| 51 |
+
}
|
| 52 |
+
?>
|
| 53 |
+
|
| 54 |
+
</address>
|
| 55 |
+
</div>
|
| 56 |
+
<div class="col-2">
|
| 57 |
+
<?php else: ?>
|
| 58 |
+
<div class="col-1">
|
| 59 |
+
<?php endif; ?>
|
| 60 |
+
<h2><?php echo $this->__('Billing Address') ?></h2>
|
| 61 |
+
<address><?php echo $_order->getBillingAddress()->format('html') ?></address>
|
| 62 |
+
</div>
|
| 63 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
| 64 |
+
</div>
|
| 65 |
+
<div class="col2-set">
|
| 66 |
+
<div class="col-1">
|
| 67 |
+
<h2><?php echo $this->__('Shipping Method') ?></h2>
|
| 68 |
+
<?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
|
| 69 |
+
</div>
|
| 70 |
+
<?php endif; ?>
|
| 71 |
+
<div class="col-2">
|
| 72 |
+
<h2><?php echo $this->__('Payment Method') ?></h2>
|
| 73 |
+
<?php echo $this->getPaymentInfoHtml() ;?>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
<h2><?php echo $this->__('Items Ordered') ?></h2>
|
| 77 |
+
<table class="data-table" id="my-orders-table">
|
| 78 |
+
<col />
|
| 79 |
+
<col width="1" />
|
| 80 |
+
<col width="1" />
|
| 81 |
+
<col width="1" />
|
| 82 |
+
<col width="1" />
|
| 83 |
+
<thead>
|
| 84 |
+
<tr>
|
| 85 |
+
<th><?php echo $this->__('Product Name') ?></th>
|
| 86 |
+
<th><?php echo $this->__('SKU') ?></th>
|
| 87 |
+
<th class="a-right"><?php echo $this->__('Price') ?></th>
|
| 88 |
+
<th class="a-center"><?php echo $this->__('Qty') ?></th>
|
| 89 |
+
<th class="a-right"><?php echo $this->__('Subtotal') ?></th>
|
| 90 |
+
</tr>
|
| 91 |
+
</thead>
|
| 92 |
+
<tfoot>
|
| 93 |
+
<?php echo $this->getChildHtml('order_totals'); ?>
|
| 94 |
+
</tfoot>
|
| 95 |
+
<?php $_items = $_order->getItemsCollection(); ?>
|
| 96 |
+
<?php $_count = $_items->count(); ?>
|
| 97 |
+
<?php foreach ($_items as $_item): ?>
|
| 98 |
+
<?php if ($_item->getParentItem()) continue; ?>
|
| 99 |
+
<tbody>
|
| 100 |
+
<?php echo $this->getItemHtml($_item) ?>
|
| 101 |
+
</tbody>
|
| 102 |
+
<?php endforeach; ?>
|
| 103 |
+
</table>
|
| 104 |
+
<script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
|
| 105 |
+
<script type="text/javascript">window.print();</script>
|
app/design/frontend/base/default/template/ecomexpress/shipping/tracking/popup.phtml
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
$track_info = $this->getTrackingInfo();
|
| 21 |
+
|
| 22 |
+
foreach($track_info as $track_data)
|
| 23 |
+
{
|
| 24 |
+
$awb_string=$track_data[0];
|
| 25 |
+
}
|
| 26 |
+
preg_match('/"([^"]+)"/', $awb_string, $awb_no);
|
| 27 |
+
$awb_no = $awb_no[1];
|
| 28 |
+
$raw_data=Mage::getModel('ecomexpress/awb')->getCollection()->addFieldToFilter('awb',$awb_no)->getData();
|
| 29 |
+
foreach($raw_data as $raw){
|
| 30 |
+
|
| 31 |
+
}
|
| 32 |
+
$current_shipping_method = Mage::getModel('sales/order')
|
| 33 |
+
->load($raw['orderid'])
|
| 34 |
+
->getShippingMethod();
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
if(strpos($current_shipping_method, 'ecomexpress') !== false)
|
| 38 |
+
{
|
| 39 |
+
|
| 40 |
+
$urll=$this->getUrl ( 'ecomexpress/index/track/', array (
|
| 41 |
+
'shipment_ids' => $raw['shipment_id']
|
| 42 |
+
) );
|
| 43 |
+
|
| 44 |
+
echo "<script>window.location='$urll';</script>";
|
| 45 |
+
|
| 46 |
+
}
|
| 47 |
+
else{
|
| 48 |
+
$this->getTrackingInfo();
|
| 49 |
+
}
|
| 50 |
+
?>
|
| 51 |
+
|
| 52 |
+
<?php /** @var $this Mage_Shipping_Block_Tracking_Popup */ ?>
|
| 53 |
+
<?php $_results = $this->getTrackingInfo(); ?>
|
| 54 |
+
<div class="page-title title-buttons">
|
| 55 |
+
<h1><?php echo $this->__('Tracking Information'); ?></h1>
|
| 56 |
+
<button class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
|
| 57 |
+
</div>
|
| 58 |
+
<?php if(sizeof($_results)>0): ?>
|
| 59 |
+
<?php foreach($_results as $shipid => $_result): ?>
|
| 60 |
+
<?php if($shipid): ?>
|
| 61 |
+
<h2 class="sub-title"><?php echo $this->__('Shipment #').$shipid; ?></h2>
|
| 62 |
+
<?php endif; ?>
|
| 63 |
+
<?php if(sizeof($_result)>0): ?>
|
| 64 |
+
<?php $rowCount = sizeof($_result); $counter = 1; ?>
|
| 65 |
+
<?php $_id = 0; foreach($_result as $track): ?>
|
| 66 |
+
<table class="tracking-table-popup data-table" id="tracking-table-popup-<?php echo $_id ?>">
|
| 67 |
+
<col width="15%" />
|
| 68 |
+
<col />
|
| 69 |
+
<tbody>
|
| 70 |
+
<?php if(is_object($track)): ?>
|
| 71 |
+
<tr>
|
| 72 |
+
<th class="label"><?php echo $this->__('Tracking Number:'); ?></th>
|
| 73 |
+
<td class="value"><?php echo $this->escapeHtml($track->getTracking()); ?></td>
|
| 74 |
+
</tr>
|
| 75 |
+
<?php if ($track->getCarrierTitle()): ?>
|
| 76 |
+
<tr>
|
| 77 |
+
<th class="label"><?php echo $this->__('Carrier:'); ?></th>
|
| 78 |
+
<td class="value"><?php echo $this->escapeHtml($track->getCarrierTitle()); ?></td>
|
| 79 |
+
</tr>
|
| 80 |
+
<?php endif; ?>
|
| 81 |
+
<?php if($track->getErrorMessage()): ?>
|
| 82 |
+
<tr>
|
| 83 |
+
<th class="label"><?php echo $this->__('Error:'); ?></th>
|
| 84 |
+
<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 Mage::helper('core')->quoteEscape($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>
|
| 85 |
+
</tr>
|
| 86 |
+
<?php elseif($track->getTrackSummary()): ?>
|
| 87 |
+
<tr>
|
| 88 |
+
<th class="label"><?php echo $this->__('Info:'); ?></th>
|
| 89 |
+
<td class="value"><?php echo $track->getTrackSummary(); ?></td>
|
| 90 |
+
</tr>
|
| 91 |
+
<?php elseif($track->getUrl()): ?>
|
| 92 |
+
<tr>
|
| 93 |
+
<th class="label"><?php echo $this->__('Track:'); ?></th>
|
| 94 |
+
<td class="value"><a href="<?php echo $this->escapeHtml($track->getUrl()); ?>" onclick="this.target='_blank'"><?php echo $this->escapeHtml($track->getUrl()); ?></a></td>
|
| 95 |
+
</tr>
|
| 96 |
+
<?php else: ?>
|
| 97 |
+
<?php if ($track->getStatus()): ?>
|
| 98 |
+
<tr>
|
| 99 |
+
<th class="label"><?php echo $this->__('Status:'); ?></th>
|
| 100 |
+
<td class="value"><?php echo $track->getStatus(); ?></td>
|
| 101 |
+
</tr>
|
| 102 |
+
<?php endif; ?>
|
| 103 |
+
|
| 104 |
+
<?php if ($track->getDeliverydate()): ?>
|
| 105 |
+
<tr>
|
| 106 |
+
<th class="label"><?php echo $this->__('Delivered on:'); ?></th>
|
| 107 |
+
<td class="value"><?php echo $this->formatDeliveryDateTime($track->getDeliverydate(),$track->getDeliverytime()); ?></td>
|
| 108 |
+
</tr>
|
| 109 |
+
<?php endif; ?>
|
| 110 |
+
|
| 111 |
+
<?php if ($track->getSignedby()): ?>
|
| 112 |
+
<tr>
|
| 113 |
+
<th class="label"><?php echo $this->__('Signed by:'); ?></th>
|
| 114 |
+
<td class="value"><?php echo $track->getSignedby(); ?></td>
|
| 115 |
+
</tr>
|
| 116 |
+
<?php endif; ?>
|
| 117 |
+
|
| 118 |
+
<?php if ($track->getDeliveryLocation()): ?>
|
| 119 |
+
<tr>
|
| 120 |
+
<th class="label"><?php echo $this->__('Delivered to:'); ?></th>
|
| 121 |
+
<td class="value"><?php echo $track->getDeliveryLocation(); ?></td>
|
| 122 |
+
</tr>
|
| 123 |
+
<?php endif; ?>
|
| 124 |
+
|
| 125 |
+
<?php if ($track->getShippedDate()): ?>
|
| 126 |
+
<tr>
|
| 127 |
+
<th class="label"><?php echo $this->__('Shipped or billed on:'); ?></th>
|
| 128 |
+
<td class="value"><?php echo $track->getShippedDate(); ?></td>
|
| 129 |
+
</tr>
|
| 130 |
+
<?php endif; ?>
|
| 131 |
+
|
| 132 |
+
<?php if ($track->getService()): ?>
|
| 133 |
+
<tr>
|
| 134 |
+
<th class="label"><?php echo $this->__('Service Type:'); ?></th>
|
| 135 |
+
<td class="value"><?php echo $track->getService(); ?></td>
|
| 136 |
+
</tr>
|
| 137 |
+
<?php endif; ?>
|
| 138 |
+
|
| 139 |
+
<?php if ($track->getWeight()): ?>
|
| 140 |
+
<tr>
|
| 141 |
+
<th class="label"><?php echo $this->__('Weight:'); ?></th>
|
| 142 |
+
<td class="value"><?php echo $track->getWeight(); ?></td>
|
| 143 |
+
</tr>
|
| 144 |
+
<?php endif; ?>
|
| 145 |
+
<?php endif; ?>
|
| 146 |
+
<?php elseif(isset($track['title']) && isset($track['number']) && $track['number']): ?>
|
| 147 |
+
<!--if the tracking is custom value-->
|
| 148 |
+
<tr>
|
| 149 |
+
<th class="label"><?php echo ($track['title'] ? $this->escapeHtml($track['title']) : $this->__('N/A')); ?>:</th>
|
| 150 |
+
<td class="value"><?php echo (isset($track['number']) ? $this->escapeHtml($track['number']) : ''); ?></td>
|
| 151 |
+
</tr>
|
| 152 |
+
<?php endif; ?>
|
| 153 |
+
</tbody>
|
| 154 |
+
</table>
|
| 155 |
+
<script type="text/javascript">decorateTable('tracking-table-popup-<?php echo $_id++ ?>');</script>
|
| 156 |
+
<?php if (is_object($track) && sizeof($track->getProgressdetail())>0): ?>
|
| 157 |
+
<br />
|
| 158 |
+
<table class="data-table" id="track-history-table-<?php echo $track->getTracking(); ?>">
|
| 159 |
+
<col />
|
| 160 |
+
<col width="1" />
|
| 161 |
+
<col width="1" />
|
| 162 |
+
<col />
|
| 163 |
+
<thead>
|
| 164 |
+
<tr>
|
| 165 |
+
<th><?php echo $this->__('Location') ?></th>
|
| 166 |
+
<th><?php echo $this->__('Date') ?></th>
|
| 167 |
+
<th><?php echo $this->__('Local Time') ?></th>
|
| 168 |
+
<th><?php echo $this->__('Description') ?></th>
|
| 169 |
+
</tr>
|
| 170 |
+
</thead>
|
| 171 |
+
<tbody>
|
| 172 |
+
<?php foreach($track->getProgressdetail() as $_detail): ?>
|
| 173 |
+
<?php $_detailDate = (isset($_detail['deliverydate']) ? $this->formatDeliveryDate($_detail['deliverydate']) : '') ?>
|
| 174 |
+
<?php $_detailTime = (isset($_detail['deliverytime']) ? $this->formatDeliveryTime($_detail['deliverytime'], $_detail['deliverydate']) : '') ?>
|
| 175 |
+
<tr>
|
| 176 |
+
<td><?php echo (isset($_detail['deliverylocation']) ? $_detail['deliverylocation'] : ''); ?></td>
|
| 177 |
+
<td><span class="nobr"><?php echo $_detailDate ?></span></td>
|
| 178 |
+
<td><span class="nobr"><?php echo $_detailTime ?></span></td>
|
| 179 |
+
<td><?php echo (isset($_detail['activity']) ? $_detail['activity'] : '') ?></td>
|
| 180 |
+
</tr>
|
| 181 |
+
<?php endforeach; ?>
|
| 182 |
+
</tbody>
|
| 183 |
+
</table>
|
| 184 |
+
<script type="text/javascript">decorateTable('track-history-table-<?php echo $track->getTracking(); ?>');</script>
|
| 185 |
+
<?php endif; ?>
|
| 186 |
+
<div class="divider"></div>
|
| 187 |
+
<?php if($counter!=$rowCount): ?>
|
| 188 |
+
<?php endif; ?>
|
| 189 |
+
<?php $counter++; ?>
|
| 190 |
+
<!--end for each tracking information-->
|
| 191 |
+
<?php endforeach; ?>
|
| 192 |
+
<?php else: ?>
|
| 193 |
+
<p><?php echo $this->__('There is no tracking available for this shipment.'); ?></p>
|
| 194 |
+
<?php endif; ?>
|
| 195 |
+
|
| 196 |
+
<?php endforeach; ?>
|
| 197 |
+
<?php else: ?>
|
| 198 |
+
<p><?php echo $this->__('There is no tracking available.'); ?></p>
|
| 199 |
+
<?php endif; ?>
|
| 200 |
+
<div class="buttons-set">
|
| 201 |
+
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Close Window')) ?>" class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
|
| 202 |
+
</div>
|
app/etc/modules/Ecom_Express.xml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<!-- /**
|
| 4 |
+
* EcomExpress
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Ecom
|
| 13 |
+
* @package Ecom_Express
|
| 14 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 15 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
|
| 20 |
+
<config>
|
| 21 |
+
<modules>
|
| 22 |
+
<Ecom_Express>
|
| 23 |
+
<active>true</active>
|
| 24 |
+
<codePool>local</codePool>
|
| 25 |
+
</Ecom_Express>
|
| 26 |
+
</modules>
|
| 27 |
+
</config>
|
js/ecom/ecomexpress.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* EcomExpress
|
| 3 |
+
*
|
| 4 |
+
* NOTICE OF LICENSE
|
| 5 |
+
*
|
| 6 |
+
* This source file is subject to the Open Source License (OSL 3.0)
|
| 7 |
+
* It is also available through the world-wide-web at this URL:
|
| 8 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 9 |
+
*
|
| 10 |
+
* @category Ecom
|
| 11 |
+
* @package Ecom_Express
|
| 12 |
+
* @author Ecom Dev Team <developer@ecomexpress.com >
|
| 13 |
+
* @copyright Copyright EcomExpress (http://ecomexpress.com/)
|
| 14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
function popup(sUrl) {
|
| 18 |
+
|
| 19 |
+
oPopup = new Window({
|
| 20 |
+
id:"popup_window",
|
| 21 |
+
className: "magento",
|
| 22 |
+
windowClassName: "popup-window",
|
| 23 |
+
title: "Current Order Status",
|
| 24 |
+
recenterAuto:false,
|
| 25 |
+
url: sUrl,
|
| 26 |
+
width: 1100,
|
| 27 |
+
height: 280,
|
| 28 |
+
minimizable: false,
|
| 29 |
+
maximizable: false,
|
| 30 |
+
showEffectOptions: {
|
| 31 |
+
duration: 0.4
|
| 32 |
+
},
|
| 33 |
+
hideEffectOptions:{
|
| 34 |
+
duration: 0.4
|
| 35 |
+
},
|
| 36 |
+
destroyOnClose: true
|
| 37 |
+
});
|
| 38 |
+
oPopup.setZIndex(100);
|
| 39 |
+
oPopup.showCenter(true);
|
| 40 |
+
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
|
lib/LinLibertineFont/ecomexpress/DejaVuSans.ttf
ADDED
|
Binary file
|
media/ecomexpress/font/FRE3OF9X.TTF
ADDED
|
Binary file
|
package.xml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Ecom_Express</name>
|
| 4 |
+
<version>0.3.2</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>OSL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>ECOM EXPRESS</summary>
|
| 10 |
+
<description>CedCommerce Ecom Express, an addon by CedCommerce, It allows the admin to integrate Ecom Express shipping method for their products and authorizes the admin to enable/disable Ecom Express carrier for admin. The smooth harmonization is established with help of Ecom REST API.</description>
|
| 11 |
+
<notes>CedCommerce Ecom Express Shipping Addon-Magento Global Addon 
|
| 12 |
+

|
| 13 |
+
Release Notes:
|
| 14 |
+

|
| 15 |
+
*Added new features:
|
| 16 |
+

|
| 17 |
+
* Ecom Express Shipping Addon allows the admin to integrate it with their product .
|
| 18 |
+

|
| 19 |
+
* Since this is a Magento standard shipping Addon so no need to install any supporting Addon.
|
| 20 |
+

|
| 21 |
+
* Admin can manage the handling Charge and display the handling charge at checkout time.
|
| 22 |
+

|
| 23 |
+
*Admin can generate the Manual and automatic AWB number.
|
| 24 |
+

|
| 25 |
+
*Admin can track the order status and cancel the shipment.
|
| 26 |
+

|
| 27 |
+
*Auto Print Shipping Label generation when Shipment created.
|
| 28 |
+

|
| 29 |
+

|
| 30 |
+

|
| 31 |
+

|
| 32 |
+

|
| 33 |
+

|
| 34 |
+

|
| 35 |
+

|
| 36 |
+
</notes>
|
| 37 |
+
<authors><author><name>CedCommerce</name><user>CedCommerce</user><email>connect@cedcommerce.com</email></author></authors>
|
| 38 |
+
<date>2016-10-13</date>
|
| 39 |
+
<time>09:12:50</time>
|
| 40 |
+
<contents><target name="magelocal"><dir name="Ecom"><dir name="Express"><dir name="Block"><dir name="Adminhtml"><dir name="Awb"><file name="Grid.php" hash="3ff73c14b64048c80557e2cfbd9fde37"/></dir><file name="Awb.php" hash="94220480ae431b9f71e7742ab2b99f07"/><dir name="Pincode"><file name="Grid.php" hash="6998aac736c0166d9241a9f98752f0fa"/></dir><file name="Pincode.php" hash="93de3aba105f7fd1ae2feb9fb82773c6"/><dir name="Renderer"><file name="Orderid.php" hash="1cd89616685cf6d884f0e192586e6f40"/><file name="Orderstatus.php" hash="e4230e89ef0e4915fce3cf38fac9f018"/><file name="Shipmentid.php" hash="6c67a0ceaf0fa979777d08f8863ccf5a"/></dir><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="View.php" hash="da29a6623e1229ed44af8aa5e3269273"/></dir></dir><dir name="Shipment"><file name="Grid.php" hash="263443d583a01de6c09df689b6d4c2ea"/></dir></dir><dir name="Widget"><dir name="Grid"><file name="Column.php" hash="9ce6b9710af29471625304d7eeaf1de0"/></dir><file name="Grid.php" hash="e5b902bc54c35e3a826700bd5b10f901"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f0335bfeae2a81b7454044a99c6405c7"/></dir><dir name="Model"><file name="Automaticawb.php" hash="7e36f0aeb0be7604d8b6b72d84486a8f"/><file name="Awb.php" hash="49190d7d9b1d3da542989384d642b378"/><dir name="Carrier"><file name="Ecomexpress.php" hash="7a16081546ea9a300b40872f0dc5f520"/></dir><dir name="Mysql4"><dir name="Awb"><file name="Collection.php" hash="f03033929f1473e48dcf1ade67db7a92"/></dir><file name="Awb.php" hash="54c121813ac73194d3de77ee5e9bc4df"/><dir name="Pincode"><file name="Collection.php" hash="6e68ef02539084a8ef854d1c589cf995"/></dir><file name="Pincode.php" hash="817015411f27a1a49a786e1406a0d8ef"/></dir><file name="Observer.php" hash="f12698f1f9cb3169e52dd7149d0b8354"/><dir name="Order"><dir name="Pdf"><file name="Shipment.php" hash="d99e8156927b222d6571866daeafd415"/><file name="Shipment_backup.php" hash="8c81573ef116557809ce48d2d6a91de5"/></dir></dir><file name="Pincode.php" hash="9ee9af5910fdd4a0e01c1f4c6aaa475e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AwbController.php" hash="a3f47456ae55afdce9107f83350864a2"/><file name="CancelController.php" hash="ea1f1d617321ab9dbac0ecbacd205a58"/><file name="IndexController.php" hash="24034b538217b7df6ff7e858b58f8958"/><file name="PincodeController.php" hash="a449af691969f5c64b9ba2603662ff74"/><file name="TrackController.php" hash="540b5a88c908693fc6b1ea9c062387d9"/></dir><file name="AjaxController.php" hash="ca84110055c2b9e617ccfae39599a78a"/><file name="IndexController.php" hash="214b8b68a343d9922cab58acdc2e83dd"/><file name="StatusController.php" hash="294706bcfe40140cdadbb54ba700b687"/></dir><dir name="etc"><file name="adminhtml.xml" hash="215cd0dd65eb832efa8254dd25f9bd3f"/><file name="config.xml" hash="144df488bd9d8dbee6c9037d7c46b505"/><file name="system.xml" hash="3644e9146ab80b129403f83217ca241c"/></dir><dir name="sql"><dir name="ecomexpress_setup"><file name="mysql4-install-0.1.0.php" hash="20b8eadba87fa9e5f2c14d66383de888"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="9350a3ebddcc83f1b41f0d0d3561d99a"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="e63ccf044255b6a58cfe464c852a184f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ecom"><dir><dir name="express"><file name="ecomexpress.xml" hash="14bc557d97dff9096931ca13c9dcf358"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ecom"><dir><dir name="express"><file name="ecomexpress.xml" hash="dcf5d4847624e4dcb38e3c0d9144d5e2"/></dir></dir></dir></dir><dir name="template"><dir name="ecomexpress"><dir><dir name="sales"><dir name="order"><file name="print.phtml" hash="0376370080bef9be2e693c6b953f4c9d"/></dir></dir><dir name="shipping"><dir name="tracking"><file name="popup.phtml" hash="57ec86367534bb416aeb2955f8c38c16"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ecom_Express.xml" hash="efbc82c3fc84c5507c0cc4b2dc1d820a"/></dir></target><target name="mage"><dir name="lib"><dir name="LinLibertineFont"><dir name="ecomexpress"><file name="DejaVuSans.ttf" hash="9e3030dca93289e02b7c3cf554b828da"/></dir></dir></dir><dir name="js"><dir name="ecom"><file name="ecomexpress.js" hash="42457d79a162071a78f8cfc97499a370"/></dir></dir><dir name="media"><dir name="ecomexpress"><dir name="font"><file name="FRE3OF9X.TTF" hash="db21b37656c8c12c17a48c38655165f0"/></dir></dir></dir></target></contents>
|
| 41 |
+
<compatible/>
|
| 42 |
+
<dependencies><required><php><min>5.1.0</min><max>7.1.0</max></php></required></dependencies>
|
| 43 |
+
</package>
|
