Version Notes
Added supported carriers to the carrier list as well as tracking URLs for them all.
Also added quote lookups for CourierPost, DHL, with Australia Post to be added in the next few days.
Download this release
Release Info
Developer | George Plummer |
Extension | Rvtech_Starshipit |
Version | 1.6.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.0.0 to 1.6.0.2
- app/code/community/Rvtech/Starshipit/Block/Sales/Order/View.php +3 -2
- app/code/community/Starshipit/Ship/Model/Carrier/Auspost.php +2 -2
- app/code/community/Starshipit/Ship/Model/Carrier/Button.php +51 -0
- app/code/community/Starshipit/Ship/Model/Carrier/Grid.php +226 -0
- app/code/community/Starshipit/Ship/Model/Carrier/Nzpost.php +1 -1
- app/code/community/Starshipit/Ship/Model/Carrier/View.php +347 -0
- package.xml +5 -5
app/code/community/Rvtech/Starshipit/Block/Sales/Order/View.php
CHANGED
@@ -34,7 +34,7 @@
|
|
34 |
class Rvtech_Starshipit_Block_Sales_Order_View extends Mage_Adminhtml_Block_Widget_Form_Container
|
35 |
{
|
36 |
|
37 |
-
const STARSHIP_BASE = 'https://
|
38 |
|
39 |
public function __construct()
|
40 |
{
|
@@ -194,7 +194,8 @@ class Rvtech_Starshipit_Block_Sales_Order_View extends Mage_Adminhtml_Block_Widg
|
|
194 |
self::STARSHIP_BASE,
|
195 |
array(
|
196 |
'ReturnURL' => $cur_url,
|
197 |
-
'
|
|
|
198 |
)
|
199 |
);
|
200 |
|
34 |
class Rvtech_Starshipit_Block_Sales_Order_View extends Mage_Adminhtml_Block_Widget_Form_Container
|
35 |
{
|
36 |
|
37 |
+
const STARSHIP_BASE = 'https://go.starshipit.com/templates/admin4/ship.aspx';
|
38 |
|
39 |
public function __construct()
|
40 |
{
|
194 |
self::STARSHIP_BASE,
|
195 |
array(
|
196 |
'ReturnURL' => $cur_url,
|
197 |
+
'Order' => $this->getOrder()->getData('increment_id'),
|
198 |
+
'source' => 'magento'
|
199 |
)
|
200 |
);
|
201 |
|
app/code/community/Starshipit/Ship/Model/Carrier/Auspost.php
CHANGED
@@ -47,7 +47,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
|
|
47 |
try
|
48 |
{
|
49 |
// Call web service.
|
50 |
-
$wsdl = '
|
51 |
$client = new SoapClient($wsdl, array(
|
52 |
'cache_wsdl' => WSDL_CACHE_NONE,
|
53 |
'cache_ttl' => 86400,
|
@@ -62,7 +62,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
|
|
62 |
}
|
63 |
catch (Exception $e)
|
64 |
{
|
65 |
-
Mage::log($e->getMessage()
|
66 |
}
|
67 |
}
|
68 |
|
47 |
try
|
48 |
{
|
49 |
// Call web service.
|
50 |
+
$wsdl = 'https://go.starshipit.com/shipment.svc?WSDL';
|
51 |
$client = new SoapClient($wsdl, array(
|
52 |
'cache_wsdl' => WSDL_CACHE_NONE,
|
53 |
'cache_ttl' => 86400,
|
62 |
}
|
63 |
catch (Exception $e)
|
64 |
{
|
65 |
+
Mage::log($e->getMessage(), null, starshipit.log);
|
66 |
}
|
67 |
}
|
68 |
|
app/code/community/Starshipit/Ship/Model/Carrier/Button.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Rvtech_Starshipit_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/*
|
5 |
+
* Set template
|
6 |
+
*/
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('starshipit/system/config/button.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Return element html
|
15 |
+
*
|
16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
20 |
+
{
|
21 |
+
return $this->_toHtml();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Return ajax url for button
|
26 |
+
*
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
public function getAjaxCheckUrl()
|
30 |
+
{
|
31 |
+
return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_starshipit/test');
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Generate button html
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getButtonHtml()
|
40 |
+
{
|
41 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
42 |
+
->setData(array(
|
43 |
+
'id' => 'starshipit_test_button',
|
44 |
+
'label' => $this->helper('adminhtml')->__('Test'),
|
45 |
+
'onclick' => 'javascript:test(); return false;'
|
46 |
+
));
|
47 |
+
|
48 |
+
return $button->toHtml();
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
app/code/community/Starshipit/Ship/Model/Carrier/Grid.php
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Adminhtml sales orders grid
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Rvtech_Starshipit_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
35 |
+
{
|
36 |
+
|
37 |
+
public function __construct()
|
38 |
+
{
|
39 |
+
parent::__construct();
|
40 |
+
$this->setId('sales_order_grid');
|
41 |
+
$this->setUseAjax(true);
|
42 |
+
$this->setDefaultSort('created_at');
|
43 |
+
$this->setDefaultDir('DESC');
|
44 |
+
$this->setSaveParametersInSession(true);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Retrieve collection class
|
49 |
+
*
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
protected function _getCollectionClass()
|
53 |
+
{
|
54 |
+
return 'sales/order_grid_collection';
|
55 |
+
}
|
56 |
+
|
57 |
+
protected function _prepareCollection()
|
58 |
+
{
|
59 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
60 |
+
$this->setCollection($collection);
|
61 |
+
return parent::_prepareCollection();
|
62 |
+
}
|
63 |
+
|
64 |
+
protected function _prepareColumns()
|
65 |
+
{
|
66 |
+
|
67 |
+
$this->addColumn('real_order_id', array(
|
68 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
69 |
+
'width' => '80px',
|
70 |
+
'type' => 'text',
|
71 |
+
'index' => 'increment_id',
|
72 |
+
));
|
73 |
+
|
74 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
75 |
+
$this->addColumn('store_id', array(
|
76 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
77 |
+
'index' => 'store_id',
|
78 |
+
'type' => 'store',
|
79 |
+
'store_view'=> true,
|
80 |
+
'display_deleted' => true,
|
81 |
+
));
|
82 |
+
}
|
83 |
+
|
84 |
+
$this->addColumn('created_at', array(
|
85 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
86 |
+
'index' => 'created_at',
|
87 |
+
'type' => 'datetime',
|
88 |
+
'width' => '100px',
|
89 |
+
));
|
90 |
+
|
91 |
+
$this->addColumn('billing_name', array(
|
92 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
93 |
+
'index' => 'billing_name',
|
94 |
+
));
|
95 |
+
|
96 |
+
$this->addColumn('shipping_name', array(
|
97 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
98 |
+
'index' => 'shipping_name',
|
99 |
+
));
|
100 |
+
|
101 |
+
$this->addColumn('base_grand_total', array(
|
102 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
103 |
+
'index' => 'base_grand_total',
|
104 |
+
'type' => 'currency',
|
105 |
+
'currency' => 'base_currency_code',
|
106 |
+
));
|
107 |
+
|
108 |
+
$this->addColumn('grand_total', array(
|
109 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
110 |
+
'index' => 'grand_total',
|
111 |
+
'type' => 'currency',
|
112 |
+
'currency' => 'order_currency_code',
|
113 |
+
));
|
114 |
+
|
115 |
+
$this->addColumn('status', array(
|
116 |
+
'header' => Mage::helper('sales')->__('Status'),
|
117 |
+
'index' => 'status',
|
118 |
+
'type' => 'options',
|
119 |
+
'width' => '70px',
|
120 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
121 |
+
));
|
122 |
+
|
123 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
124 |
+
$this->addColumn('action',
|
125 |
+
array(
|
126 |
+
'header' => Mage::helper('sales')->__('Action'),
|
127 |
+
'width' => '50px',
|
128 |
+
'type' => 'action',
|
129 |
+
'getter' => 'getId',
|
130 |
+
'actions' => array(
|
131 |
+
array(
|
132 |
+
'caption' => Mage::helper('sales')->__('View'),
|
133 |
+
'url' => array('base'=>'*/sales_order/view'),
|
134 |
+
'field' => 'order_id'
|
135 |
+
)
|
136 |
+
),
|
137 |
+
'filter' => false,
|
138 |
+
'sortable' => false,
|
139 |
+
'index' => 'stores',
|
140 |
+
'is_system' => true,
|
141 |
+
));
|
142 |
+
}
|
143 |
+
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
|
144 |
+
|
145 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
146 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
147 |
+
|
148 |
+
return parent::_prepareColumns();
|
149 |
+
}
|
150 |
+
|
151 |
+
protected function _prepareMassaction()
|
152 |
+
{
|
153 |
+
$this->setMassactionIdField('entity_id');
|
154 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
155 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
156 |
+
|
157 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
158 |
+
$this->getMassactionBlock()->addItem('cancel_order', array(
|
159 |
+
'label'=> Mage::helper('sales')->__('Cancel'),
|
160 |
+
'url' => $this->getUrl('*/sales_order/massCancel'),
|
161 |
+
));
|
162 |
+
}
|
163 |
+
|
164 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
|
165 |
+
$this->getMassactionBlock()->addItem('hold_order', array(
|
166 |
+
'label'=> Mage::helper('sales')->__('Hold'),
|
167 |
+
'url' => $this->getUrl('*/sales_order/massHold'),
|
168 |
+
));
|
169 |
+
}
|
170 |
+
|
171 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
172 |
+
$this->getMassactionBlock()->addItem('unhold_order', array(
|
173 |
+
'label'=> Mage::helper('sales')->__('Unhold'),
|
174 |
+
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
175 |
+
));
|
176 |
+
}
|
177 |
+
|
178 |
+
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
|
179 |
+
'label'=> Mage::helper('sales')->__('Print Invoices'),
|
180 |
+
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
|
181 |
+
));
|
182 |
+
|
183 |
+
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
184 |
+
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
185 |
+
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
186 |
+
));
|
187 |
+
|
188 |
+
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
189 |
+
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
190 |
+
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
191 |
+
));
|
192 |
+
|
193 |
+
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
194 |
+
'label'=> Mage::helper('sales')->__('Print All'),
|
195 |
+
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
196 |
+
));
|
197 |
+
|
198 |
+
$this->getMassactionBlock()->addItem('print_shipping_label', array(
|
199 |
+
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
|
200 |
+
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
|
201 |
+
));
|
202 |
+
|
203 |
+
$this->getMassactionBlock()->addItem('starshipIt_multi', array(
|
204 |
+
'label'=> Mage::helper('sales')->__('StarShipIt'),
|
205 |
+
'url' => $this->getUrl('http://www.google.com'),
|
206 |
+
'confirm' => Mage::helper('sales')->__('You Sure !!'),
|
207 |
+
'startshipiturl' => true,
|
208 |
+
));
|
209 |
+
|
210 |
+
return $this;
|
211 |
+
}
|
212 |
+
|
213 |
+
public function getRowUrl($row)
|
214 |
+
{
|
215 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
216 |
+
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
217 |
+
}
|
218 |
+
return false;
|
219 |
+
}
|
220 |
+
|
221 |
+
public function getGridUrl()
|
222 |
+
{
|
223 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
224 |
+
}
|
225 |
+
|
226 |
+
}
|
app/code/community/Starshipit/Ship/Model/Carrier/Nzpost.php
CHANGED
@@ -47,7 +47,7 @@ implements Mage_Shipping_Model_Carrier_Interface {
|
|
47 |
|
48 |
try{
|
49 |
// Call web service.
|
50 |
-
$wsdl = 'https://
|
51 |
$client = new SoapClient($wsdl, array(
|
52 |
'cache_wsdl' => WSDL_CACHE_NONE,
|
53 |
'cache_ttl' => 86400,
|
47 |
|
48 |
try{
|
49 |
// Call web service.
|
50 |
+
$wsdl = 'https://go.starshipit.com/shipment.svc?WSDL';
|
51 |
$client = new SoapClient($wsdl, array(
|
52 |
'cache_wsdl' => WSDL_CACHE_NONE,
|
53 |
'cache_ttl' => 86400,
|
app/code/community/Starshipit/Ship/Model/Carrier/View.php
ADDED
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Adminhtml sales order view
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Rvtech_Starshipit_Block_Sales_Order_View extends Mage_Adminhtml_Block_Widget_Form_Container
|
35 |
+
{
|
36 |
+
|
37 |
+
const STARSHIP_BASE = 'https://go.starshipit.com/templates/admin4/ship.aspx';
|
38 |
+
|
39 |
+
public function __construct()
|
40 |
+
{
|
41 |
+
$this->_objectId = 'order_id';
|
42 |
+
$this->_controller = 'sales_order';
|
43 |
+
$this->_mode = 'view';
|
44 |
+
|
45 |
+
parent::__construct();
|
46 |
+
|
47 |
+
$this->_removeButton('delete');
|
48 |
+
$this->_removeButton('reset');
|
49 |
+
$this->_removeButton('save');
|
50 |
+
$this->setId('sales_order_view');
|
51 |
+
$order = $this->getOrder();
|
52 |
+
|
53 |
+
if ($this->_isAllowedAction('edit') && $order->canEdit()) {
|
54 |
+
$onclickJs = 'deleteConfirm(\''
|
55 |
+
. Mage::helper('sales')->__('Are you sure? This order will be canceled and a new one will be created instead')
|
56 |
+
. '\', \'' . $this->getEditUrl() . '\');';
|
57 |
+
$this->_addButton('order_edit', array(
|
58 |
+
'label' => Mage::helper('sales')->__('Edit'),
|
59 |
+
'onclick' => $onclickJs,
|
60 |
+
));
|
61 |
+
// see if order has non-editable products as items
|
62 |
+
$nonEditableTypes = array_keys($this->getOrder()->getResource()->aggregateProductsByTypes(
|
63 |
+
$order->getId(),
|
64 |
+
array_keys(Mage::getConfig()
|
65 |
+
->getNode('adminhtml/sales/order/create/available_product_types')
|
66 |
+
->asArray()
|
67 |
+
),
|
68 |
+
false
|
69 |
+
));
|
70 |
+
if ($nonEditableTypes) {
|
71 |
+
$this->_updateButton('order_edit', 'onclick',
|
72 |
+
'if (!confirm(\'' .
|
73 |
+
Mage::helper('sales')->__('This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be canceled and a new order will be placed.', implode(', ', $nonEditableTypes), implode(', ', $nonEditableTypes)) . '\')) return false;' . $onclickJs
|
74 |
+
);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
if ($this->_isAllowedAction('cancel') && $order->canCancel()) {
|
79 |
+
$message = Mage::helper('sales')->__('Are you sure you want to cancel this order?');
|
80 |
+
$this->_addButton('order_cancel', array(
|
81 |
+
'label' => Mage::helper('sales')->__('Cancel'),
|
82 |
+
'onclick' => 'deleteConfirm(\''.$message.'\', \'' . $this->getCancelUrl() . '\')',
|
83 |
+
));
|
84 |
+
}
|
85 |
+
|
86 |
+
if ($this->_isAllowedAction('emails') && !$order->isCanceled()) {
|
87 |
+
$message = Mage::helper('sales')->__('Are you sure you want to send order email to customer?');
|
88 |
+
$this->addButton('send_notification', array(
|
89 |
+
'label' => Mage::helper('sales')->__('Send Email'),
|
90 |
+
'onclick' => "confirmSetLocation('{$message}', '{$this->getEmailUrl()}')",
|
91 |
+
));
|
92 |
+
}
|
93 |
+
|
94 |
+
if ($this->_isAllowedAction('creditmemo') && $order->canCreditmemo()) {
|
95 |
+
$message = Mage::helper('sales')->__('This will create an offline refund. To create an online refund, open an invoice and create credit memo for it. Do you wish to proceed?');
|
96 |
+
$onClick = "setLocation('{$this->getCreditmemoUrl()}')";
|
97 |
+
if ($order->getPayment()->getMethodInstance()->isGateway()) {
|
98 |
+
$onClick = "confirmSetLocation('{$message}', '{$this->getCreditmemoUrl()}')";
|
99 |
+
}
|
100 |
+
$this->_addButton('order_creditmemo', array(
|
101 |
+
'label' => Mage::helper('sales')->__('Credit Memo'),
|
102 |
+
'onclick' => $onClick,
|
103 |
+
'class' => 'go'
|
104 |
+
));
|
105 |
+
}
|
106 |
+
|
107 |
+
// invoice action intentionally
|
108 |
+
if ($this->_isAllowedAction('invoice') && $order->canVoidPayment()) {
|
109 |
+
$message = Mage::helper('sales')->__('Are you sure you want to void the payment?');
|
110 |
+
$this->addButton('void_payment', array(
|
111 |
+
'label' => Mage::helper('sales')->__('Void'),
|
112 |
+
'onclick' => "confirmSetLocation('{$message}', '{$this->getVoidPaymentUrl()}')",
|
113 |
+
));
|
114 |
+
}
|
115 |
+
|
116 |
+
if ($this->_isAllowedAction('hold') && $order->canHold()) {
|
117 |
+
$this->_addButton('order_hold', array(
|
118 |
+
'label' => Mage::helper('sales')->__('Hold'),
|
119 |
+
'onclick' => 'setLocation(\'' . $this->getHoldUrl() . '\')',
|
120 |
+
));
|
121 |
+
}
|
122 |
+
|
123 |
+
if ($this->_isAllowedAction('unhold') && $order->canUnhold()) {
|
124 |
+
$this->_addButton('order_unhold', array(
|
125 |
+
'label' => Mage::helper('sales')->__('Unhold'),
|
126 |
+
'onclick' => 'setLocation(\'' . $this->getUnholdUrl() . '\')',
|
127 |
+
));
|
128 |
+
}
|
129 |
+
|
130 |
+
if ($this->_isAllowedAction('review_payment')) {
|
131 |
+
if ($order->canReviewPayment()) {
|
132 |
+
$message = Mage::helper('sales')->__('Are you sure you want to accept this payment?');
|
133 |
+
$this->_addButton('accept_payment', array(
|
134 |
+
'label' => Mage::helper('sales')->__('Accept Payment'),
|
135 |
+
'onclick' => "confirmSetLocation('{$message}', '{$this->getReviewPaymentUrl('accept')}')",
|
136 |
+
));
|
137 |
+
$message = Mage::helper('sales')->__('Are you sure you want to deny this payment?');
|
138 |
+
$this->_addButton('deny_payment', array(
|
139 |
+
'label' => Mage::helper('sales')->__('Deny Payment'),
|
140 |
+
'onclick' => "confirmSetLocation('{$message}', '{$this->getReviewPaymentUrl('deny')}')",
|
141 |
+
));
|
142 |
+
}
|
143 |
+
if ($order->canFetchPaymentReviewUpdate()) {
|
144 |
+
$this->_addButton('get_review_payment_update', array(
|
145 |
+
'label' => Mage::helper('sales')->__('Get Payment Update'),
|
146 |
+
'onclick' => 'setLocation(\'' . $this->getReviewPaymentUrl('update') . '\')',
|
147 |
+
));
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
if ($this->_isAllowedAction('invoice') && $order->canInvoice()) {
|
152 |
+
$_label = $order->getForcedDoShipmentWithInvoice() ?
|
153 |
+
Mage::helper('sales')->__('Invoice and Ship') :
|
154 |
+
Mage::helper('sales')->__('Invoice');
|
155 |
+
$this->_addButton('order_invoice', array(
|
156 |
+
'label' => $_label,
|
157 |
+
'onclick' => 'setLocation(\'' . $this->getInvoiceUrl() . '\')',
|
158 |
+
'class' => 'go'
|
159 |
+
));
|
160 |
+
}
|
161 |
+
|
162 |
+
if ($this->_isAllowedAction('ship') && $order->canShip()
|
163 |
+
&& !$order->getForcedDoShipmentWithInvoice()) {
|
164 |
+
$this->_addButton('order_ship', array(
|
165 |
+
'label' => Mage::helper('sales')->__('Ship'),
|
166 |
+
'onclick' => 'setLocation(\'' . $this->getShipUrl() . '\')',
|
167 |
+
'class' => 'go'
|
168 |
+
));
|
169 |
+
}
|
170 |
+
|
171 |
+
if ($this->_isAllowedAction('reorder')
|
172 |
+
&& $this->helper('sales/reorder')->isAllowed($order->getStore())
|
173 |
+
&& $order->canReorderIgnoreSalable()
|
174 |
+
) {
|
175 |
+
$this->_addButton('order_reorder', array(
|
176 |
+
'label' => Mage::helper('sales')->__('Reorder'),
|
177 |
+
'onclick' => 'setLocation(\'' . $this->getReorderUrl() . '\')',
|
178 |
+
'class' => 'go'
|
179 |
+
));
|
180 |
+
}
|
181 |
+
|
182 |
+
// Starship Button
|
183 |
+
$this->_addButton('order_starship', array(
|
184 |
+
'label' => Mage::helper('sales')->__('StarShipIt'),
|
185 |
+
'onclick' => 'setLocation(\'' . $this->getStarshipUrl() . '\')',
|
186 |
+
'class' => 'go'
|
187 |
+
));
|
188 |
+
}
|
189 |
+
|
190 |
+
public function getStarshipUrl()
|
191 |
+
{
|
192 |
+
$cur_url = Mage::helper('core/url')->getCurrentUrl();
|
193 |
+
$starshipUrl = Mage::helper('core/url')->addRequestParam(
|
194 |
+
self::STARSHIP_BASE,
|
195 |
+
array(
|
196 |
+
'ReturnURL' => $cur_url,
|
197 |
+
'Order' => $this->getOrder()->getData('increment_id'),
|
198 |
+
'source' => 'magento'
|
199 |
+
)
|
200 |
+
);
|
201 |
+
|
202 |
+
return $starshipUrl;
|
203 |
+
}
|
204 |
+
/**
|
205 |
+
* Retrieve order model object
|
206 |
+
*
|
207 |
+
* @return Mage_Sales_Model_Order
|
208 |
+
*/
|
209 |
+
public function getOrder()
|
210 |
+
{
|
211 |
+
return Mage::registry('sales_order');
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Retrieve Order Identifier
|
216 |
+
*
|
217 |
+
* @return int
|
218 |
+
*/
|
219 |
+
public function getOrderId()
|
220 |
+
{
|
221 |
+
return $this->getOrder()->getId();
|
222 |
+
}
|
223 |
+
|
224 |
+
public function getHeaderText()
|
225 |
+
{
|
226 |
+
if ($_extOrderId = $this->getOrder()->getExtOrderId()) {
|
227 |
+
$_extOrderId = '[' . $_extOrderId . '] ';
|
228 |
+
} else {
|
229 |
+
$_extOrderId = '';
|
230 |
+
}
|
231 |
+
return Mage::helper('sales')->__('Order # %s %s | %s', $this->getOrder()->getRealOrderId(), $_extOrderId, $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true));
|
232 |
+
}
|
233 |
+
|
234 |
+
public function getUrl($params='', $params2=array())
|
235 |
+
{
|
236 |
+
$params2['order_id'] = $this->getOrderId();
|
237 |
+
return parent::getUrl($params, $params2);
|
238 |
+
}
|
239 |
+
|
240 |
+
public function getEditUrl()
|
241 |
+
{
|
242 |
+
return $this->getUrl('*/sales_order_edit/start');
|
243 |
+
}
|
244 |
+
|
245 |
+
public function getEmailUrl()
|
246 |
+
{
|
247 |
+
return $this->getUrl('*/*/email');
|
248 |
+
}
|
249 |
+
|
250 |
+
public function getCancelUrl()
|
251 |
+
{
|
252 |
+
return $this->getUrl('*/*/cancel');
|
253 |
+
}
|
254 |
+
|
255 |
+
public function getInvoiceUrl()
|
256 |
+
{
|
257 |
+
return $this->getUrl('*/sales_order_invoice/start');
|
258 |
+
}
|
259 |
+
|
260 |
+
public function getCreditmemoUrl()
|
261 |
+
{
|
262 |
+
return $this->getUrl('*/sales_order_creditmemo/start');
|
263 |
+
}
|
264 |
+
|
265 |
+
public function getHoldUrl()
|
266 |
+
{
|
267 |
+
return $this->getUrl('*/*/hold');
|
268 |
+
}
|
269 |
+
|
270 |
+
public function getUnholdUrl()
|
271 |
+
{
|
272 |
+
return $this->getUrl('*/*/unhold');
|
273 |
+
}
|
274 |
+
|
275 |
+
public function getShipUrl()
|
276 |
+
{
|
277 |
+
return $this->getUrl('*/sales_order_shipment/start');
|
278 |
+
}
|
279 |
+
|
280 |
+
public function getCommentUrl()
|
281 |
+
{
|
282 |
+
return $this->getUrl('*/*/comment');
|
283 |
+
}
|
284 |
+
|
285 |
+
public function getReorderUrl()
|
286 |
+
{
|
287 |
+
return $this->getUrl('*/sales_order_create/reorder');
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Payment void URL getter
|
292 |
+
*/
|
293 |
+
public function getVoidPaymentUrl()
|
294 |
+
{
|
295 |
+
return $this->getUrl('*/*/voidPayment');
|
296 |
+
}
|
297 |
+
|
298 |
+
protected function _isAllowedAction($action)
|
299 |
+
{
|
300 |
+
return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action);
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Return back url for view grid
|
305 |
+
*
|
306 |
+
* @return string
|
307 |
+
*/
|
308 |
+
public function getBackUrl()
|
309 |
+
{
|
310 |
+
if ($this->getOrder()->getBackUrl()) {
|
311 |
+
return $this->getOrder()->getBackUrl();
|
312 |
+
}
|
313 |
+
|
314 |
+
return $this->getUrl('*/*/');
|
315 |
+
}
|
316 |
+
|
317 |
+
public function getReviewPaymentUrl($action)
|
318 |
+
{
|
319 |
+
return $this->getUrl('*/*/reviewPayment', array('action' => $action));
|
320 |
+
}
|
321 |
+
//
|
322 |
+
// /**
|
323 |
+
// * Return URL for accept payment action
|
324 |
+
// *
|
325 |
+
// * @return string
|
326 |
+
// */
|
327 |
+
// public function getAcceptPaymentUrl()
|
328 |
+
// {
|
329 |
+
// return $this->getUrl('*/*/reviewPayment', array('action' => 'accept'));
|
330 |
+
// }
|
331 |
+
//
|
332 |
+
// /**
|
333 |
+
// * Return URL for deny payment action
|
334 |
+
// *
|
335 |
+
// * @return string
|
336 |
+
// */
|
337 |
+
// public function getDenyPaymentUrl()
|
338 |
+
// {
|
339 |
+
// return $this->getUrl('*/*/reviewPayment', array('action' => 'deny'));
|
340 |
+
// }
|
341 |
+
//
|
342 |
+
// public function getPaymentReviewUpdateUrl()
|
343 |
+
// {
|
344 |
+
// return $this->getUrl('*/*/reviewPaymentUpdate');
|
345 |
+
// }
|
346 |
+
|
347 |
+
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Rvtech_Starshipit</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -19,9 +19,9 @@ Australia Post eParcel, CourierPost, Fastways, and more</description>
|
|
19 |

|
20 |
Also added quote lookups for CourierPost, DHL, with Australia Post to be added in the next few days.</notes>
|
21 |
<authors><author><name>George Plummer</name><user>GeorgeSPlummer</user><email>george@starshipit.com</email></author></authors>
|
22 |
-
<date>
|
23 |
-
<time>05:
|
24 |
-
<contents><target name="magecommunity"><dir name="Rvtech"><dir name="Starshipit"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="2b3b0143262abe0d3ba50c38fe10d932"/><file name="Syncbutton.php" hash="b53f7f430495c1e9466789b116ce6349"/></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="52dc5c408d28810e8bc3a19dc65409a3"/><file name="View.php" hash="
|
25 |
<compatible/>
|
26 |
-
<dependencies><required><php><min>5.1.0</min><max>5.
|
27 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Rvtech_Starshipit</name>
|
4 |
+
<version>1.6.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
19 |

|
20 |
Also added quote lookups for CourierPost, DHL, with Australia Post to be added in the next few days.</notes>
|
21 |
<authors><author><name>George Plummer</name><user>GeorgeSPlummer</user><email>george@starshipit.com</email></author></authors>
|
22 |
+
<date>2015-04-13</date>
|
23 |
+
<time>05:28:49</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Rvtech"><dir name="Starshipit"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="2b3b0143262abe0d3ba50c38fe10d932"/><file name="Syncbutton.php" hash="b53f7f430495c1e9466789b116ce6349"/></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="52dc5c408d28810e8bc3a19dc65409a3"/><file name="View.php" hash="68a6ab1c4af574061427794af187ae44"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0313223fc94e9ed45f4401119bd6f528"/><file name="Starship.php" hash="8e67e9407ff4e1226c9ee83ba267b6d5"/></dir><dir name="Model"><file name="Observer.php" hash="cac0751526ff06c8bdaa99d432a75865"/><file name="Orders.php" hash="d5e6fa78702b1a0bd60e8cb4b3f57521"/><file name="Orders.php_ORG" hash="cbadeab0c67303b653bed3549a9b73de"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="StarshipitController.php" hash="926e0e618d5732fa7fffc0b1b5028259"/><file name="StarshipitController.php_ORG" hash="b7c694e8252892da817eae072f6f8ad6"/></dir><file name="IndexController.php" hash="f74d6e40df4fc46a9be2e53b5da55727"/></dir><dir name="etc"><file name="adminhtml.xml" hash="02121bfdaabeb4aa30733462d532b211"/><file name="config.xml" hash="521d80ad07595a1d4017ac610dd1512c"/><file name="system.xml" hash="02c4074fdacdf4c48f78eb85409dcc77"/></dir></dir></dir><dir name="Starshipit"><dir name="Ship"><dir name="Block"><file name="Ship.php" hash="529d915d3293400dab088a1827406977"/></dir><dir name="Helper"><file name="Data.php" hash="601fe2fdf26bd83cc88ce7b9da7d6e23"/></dir><dir name="Model"><dir name="Carrier"><file name="Auspost.php" hash="12ba8d875aa3390323356540ef291d7b"/><file name="Button.php" hash="2b3b0143262abe0d3ba50c38fe10d932"/><file name="Courierpost.php" hash="020b163a31753d59d4eb4acb30f9aa7e"/><file name="Dhlexpress.php" hash="ef0d41ba374e75028fd5ed2ecadc538a"/><file name="Fastway.php" hash="68e6be1e3bfcac41cdd68d13b5a06a0a"/><file name="Grid.php" hash="52dc5c408d28810e8bc3a19dc65409a3"/><file name="Nzpost.php" hash="fd2e2bcf5bae86f73ef4fbd43cfd5757"/><file name="View.php" hash="68a6ab1c4af574061427794af187ae44"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="87ed8f9f6923f532a1fab239c54596c5"/></dir><dir name="etc"><file name="config.xml" hash="d83e58ad297f4a06d5dea18883b141f5"/><file name="system.xml" hash="e2d23522fcc05684be45ab699d80b666"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="starshipit"><dir name="system"><dir name="config"><file name="button.phtml" hash="064f053f67fc7b749d1aec40cd352ce1"/><file name="syncbutton.phtml" hash="3e67731254d4d0298891cd2598471dc9"/></dir></dir></dir></dir><dir name="layout"><file name="starshipit.xml" hash="e451df5a50a3c73bd53ba272ba43f2a4"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rvtech_Startshipit.xml" hash="741fde1331d6a9b27ef2faa2bd8a843f"/><file name="Starshipit.xml" hash="af4dcd9278d8eb0d30dfb70de26682eb"/></dir></target><target name="mageweb"><dir name="js"><dir name="mage"><dir name="adminhtml"><file name="starshipgrid.js" hash="df976a3e0a82fa6e8117ef687609b431"/></dir></dir></dir></target></contents>
|
25 |
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.1.0</min><max>5.6.8</max></php></required></dependencies>
|
27 |
</package>
|