UPS_Worldship_Dutch - Version 1.2.0

Version Notes

notes

Download this release

Release Info

Developer Magento Core Team
Extension UPS_Worldship_Dutch
Version 1.2.0
Comparing to
See all releases


Version 1.2.0

app/code/local/Synocom/UPSOrderExport/Block/Sales/Order/Grid.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * The MIT License
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * @package Synocom_UPSOrderExport
26
+ * @copyright Copyright (c) 2011 R. Wiek (info@synocom.nl)
27
+ * @license http://opensource.org/licenses/mit-license.php The MIT License
28
+ */
29
+
30
+ /**
31
+ * Overrides Mage_Adminhtml_Block_Sales_Order_Grid to append option to export to csv
32
+ * to mass action select box in the orders grid.
33
+ */
34
+ class Synocom_UPSOrderExport_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
35
+ {
36
+ /**
37
+ * Extends the mass action select box to append the option to export to csv.
38
+ */
39
+ protected function _prepareMassaction()
40
+ {
41
+ // Let the base class do its work
42
+ parent::_prepareMassaction();
43
+
44
+ // Append option to export to csv to select box
45
+ $this->getMassactionBlock()->addItem(
46
+ 'upsorderexport',
47
+ array('label'=>$this->__('UPS Export to .csv file'), 'url'=>$this->getUrl('upsorderexport/export_order/csvexport'))
48
+ );
49
+ }
50
+ }
51
+ ?>
app/code/local/Synocom/UPSOrderExport/Model/Export/Abstract.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * The MIT License
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * @package Synocom_UPSOrderExport
26
+ * @copyright Copyright (c) 2011 R. Wiek (info@synocom.nl)
27
+ * @license http://opensource.org/licenses/mit-license.php The MIT License
28
+ */
29
+
30
+ /**
31
+ * Abstract class to define the interface to export orders and offering helper methods to
32
+ * retrieve data from orders and order items.
33
+ */
34
+ abstract class Synocom_UPSOrderExport_Model_Export_Abstract extends Mage_Core_Model_Abstract
35
+ {
36
+ /**
37
+ * Definition of abstract method to export orders to a file in a specific format in var/export.
38
+ *
39
+ * @param $orders List of orders of type Mage_Sales_Model_Order or order ids to export.
40
+ * @return String The name of the written file in var/export
41
+ */
42
+ abstract public function exportOrders($orders);
43
+
44
+ /**
45
+ * Returns the name of the website, store and store view the order was placed in.
46
+ *
47
+ * @param Mage_Sales_Model_Order $order The order to return info from
48
+ * @return String The name of the website, store and store view the order was placed in
49
+ */
50
+ protected function getStoreName($order)
51
+ {
52
+ $storeId = $order->getStoreId();
53
+ if (is_null($storeId)) {
54
+ return $this->getOrder()->getStoreName();
55
+ }
56
+ $store = Mage::app()->getStore($storeId);
57
+ $name = array(
58
+ $store->getWebsite()->getName(),
59
+ $store->getGroup()->getName(),
60
+ $store->getName()
61
+ );
62
+ return implode(', ', $name);
63
+ }
64
+
65
+ /**
66
+ * Returns the payment method of the given order.
67
+ *
68
+ * @param Mage_Sales_Model_Order $order The order to return info from
69
+ * @return String The name of the payment method
70
+ */
71
+ protected function getPaymentMethod($order)
72
+ {
73
+ return $order->getPayment()->getMethod();
74
+ }
75
+
76
+ /**
77
+ * Returns the shipping method of the given order.
78
+ *
79
+ * @param Mage_Sales_Model_Order $order The order to return info from
80
+ * @return String The name of the shipping method
81
+ */
82
+ protected function getShippingMethod($order)
83
+ {
84
+ if (!$order->getIsVirtual() && $order->getShippingMethod()) {
85
+ return $order->getShippingMethod();
86
+ }
87
+ return '';
88
+ }
89
+
90
+ /**
91
+ * Returns the total quantity of ordered items of the given order.
92
+ *
93
+ * @param Mage_Sales_Model_Order $order The order to return info from
94
+ * @return int The total quantity of ordered items
95
+ */
96
+ protected function getTotalQtyItemsOrdered($order) {
97
+ $qty = 0;
98
+ $orderedItems = $order->getItemsCollection();
99
+ foreach ($orderedItems as $item)
100
+ {
101
+ if (!$item->isDummy()) {
102
+ $qty += (int)$item->getQtyOrdered();
103
+ }
104
+ }
105
+ return $qty;
106
+ }
107
+
108
+ /**
109
+ * Returns the sku of the given item dependant on the product type.
110
+ *
111
+ * @param Mage_Sales_Model_Order_Item $item The item to return info from
112
+ * @return String The sku
113
+ */
114
+ protected function getItemSku($item)
115
+ {
116
+ if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
117
+ return $item->getProductOptionByCode('simple_sku');
118
+ }
119
+ return $item->getSku();
120
+ }
121
+
122
+ /**
123
+ * Returns the options of the given item separated by comma(s) like this:
124
+ * option1: value1, option2: value2
125
+ *
126
+ * @param Mage_Sales_Model_Order_Item $item The item to return info from
127
+ * @return String The item options
128
+ */
129
+ protected function getItemOptions($item)
130
+ {
131
+ $options = '';
132
+ if ($orderOptions = $this->getItemOrderOptions($item)) {
133
+ foreach ($orderOptions as $_option) {
134
+ if (strlen($options) > 0) {
135
+ $options .= ', ';
136
+ }
137
+ $options .= $_option['label'].': '.$_option['value'];
138
+ }
139
+ }
140
+ return $options;
141
+ }
142
+
143
+ /**
144
+ * Returns all the product options of the given item including additional_options and
145
+ * attributes_info.
146
+ *
147
+ * @param Mage_Sales_Model_Order_Item $item The item to return info from
148
+ * @return Array The item options
149
+ */
150
+ protected function getItemOrderOptions($item)
151
+ {
152
+ $result = array();
153
+ if ($options = $item->getProductOptions()) {
154
+ if (isset($options['options'])) {
155
+ $result = array_merge($result, $options['options']);
156
+ }
157
+ if (isset($options['additional_options'])) {
158
+ $result = array_merge($result, $options['additional_options']);
159
+ }
160
+ if (!empty($options['attributes_info'])) {
161
+ $result = array_merge($options['attributes_info'], $result);
162
+ }
163
+ }
164
+ return $result;
165
+ }
166
+
167
+ /**
168
+ * Calculates and returns the grand total of an item including tax and excluding
169
+ * discount.
170
+ *
171
+ * @param Mage_Sales_Model_Order_Item $item The item to return info from
172
+ * @return Float The grand total
173
+ */
174
+ protected function getItemTotal($item)
175
+ {
176
+ return $item->getRowTotal() - $item->getDiscountAmount() + $item->getTaxAmount() + $item->getWeeeTaxAppliedRowAmount();
177
+ }
178
+
179
+ /**
180
+ * Formats a price by adding the currency symbol and formatting the number
181
+ * depending on the current locale.
182
+ *
183
+ * @param Float $price The price to format
184
+ * @param Mage_Sales_Model_Order $formatter The order to format the price by implementing the method formatPriceTxt($price)
185
+ * @return String The formatted price
186
+ */
187
+ protected function formatPrice($price, $formatter)
188
+ {
189
+ return $formatter->formatPriceTxt($price);
190
+ }
191
+ }
192
+ ?>
app/code/local/Synocom/UPSOrderExport/Model/Export/Csv.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * The MIT License
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * @package Synocom_UPSOrderExport
26
+ * @copyright Copyright (c) 2011 R. Wiek (info@synocom.nl)
27
+ * @license http://opensource.org/licenses/mit-license.php The MIT License
28
+ */
29
+
30
+ /**
31
+ * Exports orders to csv file. If an order contains multiple ordered items, each item gets
32
+ * added on a separate row.
33
+ */
34
+ class Synocom_UPSOrderExport_Model_Export_Csv extends Synocom_UPSOrderExport_Model_Export_Abstract
35
+ {
36
+ const ENCLOSURE = '"';
37
+ const DELIMITER = ';';
38
+
39
+ /**
40
+ * Concrete implementation of abstract method to export given orders to csv file in var/export.
41
+ *
42
+ * @param $orders List of orders of type Mage_Sales_Model_Order or order ids to export.
43
+ * @return String The name of the written csv file in var/export
44
+ */
45
+ public function exportOrders($orders)
46
+ {
47
+ $fileName = 'ups_order_export_'.date("Ymd_His").'.csv';
48
+ $fp = fopen(Mage::getBaseDir('export').'/'.$fileName, 'w');
49
+
50
+ $this->writeHeadRow($fp);
51
+ foreach ($orders as $order) {
52
+ $order = Mage::getModel('sales/order')->load($order);
53
+ $this->writeOrder($order, $fp);
54
+ }
55
+
56
+ fclose($fp);
57
+
58
+ return $fileName;
59
+ }
60
+
61
+ /**
62
+ * Writes the head row with the column names in the csv file.
63
+ *
64
+ * @param $fp The file handle of the csv file
65
+ */
66
+ protected function writeHeadRow($fp)
67
+ {
68
+ fputcsv($fp, $this->getHeadRowValues(), self::DELIMITER, self::ENCLOSURE);
69
+ }
70
+
71
+ /**
72
+ * Writes the row(s) for the given order in the csv file.
73
+ * A row is added to the csv file for each ordered item.
74
+ *
75
+ * @param Mage_Sales_Model_Order $order The order to write csv of
76
+ * @param $fp The file handle of the csv file
77
+ */
78
+ protected function writeOrder($order, $fp)
79
+ {
80
+ $common = $this->getCommonOrderValues($order);
81
+
82
+ $orderItems = $order->getItemsCollection();
83
+ $itemInc = 0;
84
+ foreach ($orderItems as $item)
85
+ {
86
+ if (!$item->isDummy()) {
87
+ //$record = array_merge($common, $this->getOrderItemValues($item, $order, ++$itemInc));
88
+ $record = $common;
89
+ fputcsv($fp, $record, self::DELIMITER, self::ENCLOSURE);
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Returns the head column names.
96
+ *
97
+ * @return Array The array containing all column names
98
+ */
99
+ protected function getHeadRowValues()
100
+ {
101
+ return array(
102
+ 'OrderNumber',
103
+ 'CompanyorName',
104
+ 'Attention',
105
+ 'Address1',
106
+ 'CountryTerritory',
107
+ 'PostalCode',
108
+ 'CityorTown',
109
+ 'StateProvinceCounty',
110
+ 'Telephone',
111
+ 'EmailAddress',
112
+ 'ActualWeight',
113
+ 'NumberofPackages',
114
+ 'ServiceType',
115
+ 'QVN'
116
+ );
117
+ }
118
+
119
+ /**
120
+ * Returns the values which are identical for each row of the given order. These are
121
+ * all the values which are not item specific: order data, shipping address, billing
122
+ * address and order totals.
123
+ *
124
+ * @param Mage_Sales_Model_Order $order The order to get values from
125
+ * @return Array The array containing the non item specific values
126
+ */
127
+ protected function getCommonOrderValues($order)
128
+ {
129
+ $shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
130
+ $billingAddress = $order->getBillingAddress();
131
+ $CompanyName = $shippingAddress ? $shippingAddress->getData("company") : '';
132
+ if ($CompanyName == "") {
133
+ $CompanyName = $order->getCustomerName();
134
+ }
135
+
136
+ // Create the correct code for the UPS WorldShip Module for shipping option. Magento's Internal Codes don't match what worldship uses according to UPS tech support.
137
+
138
+ $UPSShippingMethod = $this->getShippingMethod($order);
139
+
140
+ switch ($UPSShippingMethod) {
141
+ case "ups_07" :
142
+ $UPSShippingMethod = "ES";
143
+ break;
144
+ case "ups_08" :
145
+ $UPSShippingMethod = "EX";
146
+ break;
147
+ case "ups_11" :
148
+ $UPSShippingMethod = "ST";
149
+ break;
150
+ case "ups_54" :
151
+ $UPSShippingMethod = "EP";
152
+ break;
153
+ case "ups_65" :
154
+ $UPSShippingMethod = "SV";
155
+ break;
156
+ }
157
+
158
+ return array(
159
+ $order->getRealOrderId(),
160
+ $CompanyName,
161
+ $order->getCustomerName(),
162
+ $shippingAddress ? str_replace(array('<br/>','<br />','\n','\r'),'',nl2br($shippingAddress->getData("street"))) : '',
163
+ $shippingAddress ? $shippingAddress->getCountry() : '',
164
+ $shippingAddress ? $shippingAddress->getData("postcode") : '',
165
+ $shippingAddress ? $shippingAddress->getData("city") : '',
166
+ //$shippingAddress ? $shippingAddress->getRegionCode() : '',
167
+ $shippingAddress ? $shippingAddress->getRegion() : '',
168
+ //$shippingAddress ? $shippingAddress->getCountryModel()->getName() : '',
169
+ $shippingAddress ? $shippingAddress->getData("telephone") : '',
170
+ $order->getCustomerEmail(),
171
+ str_replace('.',',',$order->getWeight()),
172
+ $this->getTotalQtyItemsOrdered($order),
173
+ $UPSShippingMethod,
174
+ 'Y'
175
+ );
176
+ }
177
+
178
+ /**
179
+ * Returns the item specific values.
180
+ *
181
+ * @param Mage_Sales_Model_Order_Item $item The item to get values from
182
+ * @param Mage_Sales_Model_Order $order The order the item belongs to
183
+ * @return Array The array containing the item specific values
184
+ */
185
+ protected function getOrderItemValues($item, $order, $itemInc=1)
186
+ {
187
+ return array(
188
+ $itemInc,
189
+ $item->getName(),
190
+ $item->getStatus(),
191
+ $this->getItemSku($item),
192
+ $this->getItemOptions($item),
193
+ (int)$item->getQtyOrdered()
194
+ );
195
+ }
196
+ }
197
+ ?>
app/code/local/Synocom/UPSOrderExport/Model/Observer.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * The MIT License
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * @package Synocom_UPSOrderExport
26
+ * @copyright Copyright (c) 2011 R. Wiek (info@synocom.nl)
27
+ * @license http://opensource.org/licenses/mit-license.php The MIT License
28
+ */
29
+
30
+ /**
31
+ * Observer to append option to export to csv to mass action select box in the orders grid.
32
+ */
33
+ class Synocom_UPSOrderExport_Model_Observer
34
+ {
35
+ /**
36
+ * Extends the mass action select box to append the option to export to csv.
37
+ * Event: core_block_abstract_prepare_layout_before
38
+ */
39
+ public function addMassaction($observer)
40
+ {
41
+ $block = $observer->getEvent()->getBlock();
42
+ if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
43
+ && $block->getRequest()->getControllerName() == 'sales_order')
44
+ {
45
+ $block->addItem('upsorderexport', array(
46
+ 'label' => 'Export to .csv file',
47
+ 'url' => Mage::app()->getStore()->getUrl('upsorderexport/export_order/csvexport'),
48
+ ));
49
+ }
50
+ }
51
+ }
app/code/local/Synocom/UPSOrderExport/controllers/Export/OrderController.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * The MIT License
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * @package Synocom_UPSOrderExport
26
+ * @copyright Copyright (c) 2011 R. Wiek (info@synocom.nl)
27
+ * @license http://opensource.org/licenses/mit-license.php The MIT License
28
+ */
29
+
30
+ /**
31
+ * Controller handling order export requests.
32
+ */
33
+ class Synocom_UPSOrderExport_Export_OrderController extends Mage_Adminhtml_Controller_Action
34
+ {
35
+ /**
36
+ * Exports orders defined by id in post param "order_ids" to csv and offers file directly for download
37
+ * when finished.
38
+ */
39
+ public function csvExportAction()
40
+ {
41
+ $orders = $this->getRequest()->getPost('order_ids', array());
42
+ $file = Mage::getModel('synocom_upsorderexport/export_csv')->exportOrders($orders);
43
+ $this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
44
+ }
45
+ }
46
+ ?>
app/code/local/Synocom/UPSOrderExport/etc/config.xml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * The MIT License
7
+ *
8
+ * Copyright (c) 2009 R. Wiek (info@synocom.nl)
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ * THE SOFTWARE.
27
+ *
28
+ * @package Synocom_UPSOrderExport
29
+ * @copyright Copyright (c) 2011 R. Wiek (info@synocom.nl)
30
+ * @license http://opensource.org/licenses/mit-license.php The MIT License
31
+ */
32
+ -->
33
+ <config>
34
+ <modules>
35
+ <Synocom_UPSOrderExport>
36
+ <version>1.0.4</version>
37
+ </Synocom_UPSOrderExport>
38
+ </modules>
39
+
40
+ <admin>
41
+ <routers>
42
+ <Synocom_UPSOrderExport>
43
+ <use>admin</use>
44
+ <args>
45
+ <module>Synocom_UPSOrderExport</module>
46
+ <frontName>upsorderexport</frontName>
47
+ </args>
48
+ </Synocom_UPSOrderExport>
49
+ </routers>
50
+ </admin>
51
+
52
+ <adminhtml>
53
+ <events>
54
+ <core_block_abstract_prepare_layout_before>
55
+ <observers>
56
+ <addMassaction>
57
+ <type>model</type>
58
+ <class>Synocom_UPSOrderExport_Model_Observer</class>
59
+ <method>addMassaction</method>
60
+ </addMassaction>
61
+ </observers>
62
+ </core_block_abstract_prepare_layout_before>
63
+ </events>
64
+
65
+ <translate>
66
+ <modules>
67
+ <Synocom_UPSOrderExport>
68
+ <files>
69
+ <default>Synocom_UPSOrderExport.csv</default>
70
+ </files>
71
+ </Synocom_UPSOrderExport>
72
+ </modules>
73
+ </translate>
74
+ </adminhtml>
75
+
76
+ <global>
77
+ <models>
78
+ <synocom_upsorderexport>
79
+ <class>Synocom_UPSOrderExport_Model</class>
80
+ </synocom_upsorderexport>
81
+ </models>
82
+ </global>
83
+ </config>
app/etc/modules/Synocom_UPSOrderExport.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * The MIT License
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ *
26
+ * @package Synocom_UPSOrderExport
27
+ * @copyright Copyright (c) 2011 R. Wiek (info@synocom.nl)
28
+ * @license http://opensource.org/licenses/mit-license.php The MIT License
29
+ */
30
+ -->
31
+ <config>
32
+ <modules>
33
+ <Synocom_UPSOrderExport>
34
+ <active>true</active>
35
+ <codePool>local</codePool>
36
+ </Synocom_UPSOrderExport>
37
+ </modules>
38
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>UPS_Worldship_Dutch</name>
4
+ <version>1.2.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL V3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>The Magento UPS Worldship extension allowes you to easily export shipments to your Worldship account.</summary>
10
+ <description>This module allowes you to easily export shipments to the UPS Worldship system.
11
+
12
+ Deze module stelt u in staat om eenvoudig uw zendingen te exporteren naar UPS Worldship en uw verzendingen direct verzendklaar te maken.
13
+
14
+ Voor meer informatie over deze module kunt u terecht op http://www.synocom.nl</description>
15
+ <notes>notes</notes>
16
+ <authors><author><name>synocom</name><user>auto-converted</user><email>info@synocom.nl</email></author></authors>
17
+ <date>2011-01-11</date>
18
+ <time>22:17:15</time>
19
+ <contents><target name="mageetc"><dir name="modules"><file name="Synocom_UPSOrderExport.xml" hash="96074b899011ebd6b23deeea8f198c08"/></dir></target><target name="magelocal"><dir name="Synocom"><dir name="UPSOrderExport"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="78f9023d4ec85a16e371542fb62072e6"/></dir></dir></dir><dir name="controllers"><dir name="Export"><file name="OrderController.php" hash="6fe157103054f86a577d6e5076dcd229"/></dir></dir><dir name="etc"><file name="config.xml" hash="ba89a64527c4ccd786d970d0164f01a2"/></dir><dir name="Model"><dir name="Export"><file name="Abstract.php" hash="6814531d62cc0045bfbf893b4200a17c"/><file name="Csv.php" hash="cd01c8435a1fa52c3acd4d3486ee9675"/></dir><file name="Observer.php" hash="420d9fffbded6d7c9cc03de37f141919"/></dir></dir></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>