Rvtech_Starshipit - Version 1.3.0.0

Version Notes

First release which has been in production for several months on multiple sites.

Download this release

Release Info

Developer George Plummer
Extension Rvtech_Starshipit
Version 1.3.0.0
Comparing to
See all releases


Code changes from version 1.1.0.0 to 1.3.0.0

app/code/community/Rvtech/Starshipit/Block/Sales/Order/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/Rvtech/Starshipit/Block/Sales/Order/View.php ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = 'http://app.starshipit.com/Members/Search.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
+ 'OrderNumber' => $this->getOrder()->getData('increment_id'),
198
+ )
199
+ );
200
+
201
+ return $starshipUrl;
202
+ }
203
+ /**
204
+ * Retrieve order model object
205
+ *
206
+ * @return Mage_Sales_Model_Order
207
+ */
208
+ public function getOrder()
209
+ {
210
+ return Mage::registry('sales_order');
211
+ }
212
+
213
+ /**
214
+ * Retrieve Order Identifier
215
+ *
216
+ * @return int
217
+ */
218
+ public function getOrderId()
219
+ {
220
+ return $this->getOrder()->getId();
221
+ }
222
+
223
+ public function getHeaderText()
224
+ {
225
+ if ($_extOrderId = $this->getOrder()->getExtOrderId()) {
226
+ $_extOrderId = '[' . $_extOrderId . '] ';
227
+ } else {
228
+ $_extOrderId = '';
229
+ }
230
+ return Mage::helper('sales')->__('Order # %s %s | %s', $this->getOrder()->getRealOrderId(), $_extOrderId, $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true));
231
+ }
232
+
233
+ public function getUrl($params='', $params2=array())
234
+ {
235
+ $params2['order_id'] = $this->getOrderId();
236
+ return parent::getUrl($params, $params2);
237
+ }
238
+
239
+ public function getEditUrl()
240
+ {
241
+ return $this->getUrl('*/sales_order_edit/start');
242
+ }
243
+
244
+ public function getEmailUrl()
245
+ {
246
+ return $this->getUrl('*/*/email');
247
+ }
248
+
249
+ public function getCancelUrl()
250
+ {
251
+ return $this->getUrl('*/*/cancel');
252
+ }
253
+
254
+ public function getInvoiceUrl()
255
+ {
256
+ return $this->getUrl('*/sales_order_invoice/start');
257
+ }
258
+
259
+ public function getCreditmemoUrl()
260
+ {
261
+ return $this->getUrl('*/sales_order_creditmemo/start');
262
+ }
263
+
264
+ public function getHoldUrl()
265
+ {
266
+ return $this->getUrl('*/*/hold');
267
+ }
268
+
269
+ public function getUnholdUrl()
270
+ {
271
+ return $this->getUrl('*/*/unhold');
272
+ }
273
+
274
+ public function getShipUrl()
275
+ {
276
+ return $this->getUrl('*/sales_order_shipment/start');
277
+ }
278
+
279
+ public function getCommentUrl()
280
+ {
281
+ return $this->getUrl('*/*/comment');
282
+ }
283
+
284
+ public function getReorderUrl()
285
+ {
286
+ return $this->getUrl('*/sales_order_create/reorder');
287
+ }
288
+
289
+ /**
290
+ * Payment void URL getter
291
+ */
292
+ public function getVoidPaymentUrl()
293
+ {
294
+ return $this->getUrl('*/*/voidPayment');
295
+ }
296
+
297
+ protected function _isAllowedAction($action)
298
+ {
299
+ return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action);
300
+ }
301
+
302
+ /**
303
+ * Return back url for view grid
304
+ *
305
+ * @return string
306
+ */
307
+ public function getBackUrl()
308
+ {
309
+ if ($this->getOrder()->getBackUrl()) {
310
+ return $this->getOrder()->getBackUrl();
311
+ }
312
+
313
+ return $this->getUrl('*/*/');
314
+ }
315
+
316
+ public function getReviewPaymentUrl($action)
317
+ {
318
+ return $this->getUrl('*/*/reviewPayment', array('action' => $action));
319
+ }
320
+ //
321
+ // /**
322
+ // * Return URL for accept payment action
323
+ // *
324
+ // * @return string
325
+ // */
326
+ // public function getAcceptPaymentUrl()
327
+ // {
328
+ // return $this->getUrl('*/*/reviewPayment', array('action' => 'accept'));
329
+ // }
330
+ //
331
+ // /**
332
+ // * Return URL for deny payment action
333
+ // *
334
+ // * @return string
335
+ // */
336
+ // public function getDenyPaymentUrl()
337
+ // {
338
+ // return $this->getUrl('*/*/reviewPayment', array('action' => 'deny'));
339
+ // }
340
+ //
341
+ // public function getPaymentReviewUpdateUrl()
342
+ // {
343
+ // return $this->getUrl('*/*/reviewPaymentUpdate');
344
+ // }
345
+
346
+ }
app/code/community/Rvtech/Starshipit/Helper/Starship.php CHANGED
@@ -3,7 +3,7 @@ class Rvtech_Starshipit_Helper_Starship extends Mage_Core_Helper_Abstract
3
  {
4
 
5
 
6
- public $_wsdl = 'http://dhl.starshipit.com/OrdersService.svc?singleWsdl';
7
 
8
  public $_syncMsg = '';
9
 
3
  {
4
 
5
 
6
+ public $_wsdl = 'http://app.starshipit.com/OrdersService.svc?singleWsdl';
7
 
8
  public $_syncMsg = '';
9
 
app/code/community/Rvtech/Starshipit/Model/Observer.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class Rvtech_Starshipit_Model_Observer {
4
 
5
-
6
  protected $_noticeTitle = 'Starship Automatic Synchronization';
7
 
8
  protected $_noticeStatus;
@@ -107,4 +107,25 @@ class Rvtech_Starshipit_Model_Observer {
107
  }
108
 
109
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
2
 
3
  class Rvtech_Starshipit_Model_Observer {
4
 
5
+ const STARSHIP_BASE = 'http://app.starshipit.com/Members/Search.aspx';
6
  protected $_noticeTitle = 'Starship Automatic Synchronization';
7
 
8
  protected $_noticeStatus;
107
  }
108
 
109
  }
110
+
111
+ public function addMassAction($observer)
112
+ {
113
+ $block = $observer->getEvent()->getBlock();
114
+ $cur_url = Mage::helper('core/url')->getCurrentUrl();
115
+ $starshipUrl = Mage::helper('core/url')->addRequestParam(
116
+ self::STARSHIP_BASE,
117
+ array(
118
+ 'ReturnURL' => $cur_url,
119
+ )
120
+ );
121
+ if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
122
+ && $block->getRequest()->getControllerName() == 'sales_order')
123
+ {
124
+ $block->addItem('starshipIt_multi', array(
125
+ 'label' => 'StarShipIt',
126
+ 'starshipIt_url' => $starshipUrl,
127
+
128
+ ));
129
+ }
130
+ }
131
  }
app/code/community/Rvtech/Starshipit/controllers/IndexController.php CHANGED
@@ -2,6 +2,6 @@
2
  class Rvtech_Starshipit_IndexController extends Mage_Adminhtml_Controller_Action
3
  {
4
  public function indexAction() {
5
- echo "hey there";
6
  }
7
  }
2
  class Rvtech_Starshipit_IndexController extends Mage_Adminhtml_Controller_Action
3
  {
4
  public function indexAction() {
5
+ // echo "hey there";
6
  }
7
  }
app/code/community/Rvtech/Starshipit/etc/adminhtml.xml CHANGED
@@ -1,6 +1,6 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <menu>
4
  <starshipit translate="title" module="starshipit">
5
  <title>Starshipit</title>
6
  <sort_order>9999</sort_order>
@@ -17,5 +17,5 @@
17
  </notification>
18
  </children>
19
  </starshipit>
20
- </menu>
21
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <!-- <menu>
4
  <starshipit translate="title" module="starshipit">
5
  <title>Starshipit</title>
6
  <sort_order>9999</sort_order>
17
  </notification>
18
  </children>
19
  </starshipit>
20
+ </menu> -->
21
  </config>
app/code/community/Rvtech/Starshipit/etc/config.xml CHANGED
@@ -35,12 +35,26 @@
35
  </admin>
36
  </resources>
37
  </acl>
 
 
 
 
 
 
 
38
  </adminhtml>
39
    <global>
40
  <blocks>
41
  <starshipit>
42
  <class>Rvtech_Starshipit_Block</class>
43
  </starshipit>
 
 
 
 
 
 
 
44
  </blocks>
45
  <models>
46
  <starshipit>
@@ -61,7 +75,15 @@
61
  <method>syncOrdersNow</method>
62
  </rvtech_starshipit_order_placed_sync_now>
63
  </observers>
64
- </checkout_type_onepage_save_order_after>
 
 
 
 
 
 
 
 
65
  </events>
66
  </global>
67
  <default>
35
  </admin>
36
  </resources>
37
  </acl>
38
+ <layout>
39
+ <updates>
40
+ <starshipit>
41
+ <file>starshipit.xml</file>
42
+ </starshipit>
43
+ </updates>
44
+ </layout>
45
  </adminhtml>
46
    <global>
47
  <blocks>
48
  <starshipit>
49
  <class>Rvtech_Starshipit_Block</class>
50
  </starshipit>
51
+ <adminhtml>
52
+ <rewrite>
53
+ <sales_order_view>Rvtech_Starshipit_Block_Sales_Order_View</sales_order_view>
54
+ <!-- Massaction Done by Observer, check below -->
55
+ <!-- <sales_order_grid>Rvtech_Starshipit_Block_Sales_Order_Grid</sales_order_grid> -->
56
+ </rewrite>
57
+ </adminhtml>
58
  </blocks>
59
  <models>
60
  <starshipit>
75
  <method>syncOrdersNow</method>
76
  </rvtech_starshipit_order_placed_sync_now>
77
  </observers>
78
+ </checkout_type_onepage_save_order_after>
79
+ <core_block_abstract_prepare_layout_before>
80
+ <observers>
81
+ <starshipit_core_block_abstract_prepare_layout_before>
82
+ <class>Rvtech_Starshipit_Model_Observer</class>
83
+ <method>addMassAction</method>
84
+ </starshipit_core_block_abstract_prepare_layout_before>
85
+ </observers>
86
+ </core_block_abstract_prepare_layout_before>
87
  </events>
88
  </global>
89
  <default>
app/code/community/Rvtech/Starshipit/etc/system.xml CHANGED
@@ -1,5 +1,7 @@
 
 
1
  <config>
2
- <tabs>
3
  <starshipitconfig translate="label" module="starshipit">
4
  <label>Starshipit Configuration</label>
5
  <sort_order>200</sort_order>
@@ -92,5 +94,5 @@
92
  </group1>
93
  </groups>
94
  </starshipit_options>
95
- </sections>
96
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
  <config>
4
+ <!-- <tabs>
5
  <starshipitconfig translate="label" module="starshipit">
6
  <label>Starshipit Configuration</label>
7
  <sort_order>200</sort_order>
94
  </group1>
95
  </groups>
96
  </starshipit_options>
97
+ </sections> -->
98
  </config>
app/design/adminhtml/default/default/layout/starshipit.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <adminhtml_sales_order_index>
4
+ <reference name="head">
5
+ <action method="addJs"><script>mage/adminhtml/starshipgrid.js</script></action>
6
+ </reference>
7
+ </adminhtml_sales_order_index>
8
+ </layout>
js/mage/adminhtml/starshipgrid.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ varienGridMassaction.prototype.apply = function(){
2
+ if(varienStringArray.count(this.checkedString) == 0) {
3
+ alert(this.errorText);
4
+ return;
5
+ }
6
+
7
+ var item = this.getSelectedItem();
8
+ if(!item) {
9
+ this.validator.validate();
10
+ return;
11
+ }
12
+ this.currentItem = item;
13
+ var fieldName = (item.field ? item.field : this.formFieldName);
14
+ var fieldsHtml = '';
15
+
16
+ if(this.currentItem.confirm && !window.confirm(this.currentItem.confirm)) {
17
+ return;
18
+ }
19
+
20
+ this.formHiddens.update('');
21
+ new Insertion.Bottom(this.formHiddens, this.fieldTemplate.evaluate({name: fieldName, value: this.checkedString}));
22
+ new Insertion.Bottom(this.formHiddens, this.fieldTemplate.evaluate({name: 'massaction_prepare_key', value: fieldName}));
23
+
24
+ if(!this.validator.validate()) {
25
+ return;
26
+ }
27
+
28
+ if(this.useAjax && item.url) {
29
+ new Ajax.Request(item.url, {
30
+ 'method': 'post',
31
+ 'parameters': this.form.serialize(true),
32
+ 'onComplete': this.onMassactionComplete.bind(this)
33
+ });
34
+ } else if(item.url) {
35
+ this.form.action = item.url;
36
+ this.form.submit();
37
+ } else if(item.starshipIt_url) {
38
+ var orders = this.getCheckedValues();
39
+ var re = /\s*,\s*/;
40
+ var ordersList = orders.split(re);
41
+ var orderStr = ordersList.join("_");
42
+ var finalURL = item.starshipIt_url+'&Orders='+orderStr;
43
+ // alert('Final URL : '+finalURL);
44
+ window.location = finalURL;
45
+ }
46
+
47
+ }
package.xml CHANGED
@@ -1,22 +1,23 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rvtech_Starshipit</name>
4
- <version>1.1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Syncs Orders between Magento and StarShipIT DHL ClickToDoor to enable quotes, printing of shipping labels and track and trace.</summary>
10
- <description>The StarShipIT Magento Extension enables orders to be imported into StarShipIT DHL ClickToDoor and writes back tracking information and updates order status in Magento.&#xD;
11
  &#xD;
12
- From DHL ShipToDoor shipping labels can be produced, tracking of orders is supported, quotes can be obtained and all custom and DHL documentation can be produced.&#xD;
13
  &#xD;
14
- DHL Express Worldwide is supported.</description>
 
15
  <notes>First release which has been in production for several months on multiple sites.</notes>
16
  <authors><author><name>George Plummer</name><user>GeorgeSPlummer</user><email>george@starshipit.com</email></author></authors>
17
- <date>2013-09-09</date>
18
- <time>10:49:16</time>
19
- <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><dir name="Helper"><file name="Data.php" hash="0313223fc94e9ed45f4401119bd6f528"/><file name="Starship.php" hash="f4c538bcb80335b213602528b749ce3c"/><file name="Starship.php_ORG" hash="d92f50594c70158dd94453ef7f147de9"/></dir><dir name="Model"><file name="Observer.php" hash="68edec460ac627ff4aec5fece6d688b6"/><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="3ac934011e0b4bffd25fbbe927bad092"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d1b2db6c781f6fcacfe4ef75ad490cd0"/><file name="config.xml" hash="8c3ed77f01ca97b8db4cb55a8b7b27d8"/><file name="system.xml" hash="02f6bb9bd097efe52939c8c638cdb4af"/></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></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rvtech_Startshipit.xml" hash="741fde1331d6a9b27ef2faa2bd8a843f"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.1.0</min><max>5.5.2</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rvtech_Starshipit</name>
4
+ <version>1.3.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Syncs Orders between Magento and StarShipIt DHL to enable quotes, printing of shipping labels and track and trace.</summary>
10
+ <description>The StarShipIt Magento Extension enables orders to be imported into StarShipIt DHL and writes back tracking information and updates order status in Magento.&#xD;
11
  &#xD;
12
+ From StarShipIt shipping labels can be produced, tracking of orders is supported, quotes can be obtained and all custom and DHL documentation can be produced.&#xD;
13
  &#xD;
14
+ DHL Express Worldwide is supported as well &#xD;
15
+ Australia Post eParcel, CourierPost, Fastways, and more</description>
16
  <notes>First release which has been in production for several months on multiple sites.</notes>
17
  <authors><author><name>George Plummer</name><user>GeorgeSPlummer</user><email>george@starshipit.com</email></author></authors>
18
+ <date>2014-02-25</date>
19
+ <time>07:14:03</time>
20
+ <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="08cb2c65b7ec0decec579bfdbfe79c7d"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0313223fc94e9ed45f4401119bd6f528"/><file name="Starship.php" hash="0d508c0919706880b86f9ef755cd5d34"/><file name="Starship.php_ORG" hash="d92f50594c70158dd94453ef7f147de9"/></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="74b613713201c1ceefde62369ef30621"/><file name="system.xml" hash="02c4074fdacdf4c48f78eb85409dcc77"/></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"/></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>
21
  <compatible/>
22
  <dependencies><required><php><min>5.1.0</min><max>5.5.2</max></php></required></dependencies>
23
  </package>