Version Notes
Lates stable release
Download this release
Release Info
Developer | Smart Send ApS |
Extension | Smartsend_Logistics |
Version | 7.0.5 |
Comparing to | |
See all releases |
Version 7.0.5
- app/code/community/Smartsend/Logistics/Block/Adminhtml/PickupShipping.php +95 -0
- app/code/community/Smartsend/Logistics/Block/Adminhtml/Sales/Order/View/Tab/Info.php +65 -0
- app/code/community/Smartsend/Logistics/Block/Adminhtml/Shipping.php +93 -0
- app/code/community/Smartsend/Logistics/Block/Adminhtml/System/Config/Excludetax.php +75 -0
- app/code/community/Smartsend/Logistics/Block/Bring.php +103 -0
- app/code/community/Smartsend/Logistics/Block/Gls.php +102 -0
- app/code/community/Smartsend/Logistics/Block/Pickup.php +105 -0
- app/code/community/Smartsend/Logistics/Block/Postdanmark.php +102 -0
- app/code/community/Smartsend/Logistics/Block/Posten.php +104 -0
- app/code/community/Smartsend/Logistics/Block/Swipbox.php +103 -0
- app/code/community/Smartsend/Logistics/Helper/Data.php +48 -0
- app/code/community/Smartsend/Logistics/Model/Bring.php +32 -0
- app/code/community/Smartsend/Logistics/Model/Carrier/Bring.php +173 -0
- app/code/community/Smartsend/Logistics/Model/Carrier/Gls.php +169 -0
- app/code/community/Smartsend/Logistics/Model/Carrier/Pickup.php +160 -0
- app/code/community/Smartsend/Logistics/Model/Carrier/Postdanmark.php +171 -0
- app/code/community/Smartsend/Logistics/Model/Carrier/Posten.php +171 -0
- app/code/community/Smartsend/Logistics/Model/Carrier/Swipbox.php +170 -0
- app/code/community/Smartsend/Logistics/Model/Gls.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Bring.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Bring/Collection.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Gls.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Gls/Collection.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Pickup.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Pickup/Collection.php +33 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Postdanmark.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Postdanmark/Collection.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Posten.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Posten/Collection.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Swipbox.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Mysql4/Swipbox/Collection.php +34 -0
- app/code/community/Smartsend/Logistics/Model/Observer.php +197 -0
- app/code/community/Smartsend/Logistics/Model/Order.php +1622 -0
- app/code/community/Smartsend/Logistics/Model/Pickup.php +33 -0
- app/code/community/Smartsend/Logistics/Model/Postdanmark.php +35 -0
- app/code/community/Smartsend/Logistics/Model/Posten.php +35 -0
- app/code/community/Smartsend/Logistics/Model/Rewrite/Sales/Total/Quote/Shipping.php +136 -0
- app/code/community/Smartsend/Logistics/Model/Rewrite/Sales/Total/Quote/Tax.php +118 -0
- app/code/community/Smartsend/Logistics/Model/ShippingMethods.php +274 -0
- app/code/community/Smartsend/Logistics/Model/Status.php +39 -0
- app/code/community/Smartsend/Logistics/Model/Swipbox.php +33 -0
- app/code/community/Smartsend/Logistics/Model/System/CombinePdf.php +35 -0
- app/code/community/Smartsend/Logistics/Model/System/Listformat.php +37 -0
- app/code/community/Smartsend/Logistics/Model/System/OrderOption.php +35 -0
- app/code/community/Smartsend/Logistics/Model/System/Pacsoftformat.php +35 -0
- app/code/community/Smartsend/Logistics/Model/System/Pickup/Listformat.php +34 -0
- app/code/community/Smartsend/Logistics/Model/System/PickupMethods.php +39 -0
- app/code/community/Smartsend/Logistics/Model/System/Return.php +38 -0
- app/code/community/Smartsend/Logistics/Model/System/Size.php +36 -0
- app/code/community/Smartsend/Logistics/controllers/LogisticsController.php +399 -0
- app/code/community/Smartsend/Logistics/etc/config.xml +303 -0
- app/code/community/Smartsend/Logistics/etc/system.xml +865 -0
- app/code/community/Smartsend/Logistics/sql/logistics_setup/mysql4-install-7.0.1.php +140 -0
- app/design/adminhtml/default/default/layout/logistics.xml +36 -0
- app/design/adminhtml/default/default/template/logistics/array_dropdown.phtml +180 -0
- app/design/adminhtml/default/default/template/logistics/sales/order/view/info.phtml +259 -0
- app/design/adminhtml/default/default/template/logistics/sales/order/view/tab/info.phtml +88 -0
- app/design/adminhtml/default/default/template/logistics/system/config/excludetax.phtml +34 -0
- app/design/frontend/base/default/layout/logistics.xml +41 -0
- app/design/frontend/base/default/template/logistics/checkout/onepage/shipping_method/available.phtml +163 -0
- app/design/frontend/base/default/template/logistics/onestepcheckout/shipping_method.phtml +209 -0
- app/design/frontend/base/default/template/logistics/pickup.phtml +86 -0
- app/etc/modules/Smartsend_Logistics.xml +9 -0
- app/locale/da_DK/Smartsend_Logistics.csv +95 -0
- js/logistics/jquery-1.6.4.min.js +4 -0
- js/logistics/noconflict.js +1 -0
- package.xml +23 -0
app/code/community/Smartsend/Logistics/Block/Adminhtml/PickupShipping.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Adminhtml/Shipping.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Adminhtml_PickupShipping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
public function __construct() { // create columns for the pickup carrier system config
|
31 |
+
|
32 |
+
$this->addColumn('methods', array(
|
33 |
+
'label' => $this->__('Methods'),
|
34 |
+
'size' => 6,
|
35 |
+
));
|
36 |
+
$this->addColumn('orderminprice', array(
|
37 |
+
'label' => $this->__('Min Price'),
|
38 |
+
'size' => 6,
|
39 |
+
));
|
40 |
+
$this->addColumn('ordermaxprice', array(
|
41 |
+
'label' => $this->__('Max Price'),
|
42 |
+
'size' => 6,
|
43 |
+
));
|
44 |
+
$this->addColumn('orderminweight', array(
|
45 |
+
'label' => $this->__('Min Weight'),
|
46 |
+
'size' => 6,
|
47 |
+
));
|
48 |
+
$this->addColumn('ordermaxweight', array(
|
49 |
+
'label' => $this->__('Max Weight'),
|
50 |
+
'size' => 6,
|
51 |
+
));
|
52 |
+
$this->addColumn('pickupshippingfee', array(
|
53 |
+
'label' => $this->__('Shipping Fee'),
|
54 |
+
'size' => 6,
|
55 |
+
));
|
56 |
+
|
57 |
+
$this->addColumn('countries', array(
|
58 |
+
'label' => $this->__('Countries'),
|
59 |
+
'size' => 6,
|
60 |
+
));
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$this->_addAfter = false;
|
65 |
+
$this->_addButtonLabel = $this->__('Add Rate');
|
66 |
+
|
67 |
+
parent::__construct();
|
68 |
+
$this->setTemplate('logistics/array_dropdown.phtml'); //get the dropdown for the price shipping table for pickup carrier
|
69 |
+
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
protected function _renderCellTemplate($columnName) { //inserts the value to the created columns above
|
74 |
+
if (empty($this->_columns[$columnName])) { //checking the column names
|
75 |
+
throw new Exception('Wrong column name specified.');
|
76 |
+
}
|
77 |
+
$column = $this->_columns[$columnName];
|
78 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
79 |
+
|
80 |
+
if ($columnName == 'methods') { //for column name methods
|
81 |
+
$shippingmethods = Mage::getModel('logistics/shippingMethods')->getOptionArray($inputName); //getting the list of shipping methods for the column methods
|
82 |
+
|
83 |
+
$rendered = '<select style="width:100px;" name="' . $inputName . '">';
|
84 |
+
|
85 |
+
foreach ($shippingmethods as $att => $name) {
|
86 |
+
$rendered .= '<option value="' . $att . '">' . $name . '</option>';
|
87 |
+
}
|
88 |
+
$rendered .= '</select>';
|
89 |
+
} else { //for other column than methods
|
90 |
+
return '<input type="text" class="required-entry" name="' . $inputName . '" value="#{' . $columnName . '}" ' . ($column['size'] ? 'size="' . $column['size'] . '"' : '') . '/>';
|
91 |
+
}
|
92 |
+
return $rendered;
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Adminhtml/Sales/Order/View/Tab/Info.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Adminhtml
|
24 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* admin customer left menu
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Adminhtml
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
class Smartsend_Logistics_Block_Adminhtml_Sales_Order_View_Tab_Info extends Mage_Adminhtml_Block_Sales_Order_Abstract implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
39 |
+
{
|
40 |
+
|
41 |
+
public function getTabLabel()
|
42 |
+
{
|
43 |
+
|
44 |
+
return Mage::helper('sales')->__('Smart Send Logistics');
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getTabTitle()
|
48 |
+
{
|
49 |
+
return Mage::helper('sales')->__('Smart Send Logistics');
|
50 |
+
}
|
51 |
+
|
52 |
+
public function canShowTab()
|
53 |
+
{
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function isHidden()
|
58 |
+
{
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
?>
|
app/code/community/Smartsend/Logistics/Block/Adminhtml/Shipping.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Adminhtml/Shipping.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Adminhtml_Shipping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
|
27 |
+
|
28 |
+
public function __construct() { // create columns for the table rate for the carriers(other than pickup) system config
|
29 |
+
$this->addColumn('methods', array(
|
30 |
+
'label' => $this->__('Methods'),
|
31 |
+
'size' => 6,
|
32 |
+
));
|
33 |
+
$this->addColumn('orderminprice', array(
|
34 |
+
'label' => $this->__('Min Price'),
|
35 |
+
'size' => 6,
|
36 |
+
));
|
37 |
+
$this->addColumn('ordermaxprice', array(
|
38 |
+
'label' => $this->__('Max Price'),
|
39 |
+
'size' => 6,
|
40 |
+
));
|
41 |
+
$this->addColumn('orderminweight', array(
|
42 |
+
'label' => $this->__('Min Weight'),
|
43 |
+
'size' => 6,
|
44 |
+
));
|
45 |
+
$this->addColumn('ordermaxweight', array(
|
46 |
+
'label' => $this->__('Max Weight'),
|
47 |
+
'size' => 6,
|
48 |
+
));
|
49 |
+
$this->addColumn('pickupshippingfee', array(
|
50 |
+
'label' => $this->__('Shipping Fee'),
|
51 |
+
'size' => 6,
|
52 |
+
));
|
53 |
+
|
54 |
+
$this->addColumn('countries', array(
|
55 |
+
'label' => $this->__('Countries'),
|
56 |
+
'size' => 6,
|
57 |
+
));
|
58 |
+
|
59 |
+
$this->addColumn('method_name', array(
|
60 |
+
'label' => $this->__('Method Name'),
|
61 |
+
'size' => 6,
|
62 |
+
));
|
63 |
+
|
64 |
+
$this->_addAfter = false;
|
65 |
+
$this->_addButtonLabel = $this->__('Add Rate');
|
66 |
+
|
67 |
+
parent::__construct();
|
68 |
+
$this->setTemplate('logistics/array_dropdown.phtml'); //get the dropdown for the price shipping table for carriers other than pickup carrier
|
69 |
+
}
|
70 |
+
|
71 |
+
protected function _renderCellTemplate($columnName) { //inserts the value to the created columns above
|
72 |
+
if (empty($this->_columns[$columnName])) { //checking the column names
|
73 |
+
throw new Exception('Wrong column name specified.');
|
74 |
+
}
|
75 |
+
$column = $this->_columns[$columnName];
|
76 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
77 |
+
|
78 |
+
if ($columnName == 'methods') { //for column name methods
|
79 |
+
$shippingmethods = Mage::getModel('logistics/shippingMethods')->getOptionArray($inputName); //getting the list of shipping methods for the column methods
|
80 |
+
|
81 |
+
$rendered = '<select style="width:100px;" name="' . $inputName . '">';
|
82 |
+
|
83 |
+
foreach ($shippingmethods as $att => $name) {
|
84 |
+
$rendered .= '<option value="' . $att . '">' . $name . '</option>';
|
85 |
+
}
|
86 |
+
$rendered .= '</select>';
|
87 |
+
} else { //for other column than methods
|
88 |
+
return '<input type="text" class="required-entry" name="' . $inputName . '" value="#{' . $columnName . '}" ' . ($column['size'] ? 'size="' . $column['size'] . '"' : '') . '/>';
|
89 |
+
}
|
90 |
+
return $rendered;
|
91 |
+
}
|
92 |
+
|
93 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Adminhtml/System/Config/Excludetax.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Adminhtml/System/Config/Excludetax.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Adminhtml_System_Config_Excludetax extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
27 |
+
|
28 |
+
protected $_values = null;
|
29 |
+
|
30 |
+
protected function _construct() {
|
31 |
+
|
32 |
+
$this->setTemplate('logistics/system/config/excludetax.phtml');
|
33 |
+
return parent::_construct();
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
37 |
+
$this->setNamePrefix($element->getName())
|
38 |
+
->setHtmlId($element->getHtmlId());
|
39 |
+
return $this->_toHtml();
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getValues() {
|
43 |
+
$values = array();
|
44 |
+
|
45 |
+
$values['1'] = '';
|
46 |
+
|
47 |
+
return $values;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getIsChecked($name) {
|
51 |
+
|
52 |
+
if ($this->getCheckedValues()) {
|
53 |
+
return TRUE;
|
54 |
+
} else {
|
55 |
+
return FALSE;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getCheckedValues() {
|
60 |
+
|
61 |
+
$data = $this->getConfigData();
|
62 |
+
|
63 |
+
if ($data[str_replace('_', '/', $this->getHtmlId())] == '1') {
|
64 |
+
$data = $data[str_replace('_', '/', $this->getHtmlId())];
|
65 |
+
} else {
|
66 |
+
$data = '';
|
67 |
+
}
|
68 |
+
|
69 |
+
$this->_values = $data;
|
70 |
+
|
71 |
+
|
72 |
+
return $this->_values;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Bring.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Bring.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Bring extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
$this->setTemplate('logistics/pickup.phtml');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getPickupData() {
|
33 |
+
$checkOut = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); //getting shipping address from checkout quote
|
34 |
+
$street = $checkOut->getStreet();
|
35 |
+
$street = implode(' ', $street); // splitting the street by " "(space)
|
36 |
+
$city = $checkOut->getCity();
|
37 |
+
$postcode = $checkOut->getPostcode();
|
38 |
+
$country = $checkOut->getCountry();
|
39 |
+
$result = Mage::getSingleton('logistics/carrier_bring')->_post($street, $city, $postcode, $country); // get the pickup points for the bring carrier
|
40 |
+
|
41 |
+
$output = json_decode($result->response, true); // decoding the pickup points data into array
|
42 |
+
if (!$output) { // if no pickup data return false
|
43 |
+
return FALSE;
|
44 |
+
}
|
45 |
+
$servicePoints = $output;
|
46 |
+
|
47 |
+
$format = Mage::getStoreConfig('carriers/smartsendbring/listformat'); //get the address format from the admin system config
|
48 |
+
for ($i = 0; $i < count($servicePoints); $i++) {
|
49 |
+
if (!isset($servicePoints[$i])) {
|
50 |
+
break;
|
51 |
+
}
|
52 |
+
$addressData = $this->getaddressData($servicePoints[$i]); //getting address data form the pickup points response
|
53 |
+
switch ($format) {
|
54 |
+
case 1:
|
55 |
+
$resultData[$addressData['servicePointId']] = array(
|
56 |
+
'company' => $addressData['company'],
|
57 |
+
'street' => $addressData['street'],
|
58 |
+
'zip_code' => $addressData['zipcode'],
|
59 |
+
'city' => $addressData['city']
|
60 |
+
);
|
61 |
+
break;
|
62 |
+
case 2:
|
63 |
+
$resultData[$addressData['servicePointId']] = array(
|
64 |
+
'company' => $addressData['company'],
|
65 |
+
'street' => $addressData['street'],
|
66 |
+
'zipcode' => $addressData['zipcode']
|
67 |
+
);
|
68 |
+
break;
|
69 |
+
case 3:
|
70 |
+
$resultData[$addressData['servicePointId']] = array(
|
71 |
+
'company' => $addressData['company'],
|
72 |
+
'street' => $addressData['street'],
|
73 |
+
'city' => $addressData['city']
|
74 |
+
);
|
75 |
+
default:
|
76 |
+
$resultData[$addressData['servicePointId']] = array(
|
77 |
+
'company' => $addressData['company'],
|
78 |
+
'street' => $addressData['street'],
|
79 |
+
);
|
80 |
+
break;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
if (!isset($resultData)) {
|
84 |
+
$resultData = "";
|
85 |
+
}
|
86 |
+
return $resultData;
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function getaddressData($servicePoint) {
|
90 |
+
$data['pick_up_id'] = $servicePoint['pickupid'];
|
91 |
+
$data['company'] = implode(" ", array_filter(array($servicePoint['name1'], $servicePoint['name2']))); //joining the address data
|
92 |
+
$data['city'] = $servicePoint['city'];
|
93 |
+
$data['street'] = implode(" ", array_filter(array($servicePoint['address1'], $servicePoint['address2'])));
|
94 |
+
$data['zipcode'] = $servicePoint['zip'];
|
95 |
+
$data['shippingMethod'] = $servicePoint['carrier'];
|
96 |
+
$data['country'] = $servicePoint['country'];
|
97 |
+
$ser = serialize($data);
|
98 |
+
$data['servicePointId'] = $ser;
|
99 |
+
|
100 |
+
return $data;
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Gls.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Gls.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Gls extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
$this->setTemplate('logistics/pickup.phtml'); // pickup points for gls
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getPickupData() {
|
33 |
+
$checkOut = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); //getting shipping address from checkout quote
|
34 |
+
$street = $checkOut->getStreet();
|
35 |
+
$street = implode(' ', $street); // splitting the street by " "(space)
|
36 |
+
$city = $checkOut->getCity();
|
37 |
+
$postcode = $checkOut->getPostcode();
|
38 |
+
$country = $checkOut->getCountry();
|
39 |
+
$result = Mage::getSingleton('logistics/carrier_gls')->_post($street, $city, $postcode, $country); // get the pickup points for the gls carrier
|
40 |
+
|
41 |
+
$output = json_decode($result->response, true); // decoding the pickup points data into array
|
42 |
+
if (!$output) { // if no pickup data return false
|
43 |
+
return FALSE;
|
44 |
+
}
|
45 |
+
$servicePoints = $output;
|
46 |
+
|
47 |
+
$format = Mage::getStoreConfig('carriers/smartsendgls/listformat'); //get the address format from the admin system config
|
48 |
+
for ($i = 0; $i < count($servicePoints); $i++) {
|
49 |
+
if (!isset($servicePoints[$i])) {
|
50 |
+
break;
|
51 |
+
}
|
52 |
+
$addressData = $this->getaddressData($servicePoints[$i]); //getting address data form the pickup points response
|
53 |
+
switch ($format) {
|
54 |
+
case 1:
|
55 |
+
$resultData[$addressData['servicePointId']] = array(
|
56 |
+
'company' => $addressData['company'],
|
57 |
+
'street' => $addressData['street'],
|
58 |
+
'zip_code' => $addressData['zipcode'],
|
59 |
+
'city' => $addressData['city']
|
60 |
+
);
|
61 |
+
break;
|
62 |
+
case 2:
|
63 |
+
$resultData[$addressData['servicePointId']] = array(
|
64 |
+
'company' => $addressData['company'],
|
65 |
+
'street' => $addressData['street'],
|
66 |
+
'zipcode' => $addressData['zipcode']
|
67 |
+
);
|
68 |
+
break;
|
69 |
+
case 3:
|
70 |
+
$resultData[$addressData['servicePointId']] = array(
|
71 |
+
'company' => $addressData['company'],
|
72 |
+
'street' => $addressData['street'],
|
73 |
+
'city' => $addressData['city']
|
74 |
+
);
|
75 |
+
default:
|
76 |
+
$resultData[$addressData['servicePointId']] = array(
|
77 |
+
'company' => $addressData['company'],
|
78 |
+
'street' => $addressData['street'],
|
79 |
+
);
|
80 |
+
break;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
if (!isset($resultData)) {
|
84 |
+
$resultData = "";
|
85 |
+
}
|
86 |
+
return $resultData;
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function getaddressData($servicePoint) {
|
90 |
+
$data['pick_up_id'] = $servicePoint['pickupid'];
|
91 |
+
$data['company'] = implode(" ", array_filter(array($servicePoint['name1'], $servicePoint['name2']))); //joining the address data
|
92 |
+
$data['city'] = $servicePoint['city'];
|
93 |
+
$data['street'] = implode(" ", array_filter(array($servicePoint['address1'], $servicePoint['address2'])));
|
94 |
+
$data['zipcode'] = $servicePoint['zip'];
|
95 |
+
$data['shippingMethod'] = $servicePoint['carrier'];
|
96 |
+
$data['country'] = $servicePoint['country'];
|
97 |
+
$ser = serialize($data);
|
98 |
+
$data['servicePointId'] = $ser;
|
99 |
+
return $data;
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Pickup.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Pickup.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Pickup extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
$this->setTemplate('logistics/pickup.phtml');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getPickupData() {
|
33 |
+
$checkOut = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); //getting shipping address from checkout quote
|
34 |
+
$street = $checkOut->getStreet();
|
35 |
+
$street = implode(' ', $street); // splitting the street by " "(space)
|
36 |
+
$city = $checkOut->getCity();
|
37 |
+
$postcode = $checkOut->getPostcode();
|
38 |
+
$country = $checkOut->getCountry();
|
39 |
+
$result = Mage::getSingleton('logistics/carrier_pickup')->_post($street, $city, $postcode, $country); // get the pickup points for the pickup carrier
|
40 |
+
|
41 |
+
$output = json_decode($result->response, true); // decoding the pickup points data into array
|
42 |
+
if (!$output) { // if no pickup data return false
|
43 |
+
return FALSE;
|
44 |
+
}
|
45 |
+
$servicePoints = $output;
|
46 |
+
|
47 |
+
|
48 |
+
$format = Mage::getStoreConfig('carriers/smartsendpickup/listformat'); //get the address format from the admin system config
|
49 |
+
for ($i = 0; $i < count($servicePoints); $i++) {
|
50 |
+
if (!isset($servicePoints[$i])) {
|
51 |
+
break;
|
52 |
+
}
|
53 |
+
$addressData = $this->getaddressData($servicePoints[$i]); //getting address data form the pickup points response
|
54 |
+
if ($addressData) {
|
55 |
+
switch ($format) {
|
56 |
+
case 0:
|
57 |
+
$resultData[$addressData['servicePointId']] = array(
|
58 |
+
'company' => $addressData['company'],
|
59 |
+
'street' => $addressData['street'],
|
60 |
+
'zip_code' => $addressData['zipcode'],
|
61 |
+
'city' => $addressData['city']
|
62 |
+
);
|
63 |
+
break;
|
64 |
+
case 1:
|
65 |
+
$resultData[$addressData['servicePointId']] = array(
|
66 |
+
'company' => $addressData['company'],
|
67 |
+
'street' => $addressData['street'],
|
68 |
+
'zipcode' => $addressData['zipcode']
|
69 |
+
);
|
70 |
+
break;
|
71 |
+
case 2:
|
72 |
+
$resultData[$addressData['servicePointId']] = array(
|
73 |
+
'company' => $addressData['company'],
|
74 |
+
'street' => $addressData['street'],
|
75 |
+
'city' => $addressData['city']
|
76 |
+
);
|
77 |
+
default:
|
78 |
+
$resultData[$addressData['servicePointId']] = array(
|
79 |
+
'company' => $addressData['company'],
|
80 |
+
'street' => $addressData['street'],
|
81 |
+
);
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
+
if (!isset($resultData)) {
|
87 |
+
$resultData = "";
|
88 |
+
}
|
89 |
+
return $resultData;
|
90 |
+
}
|
91 |
+
|
92 |
+
protected function getaddressData($servicePoint) {
|
93 |
+
$data['pick_up_id'] = $servicePoint['pickupid'];
|
94 |
+
$data['company'] = implode(" ", array_filter(array($servicePoint['name1'], $servicePoint['name2']))); //joining the address data
|
95 |
+
$data['city'] = $servicePoint['city'];
|
96 |
+
$data['street'] = implode(" ", array_filter(array($servicePoint['address1'], $servicePoint['address2'])));
|
97 |
+
$data['zipcode'] = $servicePoint['zip'];
|
98 |
+
$data['shippingMethod'] = $servicePoint['carrier'];
|
99 |
+
$data['country'] = $servicePoint['country'];
|
100 |
+
$ser = serialize($data);
|
101 |
+
$data['servicePointId'] = $ser;
|
102 |
+
return $data;
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Postdanmark.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Postdanmark.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Postdanmark extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
$this->setTemplate('logistics/pickup.phtml');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getPickupData() {
|
33 |
+
$checkOut = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); //getting shipping address from checkout quote
|
34 |
+
$street = $checkOut->getStreet();
|
35 |
+
$street = implode(' ', $street); // splitting the street by " "(space)
|
36 |
+
$city = $checkOut->getCity();
|
37 |
+
$postcode = $checkOut->getPostcode();
|
38 |
+
$country = $checkOut->getCountry();
|
39 |
+
$result = Mage::getSingleton('logistics/carrier_postdanmark')->_post($street, $city, $postcode, $country); // get the pickup points for the postdanmark carrier
|
40 |
+
|
41 |
+
$output = json_decode($result->response, true); // decoding the pickup points data into array
|
42 |
+
if (!$output) { // if no pickup data return false
|
43 |
+
return FALSE;
|
44 |
+
}
|
45 |
+
$servicePoints = $output;
|
46 |
+
|
47 |
+
$format = Mage::getStoreConfig('carriers/smartsendpostdanmark/listformat'); //get the address format from the admin system config
|
48 |
+
for ($i = 0; $i < count($servicePoints); $i++) {
|
49 |
+
if (!isset($servicePoints[$i])) {
|
50 |
+
break;
|
51 |
+
}
|
52 |
+
$addressData = $this->getaddressData($servicePoints[$i]); //getting address data form the pickup points response
|
53 |
+
switch ($format) {
|
54 |
+
case 1:
|
55 |
+
$resultData[$addressData['servicePointId']] = array(
|
56 |
+
'company' => $addressData['company'],
|
57 |
+
'street' => $addressData['street'],
|
58 |
+
'zip_code' => $addressData['zipcode'],
|
59 |
+
'city' => $addressData['city']
|
60 |
+
);
|
61 |
+
break;
|
62 |
+
case 2:
|
63 |
+
$resultData[$addressData['servicePointId']] = array(
|
64 |
+
'company' => $addressData['company'],
|
65 |
+
'street' => $addressData['street'],
|
66 |
+
'zipcode' => $addressData['zipcode']
|
67 |
+
);
|
68 |
+
break;
|
69 |
+
case 3:
|
70 |
+
$resultData[$addressData['servicePointId']] = array(
|
71 |
+
'company' => $addressData['company'],
|
72 |
+
'street' => $addressData['street'],
|
73 |
+
'city' => $addressData['city']
|
74 |
+
);
|
75 |
+
default:
|
76 |
+
$resultData[$addressData['servicePointId']] = array(
|
77 |
+
'company' => $addressData['company'],
|
78 |
+
'street' => $addressData['street'],
|
79 |
+
);
|
80 |
+
break;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
if (!isset($resultData)) {
|
84 |
+
$resultData = "";
|
85 |
+
}
|
86 |
+
return $resultData;
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function getaddressData($servicePoint) {
|
90 |
+
$data['pick_up_id'] = $servicePoint['pickupid'];
|
91 |
+
$data['company'] = implode(" ", array_filter(array($servicePoint['name1'], $servicePoint['name2']))); //joining the address data
|
92 |
+
$data['city'] = $servicePoint['city'];
|
93 |
+
$data['street'] = implode(" ", array_filter(array($servicePoint['address1'], $servicePoint['address2'])));
|
94 |
+
$data['zipcode'] = $servicePoint['zip'];
|
95 |
+
$data['shippingMethod'] = $servicePoint['carrier'];
|
96 |
+
$data['country'] = $servicePoint['country'];
|
97 |
+
$ser = serialize($data);
|
98 |
+
$data['servicePointId'] = $ser;
|
99 |
+
return $data;
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Posten.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/posten.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Posten extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
$this->setTemplate('logistics/pickup.phtml');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getPickupData() {
|
33 |
+
$checkOut = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); //getting shipping address from checkout quote
|
34 |
+
$street = $checkOut->getStreet();
|
35 |
+
$street = implode(' ', $street); // splitting the street by " "(space)
|
36 |
+
$city = $checkOut->getCity();
|
37 |
+
$postcode = $checkOut->getPostcode();
|
38 |
+
$country = $checkOut->getCountry();
|
39 |
+
$result = Mage::getSingleton('logistics/carrier_posten')->_post($street, $city, $postcode, $country); // get the pickup points for the posten carrier
|
40 |
+
|
41 |
+
$output = json_decode($result->response, true); // decoding the pickup points data into array
|
42 |
+
if (!$output) { // if no pickup data return false
|
43 |
+
return FALSE;
|
44 |
+
}
|
45 |
+
$servicePoints = $output;
|
46 |
+
|
47 |
+
$format = Mage::getStoreConfig('carriers/smartsendposten/listformat'); //get the address format from the admin system config
|
48 |
+
|
49 |
+
for ($i = 0; $i < count($servicePoints); $i++) {
|
50 |
+
if (!isset($servicePoints[$i])) {
|
51 |
+
break;
|
52 |
+
}
|
53 |
+
|
54 |
+
$addressData = $this->getaddressData($servicePoints[$i]); //getting address data form the pickup points response
|
55 |
+
switch ($format) {
|
56 |
+
case 1:
|
57 |
+
$resultData[$addressData['servicePointId']] = array(
|
58 |
+
'company' => $addressData['company'],
|
59 |
+
'street' => $addressData['street'],
|
60 |
+
'zip_code' => $addressData['zipcode'],
|
61 |
+
'city' => $addressData['city']
|
62 |
+
);
|
63 |
+
break;
|
64 |
+
case 2:
|
65 |
+
$resultData[$addressData['servicePointId']] = array(
|
66 |
+
'company' => $addressData['company'],
|
67 |
+
'street' => $addressData['street'],
|
68 |
+
'zipcode' => $addressData['zipcode']
|
69 |
+
);
|
70 |
+
break;
|
71 |
+
case 3:
|
72 |
+
$resultData[$addressData['servicePointId']] = array(
|
73 |
+
'company' => $addressData['company'],
|
74 |
+
'street' => $addressData['street'],
|
75 |
+
'city' => $addressData['city']
|
76 |
+
);
|
77 |
+
default:
|
78 |
+
$resultData[$addressData['servicePointId']] = array(
|
79 |
+
'company' => $addressData['company'],
|
80 |
+
'street' => $addressData['street'],
|
81 |
+
);
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
if (!isset($resultData)) {
|
86 |
+
$resultData = "";
|
87 |
+
}
|
88 |
+
return $resultData;
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function getaddressData($servicePoint) {
|
92 |
+
$data['pick_up_id'] = $servicePoint['pickupid'];
|
93 |
+
$data['company'] = implode(" ", array_filter(array($servicePoint['name1'], $servicePoint['name2']))); //joining the address data
|
94 |
+
$data['city'] = $servicePoint['city'];
|
95 |
+
$data['street'] = implode(" ", array_filter(array($servicePoint['address1'], $servicePoint['address2'])));
|
96 |
+
$data['zipcode'] = $servicePoint['zip'];
|
97 |
+
$data['shippingMethod'] = $servicePoint['carrier'];
|
98 |
+
$data['country'] = $servicePoint['country'];
|
99 |
+
$ser = serialize($data);
|
100 |
+
$data['servicePointId'] = $ser;
|
101 |
+
return $data;
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
app/code/community/Smartsend/Logistics/Block/Swipbox.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Block/Swipbox.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Block_Swipbox extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
$this->setTemplate('logistics/pickup.phtml'); // swipbox html needs to be done yet
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getPickupData() {
|
33 |
+
|
34 |
+
$checkOut = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); //getting shipping address from checkout quote
|
35 |
+
$street = $checkOut->getStreet();
|
36 |
+
$street = implode(' ', $street); // splitting the street by " "(space)
|
37 |
+
$city = $checkOut->getCity();
|
38 |
+
$postcode = $checkOut->getPostcode();
|
39 |
+
$country = $checkOut->getCountry();
|
40 |
+
$result = Mage::getSingleton('logistics/carrier_swipbox')->_post($street, $city, $postcode, $country); // get the pickup points for the swipbox carrier
|
41 |
+
|
42 |
+
$output = json_decode($result->response, true); // decoding the pickup points data into array
|
43 |
+
if (!$output) { // if no pickup data return false
|
44 |
+
return FALSE;
|
45 |
+
}
|
46 |
+
$servicePoints = $output;
|
47 |
+
|
48 |
+
$format = Mage::getStoreConfig('carriers/smartsendswipbox/listformat'); //get the address format from the admin system config
|
49 |
+
for ($i = 0; $i < count($servicePoints); $i++) {
|
50 |
+
if (!isset($servicePoints[$i])) {
|
51 |
+
break;
|
52 |
+
}
|
53 |
+
$addressData = $this->getaddressData($servicePoints[$i]); //getting address data form the pickup points response
|
54 |
+
switch ($format) {
|
55 |
+
case 1:
|
56 |
+
$resultData[$addressData['servicePointId']] = array(
|
57 |
+
'company' => $addressData['company'],
|
58 |
+
'street' => $addressData['street'],
|
59 |
+
'zip_code' => $addressData['zipcode'],
|
60 |
+
'city' => $addressData['city']
|
61 |
+
);
|
62 |
+
break;
|
63 |
+
case 2:
|
64 |
+
$resultData[$addressData['servicePointId']] = array(
|
65 |
+
'company' => $addressData['company'],
|
66 |
+
'street' => $addressData['street'],
|
67 |
+
'zipcode' => $addressData['zipcode']
|
68 |
+
);
|
69 |
+
break;
|
70 |
+
case 3:
|
71 |
+
$resultData[$addressData['servicePointId']] = array(
|
72 |
+
'company' => $addressData['company'],
|
73 |
+
'street' => $addressData['street'],
|
74 |
+
'city' => $addressData['city']
|
75 |
+
);
|
76 |
+
default:
|
77 |
+
$resultData[$addressData['servicePointId']] = array(
|
78 |
+
'company' => $addressData['company'],
|
79 |
+
'street' => $addressData['street'],
|
80 |
+
);
|
81 |
+
break;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
if (!isset($resultData)) {
|
85 |
+
$resultData = "";
|
86 |
+
}
|
87 |
+
return $resultData;
|
88 |
+
}
|
89 |
+
|
90 |
+
protected function getaddressData($servicePoint) {
|
91 |
+
$data['pick_up_id'] = $servicePoint['pickupid'];
|
92 |
+
$data['company'] = implode(" ", array_filter(array($servicePoint['name1'], $servicePoint['name2']))); //joining the address data
|
93 |
+
$data['city'] = $servicePoint['city'];
|
94 |
+
$data['street'] = implode(" ", array_filter(array($servicePoint['address1'], $servicePoint['address2'])));
|
95 |
+
$data['zipcode'] = $servicePoint['zip'];
|
96 |
+
$data['shippingMethod'] = $servicePoint['carrier'];
|
97 |
+
$data['country'] = $servicePoint['country'];
|
98 |
+
$ser = serialize($data);
|
99 |
+
$data['servicePointId'] = $ser;
|
100 |
+
return $data;
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
app/code/community/Smartsend/Logistics/Helper/Data.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Helper/Data.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Helper_Data extends Mage_Core_Helper_Abstract
|
28 |
+
{
|
29 |
+
|
30 |
+
/**
|
31 |
+
*
|
32 |
+
* Check if the vConnect module is installed or not
|
33 |
+
*
|
34 |
+
* @return boolean
|
35 |
+
*/
|
36 |
+
public function isVconnetEnabled() {
|
37 |
+
|
38 |
+
$installed = Mage::helper('core')->isModuleEnabled('Vconnect_Postnord');
|
39 |
+
|
40 |
+
if($installed == true) {
|
41 |
+
return true;
|
42 |
+
} else {
|
43 |
+
return false;
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Bring.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Bring.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Bring extends Mage_Core_Model_Abstract {
|
27 |
+
|
28 |
+
public function _construct() {
|
29 |
+
parent::_construct();
|
30 |
+
$this->_init('logistics/bring');
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Carrier/Bring.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Carrier/Bring.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Carrier_Bring extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
27 |
+
|
28 |
+
protected $_code = 'smartsendbring';
|
29 |
+
|
30 |
+
public function _post($street, $city, $postcode, $country) {
|
31 |
+
$ch = curl_init(); //intitiate curl
|
32 |
+
|
33 |
+
/* Script URL */
|
34 |
+
//$url = 'http://private-2d17c-smartsend.apiary-mock.com/pickup/';
|
35 |
+
$url = 'https://smartsend-prod.apigee.net/v7/pickup/';
|
36 |
+
|
37 |
+
$carriers = 'bring';
|
38 |
+
|
39 |
+
/* $_GET Parameters to Send */
|
40 |
+
$params = array('country' => $country, 'zip' => $postcode, 'city' => $city, 'street' => $street);
|
41 |
+
|
42 |
+
/* Update URL to container Query String of Paramaters */
|
43 |
+
$url .= $carriers . '?' . http_build_query($params);
|
44 |
+
|
45 |
+
curl_setopt($ch, CURLOPT_URL, $url); //curl url
|
46 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true); //curl request method
|
47 |
+
//curl_setopt($ch, CURLOPT_HEADER, false);
|
48 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
49 |
+
'apikey:yL18TETUVQ7E9pgVb6JeV1erIYHAMcwe',
|
50 |
+
'smartsendmail:'.Mage::getStoreConfig('carriers/smartsend/username'),
|
51 |
+
'smartsendlicence:'.Mage::getStoreConfig('carriers/smartsend/licencekey'),
|
52 |
+
'cmssystem:Magento',
|
53 |
+
'cmsversion:'.Mage::getVersion(),
|
54 |
+
'appversion:'.Mage::getConfig()->getNode('modules/Smartsend_Logistics')->version
|
55 |
+
)); //curl request header
|
56 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
57 |
+
|
58 |
+
$result = new StdClass(); //creating new class
|
59 |
+
$result->response = curl_exec($ch); //executing the curl
|
60 |
+
$result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
61 |
+
$result->meta = curl_getinfo($ch);
|
62 |
+
$curl_error = ($result->code > 0 ? null : curl_error($ch) . ' (' . curl_errno($ch) . ')'); //getting error from curl if any
|
63 |
+
|
64 |
+
curl_close($ch); //closing the curl
|
65 |
+
|
66 |
+
if ($curl_error) {
|
67 |
+
throw new Exception('An error occurred while connecting to Chargify: ' . $curl_error);
|
68 |
+
}
|
69 |
+
return $result;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function isTrackingAvailable() {
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getFormBlock() {
|
77 |
+
return 'logistics/bring';
|
78 |
+
}
|
79 |
+
|
80 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
81 |
+
if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active')) { //checking that carrier is active or not
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
|
85 |
+
$handling = Mage::getStoreConfig('carriers/' . $this->_code . '/handling');
|
86 |
+
$result = Mage::getModel('shipping/rate_result'); //shipping rate table for the bring carrier
|
87 |
+
$bringShippingFee = $this->getBringShippingFee(); //getting bring shipping fees form table rate
|
88 |
+
$carrier_label = 'Bring';
|
89 |
+
$shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress() //shipping address from the checkout quote
|
90 |
+
->getCountryId();
|
91 |
+
$show = true;
|
92 |
+
if ($show && $bringShippingFee!=NULL) { // This if condition is just to demonstrate how to return success and error in shipping methods
|
93 |
+
$carrier = $this->_code;
|
94 |
+
$check_method = Mage::getModel('logistics/shippingMethods')->checkShippingFee($carrier, $shipping_country); //checking the shipping fee for the shipping method
|
95 |
+
|
96 |
+
foreach ($check_method as $key => $value) {
|
97 |
+
|
98 |
+
$title = '';
|
99 |
+
foreach (unserialize($this->getConfigData('price')) as $val) {
|
100 |
+
|
101 |
+
if ($val['methods'] == $key && $val['pickupshippingfee'] == $value) {
|
102 |
+
|
103 |
+
$title = $val['method_name'];
|
104 |
+
$method_code = Mage::getModel('logistics/shippingMethods')->getMethodName(); //getting the shipping method name
|
105 |
+
|
106 |
+
$method_code = $method_code[$val['methods']];
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
$method = Mage::getModel('shipping/rate_result_method'); //saving the shipping method
|
112 |
+
$method->setCarrier($this->_code);
|
113 |
+
$method->setMethod($method_code);
|
114 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
115 |
+
$method->setMethodTitle($title);
|
116 |
+
$method->setPrice($value);
|
117 |
+
$method->setCost($value);
|
118 |
+
$result->append($method);
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
122 |
+
$error->setCarrier($this->_code);
|
123 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
124 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
125 |
+
$result->append($error);
|
126 |
+
}
|
127 |
+
|
128 |
+
return $result;
|
129 |
+
}
|
130 |
+
|
131 |
+
public function getAllowedMethods() {
|
132 |
+
return array('bring' => $this->getConfigData('name')); //get name for the bring carrier
|
133 |
+
}
|
134 |
+
|
135 |
+
public function getBringShippingFee() {
|
136 |
+
//$orderPrice = Mage::registry('ordsubtotal');
|
137 |
+
$orderPrice = Mage::getModel('checkout/session')->getQuote()->getGrandTotal(); // get the total amount of the order
|
138 |
+
$orderWeight = Mage::registry('ordweight'); // get the order weight
|
139 |
+
|
140 |
+
|
141 |
+
if (Mage::getStoreConfig('carriers/smartsendbring/price') != "") {
|
142 |
+
$pickupShippingRates = unserialize(Mage::getStoreConfig('carriers/smartsendbring/price', Mage::app()->getStore())); //unserializing the shipping rates from the shipping rate table
|
143 |
+
}
|
144 |
+
|
145 |
+
$rates = array();
|
146 |
+
if ($pickupShippingRates) {
|
147 |
+
|
148 |
+
foreach ($pickupShippingRates as $pickupShippingRate) {
|
149 |
+
if ($pickupShippingRate['orderminprice'] <= $orderPrice && $pickupShippingRate['ordermaxprice'] >= $orderPrice && $pickupShippingRate['orderminweight'] <= $orderWeight && $pickupShippingRate['ordermaxweight'] >= $orderWeight) { //if weight and price is correct
|
150 |
+
$rates[] = $pickupShippingRate['pickupshippingfee']; //add rate to array of rates
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
$cheapestexpensive = Mage::getStoreConfig('carriers/smartsendbring/cheapestexpensive', Mage::app()->getStore()); //get the 'Cheapest or most expensive' setting from the admin system config
|
155 |
+
if (!$cheapestexpensive) {
|
156 |
+
$cheapestexpensive = 0; //default is the cheapest
|
157 |
+
}
|
158 |
+
|
159 |
+
if (!empty($rates)) { //if at least one rate matches the order
|
160 |
+
if ($cheapestexpensive == 0) {
|
161 |
+
return min($rates); //return min price
|
162 |
+
} elseif ($cheapestexpensive == 1) {
|
163 |
+
return max($rates); //return max price
|
164 |
+
}
|
165 |
+
} else {
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
} else {
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Carrier/Gls.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Carrier/Gls.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Carrier_Gls extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
27 |
+
|
28 |
+
protected $_code = 'smartsendgls';
|
29 |
+
|
30 |
+
public function _post($street, $city, $postcode, $country) {
|
31 |
+
$ch = curl_init();
|
32 |
+
|
33 |
+
/* Script URL */
|
34 |
+
//$url = 'http://private-2d17c-smartsend.apiary-mock.com/pickup/';
|
35 |
+
$url = 'https://smartsend-prod.apigee.net/v7/pickup/';
|
36 |
+
|
37 |
+
$carriers = 'gls';
|
38 |
+
|
39 |
+
/* $_GET Parameters to Send */
|
40 |
+
$params = array('country' => $country, 'zip' => $postcode, 'city' => $city, 'street' => $street);
|
41 |
+
|
42 |
+
/* Update URL to container Query String of Paramaters */
|
43 |
+
$url .= $carriers . '?' . http_build_query($params);
|
44 |
+
|
45 |
+
curl_setopt($ch, CURLOPT_URL, $url); //curl url
|
46 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true); //curl request method
|
47 |
+
//curl_setopt($ch, CURLOPT_HEADER, false);
|
48 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
49 |
+
'apikey:yL18TETUVQ7E9pgVb6JeV1erIYHAMcwe',
|
50 |
+
'smartsendmail:'.Mage::getStoreConfig('carriers/smartsend/username'),
|
51 |
+
'smartsendlicence:'.Mage::getStoreConfig('carriers/smartsend/licencekey'),
|
52 |
+
'cmssystem:Magento',
|
53 |
+
'cmsversion:'.Mage::getVersion(),
|
54 |
+
'appversion:'.Mage::getConfig()->getNode('modules/Smartsend_Logistics')->version
|
55 |
+
)); //curl request header
|
56 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
57 |
+
|
58 |
+
$result = new StdClass(); //declare new class
|
59 |
+
$result->response = curl_exec($ch); //executing curl
|
60 |
+
$result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
61 |
+
$result->meta = curl_getinfo($ch);
|
62 |
+
$curl_error = ($result->code > 0 ? null : curl_error($ch) . ' (' . curl_errno($ch) . ')'); //getting curl error if their are any
|
63 |
+
|
64 |
+
curl_close($ch); //closing curl
|
65 |
+
|
66 |
+
if ($curl_error) {
|
67 |
+
throw new Exception('An error occurred while connecting to Chargify: ' . $curl_error); //showing error
|
68 |
+
}
|
69 |
+
return $result;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function isTrackingAvailable() {
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getFormBlock() {
|
77 |
+
return 'logistics/gls';
|
78 |
+
}
|
79 |
+
|
80 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
81 |
+
if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active')) { //checking if carrier is active or not
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
|
85 |
+
$handling = Mage::getStoreConfig('carriers/' . $this->_code . '/handling');
|
86 |
+
$result = Mage::getModel('shipping/rate_result'); //shipping rate price model
|
87 |
+
$glsShippingFee = $this->getGlsShippingFee(); //getting gls shipping prices
|
88 |
+
$carrier_label = 'Gls';
|
89 |
+
$shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress() ///get shipping address from the checkout quote
|
90 |
+
->getCountryId();
|
91 |
+
$show = true;
|
92 |
+
if ($show && $glsShippingFee!=NULL) { // This if condition is just to demonstrate how to return success and error in shipping methods
|
93 |
+
$carrier = $this->_code;
|
94 |
+
$check_method = Mage::getModel('logistics/shippingMethods')->checkShippingFee($carrier, $shipping_country); //checking the shipping price for the carrier gls
|
95 |
+
|
96 |
+
foreach ($check_method as $key => $value) {
|
97 |
+
|
98 |
+
$title = '';
|
99 |
+
foreach (unserialize($this->getConfigData('price')) as $val) {
|
100 |
+
|
101 |
+
if ($val['methods'] == $key && $val['pickupshippingfee'] == $value) {
|
102 |
+
$title = $val['method_name'];
|
103 |
+
$method_code = Mage::getModel('logistics/shippingMethods')->getMethodName(); //getting the shipping method name
|
104 |
+
|
105 |
+
$method_code = $method_code[$val['methods']];
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
$method = Mage::getModel('shipping/rate_result_method'); //saving the shipping method
|
110 |
+
$method->setCarrier($this->_code);
|
111 |
+
$method->setMethod($method_code);
|
112 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
113 |
+
$method->setMethodTitle($title);
|
114 |
+
$method->setPrice($value);
|
115 |
+
$method->setCost($value);
|
116 |
+
$result->append($method);
|
117 |
+
}
|
118 |
+
} else {
|
119 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
120 |
+
$error->setCarrier($this->_code);
|
121 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
122 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
123 |
+
$result->append($error);
|
124 |
+
}
|
125 |
+
return $result;
|
126 |
+
}
|
127 |
+
|
128 |
+
public function getAllowedMethods() {
|
129 |
+
return array('gls' => $this->getConfigData('name'));
|
130 |
+
}
|
131 |
+
|
132 |
+
public function getGlsShippingFee() {
|
133 |
+
//$orderPrice = Mage::registry('ordsubtotal') + Mage::registry('ordtaxtotal'); //adding the tax amount with the order subtotal
|
134 |
+
$orderPrice = Mage::getModel('checkout/session')->getQuote()->getGrandTotal(); // get the total amount of the order
|
135 |
+
$orderWeight = Mage::registry('ordweight'); //getting the order weight
|
136 |
+
|
137 |
+
if (Mage::getStoreConfig('carriers/smartsendgls/price') != "") { //checking the shipping price
|
138 |
+
$pickupShippingRates = unserialize(Mage::getStoreConfig('carriers/smartsendgls/price', Mage::app()->getStore()));
|
139 |
+
}
|
140 |
+
|
141 |
+
$rates = array();
|
142 |
+
if ($pickupShippingRates) {
|
143 |
+
|
144 |
+
foreach ($pickupShippingRates as $pickupShippingRate) {
|
145 |
+
if ($pickupShippingRate['orderminprice'] <= $orderPrice && $pickupShippingRate['ordermaxprice'] >= $orderPrice && $pickupShippingRate['orderminweight'] <= $orderWeight && $pickupShippingRate['ordermaxweight'] >= $orderWeight) { //if weight and price is correct
|
146 |
+
$rates[] = $pickupShippingRate['pickupshippingfee']; //add rate to array of rates
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
$cheapestexpensive = Mage::getStoreConfig('carriers/smartsendgls/cheapestexpensive', Mage::app()->getStore()); //get the 'Cheapest or most expensive' setting from the admin system config
|
151 |
+
if (!$cheapestexpensive) {
|
152 |
+
$cheapestexpensive = 0; //default is the cheapest
|
153 |
+
}
|
154 |
+
|
155 |
+
if (!empty($rates)) { //if at least one rate matches the order
|
156 |
+
if ($cheapestexpensive == 0) {
|
157 |
+
return min($rates); //return min price
|
158 |
+
} elseif ($cheapestexpensive == 1) {
|
159 |
+
return max($rates); //return max price
|
160 |
+
}
|
161 |
+
} else {
|
162 |
+
return false;
|
163 |
+
}
|
164 |
+
} else {
|
165 |
+
return false;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Carrier/Pickup.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Carrier/Pickup.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Carrier_Pickup extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
27 |
+
|
28 |
+
protected $_code = 'smartsendpickup';
|
29 |
+
|
30 |
+
public function _post($street, $city, $postcode, $country) {
|
31 |
+
|
32 |
+
$ch = curl_init();
|
33 |
+
|
34 |
+
/* Script URL */
|
35 |
+
$url = 'https://smartsend-prod.apigee.net/v7/pickup/';
|
36 |
+
|
37 |
+
$carriers = str_replace(",", "-", Mage::getStoreConfig('carriers/smartsendpickup/methods'));
|
38 |
+
|
39 |
+
/* $_GET Parameters to Send */
|
40 |
+
$params = array('country' => $country, 'zip' => $postcode, 'city' => $city, 'street' => $street);
|
41 |
+
|
42 |
+
/* Update URL to container Query String of Paramaters */
|
43 |
+
$url .= $carriers . '?' . http_build_query($params);
|
44 |
+
|
45 |
+
curl_setopt($ch, CURLOPT_URL, $url); //curl url
|
46 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true); //curl request method
|
47 |
+
//curl_setopt($ch, CURLOPT_HEADER, false);
|
48 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
49 |
+
'apikey:yL18TETUVQ7E9pgVb6JeV1erIYHAMcwe',
|
50 |
+
'smartsendmail:'.Mage::getStoreConfig('carriers/smartsend/username'),
|
51 |
+
'smartsendlicence:'.Mage::getStoreConfig('carriers/smartsend/licencekey'),
|
52 |
+
'cmssystem:Magento',
|
53 |
+
'cmsversion:'.Mage::getVersion(),
|
54 |
+
'appversion:'.Mage::getConfig()->getNode('modules/Smartsend_Logistics')->version
|
55 |
+
)); //curl request header
|
56 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
57 |
+
|
58 |
+
$result = new StdClass();
|
59 |
+
$result->response = curl_exec($ch); //executing curl
|
60 |
+
$result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
61 |
+
$result->meta = curl_getinfo($ch);
|
62 |
+
$curl_error = ($result->code > 0 ? null : curl_error($ch) . ' (' . curl_errno($ch) . ')'); //getting curl error if any
|
63 |
+
|
64 |
+
curl_close($ch); //curl closing
|
65 |
+
|
66 |
+
if ($curl_error) {
|
67 |
+
throw new Exception('An error occurred while connecting to Chargify: ' . $curl_error);
|
68 |
+
}
|
69 |
+
return $result;
|
70 |
+
}
|
71 |
+
|
72 |
+
/*
|
73 |
+
public function isTrackingAvailable() {
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
*/
|
77 |
+
|
78 |
+
public function getFormBlock() {
|
79 |
+
return 'logistics/pickup';
|
80 |
+
}
|
81 |
+
|
82 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
83 |
+
if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active')) { //checking if carrier is active or not
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
$handling = Mage::getStoreConfig('carriers/' . $this->_code . '/handling');
|
88 |
+
$result = Mage::getModel('shipping/rate_result'); //shipping rate table for the pickup carrier
|
89 |
+
$show = true;
|
90 |
+
$pickupShippingFee = $this->getPickupShippingFee(); //getting pickup shipping fees form table rate
|
91 |
+
|
92 |
+
$shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress() //getting shipping address form the checkout quote
|
93 |
+
->getCountryId();
|
94 |
+
if ($show && $pickupShippingFee!=NULL) { // This if condition is just to demonstrate how to return success and error in shipping methods
|
95 |
+
$carrier = $this->_code;
|
96 |
+
$check_method = Mage::getModel('logistics/shippingMethods')->checkShippingFee($carrier, $shipping_country); //check shipping fee rates form the table rates
|
97 |
+
|
98 |
+
foreach ($check_method as $key => $value) {
|
99 |
+
|
100 |
+
$method = Mage::getModel('shipping/rate_result_method'); //saving shipping method
|
101 |
+
$method->setCarrier($this->_code);
|
102 |
+
$method->setMethod('pickup');
|
103 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
104 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
105 |
+
$method->setPrice($value);
|
106 |
+
$method->setCost($value);
|
107 |
+
$result->append($method);
|
108 |
+
}
|
109 |
+
} else {
|
110 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
111 |
+
$error->setCarrier($this->_code);
|
112 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
113 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
114 |
+
$result->append($error);
|
115 |
+
}
|
116 |
+
return $result;
|
117 |
+
}
|
118 |
+
|
119 |
+
public function getAllowedMethods() {
|
120 |
+
return array('pickup' => $this->getConfigData('name'));
|
121 |
+
}
|
122 |
+
|
123 |
+
public function getPickupShippingFee() {
|
124 |
+
$orderPrice = Mage::getModel('checkout/session')->getQuote()->getGrandTotal(); //getting grand total form the checkout session quote
|
125 |
+
$orderWeight = Mage::registry('ordweight'); //getting order weight
|
126 |
+
|
127 |
+
if (Mage::getStoreConfig('carriers/smartsendpickup/price') != "") {
|
128 |
+
$pickupShippingRates = unserialize(Mage::getStoreConfig('carriers/smartsendpickup/price', Mage::app()->getStore())); //unserializing the shipping rates from the shipping rate table
|
129 |
+
}
|
130 |
+
|
131 |
+
$rates = array();
|
132 |
+
if ($pickupShippingRates) {
|
133 |
+
|
134 |
+
foreach ($pickupShippingRates as $pickupShippingRate) {
|
135 |
+
if ($pickupShippingRate['orderminprice'] <= $orderPrice && $pickupShippingRate['ordermaxprice'] >= $orderPrice
|
136 |
+
&& $pickupShippingRate['orderminweight'] <= $orderWeight && $pickupShippingRate['ordermaxweight'] >= $orderWeight) { //if weight and price is correct
|
137 |
+
$rates[] = $pickupShippingRate['pickupshippingfee']; //add rate to array of rates
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
$cheapestexpensive = Mage::getStoreConfig('carriers/smartsendpickup/cheapestexpensive', Mage::app()->getStore()); //get the 'Cheapest or most expensive' setting from the admin system config
|
142 |
+
if (!$cheapestexpensive) {
|
143 |
+
$cheapestexpensive = 0; //default is the cheapest
|
144 |
+
}
|
145 |
+
|
146 |
+
if (!empty($rates)) { //if at least one rate matches the order
|
147 |
+
if ($cheapestexpensive == 0) {
|
148 |
+
return min($rates); //return min price
|
149 |
+
} elseif ($cheapestexpensive == 1) {
|
150 |
+
return max($rates); //return max price
|
151 |
+
}
|
152 |
+
} else {
|
153 |
+
return false;
|
154 |
+
}
|
155 |
+
} else {
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Carrier/Postdanmark.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Carrier/Postdanmark.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Carrier_Postdanmark extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
27 |
+
|
28 |
+
protected $_code = 'smartsendpostdanmark';
|
29 |
+
|
30 |
+
public function _post($street, $city, $postcode, $country) {
|
31 |
+
$ch = curl_init();
|
32 |
+
|
33 |
+
/* Script URL */
|
34 |
+
//$url = 'http://private-2d17c-smartsend.apiary-mock.com/pickup/';
|
35 |
+
$url = 'https://smartsend-prod.apigee.net/v7/pickup/';
|
36 |
+
|
37 |
+
$carriers = 'postdanmark';
|
38 |
+
|
39 |
+
/* $_GET Parameters to Send */
|
40 |
+
$params = array('country' => $country, 'zip' => $postcode, 'city' => $city, 'street' => $street);
|
41 |
+
|
42 |
+
/* Update URL to container Query String of Paramaters */
|
43 |
+
$url .= $carriers . '?' . http_build_query($params);
|
44 |
+
|
45 |
+
curl_setopt($ch, CURLOPT_URL, $url); // curl url
|
46 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true); //curl request method
|
47 |
+
//curl_setopt($ch, CURLOPT_HEADER, false);
|
48 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
49 |
+
'apikey:yL18TETUVQ7E9pgVb6JeV1erIYHAMcwe',
|
50 |
+
'smartsendmail:'.Mage::getStoreConfig('carriers/smartsend/username'),
|
51 |
+
'smartsendlicence:'.Mage::getStoreConfig('carriers/smartsend/licencekey'),
|
52 |
+
'cmssystem:Magento',
|
53 |
+
'cmsversion:'.Mage::getVersion(),
|
54 |
+
'appversion:'.Mage::getConfig()->getNode('modules/Smartsend_Logistics')->version
|
55 |
+
)); //curl request header
|
56 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
57 |
+
|
58 |
+
$result = new StdClass();
|
59 |
+
$result->response = curl_exec($ch); //execute curl
|
60 |
+
$result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
61 |
+
$result->meta = curl_getinfo($ch);
|
62 |
+
$curl_error = ($result->code > 0 ? null : curl_error($ch) . ' (' . curl_errno($ch) . ')'); // getting error if any
|
63 |
+
|
64 |
+
curl_close($ch); //closing curl
|
65 |
+
|
66 |
+
if ($curl_error) {
|
67 |
+
throw new Exception('An error occurred while connecting to Chargify: ' . $curl_error);
|
68 |
+
}
|
69 |
+
return $result;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function isTrackingAvailable() {
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getFormBlock() {
|
77 |
+
return 'logistics/postdanmark';
|
78 |
+
}
|
79 |
+
|
80 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
81 |
+
if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active')) { //checking if carrier is active or not
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
$handling = Mage::getStoreConfig('carriers/' . $this->_code . '/handling');
|
87 |
+
$result = Mage::getModel('shipping/rate_result'); //table rate for shipping methods
|
88 |
+
$postdanmarkShippingFee = $this->getPostdanmarkShippingFee(); //getting shipping fee for the carrier
|
89 |
+
$show = true;
|
90 |
+
$carrier_label = 'Postdanmark';
|
91 |
+
$shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress() //getting shipping address from the checkout quote
|
92 |
+
->getCountryId();
|
93 |
+
if ($show && $postdanmarkShippingFee!=NULL) { // This if condition is just to demonstrate how to return success and error in shipping methods$method = Mage::getModel('shipping/rate_result_method');
|
94 |
+
$carrier = $this->_code;
|
95 |
+
$check_method = Mage::getModel('logistics/shippingMethods')->checkShippingFee($carrier, $shipping_country); //cheking the table rates for the shipping method
|
96 |
+
|
97 |
+
foreach ($check_method as $key => $value) {
|
98 |
+
|
99 |
+
$title = '';
|
100 |
+
foreach (unserialize($this->getConfigData('price')) as $val) {
|
101 |
+
|
102 |
+
if ($val['methods'] == $key && $val['pickupshippingfee'] == $value) {
|
103 |
+
$title = $val['method_name'];
|
104 |
+
$method_code = Mage::getModel('logistics/shippingMethods')->getMethodName(); //getting the shipping method name
|
105 |
+
|
106 |
+
$method_code = $method_code[$val['methods']];
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
$method = Mage::getModel('shipping/rate_result_method'); //saving the shipping method
|
112 |
+
$method->setCarrier($this->_code);
|
113 |
+
$method->setMethod($method_code);
|
114 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
115 |
+
$method->setMethodTitle($title);
|
116 |
+
$method->setPrice($value);
|
117 |
+
$method->setCost($value);
|
118 |
+
$result->append($method);
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
122 |
+
$error->setCarrier($this->_code);
|
123 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
124 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
125 |
+
$result->append($error);
|
126 |
+
}
|
127 |
+
return $result;
|
128 |
+
}
|
129 |
+
|
130 |
+
public function getAllowedMethods() {
|
131 |
+
return array('postdanmark' => $this->getConfigData('name'));
|
132 |
+
}
|
133 |
+
|
134 |
+
public function getPostdanmarkShippingFee() {
|
135 |
+
//$orderPrice = Mage::registry('ordsubtotal');
|
136 |
+
$orderPrice = Mage::getModel('checkout/session')->getQuote()->getGrandTotal(); // get the total amount of the order
|
137 |
+
$orderWeight = Mage::registry('ordweight'); // get the order weight
|
138 |
+
|
139 |
+
if (Mage::getStoreConfig('carriers/smartsendpostdanmark/price') != "") {
|
140 |
+
$pickupShippingRates = unserialize(Mage::getStoreConfig('carriers/smartsendpostdanmark/price', Mage::app()->getStore())); //unserializing the shipping rates from the shipping rate table
|
141 |
+
}
|
142 |
+
|
143 |
+
$rates = array();
|
144 |
+
if ($pickupShippingRates) {
|
145 |
+
|
146 |
+
foreach ($pickupShippingRates as $pickupShippingRate) {
|
147 |
+
if ($pickupShippingRate['orderminprice'] <= $orderPrice && $pickupShippingRate['ordermaxprice'] >= $orderPrice && $pickupShippingRate['orderminweight'] <= $orderWeight && $pickupShippingRate['ordermaxweight'] >= $orderWeight) { //if weight and price is correct
|
148 |
+
$rates[] = $pickupShippingRate['pickupshippingfee']; //add rate to array of rates
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
$cheapestexpensive = Mage::getStoreConfig('carriers/smartsendpostdanmark/cheapestexpensive', Mage::app()->getStore()); //get the 'Cheapest or most expensive' setting from the admin system config
|
153 |
+
if (!$cheapestexpensive) {
|
154 |
+
$cheapestexpensive = 0; //default is the cheapest
|
155 |
+
}
|
156 |
+
|
157 |
+
if (!empty($rates)) { //if at least one rate matches the order
|
158 |
+
if ($cheapestexpensive == 0) {
|
159 |
+
return min($rates); //return min price
|
160 |
+
} elseif ($cheapestexpensive == 1) {
|
161 |
+
return max($rates); //return max price
|
162 |
+
}
|
163 |
+
} else {
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
} else {
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Carrier/Posten.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Carrier/Posten.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Carrier_Posten extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
27 |
+
|
28 |
+
protected $_code = 'smartsendposten';
|
29 |
+
|
30 |
+
public function _post($street, $city, $postcode, $country) {
|
31 |
+
$ch = curl_init(); //initiate curl
|
32 |
+
|
33 |
+
/* Script URL */
|
34 |
+
//$url = 'http://private-2d17c-smartsend.apiary-mock.com/pickup/';
|
35 |
+
$url = 'https://smartsend-prod.apigee.net/v7/pickup/';
|
36 |
+
|
37 |
+
$carriers = 'posten';
|
38 |
+
|
39 |
+
/* $_GET Parameters to Send */
|
40 |
+
$params = array('country' => $country, 'zip' => $postcode, 'city' => $city, 'street' => $street);
|
41 |
+
|
42 |
+
/* Update URL to container Query String of Paramaters */
|
43 |
+
$url .= $carriers . '?' . http_build_query($params);
|
44 |
+
|
45 |
+
curl_setopt($ch, CURLOPT_URL, $url); //curl url
|
46 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true); //curl request method
|
47 |
+
//curl_setopt($ch, CURLOPT_HEADER, false);
|
48 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
49 |
+
'apikey:yL18TETUVQ7E9pgVb6JeV1erIYHAMcwe',
|
50 |
+
'smartsendmail:'.Mage::getStoreConfig('carriers/smartsend/username'),
|
51 |
+
'smartsendlicence:'.Mage::getStoreConfig('carriers/smartsend/licencekey'),
|
52 |
+
'cmssystem:Magento',
|
53 |
+
'cmsversion:'.Mage::getVersion(),
|
54 |
+
'appversion:'.Mage::getConfig()->getNode('modules/Smartsend_Logistics')->version
|
55 |
+
)); //curl request header
|
56 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
57 |
+
|
58 |
+
$result = new StdClass();
|
59 |
+
$result->response = curl_exec($ch); //execute curl
|
60 |
+
$result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
61 |
+
$result->meta = curl_getinfo($ch);
|
62 |
+
$curl_error = ($result->code > 0 ? null : curl_error($ch) . ' (' . curl_errno($ch) . ')'); //getting error from curl if any
|
63 |
+
|
64 |
+
curl_close($ch); //close curl
|
65 |
+
|
66 |
+
if ($curl_error) {
|
67 |
+
throw new Exception('An error occurred while connecting to Chargify: ' . $curl_error);
|
68 |
+
}
|
69 |
+
return $result;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function isTrackingAvailable() {
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getFormBlock() {
|
77 |
+
return 'logistics/posten';
|
78 |
+
}
|
79 |
+
|
80 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
81 |
+
if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active')) { //checking carrier is active or not
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
$handling = Mage::getStoreConfig('carriers/' . $this->_code . '/handling');
|
87 |
+
$result = Mage::getModel('shipping/rate_result'); //shipping rate table for the carrier
|
88 |
+
$postenShippingFee = $this->getPostenShippingFee(); //getting shipping fees form table rate
|
89 |
+
$show = true;
|
90 |
+
$carrier_label = 'posten';
|
91 |
+
$shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress() //shipping address from the checkout quote
|
92 |
+
->getCountryId();
|
93 |
+
if ($show && $postenShippingFee!=NULL) { // This if condition is just to demonstrate how to return success and error in shipping methods$method = Mage::getModel('shipping/rate_result_method');
|
94 |
+
$carrier = $this->_code;
|
95 |
+
$check_method = Mage::getModel('logistics/shippingMethods')->checkShippingFee($carrier, $shipping_country); //checking the shipping method rates
|
96 |
+
|
97 |
+
foreach ($check_method as $key => $value) {
|
98 |
+
|
99 |
+
$title = '';
|
100 |
+
foreach (unserialize($this->getConfigData('price')) as $val) {
|
101 |
+
|
102 |
+
if ($val['methods'] == $key && $val['pickupshippingfee'] == $value) {
|
103 |
+
$title = $val['method_name'];
|
104 |
+
$method_code = Mage::getModel('logistics/shippingMethods')->getMethodName(); //getting the shipping method name
|
105 |
+
|
106 |
+
$method_code = $method_code[$val['methods']];
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
$method = Mage::getModel('shipping/rate_result_method'); //saving the shipping method
|
112 |
+
$method->setCarrier($this->_code);
|
113 |
+
$method->setMethod($method_code);
|
114 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
115 |
+
$method->setMethodTitle($title);
|
116 |
+
$method->setPrice($value);
|
117 |
+
$method->setCost($value);
|
118 |
+
$result->append($method);
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
122 |
+
$error->setCarrier($this->_code);
|
123 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
124 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
125 |
+
$result->append($error);
|
126 |
+
}
|
127 |
+
return $result;
|
128 |
+
}
|
129 |
+
|
130 |
+
public function getAllowedMethods() {
|
131 |
+
return array('posten' => $this->getConfigData('name'));
|
132 |
+
}
|
133 |
+
|
134 |
+
public function getPostenShippingFee() {
|
135 |
+
//$orderPrice = Mage::registry('ordsubtotal');
|
136 |
+
$orderPrice = Mage::getModel('checkout/session')->getQuote()->getGrandTotal(); // get the total amount of the order
|
137 |
+
$orderWeight = Mage::registry('ordweight'); // get the order weight
|
138 |
+
|
139 |
+
if (Mage::getStoreConfig('carriers/smartsendposten/price') != "") {
|
140 |
+
$pickupShippingRates = unserialize(Mage::getStoreConfig('carriers/smartsendposten/price', Mage::app()->getStore())); //unserializing the shipping rates from the shipping rate table
|
141 |
+
}
|
142 |
+
|
143 |
+
$rates = array();
|
144 |
+
if ($pickupShippingRates) {
|
145 |
+
|
146 |
+
foreach ($pickupShippingRates as $pickupShippingRate) {
|
147 |
+
if ($pickupShippingRate['orderminprice'] <= $orderPrice && $pickupShippingRate['ordermaxprice'] >= $orderPrice && $pickupShippingRate['orderminweight'] <= $orderWeight && $pickupShippingRate['ordermaxweight'] >= $orderWeight) { //if weight and price is correct
|
148 |
+
$rates[] = $pickupShippingRate['pickupshippingfee']; //add rate to array of rates
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
$cheapestexpensive = Mage::getStoreConfig('carriers/smartsendposten/cheapestexpensive', Mage::app()->getStore()); //get the 'Cheapest or most expensive' setting from the admin system config
|
153 |
+
if (!$cheapestexpensive) {
|
154 |
+
$cheapestexpensive = 0; //default is the cheapest
|
155 |
+
}
|
156 |
+
|
157 |
+
if (!empty($rates)) { //if at least one rate matches the order
|
158 |
+
if ($cheapestexpensive == 0) {
|
159 |
+
return min($rates); //return min price
|
160 |
+
} elseif ($cheapestexpensive == 1) {
|
161 |
+
return max($rates); //return max price
|
162 |
+
}
|
163 |
+
} else {
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
} else {
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Carrier/Swipbox.php
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Carrier/Swipbox.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Carrier_Swipbox extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
27 |
+
|
28 |
+
protected $_code = 'smartsendswipbox';
|
29 |
+
|
30 |
+
public function _post($street, $city, $postcode, $country) {
|
31 |
+
$ch = curl_init(); //initiate curl
|
32 |
+
|
33 |
+
/* Script URL */
|
34 |
+
//$url = 'http://private-2d17c-smartsend.apiary-mock.com/pickup/';
|
35 |
+
$url = 'https://smartsend-prod.apigee.net/v7/pickup/';
|
36 |
+
|
37 |
+
$carriers = 'swipbox';
|
38 |
+
|
39 |
+
/* $_GET Parameters to Send */
|
40 |
+
$params = array('country' => $country, 'zip' => $postcode, 'city' => $city, 'street' => $street);
|
41 |
+
|
42 |
+
/* Update URL to container Query String of Paramaters */
|
43 |
+
$url .= $carriers . '?' . http_build_query($params);
|
44 |
+
|
45 |
+
curl_setopt($ch, CURLOPT_URL, $url); //curl url
|
46 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true); //curl request method
|
47 |
+
//curl_setopt($ch, CURLOPT_HEADER, false);
|
48 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
49 |
+
'apikey:yL18TETUVQ7E9pgVb6JeV1erIYHAMcwe',
|
50 |
+
'smartsendmail:'.Mage::getStoreConfig('carriers/smartsend/username'),
|
51 |
+
'smartsendlicence:'.Mage::getStoreConfig('carriers/smartsend/licencekey'),
|
52 |
+
'cmssystem:Magento',
|
53 |
+
'cmsversion:'.Mage::getVersion(),
|
54 |
+
'appversion:'.Mage::getConfig()->getNode('modules/Smartsend_Logistics')->version
|
55 |
+
)); //curl request header
|
56 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
57 |
+
|
58 |
+
$result = new StdClass();
|
59 |
+
$result->response = curl_exec($ch); //exceute curl
|
60 |
+
$result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
61 |
+
$result->meta = curl_getinfo($ch);
|
62 |
+
$curl_error = ($result->code > 0 ? null : curl_error($ch) . ' (' . curl_errno($ch) . ')'); //getting error from curl if any
|
63 |
+
|
64 |
+
curl_close($ch); //close curl
|
65 |
+
|
66 |
+
if ($curl_error) {
|
67 |
+
throw new Exception('An error occurred while connecting to Chargify: ' . $curl_error);
|
68 |
+
}
|
69 |
+
return $result;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function isTrackingAvailable() {
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getFormBlock() {
|
77 |
+
return 'logistics/swipbox';
|
78 |
+
}
|
79 |
+
|
80 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
81 |
+
if (!Mage::getStoreConfig('carriers/' . $this->_code . '/active')) { //checking that carrier is active or not
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
|
85 |
+
$handling = Mage::getStoreConfig('carriers/' . $this->_code . '/handling');
|
86 |
+
$result = Mage::getModel('shipping/rate_result'); //shipping rate table for the carrier
|
87 |
+
$swipboxShippingFee = $this->getSwipboxShippingFee(); //getting shipping fees form table rate
|
88 |
+
$show = true;
|
89 |
+
$carrier_label = 'Swipbox';
|
90 |
+
$shipping_country = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress() //shipping address from the checkout quote
|
91 |
+
->getCountryId();
|
92 |
+
if ($show && $swipboxShippingFee!=NULL) { // This if condition is just to demonstrate how to return success and error in shipping methods
|
93 |
+
$carrier = $this->_code;
|
94 |
+
$check_method = Mage::getModel('logistics/shippingMethods')->checkShippingFee($carrier, $shipping_country); //checking the shipping fee for the shipping method
|
95 |
+
|
96 |
+
foreach ($check_method as $key => $value) {
|
97 |
+
$title = '';
|
98 |
+
foreach (unserialize($this->getConfigData('price')) as $val) {
|
99 |
+
|
100 |
+
if ($val['methods'] == $key && $val['pickupshippingfee'] == $value) {
|
101 |
+
$title = $val['method_name'];
|
102 |
+
|
103 |
+
$method_code = Mage::getModel('logistics/shippingMethods')->getMethodName(); //getting the shipping method name
|
104 |
+
|
105 |
+
$method_code = $method_code[$val['methods']];
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
|
110 |
+
$method = Mage::getModel('shipping/rate_result_method'); //saving the shipping method
|
111 |
+
$method->setCarrier($this->_code);
|
112 |
+
$method->setMethod($method_code);
|
113 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
114 |
+
$method->setMethodTitle($title);
|
115 |
+
$method->setPrice($value);
|
116 |
+
$method->setCost($value);
|
117 |
+
$result->append($method);
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
121 |
+
$error->setCarrier($this->_code);
|
122 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
123 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
124 |
+
$result->append($error);
|
125 |
+
}
|
126 |
+
return $result;
|
127 |
+
}
|
128 |
+
|
129 |
+
public function getAllowedMethods() {
|
130 |
+
return array('swipbox' => $this->getConfigData('name'));
|
131 |
+
}
|
132 |
+
|
133 |
+
public function getSwipboxShippingFee() {
|
134 |
+
//$orderPrice = Mage::registry('ordsubtotal');
|
135 |
+
$orderPrice = Mage::getModel('checkout/session')->getQuote()->getGrandTotal(); // get the total amount of the order
|
136 |
+
$orderWeight = Mage::registry('ordweight'); // get the order weight
|
137 |
+
|
138 |
+
if (Mage::getStoreConfig('carriers/smartsendswipbox/price') != "") {
|
139 |
+
$pickupShippingRates = unserialize(Mage::getStoreConfig('carriers/smartsendswipbox/price', Mage::app()->getStore())); //unserializing the shipping rates from the shipping rate table
|
140 |
+
}
|
141 |
+
|
142 |
+
$rates = array();
|
143 |
+
if ($pickupShippingRates) {
|
144 |
+
|
145 |
+
foreach ($pickupShippingRates as $pickupShippingRate) {
|
146 |
+
if ($pickupShippingRate['orderminprice'] <= $orderPrice && $pickupShippingRate['ordermaxprice'] >= $orderPrice && $pickupShippingRate['orderminweight'] <= $orderWeight && $pickupShippingRate['ordermaxweight'] >= $orderWeight) { //if weight and price is correct
|
147 |
+
$rates[] = $pickupShippingRate['pickupshippingfee']; //add rate to array of rates
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
$cheapestexpensive = Mage::getStoreConfig('carriers/smartsendswipbox/cheapestexpensive', Mage::app()->getStore()); //get the 'Cheapest or most expensive' setting from the admin system config
|
152 |
+
if (!$cheapestexpensive) {
|
153 |
+
$cheapestexpensive = 0; //default is the cheapest
|
154 |
+
}
|
155 |
+
|
156 |
+
if (!empty($rates)) { //if at least one rate matches the order
|
157 |
+
if ($cheapestexpensive == 0) {
|
158 |
+
return min($rates); //return min price
|
159 |
+
} elseif ($cheapestexpensive == 1) {
|
160 |
+
return max($rates); //return max price
|
161 |
+
}
|
162 |
+
} else {
|
163 |
+
return false;
|
164 |
+
}
|
165 |
+
} else {
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Gls.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Gls.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_GLS extends Mage_Core_Model_Abstract {
|
28 |
+
|
29 |
+
public function _construct() {
|
30 |
+
parent::_construct();
|
31 |
+
$this->_init('logistics/gls');
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Bring.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Bring.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Bring extends Mage_Core_Model_Mysql4_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
// Note that the pickup_id refers to the key field in your database table.
|
32 |
+
$this->_init('logistics/bring', 'id');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Bring/Collection.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Bring/Collection.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Bring_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('logistics/bring');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Gls.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Gls.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Gls extends Mage_Core_Model_Mysql4_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
// Note that the pickup_id refers to the key field in your database table.
|
32 |
+
$this->_init('logistics/gls', 'id');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Gls/Collection.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Gls/Collection.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Gls_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('logistics/gls');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Pickup.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Pickup.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Pickup extends Mage_Core_Model_Mysql4_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
// Note that the pickup_id refers to the key field in your database table.
|
32 |
+
$this->_init('logistics/pickup', 'id');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Pickup/Collection.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartsend_Logistics
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.smartsend.dk
|
18 |
+
*
|
19 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Pickup/Collection.php
|
20 |
+
* @category Smartsend
|
21 |
+
* @package Smartsend_Logistics
|
22 |
+
* @author Anders Bilfeldt
|
23 |
+
* @url www.smartsend.dk
|
24 |
+
*/
|
25 |
+
|
26 |
+
class Smartsend_Logistics_Model_Mysql4_Pickup_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
27 |
+
{
|
28 |
+
public function _construct()
|
29 |
+
{
|
30 |
+
parent::_construct();
|
31 |
+
$this->_init('logistics/pickup');
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Postdanmark.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Postdanmark.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Postdanmark extends Mage_Core_Model_Mysql4_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
// Note that the pickup_id refers to the key field in your database table.
|
32 |
+
$this->_init('logistics/postdanmark', 'id');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Postdanmark/Collection.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Postdanmark/Collection.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Postdanmark_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('logistics/postdanmark');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Posten.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/posten.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Posten extends Mage_Core_Model_Mysql4_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
// Note that the pickup_id refers to the key field in your database table.
|
32 |
+
$this->_init('logistics/posten', 'id');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Posten/Collection.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/posten/Collection.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Posten_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('logistics/posten');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Swipbox.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Swipbox.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Swipbox extends Mage_Core_Model_Mysql4_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
// Note that the pickup_id refers to the key field in your database table.
|
32 |
+
$this->_init('logistics/swipbox', 'id');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Mysql4/Swipbox/Collection.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Mysql4/Swipbox/Collection.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Mysql4_Swipbox_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
28 |
+
{
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('logistics/swipbox');
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Observer.php
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Observer.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Observer extends Varien_Object {
|
27 |
+
|
28 |
+
public function saveShippingMethod($evt) { //saving shipping method
|
29 |
+
$request = $evt->getRequest();
|
30 |
+
$quote = $evt->getQuote();
|
31 |
+
$shippingMethod = $quote->getShippingAddress()->getShippingMethod(); //getting shipping method
|
32 |
+
|
33 |
+
$pickup_t = $request->getParam('shipping_pickup', false);
|
34 |
+
if ($shippingMethod == 'smartsendswipbox_pickup') {
|
35 |
+
$pickup['store'] = $pickup_t['store']['smartsendswipbox_pickup'];
|
36 |
+
} elseif ($shippingMethod == 'smartsendpostdanmark_pickup') {
|
37 |
+
$pickup['store'] = $pickup_t['store']['smartsendpostdanmark_pickup'];
|
38 |
+
} elseif ($shippingMethod == 'smartsendposten_pickup') {
|
39 |
+
$pickup['store'] = $pickup_t['store']['smartsendposten_pickup'];
|
40 |
+
} elseif ($shippingMethod == 'smartsendgls_pickup') {
|
41 |
+
$pickup['store'] = $pickup_t['store']['smartsendgls_pickup'];
|
42 |
+
} elseif ($shippingMethod == 'smartsendbring_pickup') {
|
43 |
+
$pickup['store'] = $pickup_t['store']['smartsendbring_pickup'];
|
44 |
+
} elseif ($shippingMethod == 'smartsendpickup_pickup') {
|
45 |
+
$pickup['store'] = $pickup_t['store']['smartsendpickup_pickup'];
|
46 |
+
}
|
47 |
+
|
48 |
+
$quote_id = $quote->getId();
|
49 |
+
$data = array($quote_id => $pickup);
|
50 |
+
|
51 |
+
if ($pickup) {
|
52 |
+
Mage::getSingleton('checkout/session')->setPickup($data); //setting pickup
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
public function saveOrderAfter($evt) {
|
57 |
+
$order = $evt->getOrder(); //getting order
|
58 |
+
$quote = $evt->getQuote();
|
59 |
+
$quote_id = $quote->getId();
|
60 |
+
$pickup = Mage::getSingleton('checkout/session')->getPickup(); //getting picup
|
61 |
+
$shippingMethod = $quote->getShippingAddress()->getShippingMethod(); //getting shipping method
|
62 |
+
|
63 |
+
if (isset($pickup[$quote_id])) {
|
64 |
+
|
65 |
+
$temp = $pickup[$quote_id];
|
66 |
+
$store = unserialize($temp['store']);
|
67 |
+
if ($shippingMethod == 'smartsendswipbox_pickup') {
|
68 |
+
$pickupModel = Mage::getModel('logistics/swipbox');
|
69 |
+
$data['pick_up_id'] = $store['pick_up_id'];
|
70 |
+
} elseif ($shippingMethod == 'smartsendpostdanmark_pickup') {
|
71 |
+
$pickupModel = Mage::getModel('logistics/postdanmark');
|
72 |
+
$data['pick_up_id'] = $store['pick_up_id'];
|
73 |
+
} elseif ($shippingMethod == 'smartsendposten_pickup') {
|
74 |
+
$pickupModel = Mage::getModel('logistics/posten');
|
75 |
+
$data['pick_up_id'] = $store['pick_up_id'];
|
76 |
+
} elseif ($shippingMethod == 'smartsendgls_pickup') {
|
77 |
+
$pickupModel = Mage::getModel('logistics/gls');
|
78 |
+
$data['pick_up_id'] = $store['pick_up_id'];
|
79 |
+
} elseif ($shippingMethod == 'smartsendbring_pickup') {
|
80 |
+
$pickupModel = Mage::getModel('logistics/bring');
|
81 |
+
$data['pick_up_id'] = $store['pick_up_id'];
|
82 |
+
} elseif ($shippingMethod == 'smartsendpickup_pickup') {
|
83 |
+
$pickupModel = Mage::getModel('logistics/pickup');
|
84 |
+
$data['pick_up_id'] = $store['pick_up_id'];
|
85 |
+
}
|
86 |
+
|
87 |
+
$data['store'] = Mage::app()->getStore()->getFrontendName();
|
88 |
+
$data['company'] = $store['company'];
|
89 |
+
$data['street'] = $store['street'];
|
90 |
+
$data['city'] = $store['city'];
|
91 |
+
$data['zip'] = $store['zipcode'];
|
92 |
+
$data['country'] = $store['country'];
|
93 |
+
$data['carrier'] = $store['shippingMethod'];
|
94 |
+
$data['order_id'] = $order->getId();
|
95 |
+
|
96 |
+
if (isset($pickupModel)) {
|
97 |
+
$pickupModel->setData($data);
|
98 |
+
$pickupModel->save();
|
99 |
+
}
|
100 |
+
} elseif(strstr($shippingMethod,"smartsend")!="") {
|
101 |
+
|
102 |
+
$carrier_name=explode("_",$shippingMethod);
|
103 |
+
$carrier = substr($carrier_name[0], 9);
|
104 |
+
|
105 |
+
$pickupModel = Mage::getModel('logistics/'.$carrier);
|
106 |
+
$data['carrier'] = ucfirst($carrier);
|
107 |
+
$data['pick_up_id'] = '000';
|
108 |
+
|
109 |
+
$data['store'] = Mage::app()->getStore()->getFrontendName();
|
110 |
+
$data['company'] = '';
|
111 |
+
$data['street'] = '';
|
112 |
+
$data['city'] = '';
|
113 |
+
$data['zip'] = '';
|
114 |
+
$data['country'] = 'DK';
|
115 |
+
$data['order_id'] = $order->getId();
|
116 |
+
|
117 |
+
if (isset($pickupModel)) {
|
118 |
+
$pickupModel->setData($data);
|
119 |
+
$pickupModel->save();
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
public function loadOrderAfter($evt) {
|
125 |
+
$order = $evt->getOrder();
|
126 |
+
if ($order->getId()) {
|
127 |
+
$order_id = $order->getId();
|
128 |
+
$pickupCollection = Mage::getModel('logistics/pickup')->getCollection(); //get pickup collection from the pickup table
|
129 |
+
$pickupCollection->addFieldToFilter('order_id', $order_id);
|
130 |
+
$pickup = $pickupCollection->getFirstItem();
|
131 |
+
$order->setPickupObject($pickup);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
public function loadQuoteAfter($evt) {
|
136 |
+
$quote = $evt->getQuote();
|
137 |
+
if ($quote->getId()) {
|
138 |
+
$data = $quote->getData();
|
139 |
+
|
140 |
+
$weight = 0;
|
141 |
+
foreach ($quote->getAllItems() as $item) {
|
142 |
+
$product = $item->getProduct();
|
143 |
+
if ($product->getTypeId() == 'simple') {
|
144 |
+
$weight = $weight + $product->getWeight() * $product->getStockItem()->getOrderedItems(); //calculating total weight of the ordered items
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
Mage::unregister('ordsubtotal');
|
149 |
+
Mage::unregister('ordweight');
|
150 |
+
|
151 |
+
Mage::register('ordsubtotal', $data['subtotal']);
|
152 |
+
Mage::register('ordweight', $weight);
|
153 |
+
|
154 |
+
$quote_id = $quote->getId();
|
155 |
+
$pickup = Mage::getSingleton('checkout/session')->getPickup();
|
156 |
+
if (isset($pickup[$quote_id])) {
|
157 |
+
$data = $pickup[$quote_id];
|
158 |
+
$quote->setPickupData($data);
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
/* Used to add a button to the top menu of the order_view_info page */
|
164 |
+
public function adminhtmlWidgetContainerHtmlBefore($event) {
|
165 |
+
$block = $event->getBlock();
|
166 |
+
|
167 |
+
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
|
168 |
+
$message = Mage::helper('sales')->__('Are you sure you want to do this?');
|
169 |
+
$block->addButton('generate_label', array(
|
170 |
+
'label' => Mage::helper('sales')->__('Generate label'),
|
171 |
+
'onclick' => "setLocation('{$block->getUrl('logistics/logistics/label')}')",//if message use: "confirmSetLocation('{$message}', '{$block->getUrl('*/yourmodule/crazy')}')",
|
172 |
+
'class' => 'go'
|
173 |
+
));
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
/* Used to add a mass action to the sales order grid */
|
178 |
+
public function addMassAction($event) {
|
179 |
+
$block = $event->getEvent()->getBlock();
|
180 |
+
if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
|
181 |
+
&& $block->getRequest()->getControllerName() == 'sales_order')
|
182 |
+
{
|
183 |
+
// Add 'generate label' action
|
184 |
+
$block->addItem('mass_generate_label', array(
|
185 |
+
'label' => Mage::helper('sales')->__('Generate label'),
|
186 |
+
'url' => $block->getUrl('logistics/logistics/labelMass')
|
187 |
+
));
|
188 |
+
|
189 |
+
// Add 'generate return label' action
|
190 |
+
$block->addItem('mass_generate_return_label', array(
|
191 |
+
'label' => Mage::helper('sales')->__('Generate return label'),
|
192 |
+
'url' => $block->getUrl('logistics/logistics/labelreturnMass')
|
193 |
+
));
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Order.php
ADDED
@@ -0,0 +1,1622 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Order.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Smartsend_Logistics_Model_Order extends Mage_Core_Model_Abstract {
|
29 |
+
|
30 |
+
/* This class is called by using the code:
|
31 |
+
|
32 |
+
$order = new Smartsend_Logistics_Order();
|
33 |
+
$order->setOrderObject($order_object);
|
34 |
+
$order->setReturn(true);
|
35 |
+
try{
|
36 |
+
$order->setInfo();
|
37 |
+
$order->setReceiver();
|
38 |
+
$order->setSender();
|
39 |
+
$order->setAgent();
|
40 |
+
$order->setService();
|
41 |
+
$order->setParcels();
|
42 |
+
|
43 |
+
//All done. Add to request.
|
44 |
+
$request_array[] = $order->getFinalOrder();
|
45 |
+
} catch (Exception $e) {
|
46 |
+
echo 'Caught exception: ', $e->getMessage(), "\n";
|
47 |
+
}
|
48 |
+
|
49 |
+
*/
|
50 |
+
|
51 |
+
private $_order;
|
52 |
+
private $_info;
|
53 |
+
private $_receiver;
|
54 |
+
private $_sender;
|
55 |
+
private $_agent;
|
56 |
+
private $_service;
|
57 |
+
private $_parcels = array();
|
58 |
+
private $_return = false;
|
59 |
+
private $_test = false;
|
60 |
+
private $_cms = 'magento';
|
61 |
+
|
62 |
+
public function _construct() {}
|
63 |
+
|
64 |
+
/**
|
65 |
+
*
|
66 |
+
* Set the order object
|
67 |
+
*/
|
68 |
+
public function setOrderObject($order_object) {
|
69 |
+
$this->_order = $order_object;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
*
|
74 |
+
* Set wheter or not the label is a return label
|
75 |
+
*/
|
76 |
+
public function setReturn($return=false) {
|
77 |
+
$this->_return = $return;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
*
|
82 |
+
* Construct the order array that is used to create the final JSON request.
|
83 |
+
* @return array
|
84 |
+
*/
|
85 |
+
public function getFinalOrder() {
|
86 |
+
return array_merge($this->_info,array(
|
87 |
+
'receiver' => $this->_receiver,
|
88 |
+
'sender' => $this->_sender,
|
89 |
+
'agent' => $this->_agent,
|
90 |
+
'service' => $this->_service,
|
91 |
+
'parcels' => $this->_parcels
|
92 |
+
));
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
/*****************************************************************************************
|
97 |
+
* Functions to return true/false for different statements
|
98 |
+
****************************************************************************************/
|
99 |
+
|
100 |
+
/**
|
101 |
+
*
|
102 |
+
* Check if order is placed by a SmartSend or a vConnect shipping method
|
103 |
+
* @return boolean
|
104 |
+
*/
|
105 |
+
private function isSmartsendOrVConnect() {
|
106 |
+
|
107 |
+
if($this->isSmartsend() == true) {
|
108 |
+
return true;
|
109 |
+
} elseif($this->isVconnect() == true) {
|
110 |
+
return true;
|
111 |
+
} else {
|
112 |
+
return false;
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
*
|
118 |
+
* Check if order is a pickup shipping method from SmartSend or vConnect
|
119 |
+
* @return boolean
|
120 |
+
*/
|
121 |
+
private function isPickup() {
|
122 |
+
|
123 |
+
if($this->isPickupSmartsend() == true) {
|
124 |
+
return true;
|
125 |
+
} elseif($this->isPickupVconnect() == true) {
|
126 |
+
return true;
|
127 |
+
} else {
|
128 |
+
return false;
|
129 |
+
}
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
*
|
135 |
+
* Check if the label is a return label for the order
|
136 |
+
* @return boolean
|
137 |
+
*/
|
138 |
+
private function isReturn() {
|
139 |
+
return $this->_return;
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/*****************************************************************************************
|
144 |
+
* Functions to get pickup data, carrier data, carrier settings
|
145 |
+
****************************************************************************************/
|
146 |
+
|
147 |
+
/**
|
148 |
+
*
|
149 |
+
* Check if order is placed by a SmartSend shipping method
|
150 |
+
* @return boolean
|
151 |
+
*/
|
152 |
+
private function isSmartsend() {
|
153 |
+
|
154 |
+
$method = strtolower($this->getShippingCarrierId());
|
155 |
+
|
156 |
+
//Check if shipping methode starts with 'smartsend'
|
157 |
+
if(substr($method, 0, strlen('smartsend')) === 'smartsend') {
|
158 |
+
return true;
|
159 |
+
} else {
|
160 |
+
return false;
|
161 |
+
}
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
*
|
167 |
+
* Check if order is placed by a vConnect shipping method
|
168 |
+
* @return boolean
|
169 |
+
*/
|
170 |
+
private function isVconnect() {
|
171 |
+
|
172 |
+
$method = strtolower($this->getShippingCarrierId());
|
173 |
+
|
174 |
+
//Check if shipping methode starts with 'vconnect' or 'vc'
|
175 |
+
if(substr($method, 0, strlen('vconnect')) === 'vconnect') {
|
176 |
+
return true;
|
177 |
+
} elseif(substr($method, 0, strlen('vc')) === 'vc') {
|
178 |
+
return true;
|
179 |
+
} else {
|
180 |
+
return false;
|
181 |
+
}
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
*
|
187 |
+
* Check if order is a pickup shipping method from SmartSend
|
188 |
+
* @return boolean
|
189 |
+
*/
|
190 |
+
private function isPickupSmartsend() {
|
191 |
+
|
192 |
+
if($this->isSmartsend() == true) {
|
193 |
+
$method = $this->getShippingMethod();
|
194 |
+
|
195 |
+
//Check if shipping methode ends with 'pickup'
|
196 |
+
if(substr($method, -strlen('pickup')) === 'pickup') {
|
197 |
+
return true;
|
198 |
+
} else {
|
199 |
+
return false;
|
200 |
+
}
|
201 |
+
} else {
|
202 |
+
return false;
|
203 |
+
}
|
204 |
+
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
*
|
209 |
+
* Check if order is a pickup shipping method from vConnect
|
210 |
+
* @return boolean
|
211 |
+
*/
|
212 |
+
private function isPickupVconnect() {
|
213 |
+
|
214 |
+
if($this->isVconnect() == true) {
|
215 |
+
$method = $this->getShippingMethod();
|
216 |
+
|
217 |
+
//Check if shipping methode ends with 'pickup'
|
218 |
+
if(substr($method, -strlen('pickup')) === 'pickup') {
|
219 |
+
return true;
|
220 |
+
} else {
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
} else {
|
224 |
+
return false;
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
*
|
230 |
+
* Get pickup id of delivery point
|
231 |
+
* @return string
|
232 |
+
*/
|
233 |
+
private function getPickupId() {
|
234 |
+
|
235 |
+
$pickupdata = $this->getPickupData();
|
236 |
+
return (isset($pickupdata['id']) ? $pickupdata['id'] : null);
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
*
|
242 |
+
* Get pickup data for delivery point
|
243 |
+
* @return array
|
244 |
+
*/
|
245 |
+
private function getPickupData() {
|
246 |
+
|
247 |
+
if($this->isPickupSmartsend() == true) {
|
248 |
+
return $this->getPickupDataSmartsend();
|
249 |
+
} elseif($this->isPickupVconnect() == true) {
|
250 |
+
return $this->getPickupDataVconnect();
|
251 |
+
} else {
|
252 |
+
throw new Exception( "Trying to access pickup data for an order that is not a pickup point order." );
|
253 |
+
}
|
254 |
+
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
*
|
259 |
+
* Get pickup data for a vConnect delivery point
|
260 |
+
* @return array
|
261 |
+
*/
|
262 |
+
private function getPickupDataVconnect() {
|
263 |
+
|
264 |
+
$billing_address = $this->getShippingAddress();
|
265 |
+
|
266 |
+
$pacsoftServicePoint = str_replace(' ', '', $billing_address['address2']); //remove spaces
|
267 |
+
$pacsoftServicePointArray = explode(":",$pacsoftServicePoint); //devide into a array by :
|
268 |
+
|
269 |
+
if ( isset($pacsoftServicePointArray) && ( strtolower($pacsoftServicePointArray[0]) == strtolower('ServicePointID') ) || strtolower($pacsoftServicePointArray[0]) == strtolower('Pakkeshop') ){
|
270 |
+
$pickupData = array(
|
271 |
+
'id' => $pacsoftServicePointArray[1]."-".time()."-".rand(9999,10000),
|
272 |
+
'agentno' => $pacsoftServicePointArray[1],
|
273 |
+
'agenttype' => ($this->getShippingCarrier() == 'postdanmark' ? 'PDK' : null),
|
274 |
+
'company' => $billing_address['company'],
|
275 |
+
'name1' => $billing_address['name1'],
|
276 |
+
'name2' => $billing_address['name2'],
|
277 |
+
'address1' => $billing_address['address1'],
|
278 |
+
'address2' => null,
|
279 |
+
'city' => $billing_address['city'],
|
280 |
+
'zip' => $billing_address['zip'],
|
281 |
+
'country' => $billing_address['country'],
|
282 |
+
'sms' => null,
|
283 |
+
'mail' => null,
|
284 |
+
);
|
285 |
+
|
286 |
+
return $pickupData;
|
287 |
+
|
288 |
+
} else {
|
289 |
+
return null;
|
290 |
+
}
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
*
|
296 |
+
* Get carrier formatted without 'smartsend'
|
297 |
+
* @return string
|
298 |
+
*/
|
299 |
+
public function formatCarrier($carrier,$format=0) {
|
300 |
+
|
301 |
+
if($format != 0 && $format != 1 && $format != 2 && $format != 3 && $format != 4 ) {
|
302 |
+
//Change this code for each CMS system
|
303 |
+
throw new Exception('Unknown format for carrier formatting.');
|
304 |
+
}
|
305 |
+
|
306 |
+
$carrier_lowcase = strtolower($carrier);
|
307 |
+
|
308 |
+
switch ($carrier_lowcase) {
|
309 |
+
case 'postdanmark':
|
310 |
+
if($format == 0) {
|
311 |
+
return 'Postdanmark';
|
312 |
+
} elseif($format == 1) {
|
313 |
+
return 'postdanmark';
|
314 |
+
} elseif($format == 2) {
|
315 |
+
return 'PostDanmark';
|
316 |
+
} elseif($format == 3) {
|
317 |
+
return 'Post Danmark';
|
318 |
+
} elseif($format == 4) {
|
319 |
+
return 'smartsendpostdanmark';
|
320 |
+
}
|
321 |
+
break;
|
322 |
+
case 'posten':
|
323 |
+
if($format == 0) {
|
324 |
+
return 'Posten';
|
325 |
+
} elseif($format == 1) {
|
326 |
+
return 'posten';
|
327 |
+
} elseif($format == 2) {
|
328 |
+
return 'Posten';
|
329 |
+
} elseif($format == 3) {
|
330 |
+
return 'Posten';
|
331 |
+
} elseif($format == 4) {
|
332 |
+
return 'smartsendposten';
|
333 |
+
}
|
334 |
+
break;
|
335 |
+
case 'gls':
|
336 |
+
if($format == 0) {
|
337 |
+
return 'Gls';
|
338 |
+
} elseif($format == 1) {
|
339 |
+
return 'gls';
|
340 |
+
} elseif($format == 2) {
|
341 |
+
return 'GLS';
|
342 |
+
} elseif($format == 3) {
|
343 |
+
return 'GLS';
|
344 |
+
} elseif($format == 4) {
|
345 |
+
return 'smartsendgls';
|
346 |
+
}
|
347 |
+
break;
|
348 |
+
case 'bring':
|
349 |
+
if($format == 0) {
|
350 |
+
return 'Bring';
|
351 |
+
} elseif($format == 1) {
|
352 |
+
return 'bring';
|
353 |
+
} elseif($format == 2) {
|
354 |
+
return 'Bring';
|
355 |
+
} elseif($format == 3) {
|
356 |
+
return 'Bring';
|
357 |
+
} elseif($format == 4) {
|
358 |
+
return 'smartsendbring';
|
359 |
+
}
|
360 |
+
break;
|
361 |
+
default:
|
362 |
+
//Change this code for each CMS system
|
363 |
+
throw new Exception('Unable to determine carrier for formatting.');
|
364 |
+
}
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
*
|
370 |
+
* Get data about 0: shipping carrier, 1: shipping method, 2: shipping name/id, 3: Carrier raw
|
371 |
+
* Magento example
|
372 |
+
* 0: gls, 1: pickup, 2: smartsendpostdanmark_pickup, 3: smartsendpostdanmark
|
373 |
+
* @return array
|
374 |
+
*/
|
375 |
+
private function renameShipping($shipping_id) {
|
376 |
+
|
377 |
+
$shipping_id = strtolower($shipping_id);
|
378 |
+
$carrier_raw = null;
|
379 |
+
|
380 |
+
// Carrier
|
381 |
+
if(substr($shipping_id, 0, strlen('smartsendpickup')) === 'smartsendpickup' || substr($shipping_id, 0, strlen('smartsend_pickup')) === 'smartsend_pickup') {
|
382 |
+
$carrier = $this->getPickupCarrier();
|
383 |
+
if($carrier == '') {
|
384 |
+
throw new Exception("Unable to determine carrier for pickup shipping method");
|
385 |
+
}
|
386 |
+
$carrier_raw = $this->formatCarrier($carrier,4);
|
387 |
+
} elseif(substr($shipping_id, 0, strlen('smartsendbring')) === 'smartsendbring' || substr($shipping_id, 0, strlen('smartsend_bring')) === 'smartsend_bring') {
|
388 |
+
$carrier = 'bring';
|
389 |
+
$carrier_raw = 'smartsendbring';
|
390 |
+
} elseif(substr($shipping_id, 0, strlen('smartsendgls')) === 'smartsendgls' || substr($shipping_id, 0, strlen('smartsend_gls')) === 'smartsend_gls') {
|
391 |
+
$carrier = 'gls';
|
392 |
+
$carrier_raw = 'smartsendgls';
|
393 |
+
} elseif(substr($shipping_id, 0, strlen('smartsendpostdanmark')) === 'smartsendpostdanmark' || substr($shipping_id, 0, strlen('smartsend_postdanmark')) === 'smartsend_postdanmark') {
|
394 |
+
$carrier = 'postdanmark';
|
395 |
+
$carrier_raw = 'smartsendpostdanmark';
|
396 |
+
} elseif(substr($shipping_id, 0, strlen('smartsendposten')) === 'smartsendposten' || substr($shipping_id, 0, strlen('smartsend_posten')) === 'smartsend_posten') {
|
397 |
+
$carrier = 'posten';
|
398 |
+
$carrier_raw = 'smartsendposten';
|
399 |
+
} elseif(substr($shipping_id, 0, strlen('vconnect_postnord')) === 'vconnect_postnord' || substr($shipping_id, 0, strlen('vc_postnord')) === 'vc_postnord') {
|
400 |
+
$carrier = 'postdanmark';
|
401 |
+
$carrier_raw = 'vconnectpostdanmark';
|
402 |
+
} elseif(substr($shipping_id, 0, strlen('vconnect_postdanmark')) === 'vconnect_postdanmark' || substr($shipping_id, 0, strlen('vc_postdanmark')) === 'vc_postdanmark') {
|
403 |
+
$carrier = 'postdanmark';
|
404 |
+
$carrier_raw = 'vconnectpostdanmark';
|
405 |
+
} elseif(substr($shipping_id, 0, strlen('vconnect_posten')) === 'vconnect_posten' || substr($shipping_id, 0, strlen('vc_posten')) === 'vc_posten') {
|
406 |
+
$carrier = 'posten';
|
407 |
+
$carrier_raw = 'vconnectposten';
|
408 |
+
} elseif(substr($shipping_id, 0, strlen('vconnect_gls')) === 'vconnect_gls' || substr($shipping_id, 0, strlen('vc_gls')) === 'vc_gls') {
|
409 |
+
$carrier = 'gls';
|
410 |
+
$carrier_raw = 'vconnectgls';
|
411 |
+
} elseif(substr($shipping_id, 0, strlen('vconnect_bring')) === 'vconnect_bring' || substr($shipping_id, 0, strlen('vc_bring')) === 'vc_bring') {
|
412 |
+
$carrier = 'bring';
|
413 |
+
$carrier_raw = 'vconnectbring';
|
414 |
+
} else {
|
415 |
+
throw new Exception( "Unsupported carrier: " .$shipping_id );
|
416 |
+
}
|
417 |
+
|
418 |
+
// Method
|
419 |
+
if(substr($shipping_id, -strlen('pickup')) === 'pickup') {
|
420 |
+
$method = 'pickup';
|
421 |
+
} elseif(substr($shipping_id, -strlen('private')) === 'private') {
|
422 |
+
$method = 'private';
|
423 |
+
} elseif(substr($shipping_id, -strlen('privatehome')) === 'privatehome') {
|
424 |
+
$method = 'privatehome';
|
425 |
+
} elseif(substr($shipping_id, -strlen('commercial')) === 'commercial') {
|
426 |
+
$method = 'commercial';
|
427 |
+
} elseif(substr($shipping_id, -strlen('express')) === 'express') {
|
428 |
+
$method = 'express';
|
429 |
+
} elseif(substr($shipping_id, -strlen('privatesamsending')) === 'privatesamsending') {
|
430 |
+
$method = 'privatesamsending';
|
431 |
+
} elseif(substr($shipping_id, -strlen('privatepriority')) === 'privatepriority') {
|
432 |
+
$method = 'privatepriority';
|
433 |
+
} elseif(substr($shipping_id, -strlen('privateeconomy')) === 'privateeconomy') {
|
434 |
+
$method = 'privateeconomy';
|
435 |
+
} elseif(substr($shipping_id, -strlen('dpdclassic')) === 'dpdclassic') {
|
436 |
+
$method = 'dpdclassic';
|
437 |
+
} elseif(substr($shipping_id, -strlen('dpdguarantee')) === 'dpdguarantee') {
|
438 |
+
$method = 'dpdguarantee';
|
439 |
+
} elseif(substr($shipping_id, -strlen('valuemail')) === 'valuemail') {
|
440 |
+
$method = 'valuemail';
|
441 |
+
} elseif(substr($shipping_id, -strlen('valuemailfirstclass')) === 'valuemailfirstclass') {
|
442 |
+
$method = 'valuemailfirstclass';
|
443 |
+
} elseif(substr($shipping_id, -strlen('valuemaileconomy')) === 'valuemaileconomy') {
|
444 |
+
$method = 'valuemaileconomy';
|
445 |
+
} elseif(substr($shipping_id, -strlen('maximail')) === 'maximail') {
|
446 |
+
$method = 'maximail';
|
447 |
+
} elseif(substr($shipping_id, -strlen('private_bulksplit')) === 'private_bulksplit') {
|
448 |
+
$method = 'private_bulksplit';
|
449 |
+
} elseif(substr($shipping_id, -strlen('privatehome_bulksplit')) === 'privatehome_bulksplit') {
|
450 |
+
$method = 'privatehome_bulksplit';
|
451 |
+
} elseif(substr($shipping_id, -strlen('commercial_bulksplit')) === 'commercial_bulksplit') {
|
452 |
+
$method = 'commercial_bulksplit';
|
453 |
+
} elseif(substr($shipping_id, -strlen('bestway')) === 'bestway') {
|
454 |
+
$method = 'pickup';
|
455 |
+
} elseif(substr($shipping_id, -strlen('postdanmark')) === 'postdanmark') {
|
456 |
+
$method = 'pickup';
|
457 |
+
} elseif(substr($shipping_id, -strlen('posten')) === 'posten') {
|
458 |
+
$method = 'pickup';
|
459 |
+
} elseif(substr($shipping_id, -strlen('postnord')) === 'postnord') {
|
460 |
+
$method = 'pickup';
|
461 |
+
} elseif(substr($shipping_id, -strlen('bring')) === 'bring') {
|
462 |
+
$method = 'pickup';
|
463 |
+
} elseif(substr($shipping_id, -strlen('gls')) === 'gls') {
|
464 |
+
$method = 'pickup';
|
465 |
+
} else {
|
466 |
+
throw new Exception('Uanble to determine shipping method.' );
|
467 |
+
}
|
468 |
+
|
469 |
+
return array($carrier,$method,$shipping_id,$carrier_raw);
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
*
|
474 |
+
* Get shipping carrier
|
475 |
+
* Example: 'postdanmark'
|
476 |
+
* @return string
|
477 |
+
*/
|
478 |
+
public function getShippingCarrier() {
|
479 |
+
$shipping_info = $this->getShippingInfo();
|
480 |
+
|
481 |
+
if(isset($shipping_info[0]) && $shipping_info[0] != '') {
|
482 |
+
return $shipping_info[0];
|
483 |
+
} else {
|
484 |
+
//Change this code for each CMS system
|
485 |
+
throw new Exception('Unable to determine shipping carrier.');
|
486 |
+
}
|
487 |
+
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
*
|
492 |
+
* Get shipping method
|
493 |
+
* Example: 'pickup'
|
494 |
+
* @return string
|
495 |
+
*/
|
496 |
+
public function getShippingMethod() {
|
497 |
+
$shipping_info = $this->getShippingInfo();
|
498 |
+
|
499 |
+
if(isset($shipping_info[1]) && $shipping_info[1] != '') {
|
500 |
+
return $shipping_info[1];
|
501 |
+
} else {
|
502 |
+
//Change this code for each CMS system
|
503 |
+
throw new Exception('Unable to determine shipping method.');
|
504 |
+
}
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
*
|
509 |
+
* Get shipping name/id
|
510 |
+
* Example: 'smartsendpostdanmark_pickup'
|
511 |
+
* @return string
|
512 |
+
*/
|
513 |
+
public function getShippingName() {
|
514 |
+
$shipping_info = $this->getShippingInfo();
|
515 |
+
|
516 |
+
if(isset($shipping_info[2]) && $shipping_info[2] != '') {
|
517 |
+
return $shipping_info[2];
|
518 |
+
} else {
|
519 |
+
//Change this code for each CMS system
|
520 |
+
throw new Exception('Unable to determine shipping id.');
|
521 |
+
}
|
522 |
+
|
523 |
+
}
|
524 |
+
|
525 |
+
/**
|
526 |
+
*
|
527 |
+
* Get raw carrier name/id
|
528 |
+
* Example: 'smartsendpostdanmark' or 'vconnectpostdanmark'
|
529 |
+
* @return string
|
530 |
+
*/
|
531 |
+
public function getShippingCarrierId() {
|
532 |
+
$shipping_info = $this->getShippingInfo();
|
533 |
+
|
534 |
+
if(isset($shipping_info[3]) && $shipping_info[3] != '') {
|
535 |
+
return $shipping_info[3];
|
536 |
+
} else {
|
537 |
+
//Change this code for each CMS system
|
538 |
+
throw new Exception('Unable to determine carrier id.');
|
539 |
+
}
|
540 |
+
|
541 |
+
}
|
542 |
+
|
543 |
+
/**
|
544 |
+
*
|
545 |
+
* Get data about 0: shipping carrier, 1: shipping method, 2: shipping name/id, 3: Carrier raw
|
546 |
+
* Magento example
|
547 |
+
* 0: gls, 1: pickup, 2: smartsendpostdanmark_pickup, 3: smartsendpostdanmark
|
548 |
+
* @return array
|
549 |
+
*/
|
550 |
+
private function getShippingInfo() {
|
551 |
+
/* TEST
|
552 |
+
return array('postdanmark','pickup','smartsendpostdanmark_pickup'); */
|
553 |
+
|
554 |
+
$shipping_id = $this->getShippingId();
|
555 |
+
|
556 |
+
$shipping_info = $this->renameShipping($shipping_id);
|
557 |
+
|
558 |
+
if($this->isReturn() == true) {
|
559 |
+
$carrier = $this->formatCarrier($shipping_info[0],1);
|
560 |
+
switch ($carrier) {
|
561 |
+
case 'postdanmark':
|
562 |
+
$settings = $this->getSettingsPostdanmark();
|
563 |
+
$return_shipping_method = $settings['return'];
|
564 |
+
break;
|
565 |
+
case 'posten':
|
566 |
+
$settings = $this->getSettingsPosten();
|
567 |
+
$return_shipping_method = $settings['return'];
|
568 |
+
break;
|
569 |
+
case 'gls':
|
570 |
+
$settings = $this->getSettingsGls();
|
571 |
+
$return_shipping_method = $settings['return'];
|
572 |
+
break;
|
573 |
+
case 'bring':
|
574 |
+
$settings = $this->getSettingsBring();
|
575 |
+
$return_shipping_method = $settings['return'];
|
576 |
+
break;
|
577 |
+
default:
|
578 |
+
//Change this code for each CMS system
|
579 |
+
throw new Exception('Unable to determine shipping method for return.');
|
580 |
+
}
|
581 |
+
|
582 |
+
if($return_shipping_method != '') {
|
583 |
+
$shipping_info = $this->renameShipping($return_shipping_method);
|
584 |
+
}
|
585 |
+
}
|
586 |
+
|
587 |
+
return $shipping_info;
|
588 |
+
|
589 |
+
}
|
590 |
+
|
591 |
+
/**
|
592 |
+
*
|
593 |
+
* Get unique order reference. Constructed from ordernumber, timestamp and a random number
|
594 |
+
* @return string
|
595 |
+
*/
|
596 |
+
private function getOrderReference() {
|
597 |
+
|
598 |
+
return $this->getOrderId()."-".time()."-".rand(9999,10000);
|
599 |
+
|
600 |
+
}
|
601 |
+
|
602 |
+
/**
|
603 |
+
*
|
604 |
+
* Get the settings from the carrier that would be used if this is a normal label.
|
605 |
+
* This is not nessesary the same as the actual carrier if one uses a different carrier
|
606 |
+
* for return labels.
|
607 |
+
* @return array
|
608 |
+
*/
|
609 |
+
private function getSettingsCarrier() {
|
610 |
+
|
611 |
+
$carrier = $this->formatCarrier($this->getShippingCarrier(),1);
|
612 |
+
switch ($carrier) {
|
613 |
+
case 'postdanmark':
|
614 |
+
$settings = $this->getSettingsPostdanmark();
|
615 |
+
break;
|
616 |
+
case 'posten':
|
617 |
+
$settings = $this->getSettingsPosten();
|
618 |
+
break;
|
619 |
+
case 'gls':
|
620 |
+
$settings = $this->getSettingsGls();
|
621 |
+
break;
|
622 |
+
case 'bring':
|
623 |
+
$settings = $this->getSettingsBring();
|
624 |
+
break;
|
625 |
+
default:
|
626 |
+
$settings = null;
|
627 |
+
}
|
628 |
+
|
629 |
+
return $settings;
|
630 |
+
|
631 |
+
}
|
632 |
+
|
633 |
+
/**
|
634 |
+
*
|
635 |
+
* Function to return if waybill id if any
|
636 |
+
* @return string
|
637 |
+
*/
|
638 |
+
private function getWaybill($string,$country) {
|
639 |
+
|
640 |
+
//Devide string into array
|
641 |
+
$array = explode(";", $string);
|
642 |
+
|
643 |
+
//Remove empty fields
|
644 |
+
$array = array_filter($array);
|
645 |
+
|
646 |
+
//Check if there is entries
|
647 |
+
if(!empty($array) || !is_array($array)) {
|
648 |
+
if(strpos($array[0], ',') !== FALSE) {
|
649 |
+
|
650 |
+
$new_array = array();
|
651 |
+
foreach($array as $element) {
|
652 |
+
//Devide string into array
|
653 |
+
$line = explode(",", $element);
|
654 |
+
if(isset($line[0])) {
|
655 |
+
$new_array[$line[0]] = $line[1];
|
656 |
+
}
|
657 |
+
}
|
658 |
+
|
659 |
+
if(isset($new_array[$country])) {
|
660 |
+
return $new_array[$country];
|
661 |
+
} elseif(isset($new_array["*"])) {
|
662 |
+
return $new_array["*"];
|
663 |
+
}
|
664 |
+
} else {
|
665 |
+
//Only one id is entered
|
666 |
+
return $array[0];
|
667 |
+
}
|
668 |
+
} else {
|
669 |
+
return null;
|
670 |
+
}
|
671 |
+
|
672 |
+
}
|
673 |
+
|
674 |
+
|
675 |
+
/*****************************************************************************************
|
676 |
+
* Functions to set order parameters
|
677 |
+
****************************************************************************************/
|
678 |
+
|
679 |
+
/**
|
680 |
+
*
|
681 |
+
* Set the meta data for the order
|
682 |
+
*/
|
683 |
+
public function setInfo() {
|
684 |
+
|
685 |
+
$carrier = $this->formatCarrier($this->getShippingCarrier(),1);
|
686 |
+
$method = $this->getShippingMethod();
|
687 |
+
|
688 |
+
$settings = $this->getSettingsCarrier();
|
689 |
+
$type = (isset($settings['format']) ? $settings['format'] : null);
|
690 |
+
|
691 |
+
$this->_info = array(
|
692 |
+
'orderno' => $this->getOrderId(),
|
693 |
+
'type' => $type,
|
694 |
+
'reference' => $this->getOrderReference(),
|
695 |
+
'carrier' => $carrier,
|
696 |
+
'method' => $method,
|
697 |
+
'return' => $this->isReturn(),
|
698 |
+
'totalprice' => $this->getOrderPriceTotal(),
|
699 |
+
'shipprice' => $this->getOrderPriceShipping(),
|
700 |
+
'currency' => $this->getOrderPriceCurrency(),
|
701 |
+
'test' => $this->_test,
|
702 |
+
);
|
703 |
+
|
704 |
+
}
|
705 |
+
|
706 |
+
/**
|
707 |
+
*
|
708 |
+
* Set the receiver information
|
709 |
+
*/
|
710 |
+
public function setReceiver() {
|
711 |
+
|
712 |
+
if($this->isSmartSend() == true) {
|
713 |
+
$this->_receiver = $this->getShippingAddress();
|
714 |
+
} elseif($this->isVconnect() == true) {
|
715 |
+
$this->_receiver = $this->getBillingAddress();
|
716 |
+
} else {
|
717 |
+
//Change this code for each CMS system
|
718 |
+
throw new Exception('Unable to set receiver');
|
719 |
+
}
|
720 |
+
|
721 |
+
}
|
722 |
+
|
723 |
+
/**
|
724 |
+
*
|
725 |
+
* Set the sender information
|
726 |
+
*/
|
727 |
+
public function setSender() {
|
728 |
+
|
729 |
+
$carrier = $this->formatCarrier($this->getShippingCarrier(),1);
|
730 |
+
|
731 |
+
switch ($carrier) {
|
732 |
+
case 'postdanmark':
|
733 |
+
$settings = $this->getSettingsPostdanmark();
|
734 |
+
$sender = array(
|
735 |
+
'senderid' => (isset($settings['quickid']) ? $settings['quickid'] : null),
|
736 |
+
'company' => null,
|
737 |
+
'name1' => null,
|
738 |
+
'name2' => null,
|
739 |
+
'address1' => null,
|
740 |
+
'address2' => null,
|
741 |
+
'zip' => null,
|
742 |
+
'city' => null,
|
743 |
+
'country' => null,
|
744 |
+
'sms' => null,
|
745 |
+
'mail' => null
|
746 |
+
);
|
747 |
+
break;
|
748 |
+
case 'posten':
|
749 |
+
$settings = $this->getSettingsPosten();
|
750 |
+
$sender = array(
|
751 |
+
'senderid' => (isset($settings['quickid']) ? $settings['quickid'] : null),
|
752 |
+
'company' => null,
|
753 |
+
'name1' => null,
|
754 |
+
'name2' => null,
|
755 |
+
'address1' => null,
|
756 |
+
'address2' => null,
|
757 |
+
'zip' => null,
|
758 |
+
'city' => null,
|
759 |
+
'country' => null,
|
760 |
+
'sms' => null,
|
761 |
+
'mail' => null
|
762 |
+
);
|
763 |
+
break;
|
764 |
+
default:
|
765 |
+
$sender = array(
|
766 |
+
'senderid' => null,
|
767 |
+
'company' => null,
|
768 |
+
'name1' => null,
|
769 |
+
'name2' => null,
|
770 |
+
'address1' => null,
|
771 |
+
'address2' => null,
|
772 |
+
'zip' => null,
|
773 |
+
'city' => null,
|
774 |
+
'country' => null,
|
775 |
+
'sms' => null,
|
776 |
+
'mail' => null
|
777 |
+
);
|
778 |
+
}
|
779 |
+
|
780 |
+
$this->_sender = $sender;
|
781 |
+
|
782 |
+
}
|
783 |
+
|
784 |
+
/**
|
785 |
+
*
|
786 |
+
* Set the agen information
|
787 |
+
*/
|
788 |
+
public function setAgent() {
|
789 |
+
|
790 |
+
if($this->isPickup() == true) {
|
791 |
+
$this->_agent = $this->getPickupData();
|
792 |
+
} else {
|
793 |
+
$this->_agent = null;
|
794 |
+
}
|
795 |
+
|
796 |
+
}
|
797 |
+
|
798 |
+
/**
|
799 |
+
*
|
800 |
+
* Set the services that is used for the order
|
801 |
+
*/
|
802 |
+
public function setService() {
|
803 |
+
|
804 |
+
$settings = $this->getSettingsCarrier();
|
805 |
+
|
806 |
+
$this->_service = array(
|
807 |
+
'notemail' => ($settings['notemail'] == 1 ? $this->_receiver['mail'] : null),
|
808 |
+
'notesms' => ($settings['notesms'] == 1 ? $this->_receiver['sms'] : null),
|
809 |
+
'prenote' => $settings['prenote'],
|
810 |
+
'prenote_from' => $settings['prenote_from'],
|
811 |
+
'prenote_receiver' => ($settings['prenote_receiver'] == '' ? $this->_receiver['mail'] : $settings['prenote_receiver']),
|
812 |
+
'prenote_message' => ($settings['prenote_message'] != '' ? $settings['prenote_message'] : null),
|
813 |
+
'waybillid' => $this->getWaybill($settings['waybillid'],$this->_receiver['country'])
|
814 |
+
);
|
815 |
+
|
816 |
+
}
|
817 |
+
|
818 |
+
/**
|
819 |
+
*
|
820 |
+
* Set the parcels. Each parcel contains items.
|
821 |
+
*/
|
822 |
+
public function setParcels() {
|
823 |
+
|
824 |
+
//Get all shipments for the order
|
825 |
+
$shipments = $this->getShipments();
|
826 |
+
|
827 |
+
if(!empty($shipments)) {
|
828 |
+
//Go through shipments and check for Track & Trace
|
829 |
+
foreach($shipments as $shipment) {
|
830 |
+
if($this->isReturn() == true) {
|
831 |
+
//Add shipment to order object as a parcel
|
832 |
+
$this->addShipment($shipment);
|
833 |
+
} else {
|
834 |
+
if( !$this->getShipmentTrace($shipment) ) {
|
835 |
+
//Add shipment to order object as a parcel
|
836 |
+
$this->addShipment($shipment);
|
837 |
+
}
|
838 |
+
}
|
839 |
+
}
|
840 |
+
|
841 |
+
if(empty($this->_parcels)) {
|
842 |
+
throw new Exception('No parcels without trace code');
|
843 |
+
}
|
844 |
+
} else {
|
845 |
+
if($this->getUnshippedItems() != null) {
|
846 |
+
$this->createShipment();
|
847 |
+
} else {
|
848 |
+
throw new Exception('No unshipped items');
|
849 |
+
}
|
850 |
+
}
|
851 |
+
|
852 |
+
if(empty($this->_parcels)) {
|
853 |
+
throw new Exception('No parcels to ship');
|
854 |
+
}
|
855 |
+
|
856 |
+
}
|
857 |
+
|
858 |
+
|
859 |
+
/*****************************************************************************************
|
860 |
+
* CMS dependent functions
|
861 |
+
****************************************************************************************/
|
862 |
+
|
863 |
+
/**
|
864 |
+
*
|
865 |
+
* Get shipping name/id
|
866 |
+
* @return string
|
867 |
+
*/
|
868 |
+
public function getShippingId() {
|
869 |
+
|
870 |
+
/* WooCommerce start */
|
871 |
+
if($this->_cms == 'woocommerce') {
|
872 |
+
$line_items_shipping = $this->_order->get_items( 'shipping' );
|
873 |
+
|
874 |
+
if(!empty($line_items_shipping)){
|
875 |
+
foreach ( $line_items_shipping as $item_id => $item ) {
|
876 |
+
if( !empty($item['name']) ) {
|
877 |
+
$shipMethod = esc_html( $item['name'] );
|
878 |
+
}
|
879 |
+
if( !empty($item['method_id']) ) {
|
880 |
+
$shipMethod_id = esc_html( $item['method_id'] );
|
881 |
+
}
|
882 |
+
}
|
883 |
+
}
|
884 |
+
|
885 |
+
return $shipMethod_id; //return unique id of shipping method
|
886 |
+
} /* WooCommerce end */
|
887 |
+
|
888 |
+
/* Magento start */
|
889 |
+
if($this->_cms == 'magento') {
|
890 |
+
$shipMethod_id = $this->_order->getShippingMethod();
|
891 |
+
|
892 |
+
return $shipMethod_id; //return unique id of shipping method
|
893 |
+
} /* Magento end */
|
894 |
+
|
895 |
+
}
|
896 |
+
|
897 |
+
/**
|
898 |
+
*
|
899 |
+
* Get carrier name based on the pickup information.
|
900 |
+
* Used if the shipping method is 'closest pickup point'
|
901 |
+
* @return string
|
902 |
+
*/
|
903 |
+
private function getPickupCarrier() {
|
904 |
+
|
905 |
+
/* WooCommerce start */
|
906 |
+
if($this->_cms == 'woocommerce') {
|
907 |
+
$store_pickup = get_post_custom($order->id);
|
908 |
+
$store_pickup = @unserialize($store_pickup['store_pickup'][0]);
|
909 |
+
if(!is_array($store_pickup)) $store_pickup = unserialize($store_pickup);
|
910 |
+
|
911 |
+
if(!empty($store_pickup) && isset($store_pickup['carrier'])){
|
912 |
+
return $store_pickup['carrier'];
|
913 |
+
} else {
|
914 |
+
return null;
|
915 |
+
}
|
916 |
+
} /* WooCommerce end */
|
917 |
+
|
918 |
+
/* Magento start */
|
919 |
+
if($this->_cms == 'magento') {
|
920 |
+
$pickupModel = Mage::getModel('logistics/pickup');
|
921 |
+
$pickupData = $pickupModel->getCollection()->addFieldToFilter('order_id', $this->_order->getOrderId() )->getFirstItem(); //pickup data
|
922 |
+
if ($pickupData->getData()) {
|
923 |
+
$carrier = $pickupData->getCarrier();
|
924 |
+
} else {
|
925 |
+
$carrier = null;
|
926 |
+
}
|
927 |
+
} /* Magento end */
|
928 |
+
|
929 |
+
}
|
930 |
+
|
931 |
+
/**
|
932 |
+
*
|
933 |
+
* Get the order id
|
934 |
+
* @return string
|
935 |
+
*/
|
936 |
+
private function getOrderId() {
|
937 |
+
|
938 |
+
/* WooCommerce start */
|
939 |
+
if($this->_cms == 'woocommerce') {
|
940 |
+
return $this->_order->id;
|
941 |
+
} /* WooCommerce end */
|
942 |
+
|
943 |
+
/* Magento start */
|
944 |
+
if($this->_cms == 'magento') {
|
945 |
+
return $this->_order->getIncrementId();
|
946 |
+
} /* Magento end */
|
947 |
+
}
|
948 |
+
|
949 |
+
/**
|
950 |
+
*
|
951 |
+
* Get total price of order including tax
|
952 |
+
* @return float
|
953 |
+
*/
|
954 |
+
private function getOrderPriceTotal() {
|
955 |
+
|
956 |
+
/* WooCommerce start */
|
957 |
+
if($this->_cms == 'woocommerce') {
|
958 |
+
return $this->_order->get_total();
|
959 |
+
} /* WooCommerce end */
|
960 |
+
|
961 |
+
/* Magento start */
|
962 |
+
if($this->_cms == 'magento') {
|
963 |
+
return $this->_order->getGrandTotal();
|
964 |
+
} /* Magento end */
|
965 |
+
}
|
966 |
+
|
967 |
+
/**
|
968 |
+
*
|
969 |
+
* Get shipping costs including tax
|
970 |
+
* @return float
|
971 |
+
*/
|
972 |
+
private function getOrderPriceShipping() {
|
973 |
+
|
974 |
+
/* WooCommerce start */
|
975 |
+
if($this->_cms == 'woocommerce') {
|
976 |
+
return $this->_order->get_total_shipping();
|
977 |
+
} /* WooCommerce end */
|
978 |
+
|
979 |
+
/* Magento start */
|
980 |
+
if($this->_cms == 'magento') {
|
981 |
+
return $this->_order->getShippingAmount();
|
982 |
+
} /* Magento end */
|
983 |
+
}
|
984 |
+
|
985 |
+
/**
|
986 |
+
*
|
987 |
+
* Get the currency used for the order
|
988 |
+
* @return string
|
989 |
+
*/
|
990 |
+
private function getOrderPriceCurrency() {
|
991 |
+
|
992 |
+
/* WooCommerce start */
|
993 |
+
if($this->_cms == 'woocommerce') {
|
994 |
+
return $this->_order->get_order_currency();
|
995 |
+
} /* WooCommerce end */
|
996 |
+
|
997 |
+
/* Magento start */
|
998 |
+
if($this->_cms == 'magento') {
|
999 |
+
return $this->_order->getOrderCurrencyCode();
|
1000 |
+
} /* Magento end */
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
/**
|
1004 |
+
*
|
1005 |
+
* Get the shipping address information
|
1006 |
+
* @return array
|
1007 |
+
*/
|
1008 |
+
private function getShippingAddress() {
|
1009 |
+
|
1010 |
+
/* WooCommerce start */
|
1011 |
+
if($this->_cms == 'woocommerce') {
|
1012 |
+
return array(
|
1013 |
+
'receiverid'=> $this->_order->user_id,
|
1014 |
+
'company' => $this->_order->shipping_company,
|
1015 |
+
'name1' => $this->_order->shipping_first_name .' '. $this->_order->shipping_last_name,
|
1016 |
+
'name2' => null,
|
1017 |
+
'address1' => $this->_order->shipping_address_1,
|
1018 |
+
'address2' => $this->_order->shipping_address_2,
|
1019 |
+
'city' => $this->_order->shipping_city,
|
1020 |
+
'zip' => $this->_order->shipping_postcode,
|
1021 |
+
'country' => $this->_order->shipping_country,
|
1022 |
+
'sms' => $this->_order->billing_phone, // Billing used
|
1023 |
+
'mail' => $this->_order->billing_email // Billing used
|
1024 |
+
);
|
1025 |
+
} /* WooCommerce end */
|
1026 |
+
|
1027 |
+
/* Magento start */
|
1028 |
+
if($this->_cms == 'magento') {
|
1029 |
+
return array(
|
1030 |
+
'receiverid'=> $this->_order->getShippingAddress()->getId(),
|
1031 |
+
'company' => $this->_order->getShippingAddress()->getCompany(),
|
1032 |
+
'name1' => $this->_order->getShippingAddress()->getFirstname() .' '. $this->_order->getShippingAddress()->getLastname(),
|
1033 |
+
'name2' => null,
|
1034 |
+
'address1' => $this->_order->getShippingAddress()->getStreet(1),
|
1035 |
+
'address2' => $this->_order->getShippingAddress()->getStreet(2),
|
1036 |
+
'city' => $this->_order->getShippingAddress()->getCity(),
|
1037 |
+
'zip' => $this->_order->getShippingAddress()->getPostcode(),
|
1038 |
+
'country' => $this->_order->getShippingAddress()->getCountry_id(),
|
1039 |
+
'sms' => $this->_order->getShippingAddress()->getTelephone(),
|
1040 |
+
'mail' => $this->_order->getShippingAddress()->getEmail()
|
1041 |
+
);
|
1042 |
+
} /* Magento end */
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
/**
|
1046 |
+
*
|
1047 |
+
* Get the shipping address information
|
1048 |
+
* @return array
|
1049 |
+
*/
|
1050 |
+
private function getBillingAddress() {
|
1051 |
+
|
1052 |
+
/* WooCommerce start */
|
1053 |
+
if($this->_cms == 'woocommerce') {
|
1054 |
+
return array(
|
1055 |
+
'receiverid'=> $this->_order->user_id,
|
1056 |
+
'company' => $this->_order->billing_company,
|
1057 |
+
'name1' => $this->_order->billing_first_name .' '. $this->_order->billing_last_name,
|
1058 |
+
'name2' => null,
|
1059 |
+
'address1' => $this->_order->billing_address_1,
|
1060 |
+
'address2' => $this->_order->billing_address_2,
|
1061 |
+
'city' => $this->_order->billing_city,
|
1062 |
+
'zip' => $this->_order->billing_postcode,
|
1063 |
+
'country' => $this->_order->billing_country,
|
1064 |
+
'sms' => $this->_order->billing_phone, // Billing used
|
1065 |
+
'mail' => $this->_order->billing_email // Billing used
|
1066 |
+
);
|
1067 |
+
} /* WooCommerce end */
|
1068 |
+
|
1069 |
+
/* Magento start */
|
1070 |
+
if($this->_cms == 'magento') {
|
1071 |
+
return array(
|
1072 |
+
'receiverid'=> $this->_order->getBillingAddress()->getId(),
|
1073 |
+
'company' => $this->_order->getBillingAddress()->getCompany(),
|
1074 |
+
'name1' => $this->_order->getBillingAddress()->getFirstname() .' '. $this->_order->getBillingAddress()->getLastname(),
|
1075 |
+
'name2' => null,
|
1076 |
+
'address1' => $this->_order->getBillingAddress()->getStreet(1),
|
1077 |
+
'address2' => $this->_order->getBillingAddress()->getStreet(2),
|
1078 |
+
'city' => $this->_order->getBillingAddress()->getCity(),
|
1079 |
+
'zip' => $this->_order->getBillingAddress()->getPostcode(),
|
1080 |
+
'country' => $this->_order->getBillingAddress()->getCountry_id(),
|
1081 |
+
'sms' => $this->_order->getBillingAddress()->getTelephone(),
|
1082 |
+
'mail' => $this->_order->getBillingAddress()->getEmail()
|
1083 |
+
);
|
1084 |
+
} /* Magento end */
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
/**
|
1088 |
+
*
|
1089 |
+
* Get pickup data for a SmartSend delivery point
|
1090 |
+
* @return array
|
1091 |
+
*/
|
1092 |
+
private function getPickupDataSmartsend() {
|
1093 |
+
|
1094 |
+
/* WooCommerce start */
|
1095 |
+
if($this->_cms == 'woocommerce') {
|
1096 |
+
$store_pickup = get_post_custom($order->id);
|
1097 |
+
$store_pickup = @unserialize($store_pickup['store_pickup'][0]);
|
1098 |
+
if(!is_array($store_pickup)) $store_pickup = unserialize($store_pickup);
|
1099 |
+
|
1100 |
+
if(!empty($store_pickup)){
|
1101 |
+
|
1102 |
+
return array(
|
1103 |
+
'id' => (isset($store_pickup['id']) ? $store_pickup['id'] : 0)."-".time()."-".rand(9999,10000),
|
1104 |
+
'agentno' => (isset($store_pickup['id']) ? $store_pickup['id'] : null),
|
1105 |
+
'agenttype' => ($this->getShippingCarrier() == 'postdanmark' ? 'PDK' : null),
|
1106 |
+
'company' => (isset($store_pickup['company']) ? $store_pickup['company'] : null),
|
1107 |
+
'name1' => null,
|
1108 |
+
'name2' => null,
|
1109 |
+
'address1' => (isset($store_pickup['street']) ? $store_pickup['street'] : null),
|
1110 |
+
'address2' => null,
|
1111 |
+
'city' => (isset($store_pickup['city']) ? $store_pickup['city'] : null),
|
1112 |
+
'zip' => (isset($store_pickup['zip']) ? $store_pickup['zip'] : null),
|
1113 |
+
'country' => (isset($store_pickup['country']) ? $store_pickup['country'] : null),
|
1114 |
+
'sms' => null,
|
1115 |
+
'mail' => null,
|
1116 |
+
);
|
1117 |
+
|
1118 |
+
} else {
|
1119 |
+
return null;
|
1120 |
+
}
|
1121 |
+
} /* WooCommerce end */
|
1122 |
+
|
1123 |
+
/* Magento start */
|
1124 |
+
if($this->_cms == 'magento') {
|
1125 |
+
|
1126 |
+
$carrier = $this->formatCarrier($this->getShippingCarrier(),1);
|
1127 |
+
switch ($carrier) {
|
1128 |
+
case 'postdanmark':
|
1129 |
+
$pickupModel = Mage::getModel('logistics/postdanmark');
|
1130 |
+
break;
|
1131 |
+
case 'posten':
|
1132 |
+
$pickupModel = Mage::getModel('logistics/posten');
|
1133 |
+
break;
|
1134 |
+
case 'gls':
|
1135 |
+
$pickupModel = Mage::getModel('logistics/gls');
|
1136 |
+
break;
|
1137 |
+
case 'bring':
|
1138 |
+
$pickupModel = Mage::getModel('logistics/bring');
|
1139 |
+
break;
|
1140 |
+
default:
|
1141 |
+
//Change this code for each CMS system
|
1142 |
+
throw new Exception('Unable to get pickup data for Smart Send shipping method.');
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
$order_id = $this->_order->getId(); //order id
|
1146 |
+
$pickupData = $pickupModel->getCollection()->addFieldToFilter('order_id', $order_id)->getFirstItem(); //pickup data
|
1147 |
+
|
1148 |
+
if ($pickupData->getData()) {
|
1149 |
+
|
1150 |
+
return array(
|
1151 |
+
'id' => $pickupData->getPickUpId()."-".time()."-".rand(9999,10000),
|
1152 |
+
'agentno' => $pickupData->getPickUpId(),
|
1153 |
+
'agenttype' => ($this->getShippingCarrier() == 'postdanmark' ? 'PDK' : null),
|
1154 |
+
'company' => $pickupData->getCompany(),
|
1155 |
+
'name1' => null,
|
1156 |
+
'name2' => null,
|
1157 |
+
'address1' => $pickupData->getStreet(),
|
1158 |
+
'address2' => null,
|
1159 |
+
'city' => $pickupData->getCity(),
|
1160 |
+
'zip' => $pickupData->getZip(),
|
1161 |
+
'country' => $pickupData->getCountry(),
|
1162 |
+
'sms' => null,
|
1163 |
+
'mail' => null,
|
1164 |
+
);
|
1165 |
+
|
1166 |
+
} else {
|
1167 |
+
return null;
|
1168 |
+
}
|
1169 |
+
} /* Magento end */
|
1170 |
+
}
|
1171 |
+
|
1172 |
+
/**
|
1173 |
+
*
|
1174 |
+
* Get the settings for Post Danmark
|
1175 |
+
* @return array
|
1176 |
+
*/
|
1177 |
+
private function getSettingsPostdanmark() {
|
1178 |
+
|
1179 |
+
/* WooCommerce start */
|
1180 |
+
if($this->_cms == 'woocommerce') {
|
1181 |
+
$postdanmark = new Smartsend_Logistics_PostDanmark();
|
1182 |
+
return array(
|
1183 |
+
'notemail' => ($postdanmark->get_option( 'notemail','yes') == 'yes' ? true : null),
|
1184 |
+
'notesms' => ($postdanmark->get_option( 'notesms','yes') == 'yes' ? true : null),
|
1185 |
+
'prenote' => ($postdanmark->get_option( 'prenote','yes') == 'yes' ? true : false),
|
1186 |
+
'prenote_from' => $postdanmark->get_option( 'prenote_sender',''),
|
1187 |
+
'prenote_receiver' => $postdanmark->get_option( 'prenote_receiver','user'),
|
1188 |
+
'prenote_message' => $postdanmark->get_option( 'prenote_message',''),
|
1189 |
+
'format' => $postdanmark->get_option( 'format','pdf'),
|
1190 |
+
'quickid' => $postdanmark->get_option( 'quickid','1'),
|
1191 |
+
'waybillid' => $postdanmark->get_option( 'waybillid',''),
|
1192 |
+
'return' => $postdanmark->get_option( 'return',''),
|
1193 |
+
);
|
1194 |
+
} /* WooCommerce end */
|
1195 |
+
|
1196 |
+
/* Magento start */
|
1197 |
+
if($this->_cms == 'magento') {
|
1198 |
+
return array(
|
1199 |
+
'notemail' => Mage::getStoreConfig('carriers/smartsendpostdanmark/notemail'),
|
1200 |
+
'notesms' => Mage::getStoreConfig('carriers/smartsendpostdanmark/notesms'),
|
1201 |
+
'prenote' => Mage::getStoreConfig('carriers/smartsendpostdanmark/prenote'),
|
1202 |
+
'prenote_from' => Mage::getStoreConfig('carriers/smartsendpostdanmark/prenote_sender'),
|
1203 |
+
'prenote_receiver' => Mage::getStoreConfig('carriers/smartsendpostdanmark/prenote_receiver'),
|
1204 |
+
'prenote_message' => Mage::getStoreConfig('carriers/smartsendpostdanmark/prenote_message'),
|
1205 |
+
'format' => Mage::getStoreConfig('carriers/smartsendpostdanmark/format'),
|
1206 |
+
'quickid' => Mage::getStoreConfig('carriers/smartsendpostdanmark/quickid'),
|
1207 |
+
'waybillid' => Mage::getStoreConfig('carriers/smartsendpostdanmark/waybillid'),
|
1208 |
+
'return' => Mage::getStoreConfig('carriers/smartsendpostdanmark/return'),
|
1209 |
+
);
|
1210 |
+
} /* Magento end */
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
/**
|
1214 |
+
*
|
1215 |
+
* Get the settings for Posten
|
1216 |
+
* @return array
|
1217 |
+
*/
|
1218 |
+
private function getSettingsPosten() {
|
1219 |
+
|
1220 |
+
/* WooCommerce start */
|
1221 |
+
if($this->_cms == 'woocommerce') {
|
1222 |
+
$posten = new Smartsend_Logistics_Posten();
|
1223 |
+
return array(
|
1224 |
+
'notemail' => ($posten->get_option( 'notemail','yes') == 'yes' ? true : null),
|
1225 |
+
'notesms' => ($posten->get_option( 'notesms','yes') == 'yes' ? true : null),
|
1226 |
+
'prenote' => ($posten->get_option( 'prenote','yes') == 'yes' ? true : false),
|
1227 |
+
'prenote_from' => $posten->get_option( 'prenote_sender',''),
|
1228 |
+
'prenote_receiver' => $posten->get_option( 'prenote_receiver','user'),
|
1229 |
+
'prenote_message' => $posten->get_option( 'prenote_message',''),
|
1230 |
+
'format' => $posten->get_option( 'format','pdf'),
|
1231 |
+
'quickid' => $posten->get_option( 'quickid','1'),
|
1232 |
+
'waybillid' => $posten->get_option( 'waybillid',''),
|
1233 |
+
'return' => $posten->get_option( 'return',''),
|
1234 |
+
);
|
1235 |
+
} /* WooCommerce end */
|
1236 |
+
|
1237 |
+
/* Magento start */
|
1238 |
+
if($this->_cms == 'magento') {
|
1239 |
+
return array(
|
1240 |
+
'notemail' => Mage::getStoreConfig('carriers/smartsendposten/notemail'),
|
1241 |
+
'notesms' => Mage::getStoreConfig('carriers/smartsendposten/notesms'),
|
1242 |
+
'prenote' => Mage::getStoreConfig('carriers/smartsendposten/prenote'),
|
1243 |
+
'prenote_from' => Mage::getStoreConfig('carriers/smartsendposten/prenote_sender'),
|
1244 |
+
'prenote_receiver' => Mage::getStoreConfig('carriers/smartsendposten/prenote_receiver'),
|
1245 |
+
'prenote_message' => Mage::getStoreConfig('carriers/smartsendposten/prenote_message'),
|
1246 |
+
'format' => Mage::getStoreConfig('carriers/smartsendposten/format'),
|
1247 |
+
'quickid' => Mage::getStoreConfig('carriers/smartsendposten/quickid'),
|
1248 |
+
'waybillid' => Mage::getStoreConfig('carriers/smartsendposten/waybillid'),
|
1249 |
+
'return' => Mage::getStoreConfig('carriers/smartsendposten/return'),
|
1250 |
+
);
|
1251 |
+
} /* Magento end */
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
/**
|
1255 |
+
*
|
1256 |
+
* Get the settings for GLS
|
1257 |
+
* @return array
|
1258 |
+
*/
|
1259 |
+
private function getSettingsGls() {
|
1260 |
+
|
1261 |
+
/* WooCommerce start */
|
1262 |
+
if($this->_cms == 'woocommerce') {
|
1263 |
+
$gls = new Smartsend_Logistics_GLS();
|
1264 |
+
return array(
|
1265 |
+
'notemail' => ($gls->get_option( 'notemail','yes') == 'yes' ? true : null),
|
1266 |
+
'notesms' => ($gls->get_option( 'notesms','yes') == 'yes' ? true : null),
|
1267 |
+
'prenote' => null,
|
1268 |
+
'prenote_from' => null,
|
1269 |
+
'prenote_receiver' => null,
|
1270 |
+
'prenote_message' => null,
|
1271 |
+
'format' => null,
|
1272 |
+
'quickid' => null,
|
1273 |
+
'waybillid' => null,
|
1274 |
+
'return' => $gls->get_option( 'return',''),
|
1275 |
+
);
|
1276 |
+
} /* WooCommerce end */
|
1277 |
+
|
1278 |
+
/* Magento start */
|
1279 |
+
if($this->_cms == 'magento') {
|
1280 |
+
return array(
|
1281 |
+
'notemail' => Mage::getStoreConfig('carriers/smartsendgls/notemail'),
|
1282 |
+
'notesms' => Mage::getStoreConfig('carriers/smartsendgls/notesms'),
|
1283 |
+
'prenote' => null,
|
1284 |
+
'prenote_from' => null,
|
1285 |
+
'prenote_receiver' => null,
|
1286 |
+
'prenote_message' => null,
|
1287 |
+
'format' => null,
|
1288 |
+
'quickid' => null,
|
1289 |
+
'waybillid' => null,
|
1290 |
+
'return' => Mage::getStoreConfig('carriers/smartsendgls/return'),
|
1291 |
+
);
|
1292 |
+
} /* Magento end */
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
/**
|
1296 |
+
*
|
1297 |
+
* Get the settings for Bring
|
1298 |
+
* @return array
|
1299 |
+
*/
|
1300 |
+
private function getSettingsBring() {
|
1301 |
+
|
1302 |
+
/* WooCommerce start */
|
1303 |
+
if($this->_cms == 'woocommerce') {
|
1304 |
+
$bring = new Smartsend_Logistics_Bring();
|
1305 |
+
return array(
|
1306 |
+
'notemail' => ($bring->get_option( 'notemail','yes') == 'yes' ? true : null),
|
1307 |
+
'notesms' => ($bring->get_option( 'notesms','yes') == 'yes' ? true : null),
|
1308 |
+
'prenote' => null,
|
1309 |
+
'prenote_from' => null,
|
1310 |
+
'prenote_receiver' => null,
|
1311 |
+
'prenote_message' => null,
|
1312 |
+
'format' => null,
|
1313 |
+
'quickid' => null,
|
1314 |
+
'waybillid' => null,
|
1315 |
+
'return' => $bring->get_option( 'return',''),
|
1316 |
+
);
|
1317 |
+
} /* WooCommerce end */
|
1318 |
+
|
1319 |
+
/* Magento start */
|
1320 |
+
if($this->_cms == 'magento') {
|
1321 |
+
return array(
|
1322 |
+
'notemail' => Mage::getStoreConfig('carriers/smartsendbring/notemail'),
|
1323 |
+
'notesms' => Mage::getStoreConfig('carriers/smartsendbring/notesms'),
|
1324 |
+
'prenote' => null,
|
1325 |
+
'prenote_from' => null,
|
1326 |
+
'prenote_receiver' => null,
|
1327 |
+
'prenote_message' => null,
|
1328 |
+
'format' => null,
|
1329 |
+
'quickid' => null,
|
1330 |
+
'waybillid' => null,
|
1331 |
+
'return' => Mage::getStoreConfig('carriers/smartsendbring/return'),
|
1332 |
+
);
|
1333 |
+
} /* Magento end */
|
1334 |
+
}
|
1335 |
+
|
1336 |
+
/* CMS FUNCTIONS ABOUT PARCELS AND SHIPMENTS */
|
1337 |
+
|
1338 |
+
/**
|
1339 |
+
*
|
1340 |
+
* Get the Track&Trace code for a given shipment
|
1341 |
+
* @return string
|
1342 |
+
*/
|
1343 |
+
private function getShipmentTrace($shipment) {
|
1344 |
+
|
1345 |
+
/* WooCommerce start */
|
1346 |
+
if($this->_cms == 'woocommerce') {
|
1347 |
+
return false;
|
1348 |
+
} /* WooCommerce end */
|
1349 |
+
|
1350 |
+
/* Magento start */
|
1351 |
+
if($this->_cms == 'magento') {
|
1352 |
+
$tracknums = array();
|
1353 |
+
foreach($shipment->getAllTracks() as $tracknum) {
|
1354 |
+
$tracknums[]=$tracknum->getNumber();
|
1355 |
+
}
|
1356 |
+
|
1357 |
+
if(empty($tracknums)) {
|
1358 |
+
return false;
|
1359 |
+
} else {
|
1360 |
+
return true;
|
1361 |
+
}
|
1362 |
+
} /* Magento end */
|
1363 |
+
}
|
1364 |
+
|
1365 |
+
/**
|
1366 |
+
*
|
1367 |
+
* Get the weight (in kg) of a given shipment
|
1368 |
+
* @return float
|
1369 |
+
*/
|
1370 |
+
private function getShipmentWeight($shipment) {
|
1371 |
+
|
1372 |
+
/* WooCommerce start */
|
1373 |
+
if($this->_cms == 'woocommerce') {
|
1374 |
+
$weight = 0;
|
1375 |
+
foreach($shipment as $eachShipmentItem) {
|
1376 |
+
$itemWeight = $eachShipmentItem['unitweight'];
|
1377 |
+
$itemQty = $eachShipmentItem['quantity'];
|
1378 |
+
$rowWeight = $itemWeight*$itemQty;
|
1379 |
+
|
1380 |
+
$weight = $weight + $rowWeight;
|
1381 |
+
}
|
1382 |
+
} /* WooCommerce end */
|
1383 |
+
|
1384 |
+
/* Magento start */
|
1385 |
+
if($this->_cms == 'magento') {
|
1386 |
+
$weight = 0;
|
1387 |
+
foreach($shipment->getAllItems() as $eachShipmentItem) {
|
1388 |
+
$itemWeight = $eachShipmentItem->getWeight();
|
1389 |
+
$itemQty = $eachShipmentItem->getQty();
|
1390 |
+
$rowWeight = $itemWeight*$itemQty;
|
1391 |
+
|
1392 |
+
$weight = $weight + $rowWeight;
|
1393 |
+
}
|
1394 |
+
} /* Magento end */
|
1395 |
+
|
1396 |
+
/* All */
|
1397 |
+
if($weight > 0) {
|
1398 |
+
return $weight;
|
1399 |
+
} else {
|
1400 |
+
return null;
|
1401 |
+
}
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
/**
|
1405 |
+
*
|
1406 |
+
* Get the shipments for the order if any
|
1407 |
+
* @return array
|
1408 |
+
*/
|
1409 |
+
private function getShipments() {
|
1410 |
+
|
1411 |
+
/* WooCommerce start */
|
1412 |
+
if($this->_cms == 'woocommerce') {
|
1413 |
+
return null;
|
1414 |
+
} /* WooCommerce end */
|
1415 |
+
|
1416 |
+
/* Magento start */
|
1417 |
+
if($this->_cms == 'magento') {
|
1418 |
+
if( $this->_order->hasShipments() ) {
|
1419 |
+
return $this->_order->getShipmentsCollection();
|
1420 |
+
} else {
|
1421 |
+
return null;
|
1422 |
+
}
|
1423 |
+
} /* Magento end */
|
1424 |
+
}
|
1425 |
+
|
1426 |
+
/**
|
1427 |
+
*
|
1428 |
+
* Add a shipment to the request
|
1429 |
+
*/
|
1430 |
+
private function addShipment($shipment) {
|
1431 |
+
|
1432 |
+
/* WooCommerce start */
|
1433 |
+
if($this->_cms == 'woocommerce') {
|
1434 |
+
$this->_parcels[] = $shipment;
|
1435 |
+
} /* WooCommerce end */
|
1436 |
+
|
1437 |
+
/* Magento start */
|
1438 |
+
if($this->_cms == 'magento') {
|
1439 |
+
$parcel = array(
|
1440 |
+
'shipdate' => null,
|
1441 |
+
'reference' => $shipment->getId(),
|
1442 |
+
'weight' => $this->getShipmentWeight($shipment),
|
1443 |
+
'height' => null,
|
1444 |
+
'width' => null,
|
1445 |
+
'length' => null,
|
1446 |
+
'size' => null,
|
1447 |
+
'freetext1' => null,
|
1448 |
+
'freetext2' => null,
|
1449 |
+
'freetext3' => null,
|
1450 |
+
'items' => array(),
|
1451 |
+
);
|
1452 |
+
|
1453 |
+
$ordered_items = $shipment->getAllItems();
|
1454 |
+
foreach($ordered_items as $item) {
|
1455 |
+
$parcel['items'][] = $this->addItem($item);
|
1456 |
+
}
|
1457 |
+
|
1458 |
+
$this->_parcels[] = $parcel;
|
1459 |
+
} /* Magento end */
|
1460 |
+
}
|
1461 |
+
|
1462 |
+
/**
|
1463 |
+
*
|
1464 |
+
* Format an item to be added to a parcel
|
1465 |
+
* @return array
|
1466 |
+
*/
|
1467 |
+
private function addItem($item) {
|
1468 |
+
|
1469 |
+
/* Magento start */
|
1470 |
+
if($this->_cms == 'magento') {
|
1471 |
+
return array(
|
1472 |
+
'sku' => $item->getSku(),
|
1473 |
+
'title' => $item->getName(),
|
1474 |
+
'quantity' => $item->getQty(),
|
1475 |
+
'unitweight'=> $item->getWeight(),
|
1476 |
+
'unitprice' => $item->getPrice(),
|
1477 |
+
'currency' => Mage::app()->getStore()->getCurrentCurrencyCode()
|
1478 |
+
);
|
1479 |
+
// $item->getItemId(); //product id
|
1480 |
+
} /* Magento end */
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
/**
|
1484 |
+
*
|
1485 |
+
* Get the unshipped items of the order
|
1486 |
+
* @return array
|
1487 |
+
*/
|
1488 |
+
private function getUnshippedItems() {
|
1489 |
+
|
1490 |
+
/* WooCommerce start */
|
1491 |
+
if($this->_cms == 'woocommerce') {
|
1492 |
+
$ordered_items = $this->_order->get_items();
|
1493 |
+
foreach($ordered_items as $item) {
|
1494 |
+
$_product = $this->_order->get_product_from_item( $item );
|
1495 |
+
if ( ! $_product->is_virtual() ) {
|
1496 |
+
$weight = $_product->get_weight();
|
1497 |
+
} else {
|
1498 |
+
$weight = null;
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
$items[] = array(
|
1502 |
+
'sku' => ($_product->get_sku() != '' ? $_product->get_sku() : null),
|
1503 |
+
'title' => ($_product->get_title() != '' ? $_product->get_title() : null),
|
1504 |
+
'quantity' => $item['qty'],
|
1505 |
+
'unitweight'=> ($weight != '' ? $weight : null),
|
1506 |
+
'unitprice' => $_product->get_price(),
|
1507 |
+
'currency' => get_woocommerce_currency()
|
1508 |
+
);
|
1509 |
+
}
|
1510 |
+
} /* WooCommerce end */
|
1511 |
+
|
1512 |
+
/* Magento start */
|
1513 |
+
if($this->_cms == 'magento') {
|
1514 |
+
$items = array();
|
1515 |
+
foreach($this->_order->getAllItems() as $eachOrderItem){
|
1516 |
+
$Itemqty = 0;
|
1517 |
+
$Itemqty = $eachOrderItem->getQtyOrdered()
|
1518 |
+
- $eachOrderItem->getQtyShipped()
|
1519 |
+
- $eachOrderItem->getQtyRefunded()
|
1520 |
+
- $eachOrderItem->getQtyCanceled();
|
1521 |
+
if($Itemqty > 0) {
|
1522 |
+
$items[$eachOrderItem->getId()] = $Itemqty;
|
1523 |
+
}
|
1524 |
+
}
|
1525 |
+
} /* Magento end */
|
1526 |
+
|
1527 |
+
/* All */
|
1528 |
+
if(!empty($items)) {
|
1529 |
+
return $items;
|
1530 |
+
} else {
|
1531 |
+
return null;
|
1532 |
+
}
|
1533 |
+
|
1534 |
+
}
|
1535 |
+
|
1536 |
+
/**
|
1537 |
+
*
|
1538 |
+
* Create a parcel containing all unshipped items.
|
1539 |
+
* Add the parcel to the request.
|
1540 |
+
*/
|
1541 |
+
private function createShipment() {
|
1542 |
+
|
1543 |
+
/* WooCommerce start */
|
1544 |
+
if($this->_cms == 'woocommerce') {
|
1545 |
+
//create and object, $shipment, with all items
|
1546 |
+
if ( sizeof( $this->_order->get_items() ) > 0 ) {
|
1547 |
+
$shipment = array(
|
1548 |
+
'shipdate' => null,
|
1549 |
+
'reference' => $this->_order->id,
|
1550 |
+
'weight' => $this->getShipmentWeight($this->getUnshippedItems()),
|
1551 |
+
'height' => null,
|
1552 |
+
'width' => null,
|
1553 |
+
'length' => null,
|
1554 |
+
'size' => null,
|
1555 |
+
'freetext1' => null,
|
1556 |
+
'freetext2' => null,
|
1557 |
+
'freetext3' => null,
|
1558 |
+
'items' => $this->getUnshippedItems()
|
1559 |
+
);
|
1560 |
+
} else {
|
1561 |
+
//Order has no shipments and cannot be shipped
|
1562 |
+
throw new Exception(__("No items that could be shipped"));
|
1563 |
+
}
|
1564 |
+
} /* WooCommerce end */
|
1565 |
+
|
1566 |
+
/* Magento start */
|
1567 |
+
if($this->_cms == 'magento') {
|
1568 |
+
$order = $this->_order;
|
1569 |
+
$qty = $this->getUnshippedItems();
|
1570 |
+
|
1571 |
+
/* check order shipment is prossiable or not */
|
1572 |
+
|
1573 |
+
$email = false;
|
1574 |
+
$includeComment = false;
|
1575 |
+
$comment = "";
|
1576 |
+
|
1577 |
+
if ($order->canShip()) {
|
1578 |
+
// @var $shipment Mage_Sales_Model_Order_Shipment
|
1579 |
+
// prepare to create shipment
|
1580 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($qty);
|
1581 |
+
if ($shipment) {
|
1582 |
+
$shipment->register();
|
1583 |
+
|
1584 |
+
//Add a comment. Second parameter is whether or not to email the comment to the user
|
1585 |
+
$shipment->addComment($comment, $email && $includeComment);
|
1586 |
+
|
1587 |
+
// Set the order status as 'Processing'
|
1588 |
+
$order->setIsInProcess($email);
|
1589 |
+
$order->addStatusHistoryComment('Label generated by Smart Send Logistics.', false);
|
1590 |
+
|
1591 |
+
try {
|
1592 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
1593 |
+
->addObject($shipment)
|
1594 |
+
->addObject($order)
|
1595 |
+
->save();
|
1596 |
+
|
1597 |
+
//Email the customer that the order is sent
|
1598 |
+
$shipment->sendEmail($email, ($includeComment ? $comment : ''));
|
1599 |
+
|
1600 |
+
//Set order status as complete
|
1601 |
+
//$order->setData('state', Mage_Sales_Model_Order::STATE_COMPLETE);
|
1602 |
+
//$order->setData('status', Mage_Sales_Model_Order::STATE_COMPLETE);
|
1603 |
+
//$order->save();
|
1604 |
+
|
1605 |
+
//var_dump($qty); exit();
|
1606 |
+
} catch (Mage_Core_Exception $e) {
|
1607 |
+
throw new Exception(Mage::helper('logistics')->__("Error while creating parcel: ".$e));
|
1608 |
+
}
|
1609 |
+
}
|
1610 |
+
}
|
1611 |
+
|
1612 |
+
} /* Magento end */
|
1613 |
+
|
1614 |
+
/* All */
|
1615 |
+
if ($shipment) {
|
1616 |
+
//Lastly add the shipment to the order array.
|
1617 |
+
$this->addShipment($shipment);
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
}
|
1621 |
+
|
1622 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Pickup.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Pickup.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Pickup extends Mage_Core_Model_Abstract {
|
27 |
+
|
28 |
+
public function _construct() {
|
29 |
+
parent::_construct();
|
30 |
+
$this->_init('logistics/pickup');
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Postdanmark.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Postdanmark.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Smartsend_Logistics_Model_Postdanmark extends Mage_Core_Model_Abstract {
|
29 |
+
|
30 |
+
public function _construct() {
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('logistics/postdanmark');
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Posten.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Posten.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Smartsend_Logistics_Model_Posten extends Mage_Core_Model_Abstract {
|
29 |
+
|
30 |
+
public function _construct() {
|
31 |
+
parent::_construct();
|
32 |
+
$this->_init('logistics/Posten');
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Rewrite/Sales/Total/Quote/Shipping.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Rewrite/Sales/Total/Quote/Shipping.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Rewrite_Sales_Total_Quote_Shipping extends Mage_Tax_Model_Sales_Total_Quote_Shipping
|
28 |
+
{
|
29 |
+
|
30 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
31 |
+
{
|
32 |
+
|
33 |
+
$this->_setAddress($address);
|
34 |
+
/**
|
35 |
+
* Reset amounts
|
36 |
+
*/
|
37 |
+
$this->_setAmount(0);
|
38 |
+
$this->_setBaseAmount(0);
|
39 |
+
|
40 |
+
|
41 |
+
$calc = $this->_calculator;
|
42 |
+
$store = $address->getQuote()->getStore();
|
43 |
+
$storeTaxRequest = $calc->getRateOriginRequest($store);
|
44 |
+
$addressTaxRequest = $calc->getRateRequest(
|
45 |
+
$address,
|
46 |
+
$address->getQuote()->getBillingAddress(),
|
47 |
+
$address->getQuote()->getCustomerTaxClassId(),
|
48 |
+
$store
|
49 |
+
);
|
50 |
+
|
51 |
+
$shippingTaxClass = $this->_config->getShippingTaxClass($store);
|
52 |
+
|
53 |
+
|
54 |
+
//custom code - start
|
55 |
+
$shipping_method = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
|
56 |
+
|
57 |
+
if(substr($shipping_method, 0, strlen('smartsend')) === 'smartsend') {
|
58 |
+
$carrier = explode('_',$shipping_method);
|
59 |
+
$smartsend_carrier = $carrier['0'];
|
60 |
+
|
61 |
+
$exclude_tax = Mage::getStoreConfig("carriers/".$smartsend_carrier."/excludetax");
|
62 |
+
|
63 |
+
if($exclude_tax) {
|
64 |
+
$shippingTaxClass=0;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
//custom code - end
|
68 |
+
|
69 |
+
$storeTaxRequest->setProductClassId($shippingTaxClass);
|
70 |
+
$addressTaxRequest->setProductClassId($shippingTaxClass);
|
71 |
+
|
72 |
+
$priceIncludesTax = $this->_config->shippingPriceIncludesTax($store);
|
73 |
+
if ($priceIncludesTax) {
|
74 |
+
$this->_areTaxRequestsSimilar = $calc->compareRequests($addressTaxRequest, $storeTaxRequest);
|
75 |
+
}
|
76 |
+
|
77 |
+
$shipping = $taxShipping = $address->getShippingAmount();
|
78 |
+
$baseShipping = $baseTaxShipping = $address->getBaseShippingAmount();
|
79 |
+
$rate = $calc->getRate($addressTaxRequest);
|
80 |
+
if ($priceIncludesTax) {
|
81 |
+
if ($this->_areTaxRequestsSimilar) {
|
82 |
+
$taxExact = $calc->calcTaxAmount($shipping, $rate, true, false);
|
83 |
+
$baseTaxExact = $calc->calcTaxAmount($baseShipping, $rate, true, false);
|
84 |
+
$taxShipping = $shipping;
|
85 |
+
$baseTaxShipping = $baseShipping;
|
86 |
+
$shippingExact = $shipping - $taxExact;
|
87 |
+
$baseShippingExact = $baseShipping - $baseTaxExact;
|
88 |
+
$taxable = $taxShipping;
|
89 |
+
$baseTaxable = $baseTaxShipping;
|
90 |
+
$isPriceInclTax = true;
|
91 |
+
$address->setTotalAmount('shipping', $shippingExact);
|
92 |
+
$address->setBaseTotalAmount('shipping', $baseShippingExact);
|
93 |
+
} else {
|
94 |
+
$storeRate = $calc->getStoreRate($addressTaxRequest, $store);
|
95 |
+
$storeTax = $calc->calcTaxAmount($shipping, $storeRate, true, false);
|
96 |
+
$baseStoreTax = $calc->calcTaxAmount($baseShipping, $storeRate, true, false);
|
97 |
+
$shipping = $calc->round($shipping - $storeTax);
|
98 |
+
$baseShipping = $calc->round($baseShipping - $baseStoreTax);
|
99 |
+
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, false, false), $rate, false);
|
100 |
+
$baseTax = $this->_round(
|
101 |
+
$calc->calcTaxAmount($baseShipping, $rate, false, false), $rate, false, 'base');
|
102 |
+
$taxShipping = $shipping + $tax;
|
103 |
+
$baseTaxShipping = $baseShipping + $baseTax;
|
104 |
+
$taxable = $shipping;
|
105 |
+
$baseTaxable = $baseShipping;
|
106 |
+
$isPriceInclTax = false;
|
107 |
+
$address->setTotalAmount('shipping', $shipping);
|
108 |
+
$address->setBaseTotalAmount('shipping', $baseShipping);
|
109 |
+
}
|
110 |
+
} else {
|
111 |
+
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, false, false), $rate, false);
|
112 |
+
$baseTax = $this->_round(
|
113 |
+
$calc->calcTaxAmount($baseShipping, $rate, false, false), $rate, false, 'base');
|
114 |
+
$taxShipping = $shipping + $tax;
|
115 |
+
$baseTaxShipping = $baseShipping + $baseTax;
|
116 |
+
$taxable = $shipping;
|
117 |
+
$baseTaxable = $baseShipping;
|
118 |
+
$isPriceInclTax = false;
|
119 |
+
$address->setTotalAmount('shipping', $shipping);
|
120 |
+
$address->setBaseTotalAmount('shipping', $baseShipping);
|
121 |
+
}
|
122 |
+
$address->setShippingInclTax($taxShipping);
|
123 |
+
$address->setBaseShippingInclTax($baseTaxShipping);
|
124 |
+
$address->setShippingTaxable($taxable);
|
125 |
+
$address->setBaseShippingTaxable($baseTaxable);
|
126 |
+
$address->setIsShippingInclTax($isPriceInclTax);
|
127 |
+
if ($this->_config->discountTax($store)) {
|
128 |
+
$address->setShippingAmountForDiscount($taxShipping);
|
129 |
+
$address->setBaseShippingAmountForDiscount($baseTaxShipping);
|
130 |
+
}
|
131 |
+
return $this;
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
|
app/code/community/Smartsend/Logistics/Model/Rewrite/Sales/Total/Quote/Tax.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Rewrite/Sales/Total/Quote/Tax.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Rewrite_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax
|
28 |
+
{
|
29 |
+
|
30 |
+
protected function _calculateShippingTax(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
|
31 |
+
{
|
32 |
+
|
33 |
+
$taxRateRequest->setProductClassId($this->_config->getShippingTaxClass($this->_store));
|
34 |
+
|
35 |
+
|
36 |
+
//custom code - start
|
37 |
+
$shipping_method= Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
|
38 |
+
|
39 |
+
if(substr($shipping_method, 0, strlen('smartsend')) === 'smartsend') {
|
40 |
+
|
41 |
+
$carrier=explode('_',$shipping_method);
|
42 |
+
$smartsend_carrier=$carrier['0'];
|
43 |
+
|
44 |
+
$exclude_tax= Mage::getStoreConfig("carriers/".$smartsend_carrier."/excludetax");
|
45 |
+
|
46 |
+
if($exclude_tax) {
|
47 |
+
$taxRateRequest->setProductClassId(0);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
//custom code - end
|
51 |
+
|
52 |
+
|
53 |
+
$rate = $this->_calculator->getRate($taxRateRequest);
|
54 |
+
$inclTax = $address->getIsShippingInclTax();
|
55 |
+
$shipping = $address->getShippingTaxable();
|
56 |
+
$baseShipping = $address->getBaseShippingTaxable();
|
57 |
+
$rateKey = (string)$rate;
|
58 |
+
|
59 |
+
$hiddenTax = null;
|
60 |
+
$baseHiddenTax = null;
|
61 |
+
switch ($this->_helper->getCalculationSequence($this->_store)) {
|
62 |
+
case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
|
63 |
+
case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
|
64 |
+
$tax = $this->_calculator->calcTaxAmount($shipping, $rate, $inclTax, false);
|
65 |
+
$baseTax = $this->_calculator->calcTaxAmount($baseShipping, $rate, $inclTax, false);
|
66 |
+
break;
|
67 |
+
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
|
68 |
+
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
|
69 |
+
$discountAmount = $address->getShippingDiscountAmount();
|
70 |
+
$baseDiscountAmount = $address->getBaseShippingDiscountAmount();
|
71 |
+
$tax = $this->_calculator->calcTaxAmount(
|
72 |
+
$shipping - $discountAmount,
|
73 |
+
$rate,
|
74 |
+
$inclTax,
|
75 |
+
false
|
76 |
+
);
|
77 |
+
$baseTax = $this->_calculator->calcTaxAmount(
|
78 |
+
$baseShipping - $baseDiscountAmount,
|
79 |
+
$rate,
|
80 |
+
$inclTax,
|
81 |
+
false
|
82 |
+
);
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
|
86 |
+
if ($this->_config->getAlgorithm($this->_store) == Mage_Tax_Model_Calculation::CALC_TOTAL_BASE) {
|
87 |
+
$this->_addAmount(max(0, $tax));
|
88 |
+
$this->_addBaseAmount(max(0, $baseTax));
|
89 |
+
$tax = $this->_deltaRound($tax, $rate, $inclTax);
|
90 |
+
$baseTax = $this->_deltaRound($baseTax, $rate, $inclTax, 'base');
|
91 |
+
} else {
|
92 |
+
$tax = $this->_calculator->round($tax);
|
93 |
+
$baseTax = $this->_calculator->round($baseTax);
|
94 |
+
$this->_addAmount(max(0, $tax));
|
95 |
+
$this->_addBaseAmount(max(0, $baseTax));
|
96 |
+
}
|
97 |
+
|
98 |
+
if ($inclTax && !empty($discountAmount)) {
|
99 |
+
$hiddenTax = $this->_calculator->calcTaxAmount($discountAmount, $rate, $inclTax, false);
|
100 |
+
$baseHiddenTax = $this->_calculator->calcTaxAmount($baseDiscountAmount, $rate, $inclTax, false);
|
101 |
+
$this->_hiddenTaxes[] = array(
|
102 |
+
'rate_key' => $rateKey,
|
103 |
+
'value' => $hiddenTax,
|
104 |
+
'base_value' => $baseHiddenTax,
|
105 |
+
'incl_tax' => $inclTax,
|
106 |
+
);
|
107 |
+
}
|
108 |
+
|
109 |
+
$address->setShippingTaxAmount(max(0, $tax));
|
110 |
+
$address->setBaseShippingTaxAmount(max(0, $baseTax));
|
111 |
+
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
112 |
+
$this->_saveAppliedTaxes($address, $applied, $tax, $baseTax, $rate);
|
113 |
+
|
114 |
+
return $this;
|
115 |
+
}
|
116 |
+
|
117 |
+
}
|
118 |
+
|
app/code/community/Smartsend/Logistics/Model/ShippingMethods.php
ADDED
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Status.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_ShippingMethods extends Varien_Object {
|
27 |
+
|
28 |
+
static public function getOptionArray($carrier) {
|
29 |
+
|
30 |
+
|
31 |
+
$carrier_name = explode('groups[', $carrier); //getting carrier name
|
32 |
+
|
33 |
+
$carrier_name = explode(']', $carrier_name[1]);
|
34 |
+
|
35 |
+
$carrier_name = $carrier_name[0];
|
36 |
+
|
37 |
+
if ($carrier_name == 'smartsendbring') {
|
38 |
+
|
39 |
+
//Bring shipping methods
|
40 |
+
$shipping_methods = array(
|
41 |
+
'private',
|
42 |
+
'privatehome',
|
43 |
+
'commercial',
|
44 |
+
'commercial_bulksplit',
|
45 |
+
'private_bulksplit',
|
46 |
+
'privatehome_bulksplit'
|
47 |
+
);
|
48 |
+
if(Mage::helper('logistics/data')->isVconnetEnabled() == false) {
|
49 |
+
array_unshift($shipping_methods,'pickup');
|
50 |
+
}
|
51 |
+
|
52 |
+
$method_names = array_flip(Mage::getModel('logistics/shippingMethods')->getMethodName());
|
53 |
+
|
54 |
+
$methods_array = array();
|
55 |
+
foreach ($shipping_methods as $key => $value) {
|
56 |
+
|
57 |
+
if (array_key_exists($value, $method_names)) {
|
58 |
+
$methods_array[$method_names[$value]] = $method_names[$value];
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
return $methods_array;
|
63 |
+
} elseif ($carrier_name == 'smartsendpostdanmark') {
|
64 |
+
|
65 |
+
//Post Danmark shipping methods
|
66 |
+
$shipping_methods = array(
|
67 |
+
'private',
|
68 |
+
'privatehome',
|
69 |
+
'commercial',
|
70 |
+
'dpdclassic',
|
71 |
+
'dpdguranty',
|
72 |
+
'valuemail',
|
73 |
+
'privatesamsending',
|
74 |
+
'privatepriority',
|
75 |
+
'privateeconomy'
|
76 |
+
);
|
77 |
+
if(Mage::helper('logistics/data')->isVconnetEnabled() == false) {
|
78 |
+
array_unshift($shipping_methods,'pickup');
|
79 |
+
}
|
80 |
+
|
81 |
+
$method_names = array_flip(Mage::getModel('logistics/shippingMethods')->getMethodName());
|
82 |
+
|
83 |
+
$methods_array = array();
|
84 |
+
foreach ($shipping_methods as $key => $value) {
|
85 |
+
|
86 |
+
if (array_key_exists($value, $method_names)) {
|
87 |
+
$methods_array[$method_names[$value]] = $method_names[$value];
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
return $methods_array;
|
92 |
+
} elseif ($carrier_name == 'smartsendposten') {
|
93 |
+
|
94 |
+
//Posten shipping methods
|
95 |
+
$shipping_methods = array(
|
96 |
+
'private',
|
97 |
+
'privatehome',
|
98 |
+
'commercial',
|
99 |
+
'valuemail',
|
100 |
+
'valuemailfirstclass',
|
101 |
+
'valuemaileconomy',
|
102 |
+
'maximail'
|
103 |
+
);
|
104 |
+
if(Mage::helper('logistics/data')->isVconnetEnabled() == false) {
|
105 |
+
array_unshift($shipping_methods,'pickup');
|
106 |
+
}
|
107 |
+
|
108 |
+
$method_names = array_flip(Mage::getModel('logistics/shippingMethods')->getMethodName());
|
109 |
+
|
110 |
+
$methods_array = array();
|
111 |
+
foreach ($shipping_methods as $key => $value) {
|
112 |
+
|
113 |
+
if (array_key_exists($value, $method_names)) {
|
114 |
+
$methods_array[$method_names[$value]] = $method_names[$value];
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
return $methods_array;
|
119 |
+
} elseif ($carrier_name == 'smartsendswipbox') {
|
120 |
+
|
121 |
+
//SwipBox shipping methods
|
122 |
+
$shipping_methods = array(
|
123 |
+
'pickup'
|
124 |
+
);
|
125 |
+
|
126 |
+
$method_names = array_flip(Mage::getModel('logistics/shippingMethods')->getMethodName());
|
127 |
+
|
128 |
+
$methods_array = array();
|
129 |
+
foreach ($shipping_methods as $key => $value) {
|
130 |
+
|
131 |
+
if (array_key_exists($value, $method_names)) {
|
132 |
+
$methods_array[$method_names[$value]] = $method_names[$value];
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
return $methods_array;
|
137 |
+
} elseif ($carrier_name == 'smartsendpickup') {
|
138 |
+
|
139 |
+
//Closest shipping methods
|
140 |
+
$shipping_methods = array();
|
141 |
+
if(Mage::helper('logistics/data')->isVconnetEnabled() == false) {
|
142 |
+
array_unshift($shipping_methods,'pickup');
|
143 |
+
}
|
144 |
+
|
145 |
+
$method_names = array_flip(Mage::getModel('logistics/shippingMethods')->getMethodName());
|
146 |
+
|
147 |
+
$methods_array = array();
|
148 |
+
foreach ($shipping_methods as $key => $value) {
|
149 |
+
|
150 |
+
if (array_key_exists($value, $method_names)) {
|
151 |
+
$methods_array[$method_names[$value]] = $method_names[$value];
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
return $methods_array;
|
156 |
+
} elseif ($carrier_name == 'smartsendgls') {
|
157 |
+
|
158 |
+
//GLS shipping methods
|
159 |
+
$shipping_methods = array(
|
160 |
+
'private',
|
161 |
+
'privatehome',
|
162 |
+
'commercial'
|
163 |
+
);
|
164 |
+
if(Mage::helper('logistics/data')->isVconnetEnabled() == false) {
|
165 |
+
array_unshift($shipping_methods,'pickup');
|
166 |
+
}
|
167 |
+
|
168 |
+
$method_names = array_flip(Mage::getModel('logistics/shippingMethods')->getMethodName());
|
169 |
+
|
170 |
+
$methods_array = array();
|
171 |
+
foreach ($shipping_methods as $key => $value) {
|
172 |
+
|
173 |
+
if (array_key_exists($value, $method_names)) {
|
174 |
+
$methods_array[$method_names[$value]] = $method_names[$value];
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
return $methods_array;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
public function getMethodName() {
|
183 |
+
|
184 |
+
return array(
|
185 |
+
'Pickuppoint' => 'pickup',
|
186 |
+
'Private to home' => 'privatehome',
|
187 |
+
'Commercial' => 'commercial',
|
188 |
+
'Private' => 'private',
|
189 |
+
'DPDclassic' => 'dpdclassic',
|
190 |
+
'DPDguarantee' => 'dpdguranty',
|
191 |
+
'Valuemail' => 'valuemail',
|
192 |
+
'Valuemailfirstclass' => 'valuemailfirstclass',
|
193 |
+
'Valuemaileconomy' => 'valuemaileconomy',
|
194 |
+
'Maximail' => 'maximail',
|
195 |
+
'Commercial Bulksplit' => 'commercial_bulksplit',
|
196 |
+
'Private Bulksplit' => 'private_bulksplit',
|
197 |
+
'Privatehome Bulksplit' => 'privatehome_bulksplit',
|
198 |
+
'Private samsending' => 'privatesamsending',
|
199 |
+
'Private priority' => 'privatepriority',
|
200 |
+
'Private economy' => 'privateeconomy'
|
201 |
+
);
|
202 |
+
}
|
203 |
+
|
204 |
+
public function getTitleValue($opt) {
|
205 |
+
|
206 |
+
if ($opt == "Private") { //getting title of the shipping method
|
207 |
+
$label = "Privat";
|
208 |
+
} elseif ($opt == "Commercial") {
|
209 |
+
$label = "Erhverv";
|
210 |
+
} else {
|
211 |
+
$label = $opt;
|
212 |
+
}
|
213 |
+
|
214 |
+
return $label;
|
215 |
+
}
|
216 |
+
|
217 |
+
public function checkShippingFee($carrier, $shipping_country) { //cheking shipping fees for the shipping method
|
218 |
+
$orderPrice = Mage::getModel('checkout/session')->getQuote()->getGrandTotal(); //getting order total
|
219 |
+
$orderWeight = Mage::registry('ordweight'); //getting order weight
|
220 |
+
|
221 |
+
if (Mage::getStoreConfig('carriers/' . $carrier . '/price') != "") {
|
222 |
+
$pickupShippingRates = unserialize(Mage::getStoreConfig('carriers/' . $carrier . '/price', Mage::app()->getStore())); //unserializing the shipping rates from the shipping rate table
|
223 |
+
}
|
224 |
+
|
225 |
+
$cheapestexpensive = Mage::getStoreConfig('carriers/' . $carrier . '/cheapestexpensive', Mage::app()->getStore()); // get the Cheapest or most expensive for the admin system config
|
226 |
+
if (!$cheapestexpensive) {
|
227 |
+
$cheapestexpensive = 0;
|
228 |
+
}
|
229 |
+
|
230 |
+
//This array will contain the valid shipping methods
|
231 |
+
$shippingmethods = array();
|
232 |
+
|
233 |
+
if (is_array($pickupShippingRates)) {
|
234 |
+
|
235 |
+
foreach ($pickupShippingRates as $pickupShippingRate) {
|
236 |
+
$countries = explode(',', $pickupShippingRate['countries']);
|
237 |
+
$countries = array_map("strtoupper", $countries);
|
238 |
+
|
239 |
+
if(in_array(strtoupper($shipping_country), $countries)
|
240 |
+
&& (float)$pickupShippingRate['orderminprice'] <= (float)$orderPrice && (float)$pickupShippingRate['ordermaxprice'] >= (float)$orderPrice
|
241 |
+
&& (float)$pickupShippingRate['orderminweight'] <= (float)$orderWeight && (float)$pickupShippingRate['ordermaxweight'] >= (float)$orderWeight
|
242 |
+
) {
|
243 |
+
|
244 |
+
// The shipping rate is valid.
|
245 |
+
|
246 |
+
if(isset($shippingmethods[$pickupShippingRate['methods']]) && $shippingmethods[$pickupShippingRate['methods']] != '') {
|
247 |
+
//There is already a shipping method with the name in the array of valid shipping methods.
|
248 |
+
if ( (int)$cheapestexpensive == 0 && ( (float) $shippingmethods[$pickupShippingRate['methods']] > (float) $pickupShippingRate['pickupshippingfee'] )) {
|
249 |
+
//This method is cheaper and will override existing shipping method
|
250 |
+
$shippingmethods[$pickupShippingRate['methods']] = $pickupShippingRate['pickupshippingfee'];
|
251 |
+
} elseif ( (int)$cheapestexpensive == 1 && ( (float) $shippingmethods[$rates['methods']] < (float) $pickupShippingRate['pickupshippingfee'] )) {
|
252 |
+
//This method is more expensive and will override existing shipping method
|
253 |
+
$shippingmethods[$pickupShippingRate['methods']] = $pickupShippingRate['pickupshippingfee'];
|
254 |
+
}
|
255 |
+
} else {
|
256 |
+
//Add the shipping method to the array of valid methods.
|
257 |
+
$shippingmethods[$pickupShippingRate['methods']] = $pickupShippingRate['pickupshippingfee'];
|
258 |
+
}
|
259 |
+
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
return $shippingmethods;
|
264 |
+
}
|
265 |
+
|
266 |
+
public function getLabel() { //generate label method
|
267 |
+
// Dummy function that is not used
|
268 |
+
}
|
269 |
+
|
270 |
+
public function getReturnLabel() { //generate label method
|
271 |
+
// Dummy function that is not used
|
272 |
+
}
|
273 |
+
|
274 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Status.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Status.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_Status extends Varien_Object {
|
28 |
+
|
29 |
+
const STATUS_ENABLED = 1;
|
30 |
+
const STATUS_DISABLED = 2;
|
31 |
+
|
32 |
+
static public function getOptionArray() {
|
33 |
+
return array(
|
34 |
+
self::STATUS_ENABLED => $this->__('Enabled'),
|
35 |
+
self::STATUS_DISABLED => $this->__('Disabled')
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
app/code/community/Smartsend/Logistics/Model/Swipbox.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/Swipbox.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
class Smartsend_Logistics_Model_Swipbox extends Mage_Core_Model_Abstract {
|
27 |
+
|
28 |
+
public function _construct() {
|
29 |
+
parent::_construct();
|
30 |
+
$this->_init('logistics/swipbox');
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/CombinePdf.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/CombinePdf.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_System_CombinePdf extends Mage_Core_Model_Config_Data {
|
28 |
+
|
29 |
+
public function toOptionArray() { //Cheapest or Most Expensive method
|
30 |
+
$opt[] = array('value' => 0, 'label' => Mage::helper('adminhtml')->__("Seperate pdf's"));
|
31 |
+
$opt[] = array('value' => 1, 'label' => Mage::helper('adminhtml')->__("Combine pdf's into one file"));
|
32 |
+
return $opt;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/Listformat.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/Listformat.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_System_Listformat extends Mage_Core_Model_Config_Data {
|
28 |
+
|
29 |
+
public function toOptionArray() { //address list format for the admin system config
|
30 |
+
$opt[1] = array('value' => 1, 'label' => Mage::helper('adminhtml')->__("#Company, #Street, #Zipcode #City"));
|
31 |
+
$opt[2] = array('value' => 2, 'label' => Mage::helper('adminhtml')->__("#Company, #Street, #Zipcode"));
|
32 |
+
$opt[3] = array('value' => 3, 'label' => Mage::helper('adminhtml')->__("#Company, #Street, #City"));
|
33 |
+
$opt[4] = array('value' => 4, 'label' => Mage::helper('adminhtml')->__("#Company, #Street"));
|
34 |
+
return $opt;
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/OrderOption.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/OrderOption.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_System_OrderOption extends Mage_Core_Model_Config_Data {
|
28 |
+
|
29 |
+
public function toOptionArray() { //Cheapest or Most Expensive method
|
30 |
+
$opt[] = array('value' => 0, 'label' => Mage::helper('adminhtml')->__("Cheapest"));
|
31 |
+
$opt[] = array('value' => 1, 'label' => Mage::helper('adminhtml')->__("Most Expensive"));
|
32 |
+
return $opt;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/Pacsoftformat.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/Pickup/Pacsoftformat.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_System_Pacsoftformat extends Mage_Core_Model_Config_Data {
|
28 |
+
|
29 |
+
public function toOptionArray() {
|
30 |
+
$opt[] = array('value' => 'link', 'label' => Mage::helper('adminhtml')->__("Pacsoft link"));
|
31 |
+
$opt[] = array('value' => 'pdf', 'label' => Mage::helper('adminhtml')->__("PDF file"));
|
32 |
+
return $opt;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/Pickup/Listformat.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/Pickup/Listformat.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_System_Pickup_Listformat extends Smartsend_Logistics_Model_System_Listformat {
|
28 |
+
|
29 |
+
public function toOptionArray() { //address list format for the admin system config
|
30 |
+
$opt[0] = array('value' => 0, 'label' => Mage::helper('adminhtml')->__("#Company, #Street, #Zipcode #City (#Carrier)"));
|
31 |
+
return $opt + parent::toOptionArray();
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/PickupMethods.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/PickupMethods.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Smartsend_Logistics_Model_System_PickupMethods extends Mage_Core_Model_Config_Data {
|
29 |
+
|
30 |
+
public function toOptionArray() { //different pickup methods
|
31 |
+
$opt[] = array('value' => 'postdanmark', 'label' => Mage::helper('adminhtml')->__("PostDanmark"));
|
32 |
+
$opt[] = array('value' => 'swipbox', 'label' => Mage::helper('adminhtml')->__("Swipbox"));
|
33 |
+
$opt[] = array('value' => 'bring', 'label' => Mage::helper('adminhtml')->__("Bring"));
|
34 |
+
$opt[] = array('value' => 'gls', 'label' => Mage::helper('adminhtml')->__("GLS"));
|
35 |
+
$opt[] = array('value' => 'posten', 'label' => Mage::helper('adminhtml')->__("Posten"));
|
36 |
+
return $opt;
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/Return.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/Return.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_System_Return extends Mage_Core_Model_Config_Data {
|
28 |
+
|
29 |
+
public function toOptionArray() { //address list format for the admin system config
|
30 |
+
$opt[] = array('value' => '', 'label' => Mage::helper('adminhtml')->__("Same carrier"));
|
31 |
+
$opt[] = array('value' => 'smartsendpostdanmark_private', 'label' => Mage::helper('adminhtml')->__("Post Danmark"));
|
32 |
+
$opt[] = array('value' => 'smartsendgls_private', 'label' => Mage::helper('adminhtml')->__("GLS"));
|
33 |
+
$opt[] = array('value' => 'smartsendbring_private', 'label' => Mage::helper('adminhtml')->__("Bring"));
|
34 |
+
$opt[] = array('value' => 'smartsendposten_private', 'label' => Mage::helper('adminhtml')->__("Posten"));
|
35 |
+
return $opt;
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
app/code/community/Smartsend/Logistics/Model/System/Size.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/Model/System/Pickup/Size.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Smartsend_Logistics_Model_System_Size extends Mage_Core_Model_Config_Data {
|
28 |
+
|
29 |
+
public function toOptionArray() {
|
30 |
+
$opt[] = array('value' => 0, 'label' => Mage::helper('adminhtml')->__("Small"));
|
31 |
+
$opt[] = array('value' => 1, 'label' => Mage::helper('adminhtml')->__("Medium"));
|
32 |
+
$opt[] = array('value' => 2, 'label' => Mage::helper('adminhtml')->__("Large"));
|
33 |
+
return $opt;
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
app/code/community/Smartsend/Logistics/controllers/LogisticsController.php
ADDED
@@ -0,0 +1,399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Smartsend_Logistics_LogisticsController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
protected $request=array();
|
6 |
+
protected $response;
|
7 |
+
|
8 |
+
/*
|
9 |
+
$label = Mage::getModel('logistics/shippingMethods')->getLabel(); //calling label method in: /app/code/community/Smartsend/Logistics/Model/ShippingMethods.php
|
10 |
+
$returnlabel = Mage::getModel('logistics/shippingMethods')->getReturnLabel(); //calling label method in: /app/code/community/Smartsend/Logistics/Model/ShippingMethods.php
|
11 |
+
$this->_getSession()->addSuccess('Success message 2');
|
12 |
+
$this->_getSession()->addNotice('Notice message 2');
|
13 |
+
$this->_getSession()->addError('Error message 2');
|
14 |
+
*/
|
15 |
+
|
16 |
+
|
17 |
+
/***********
|
18 |
+
* Functions called from action buttons
|
19 |
+
***********/
|
20 |
+
|
21 |
+
|
22 |
+
/*
|
23 |
+
* Action: Create single order
|
24 |
+
*/
|
25 |
+
public function labelAction() { //label action
|
26 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
27 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
28 |
+
|
29 |
+
if((Mage::getStoreConfig('carriers/smartsend/username') == '' || Mage::getStoreConfig('carriers/smartsend/licencekey') == '') &&
|
30 |
+
(Mage::getStoreConfig('vconnect_postnord/general/username') == '' || Mage::getStoreConfig('vconnect_postnord/general/license_key') == '')) {
|
31 |
+
$this->_getSession()->addError($this->__("Username and licencekey must be entered in settings"));
|
32 |
+
} else {
|
33 |
+
$this->createOrder($order,false);
|
34 |
+
|
35 |
+
if($this->isRequest()) {
|
36 |
+
try{
|
37 |
+
$this->postRequest(true);
|
38 |
+
$this->handleRequest();
|
39 |
+
} catch(Exception $e) {
|
40 |
+
$this->_getSession()->addError($e->getMessage());
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->_redirectReferer();
|
46 |
+
return ;
|
47 |
+
}
|
48 |
+
|
49 |
+
/*
|
50 |
+
* Action: Create array of orders
|
51 |
+
*/
|
52 |
+
public function labelMassAction() { //label mass action
|
53 |
+
|
54 |
+
if((Mage::getStoreConfig('carriers/smartsend/username') == '' || Mage::getStoreConfig('carriers/smartsend/licencekey') == '') &&
|
55 |
+
(Mage::getStoreConfig('vconnect_postnord/general/username') == '' || Mage::getStoreConfig('vconnect_postnord/general/license_key') == '')) {
|
56 |
+
$this->_getSession()->addError($this->__("Username and licencekey must be entered in settings"));
|
57 |
+
} else {
|
58 |
+
|
59 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
60 |
+
if (!empty($orderIds)) {
|
61 |
+
foreach($orderIds as $orderId) {
|
62 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
63 |
+
$this->createOrder($order,false);
|
64 |
+
}
|
65 |
+
} else {
|
66 |
+
$this->_getSession()->addError($this->__('No orders selected'));
|
67 |
+
}
|
68 |
+
|
69 |
+
if($this->isRequest()) {
|
70 |
+
try{
|
71 |
+
$this->postRequest(false);
|
72 |
+
$this->handleRequest();
|
73 |
+
} catch(Exception $e) {
|
74 |
+
$this->_getSession()->addError($e->getMessage());
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->_redirectReferer();
|
81 |
+
return ;
|
82 |
+
}
|
83 |
+
|
84 |
+
/*
|
85 |
+
* Action: Create single return order
|
86 |
+
*/
|
87 |
+
public function labelreturnAction() { // return label action
|
88 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
89 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
90 |
+
|
91 |
+
if((Mage::getStoreConfig('carriers/smartsend/username') == '' || Mage::getStoreConfig('carriers/smartsend/licencekey') == '') &&
|
92 |
+
(Mage::getStoreConfig('vconnect_postnord/general/username') == '' || Mage::getStoreConfig('vconnect_postnord/general/license_key') == '')) {
|
93 |
+
$this->_getSession()->addError($this->__("Username and licencekey must be entered in settings"));
|
94 |
+
} else {
|
95 |
+
$this->createOrder($order,true);
|
96 |
+
|
97 |
+
if($this->isRequest()) {
|
98 |
+
try{
|
99 |
+
$this->postRequest(true);
|
100 |
+
$this->handleRequest();
|
101 |
+
} catch(Exception $e) {
|
102 |
+
$this->_getSession()->addError($e->getMessage());
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->_redirectReferer();
|
108 |
+
return ;
|
109 |
+
}
|
110 |
+
|
111 |
+
/*
|
112 |
+
* Action: Create array of return orders
|
113 |
+
*/
|
114 |
+
public function labelreturnMassAction() { //label return mass action
|
115 |
+
|
116 |
+
if((Mage::getStoreConfig('carriers/smartsend/username') == '' || Mage::getStoreConfig('carriers/smartsend/licencekey') == '') &&
|
117 |
+
(Mage::getStoreConfig('vconnect_postnord/general/username') == '' || Mage::getStoreConfig('vconnect_postnord/general/license_key') == '')) {
|
118 |
+
$this->_getSession()->addError($this->__("Username and licencekey must be entered in settings"));
|
119 |
+
} else {
|
120 |
+
|
121 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
122 |
+
if (!empty($orderIds)) {
|
123 |
+
foreach($orderIds as $orderId) {
|
124 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
125 |
+
$this->createOrder($order,true);
|
126 |
+
}
|
127 |
+
} else {
|
128 |
+
$this->_getSession()->addError($this->__('No orders selected'));
|
129 |
+
}
|
130 |
+
|
131 |
+
if($this->isRequest()) {
|
132 |
+
try{
|
133 |
+
$this->postRequest(false);
|
134 |
+
$this->handleRequest();
|
135 |
+
} catch(Exception $e) {
|
136 |
+
$this->_getSession()->addError($e->getMessage());
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
$this->_redirectReferer();
|
143 |
+
return ;
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
/***********
|
149 |
+
* Functions used to generate labels
|
150 |
+
***********/
|
151 |
+
|
152 |
+
/*
|
153 |
+
* Function: is there a requerst?
|
154 |
+
* both for single and mass generation
|
155 |
+
*/
|
156 |
+
private function isRequest() {
|
157 |
+
if(empty($this->request)) {
|
158 |
+
return false;
|
159 |
+
} else {
|
160 |
+
return true;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
/*
|
166 |
+
* Function: Get JSON request
|
167 |
+
* both for single and mass generation
|
168 |
+
*/
|
169 |
+
private function getJsonRequest() {
|
170 |
+
if(empty($this->request)) {
|
171 |
+
throw new Exception($this->__("Trying to send empty order array"));
|
172 |
+
} else {
|
173 |
+
return json_encode($this->request);
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
/*
|
178 |
+
* Function: Create an order request
|
179 |
+
* both for single and mass generation
|
180 |
+
*/
|
181 |
+
private function createOrder($order,$return=false) {
|
182 |
+
|
183 |
+
$smartsendorder = Mage::getModel('logistics/order');
|
184 |
+
$smartsendorder->setOrderObject($order);
|
185 |
+
$smartsendorder->setReturn($return);
|
186 |
+
try {
|
187 |
+
$smartsendorder->setInfo();
|
188 |
+
$smartsendorder->setReceiver();
|
189 |
+
$smartsendorder->setSender();
|
190 |
+
$smartsendorder->setAgent();
|
191 |
+
$smartsendorder->setService();
|
192 |
+
$smartsendorder->setParcels();
|
193 |
+
|
194 |
+
//All done. Add to request.
|
195 |
+
$this->request[] = $smartsendorder->getFinalOrder();
|
196 |
+
|
197 |
+
//$this->_getSession()->addNotice("Order " . $order->getIncrementId() .": ".json_encode($smartsendorder->getFinalOrder()));
|
198 |
+
} catch(Exception $e) {
|
199 |
+
$this->_getSession()->addError("Order #" . $order->getIncrementId() .": ".$e->getMessage());
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/*
|
204 |
+
* Function: POST final cURL request
|
205 |
+
* both for single and mass generation
|
206 |
+
*/
|
207 |
+
private function postRequest($single=false) {
|
208 |
+
|
209 |
+
$ch = curl_init(); //intitiate curl
|
210 |
+
|
211 |
+
/* Script URL */
|
212 |
+
if($single == true) {
|
213 |
+
$url = 'https://smartsend-prod.apigee.net/v7/booking/order';
|
214 |
+
} elseif($single == false) {
|
215 |
+
$url = 'https://smartsend-prod.apigee.net/v7/booking/orders';
|
216 |
+
} else {
|
217 |
+
throw new Exception('Unknown post method: '.$single);
|
218 |
+
}
|
219 |
+
|
220 |
+
if(Mage::getStoreConfig('carriers/smartsend/username') == '' && Mage::helper('core')->isModuleEnabled('Vconnect_Postnord')) {
|
221 |
+
$username = Mage::getStoreConfig('vconnect_postnord/general/username');
|
222 |
+
$licensekey = Mage::getStoreConfig('vconnect_postnord/general/license_key');
|
223 |
+
} else {
|
224 |
+
$username = Mage::getStoreConfig('carriers/smartsend/username');
|
225 |
+
$licensekey = Mage::getStoreConfig('carriers/smartsend/licencekey');
|
226 |
+
}
|
227 |
+
|
228 |
+
curl_setopt($ch, CURLOPT_URL, $url); //curl url
|
229 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
230 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->getJsonRequest());
|
231 |
+
//curl_setopt($ch, CURLOPT_HTTPGET, true); //curl request method
|
232 |
+
//curl_setopt($ch, CURLOPT_HEADER, false);
|
233 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
234 |
+
'apikey:yL18TETUVQ7E9pgVb6JeV1erIYHAMcwe',
|
235 |
+
'smartsendmail:'.$username,
|
236 |
+
'smartsendlicence:'.$licensekey,
|
237 |
+
'cmssystem:Magento',
|
238 |
+
'cmsversion:'.Mage::getVersion(),
|
239 |
+
'appversion:'.Mage::getConfig()->getNode('modules/Smartsend_Logistics')->version,
|
240 |
+
'Content-Type:application/json; charset=UTF-8'
|
241 |
+
)); //curl request header
|
242 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
243 |
+
|
244 |
+
$this->response = new StdClass(); //creating new class
|
245 |
+
$this->response->body = curl_exec($ch); //executing the curl
|
246 |
+
$this->response->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
247 |
+
$this->response->meta = curl_getinfo($ch);
|
248 |
+
$curl_error = ($this->response->code > 0 ? null : curl_error($ch) . ' (' . curl_errno($ch) . ')'); //getting error from curl if any
|
249 |
+
|
250 |
+
curl_close($ch); //closing the curl
|
251 |
+
|
252 |
+
if ($curl_error) {
|
253 |
+
throw new Exception($this->__('An error occurred while sending order').': ' . $curl_error);
|
254 |
+
}
|
255 |
+
|
256 |
+
if(!($this->response->code >= '200') || !($this->response->code <= '210')) {
|
257 |
+
throw new Exception($this->__('Response').': ('.$this->response->code.') '.$this->response->body);
|
258 |
+
}
|
259 |
+
|
260 |
+
}
|
261 |
+
|
262 |
+
|
263 |
+
/*
|
264 |
+
* Add Track and Trace number to parcels
|
265 |
+
* @string shipment_reference: unique if of shipment
|
266 |
+
* @string tracecode
|
267 |
+
*/
|
268 |
+
private function addTraceToShipment($shipment_reference,$tracecode) {
|
269 |
+
|
270 |
+
/* $shipment_collection = Mage::getResourceModel('sales/order_shipment_collection');
|
271 |
+
$shipment_collection->addAttributeToFilter('order_id', $order_id);
|
272 |
+
|
273 |
+
foreach($shipment_collection as $sc) {
|
274 |
+
$shipment = Mage::getModel('sales/order_shipment');
|
275 |
+
$shipment->load($sc->getId());
|
276 |
+
if($shipment->getId() != '') {
|
277 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
278 |
+
->setShipment($shipment)
|
279 |
+
->setData('title', 'ShippingMethodName')
|
280 |
+
->setData('number', $track_no)
|
281 |
+
->setData('carrier_code', 'ShippingCarrierCode')
|
282 |
+
->setData('order_id', $shipment->getData('order_id'))
|
283 |
+
->save();
|
284 |
+
}
|
285 |
+
} */
|
286 |
+
|
287 |
+
$shipment = Mage::getModel('sales/order_shipment');
|
288 |
+
$shipment->load($shipment_reference);
|
289 |
+
if($shipment->getId() != '') {
|
290 |
+
$order = Mage::getModel('sales/order')->load($shipment->getData('order_id'));
|
291 |
+
$smartsendorder = Mage::getModel('logistics/order');
|
292 |
+
$smartsendorder->setOrderObject($order);
|
293 |
+
|
294 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
295 |
+
->setShipment($shipment)
|
296 |
+
->setData('title', $smartsendorder->getShippingMethod())
|
297 |
+
->setData('number', $tracecode)
|
298 |
+
->setData('carrier_code', $smartsendorder->getShippingCarrierId())
|
299 |
+
->setData('order_id', $shipment->getData('order_id'))
|
300 |
+
->save();
|
301 |
+
} else {
|
302 |
+
throw new Exception($this->__('Failed to insert tracecode'));
|
303 |
+
}
|
304 |
+
|
305 |
+
}
|
306 |
+
|
307 |
+
/*
|
308 |
+
* Function: go through parcels and add trace code
|
309 |
+
*/
|
310 |
+
private function verifyParcels($json) {
|
311 |
+
if(isset($json->parcels) && is_array($json->parcels)) {
|
312 |
+
foreach($json->parcels as $parcel) {
|
313 |
+
if(isset($parcel->reference) && $parcel->reference != '' && isset($parcel->tracecode) && $parcel->tracecode != '') {
|
314 |
+
$this->addTraceToShipment($parcel->reference, $parcel->tracecode);
|
315 |
+
}
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
|
321 |
+
/*
|
322 |
+
* Function: Handle cURL response
|
323 |
+
* both for single and mass generation
|
324 |
+
*/
|
325 |
+
private function handleRequest() {
|
326 |
+
if(strpos($this->response->meta['content_type'],'json') !== false) {
|
327 |
+
$json = json_decode($this->response->body);
|
328 |
+
/* $this->_getSession()->addNotice($this->getJsonRequest());
|
329 |
+
$this->_getSession()->addNotice($this->response->body); */
|
330 |
+
|
331 |
+
//Show a notice if info is given
|
332 |
+
if(isset($json->info)) {
|
333 |
+
if(is_array($json->info)) {
|
334 |
+
foreach($json->info as $info) {
|
335 |
+
$this->_getSession()->addNotice($info);
|
336 |
+
}
|
337 |
+
} else {
|
338 |
+
$this->_getSession()->addNotice($json->info);
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
+
if(isset($json->combine_pdf) && Mage::getStoreConfig('carriers/smartsend/combinepdf') == 1) {
|
343 |
+
$this->_getSession()->addSuccess('<a href="'. $json->combine_pdf .'" target="_blank">Combined PDF labels</a>');
|
344 |
+
}
|
345 |
+
|
346 |
+
if(isset($json->combine_link) && Mage::getStoreConfig('carriers/smartsend/combinepdf') == 1) {
|
347 |
+
$this->_getSession()->addSuccess('<a href="'. $json->combine_link .'" target="_blank">Combined label links</a>');
|
348 |
+
}
|
349 |
+
|
350 |
+
if(isset($json->orders) && is_array($json->orders)) {
|
351 |
+
// An array of orders was returned
|
352 |
+
foreach($json->orders as $json_order) {
|
353 |
+
if(isset($json_order->pdflink) && !(isset($json->combine_pdf) && Mage::getStoreConfig('carriers/smartsend/combinepdf') == 1)) {
|
354 |
+
$this->_getSession()->addSuccess('Order #'.$json_order->orderno.': <a href="'. $json_order->pdflink .'" target="_blank">PDF label</a>');
|
355 |
+
// Go through parcels and add trace to shipments
|
356 |
+
$this->verifyParcels($json_order);
|
357 |
+
} elseif(isset($json_order->link) && !(isset($json->combine_link) && Mage::getStoreConfig('carriers/smartsend/combinepdf') == 1)) {
|
358 |
+
$this->_getSession()->addSuccess('Order #'.$json_order->orderno.': <a href="'. $json_order->link .'" target="_blank">Label link</a>');
|
359 |
+
// Go through parcels and add trace to shipments
|
360 |
+
$this->verifyParcels($json_order);
|
361 |
+
} elseif( (isset($json_order->pdflink) || isset($json_order->link) ) && Mage::getStoreConfig('carriers/smartsend/combinepdf') == 1) {
|
362 |
+
$this->_getSession()->addSuccess('Order #'.$json_order->orderno.': '. $json_order->message);
|
363 |
+
$this->verifyParcels($json_order);
|
364 |
+
} else {
|
365 |
+
if(isset($json_order->status) && $json_order->status != '') {
|
366 |
+
$this->_getSession()->addError('Order #'.$json_order->orderno.': '. $json_order->message);
|
367 |
+
} else {
|
368 |
+
$this->_getSession()->addError($this->__('Unknown status').': '. $json_order->message);
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
} else {
|
374 |
+
// An array of orders was not returned. Check if just a single order was returned
|
375 |
+
|
376 |
+
if(isset($json->pdflink) && !(isset($json->combine_pdf) && Mage::getStoreConfig('carriers/smartsend/combinepdf') == 1)) {
|
377 |
+
$this->_getSession()->addSuccess('Order #'.$json->orderno.': <a href="'. $json->pdflink .'" target="_blank">PDF label</a>');
|
378 |
+
// Go through parcels and add trace to shipments
|
379 |
+
$this->verifyParcels($json);
|
380 |
+
} elseif(isset($json->link) && !(isset($json->combine_link) && Mage::getStoreConfig('carriers/smartsend/combinepdf') == 1)) {
|
381 |
+
$this->_getSession()->addSuccess('Order #'.$json->orderno.': <a href="'. $json->link .'" target="_blank">Label link</a>');
|
382 |
+
// Go through parcels and add trace to shipments
|
383 |
+
$this->verifyParcels($json);
|
384 |
+
} else {
|
385 |
+
if(isset($json->status) && $json->status != '') {
|
386 |
+
$this->_getSession()->addError('Order #'.$json->orderno.': '. $json->message);
|
387 |
+
} else {
|
388 |
+
$this->_getSession()->addError($this->__('Unknown status').': '. $json->message);
|
389 |
+
}
|
390 |
+
}
|
391 |
+
}
|
392 |
+
|
393 |
+
} else {
|
394 |
+
throw new Exception($this->__('Unknown content type').': '.$this->response->meta['content_type']);
|
395 |
+
}
|
396 |
+
|
397 |
+
}
|
398 |
+
|
399 |
+
}
|
app/code/community/Smartsend/Logistics/etc/config.xml
ADDED
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Smartsend_Logistics>
|
5 |
+
<version>7.0.5</version>
|
6 |
+
</Smartsend_Logistics>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<translate>
|
10 |
+
<modules>
|
11 |
+
<Smartsend_Logistics>
|
12 |
+
<files>
|
13 |
+
<default>Smartsend_Logistics.csv</default> <!--smartsend csv -->
|
14 |
+
</files>
|
15 |
+
</Smartsend_Logistics>
|
16 |
+
</modules>
|
17 |
+
</translate>
|
18 |
+
<routers>
|
19 |
+
<logistics>
|
20 |
+
<use>standard</use>
|
21 |
+
<args>
|
22 |
+
<module>Smartsend_Logistics</module> <!--smartsend module -->
|
23 |
+
<frontName>logistics</frontName>
|
24 |
+
</args>
|
25 |
+
</logistics>
|
26 |
+
</routers>
|
27 |
+
<layout>
|
28 |
+
<updates>
|
29 |
+
<logistics>
|
30 |
+
<file>logistics.xml</file> <!--smartsend fontend xml file -->
|
31 |
+
</logistics>
|
32 |
+
</updates>
|
33 |
+
</layout>
|
34 |
+
</frontend>
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<logistics>
|
38 |
+
<use>admin</use>
|
39 |
+
<args>
|
40 |
+
<module>Smartsend_Logistics</module> <!--smartsend admin -->
|
41 |
+
<frontName>logistics</frontName>
|
42 |
+
</args>
|
43 |
+
</logistics>
|
44 |
+
</routers>
|
45 |
+
</admin>
|
46 |
+
<adminhtml>
|
47 |
+
<translate>
|
48 |
+
<modules>
|
49 |
+
<Smartsend_Logistics>
|
50 |
+
<files>
|
51 |
+
<default>Smartsend_Logistics.csv</default>
|
52 |
+
</files>
|
53 |
+
</Smartsend_Logistics>
|
54 |
+
</modules>
|
55 |
+
</translate>
|
56 |
+
<acl>
|
57 |
+
<resources>
|
58 |
+
<all>
|
59 |
+
<title>Allow Everything</title> <!--smartsend permissions -->
|
60 |
+
</all>
|
61 |
+
<admin>
|
62 |
+
<children>
|
63 |
+
<Smartsend_Logistics>
|
64 |
+
<title>Logistics Module</title>
|
65 |
+
<sort_order>10</sort_order>
|
66 |
+
</Smartsend_Logistics>
|
67 |
+
</children>
|
68 |
+
</admin>
|
69 |
+
</resources>
|
70 |
+
</acl>
|
71 |
+
<layout>
|
72 |
+
<updates>
|
73 |
+
<logistics>
|
74 |
+
<file>logistics.xml</file> <!--smartsend admin layout -->
|
75 |
+
</logistics>
|
76 |
+
</updates>
|
77 |
+
</layout>
|
78 |
+
<events>
|
79 |
+
<!-- Used to add a button in the right corner of order_view -->
|
80 |
+
<adminhtml_widget_container_html_before>
|
81 |
+
<observers>
|
82 |
+
<adminhtml_widget_container_html_before>
|
83 |
+
<class>logistics/observer</class>
|
84 |
+
<type>model</type>
|
85 |
+
<method>adminhtmlWidgetContainerHtmlBefore</method>
|
86 |
+
</adminhtml_widget_container_html_before>
|
87 |
+
</observers>
|
88 |
+
</adminhtml_widget_container_html_before>
|
89 |
+
<!-- Used to add a mass action to the sales order grid -->
|
90 |
+
<core_block_abstract_prepare_layout_before>
|
91 |
+
<observers>
|
92 |
+
<core_block_abstract_prepare_layout_before>
|
93 |
+
<type>singleton</type>
|
94 |
+
<class>logistics/observer</class>
|
95 |
+
<method>addMassAction</method>
|
96 |
+
</core_block_abstract_prepare_layout_before>
|
97 |
+
</observers>
|
98 |
+
</core_block_abstract_prepare_layout_before>
|
99 |
+
</events>
|
100 |
+
</adminhtml>
|
101 |
+
<global>
|
102 |
+
<events>
|
103 |
+
<checkout_controller_onepage_save_shipping_method> <!-- overriding checkout save shipping method observer -->
|
104 |
+
<observers>
|
105 |
+
<checkout_controller_onepage_save_shipping_method>
|
106 |
+
<type>model</type>
|
107 |
+
<class>logistics/observer</class>
|
108 |
+
<method>saveShippingMethod</method>
|
109 |
+
</checkout_controller_onepage_save_shipping_method>
|
110 |
+
</observers>
|
111 |
+
</checkout_controller_onepage_save_shipping_method>
|
112 |
+
<sales_model_service_quote_submit_after> <!-- overriding sales submit observer -->
|
113 |
+
<observers>
|
114 |
+
<checkout_controller_onepage_save_shipping_method>
|
115 |
+
<type>model</type>
|
116 |
+
<class>logistics/observer</class>
|
117 |
+
<method>saveOrderAfter</method>
|
118 |
+
</checkout_controller_onepage_save_shipping_method>
|
119 |
+
</observers>
|
120 |
+
</sales_model_service_quote_submit_after>
|
121 |
+
<sales_order_load_after> <!-- overriding checkout sales order observer -->
|
122 |
+
<observers>
|
123 |
+
<sales_order_load_after>
|
124 |
+
<type>model</type>
|
125 |
+
<class>logistics/observer</class>
|
126 |
+
<method>loadOrderAfter</method>
|
127 |
+
</sales_order_load_after>
|
128 |
+
</observers>
|
129 |
+
</sales_order_load_after>
|
130 |
+
<sales_quote_load_after> <!-- overriding checkout sales quote observer -->
|
131 |
+
<observers>
|
132 |
+
<sales_quote_load_after>
|
133 |
+
<type>model</type>
|
134 |
+
<class>logistics/observer</class>
|
135 |
+
<method>loadQuoteAfter</method>
|
136 |
+
</sales_quote_load_after>
|
137 |
+
</observers>
|
138 |
+
</sales_quote_load_after>
|
139 |
+
</events>
|
140 |
+
<models>
|
141 |
+
<logistics>
|
142 |
+
<class>Smartsend_Logistics_Model</class>
|
143 |
+
<resourceModel>logistics_mysql4</resourceModel>
|
144 |
+
</logistics>
|
145 |
+
<logistics_mysql4>
|
146 |
+
<class>Smartsend_Logistics_Model_Mysql4</class>
|
147 |
+
<entities>
|
148 |
+
<postdanmark>
|
149 |
+
<table>smartsend_pickup</table>
|
150 |
+
</postdanmark>
|
151 |
+
<posten>
|
152 |
+
<table>smartsend_pickup</table>
|
153 |
+
</posten>
|
154 |
+
<swipbox>
|
155 |
+
<table>smartsend_pickup</table>
|
156 |
+
</swipbox>
|
157 |
+
<gls>
|
158 |
+
<table>smartsend_pickup</table>
|
159 |
+
</gls>
|
160 |
+
<bring>
|
161 |
+
<table>smartsend_pickup</table>
|
162 |
+
</bring>
|
163 |
+
<pickup>
|
164 |
+
<table>smartsend_pickup</table>
|
165 |
+
</pickup>
|
166 |
+
<shipping>
|
167 |
+
<table>shipping_rates_name</table>
|
168 |
+
</shipping>
|
169 |
+
<shippingrates>
|
170 |
+
<table>pickup_shipping_rates</table>
|
171 |
+
</shippingrates>
|
172 |
+
</entities>
|
173 |
+
</logistics_mysql4>
|
174 |
+
</models>
|
175 |
+
<resources>
|
176 |
+
<logistics_setup>
|
177 |
+
<setup>
|
178 |
+
<module>Smartsend_Logistics</module>
|
179 |
+
</setup>
|
180 |
+
<connection>
|
181 |
+
<use>core_setup</use>
|
182 |
+
</connection>
|
183 |
+
</logistics_setup>
|
184 |
+
<logistics_write>
|
185 |
+
<connection>
|
186 |
+
<use>core_write</use>
|
187 |
+
</connection>
|
188 |
+
</logistics_write>
|
189 |
+
<logistics_read>
|
190 |
+
<connection>
|
191 |
+
<use>core_read</use>
|
192 |
+
</connection>
|
193 |
+
</logistics_read>
|
194 |
+
</resources>
|
195 |
+
<blocks>
|
196 |
+
<logistics>
|
197 |
+
<class>Smartsend_Logistics_Block</class>
|
198 |
+
</logistics>
|
199 |
+
</blocks>
|
200 |
+
<helpers>
|
201 |
+
<logistics>
|
202 |
+
<class>Smartsend_Logistics_Helper</class>
|
203 |
+
</logistics>
|
204 |
+
</helpers>
|
205 |
+
<models>
|
206 |
+
<tax>
|
207 |
+
<rewrite>
|
208 |
+
<sales_total_quote_shipping>Smartsend_Logistics_Model_Rewrite_Sales_Total_Quote_Shipping</sales_total_quote_shipping>
|
209 |
+
</rewrite>
|
210 |
+
</tax>
|
211 |
+
</models>
|
212 |
+
<models>
|
213 |
+
<tax>
|
214 |
+
<rewrite>
|
215 |
+
<sales_total_quote_tax>Smartsend_Logistics_Model_Rewrite_Sales_Total_Quote_Tax</sales_total_quote_tax>
|
216 |
+
</rewrite>
|
217 |
+
</tax>
|
218 |
+
</models>
|
219 |
+
|
220 |
+
</global>
|
221 |
+
<default> <!-- default for the carriers -->
|
222 |
+
<carriers>
|
223 |
+
<smartsend>
|
224 |
+
<username></username>
|
225 |
+
<licencekey></licencekey>
|
226 |
+
<combinepdf>0</combinepdf>
|
227 |
+
</smartsend>
|
228 |
+
<smartsendpostdanmark>
|
229 |
+
<active>0</active> <!-- is not active -->
|
230 |
+
<model>logistics/carrier_postdanmark</model>
|
231 |
+
<title>Post Danmark</title> <!-- title -->
|
232 |
+
<cheapestexpensive>0</cheapestexpensive> <!-- is cheapest -->
|
233 |
+
<excludetax>0</excludetax> <!-- Exclude from TAX -->
|
234 |
+
<listformat>1</listformat> <!-- is listtype #Company, #Street, #Zipcode #City-->
|
235 |
+
<format>pdf</format> <!-- format is PDF file -->
|
236 |
+
<quickid>1</quickid> <!-- Default QuickId=1 -->
|
237 |
+
<waybillid></waybillid> <!-- Default WaybillId=NULL -->
|
238 |
+
<notemail>1</notemail> <!-- Email notification is ON -->
|
239 |
+
<notesms>1</notesms> <!-- SMS notification is ON -->
|
240 |
+
<prenote>0</prenote> <!-- pre-notification is OFF -->
|
241 |
+
<return></return> <!-- standard return shipping method -->
|
242 |
+
</smartsendpostdanmark>
|
243 |
+
<smartsendposten>
|
244 |
+
<active>0</active>
|
245 |
+
<model>logistics/carrier_posten</model>
|
246 |
+
<title>Posten</title>
|
247 |
+
<cheapestexpensive>0</cheapestexpensive>
|
248 |
+
<excludetax>0</excludetax>
|
249 |
+
<listformat>1</listformat>
|
250 |
+
<format>pdf</format>
|
251 |
+
<quickid>1</quickid>
|
252 |
+
<waybillid></waybillid>
|
253 |
+
<notemail>1</notemail>
|
254 |
+
<notesms>1</notesms>
|
255 |
+
<prenote>0</prenote>
|
256 |
+
<return></return>
|
257 |
+
</smartsendposten>
|
258 |
+
<smartsendgls>
|
259 |
+
<active>0</active>
|
260 |
+
<model>logistics/carrier_gls</model>
|
261 |
+
<title>GLS</title>
|
262 |
+
<cheapestexpensive>0</cheapestexpensive>
|
263 |
+
<excludetax>0</excludetax>
|
264 |
+
<listformat>1</listformat>
|
265 |
+
<notemail>1</notemail>
|
266 |
+
<notesms>1</notesms>
|
267 |
+
<return></return>
|
268 |
+
</smartsendgls>
|
269 |
+
<smartsendbring>
|
270 |
+
<active>0</active>
|
271 |
+
<model>logistics/carrier_bring</model>
|
272 |
+
<title>Bring</title>
|
273 |
+
<cheapestexpensive>0</cheapestexpensive>
|
274 |
+
<excludetax>0</excludetax>
|
275 |
+
<listformat>1</listformat>
|
276 |
+
<notemail>1</notemail>
|
277 |
+
<notesms>1</notesms>
|
278 |
+
<return></return>
|
279 |
+
</smartsendbring>
|
280 |
+
<smartsendswipbox>
|
281 |
+
<active>0</active>
|
282 |
+
<model>logistics/carrier_swipbox</model>
|
283 |
+
<title>SwipBox</title>
|
284 |
+
<cheapestexpensive>0</cheapestexpensive>
|
285 |
+
<excludetax>0</excludetax>
|
286 |
+
<listformat>1</listformat>
|
287 |
+
<size>0</size>
|
288 |
+
<return></return>
|
289 |
+
</smartsendswipbox>
|
290 |
+
<smartsendpickup>
|
291 |
+
<active>0</active>
|
292 |
+
<model>logistics/carrier_pickup</model>
|
293 |
+
<methods>postdanmark,swipbox,bring,gls,posten</methods>
|
294 |
+
<title>Smart Send</title>
|
295 |
+
<name>Closest pickup</name>
|
296 |
+
<cheapestexpensive>0</cheapestexpensive>
|
297 |
+
<excludetax>0</excludetax>
|
298 |
+
<listformat>0</listformat>
|
299 |
+
<return></return>
|
300 |
+
</smartsendpickup>
|
301 |
+
</carriers>
|
302 |
+
</default>
|
303 |
+
</config>
|
app/code/community/Smartsend/Logistics/etc/system.xml
ADDED
@@ -0,0 +1,865 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections> <!-- system config section -->
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<smartsend translate="label" module="logistics">
|
7 |
+
<label>Smart Send ApS</label>
|
8 |
+
<comment>
|
9 |
+
<![CDATA[<div class="smartsend"><p style="background: #FFFFFF;border: 1px solid orange;font-weight: bold; padding: 20px;width:55%">
|
10 |
+
If you don't have a Smart Send subscription please create one at our website: <a href="http://www.smartsend.dk" target="_blank">Smart Send</a>
|
11 |
+
</p></div>]]>
|
12 |
+
</comment>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>90</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<fields>
|
19 |
+
<username translate="label">
|
20 |
+
<label>Username</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>110</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
</username>
|
27 |
+
<licencekey translate="label">
|
28 |
+
<label>Licencekey</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>120</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</licencekey>
|
35 |
+
<combinepdf translate="label">
|
36 |
+
<label>Combine PDF files?</label>
|
37 |
+
<source_model>logistics/system_combinePdf</source_model>
|
38 |
+
<frontend_type>radios</frontend_type>
|
39 |
+
<sort_order>130</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</combinepdf>
|
44 |
+
</fields>
|
45 |
+
</smartsend>
|
46 |
+
<smartsendpostdanmark translate="label" module="logistics">
|
47 |
+
<label>Smart Send - Post Danmark</label>
|
48 |
+
<comment>
|
49 |
+
<![CDATA[<div class="smartsend"><p style="background: #FFFFFF;border: 1px solid orange;font-weight: bold; padding: 20px;width:55%">
|
50 |
+
This shipping method may only be used if a valid Smart Send licence is purchased. Please see <a href="http://www.smartsend.dk" target="_blank">Smart Send</a> for further information.
|
51 |
+
</p></div>]]>
|
52 |
+
</comment>
|
53 |
+
<frontend_type>text</frontend_type>
|
54 |
+
<sort_order>91</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>1</show_in_store>
|
58 |
+
<fields>
|
59 |
+
<active translate="label">
|
60 |
+
<label>Enabled</label>
|
61 |
+
<frontend_type>select</frontend_type>
|
62 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
63 |
+
<sort_order>110</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>1</show_in_store>
|
67 |
+
</active>
|
68 |
+
<title translate="label">
|
69 |
+
<label>Carrier Title</label>
|
70 |
+
<frontend_type>text</frontend_type>
|
71 |
+
<sort_order>115</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</title>
|
76 |
+
<price translate="label">
|
77 |
+
<label>Price</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<frontend_model>smartsend_logistics_block_adminhtml_shipping</frontend_model>
|
80 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
81 |
+
<sort_order>120</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
</price>
|
86 |
+
<cheapestexpensive translate="label">
|
87 |
+
<label>Cheapest or most expensive?</label>
|
88 |
+
<source_model>logistics/system_orderOption</source_model>
|
89 |
+
<frontend_type>radios</frontend_type>
|
90 |
+
<sort_order>125</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
</cheapestexpensive>
|
95 |
+
<excludetax translate="label">
|
96 |
+
<label>Exclude from TAX</label>
|
97 |
+
<comment>Carrier is excluded from TAX even though there is a Shipping Tax defined</comment>
|
98 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
99 |
+
<frontend_type>select</frontend_type>
|
100 |
+
<sort_order>129</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</excludetax>
|
105 |
+
<listformat translate="label">
|
106 |
+
<label>Dropdown format</label>
|
107 |
+
<comment>How the dropdown is formatted</comment>
|
108 |
+
<source_model>logistics/system_listformat</source_model>
|
109 |
+
<frontend_type>select</frontend_type>
|
110 |
+
<sort_order>130</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>1</show_in_website>
|
113 |
+
<show_in_store>1</show_in_store>
|
114 |
+
</listformat>
|
115 |
+
<heading_services translate="label">
|
116 |
+
<label>Services</label>
|
117 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
118 |
+
<sort_order>135</sort_order>
|
119 |
+
<show_in_default>1</show_in_default>
|
120 |
+
<show_in_website>1</show_in_website>
|
121 |
+
<show_in_store>1</show_in_store>
|
122 |
+
</heading_services>
|
123 |
+
<format translate="label">
|
124 |
+
<label>Format</label>
|
125 |
+
<source_model>logistics/system_pacsoftformat</source_model>
|
126 |
+
<frontend_type>select</frontend_type>
|
127 |
+
<sort_order>140</sort_order>
|
128 |
+
<show_in_default>1</show_in_default>
|
129 |
+
<show_in_website>1</show_in_website>
|
130 |
+
<show_in_store>1</show_in_store>
|
131 |
+
</format>
|
132 |
+
<quickid translate="label">
|
133 |
+
<label>Pacsoft QuickID</label>
|
134 |
+
<validate>validate-alphanum</validate>
|
135 |
+
<frontend_type>text</frontend_type>
|
136 |
+
<sort_order>145</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>1</show_in_store>
|
140 |
+
</quickid>
|
141 |
+
<waybillid translate="label">
|
142 |
+
<label>Waybill ID</label>
|
143 |
+
<comment>Either just an id or a semicolon separated list of 'country,id' (* is all countries). Eg: SE,123;NO,321;*,44</comment>
|
144 |
+
<frontend_type>text</frontend_type>
|
145 |
+
<sort_order>146</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
</waybillid>
|
150 |
+
<notemail translate="label">
|
151 |
+
<label>Email notification</label>
|
152 |
+
<frontend_type>select</frontend_type>
|
153 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
154 |
+
<sort_order>150</sort_order>
|
155 |
+
<show_in_default>1</show_in_default>
|
156 |
+
<show_in_website>1</show_in_website>
|
157 |
+
<show_in_store>1</show_in_store>
|
158 |
+
</notemail>
|
159 |
+
<notesms translate="label">
|
160 |
+
<label>SMS notification</label>
|
161 |
+
<frontend_type>select</frontend_type>
|
162 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
163 |
+
<sort_order>155</sort_order>
|
164 |
+
<show_in_default>1</show_in_default>
|
165 |
+
<show_in_website>1</show_in_website>
|
166 |
+
<show_in_store>1</show_in_store>
|
167 |
+
</notesms>
|
168 |
+
<prenote translate="label">
|
169 |
+
<label>Pre-notification</label>
|
170 |
+
<frontend_type>select</frontend_type>
|
171 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
172 |
+
<sort_order>160</sort_order>
|
173 |
+
<show_in_default>1</show_in_default>
|
174 |
+
<show_in_website>1</show_in_website>
|
175 |
+
<show_in_store>1</show_in_store>
|
176 |
+
</prenote>
|
177 |
+
<prenote_receiver translate="label">
|
178 |
+
<label>Pre-notification receiver</label>
|
179 |
+
<comment>Leave blank if receiver should be the user</comment>
|
180 |
+
<frontend_type>Text</frontend_type>
|
181 |
+
<validate>validate-email</validate>
|
182 |
+
<sort_order>165</sort_order>
|
183 |
+
<show_in_default>1</show_in_default>
|
184 |
+
<show_in_website>1</show_in_website>
|
185 |
+
<show_in_store>1</show_in_store>
|
186 |
+
<depends>
|
187 |
+
<prenote>1</prenote>
|
188 |
+
</depends>
|
189 |
+
</prenote_receiver>
|
190 |
+
<prenote_sender translate="label">
|
191 |
+
<label>Pre-notification sender</label>
|
192 |
+
<frontend_type>Text</frontend_type>
|
193 |
+
<validate>validate-email</validate>
|
194 |
+
<sort_order>170</sort_order>
|
195 |
+
<show_in_default>1</show_in_default>
|
196 |
+
<show_in_website>1</show_in_website>
|
197 |
+
<show_in_store>1</show_in_store>
|
198 |
+
<depends>
|
199 |
+
<prenote>1</prenote>
|
200 |
+
</depends>
|
201 |
+
</prenote_sender>
|
202 |
+
<prenote_message translate="label">
|
203 |
+
<label>Pre-notification message</label>
|
204 |
+
<frontend_type>textarea</frontend_type>
|
205 |
+
<sort_order>171</sort_order>
|
206 |
+
<show_in_default>1</show_in_default>
|
207 |
+
<show_in_website>1</show_in_website>
|
208 |
+
<show_in_store>1</show_in_store>
|
209 |
+
<depends>
|
210 |
+
<prenote>1</prenote>
|
211 |
+
</depends>
|
212 |
+
</prenote_message>
|
213 |
+
<heading_return translate="label">
|
214 |
+
<label>Return</label>
|
215 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
216 |
+
<sort_order>175</sort_order>
|
217 |
+
<show_in_default>1</show_in_default>
|
218 |
+
<show_in_website>1</show_in_website>
|
219 |
+
<show_in_store>1</show_in_store>
|
220 |
+
</heading_return>
|
221 |
+
<return translate="label">
|
222 |
+
<label>Return methode</label>
|
223 |
+
<comment>Which carrier should handle return packages?</comment>
|
224 |
+
<source_model>logistics/system_return</source_model>
|
225 |
+
<frontend_type>select</frontend_type>
|
226 |
+
<sort_order>180</sort_order>
|
227 |
+
<show_in_default>1</show_in_default>
|
228 |
+
<show_in_website>1</show_in_website>
|
229 |
+
<show_in_store>1</show_in_store>
|
230 |
+
</return>
|
231 |
+
</fields>
|
232 |
+
</smartsendpostdanmark>
|
233 |
+
<smartsendgls translate="label" module="logistics">
|
234 |
+
<label>Smart Send - GLS</label>
|
235 |
+
<comment>
|
236 |
+
<![CDATA[<div class="smartsend"><p style="background: #FFFFFF;border: 1px solid orange;font-weight: bold; padding: 20px;width:55%">
|
237 |
+
This shipping method may only be used if a valid Smart Send licence is purchased. Please see <a href="http://www.smartsend.dk" target="_blank">Smart Send</a> for further information.
|
238 |
+
</p></div>]]>
|
239 |
+
</comment>
|
240 |
+
<frontend_type>text</frontend_type>
|
241 |
+
<sort_order>92</sort_order>
|
242 |
+
<show_in_default>1</show_in_default>
|
243 |
+
<show_in_website>1</show_in_website>
|
244 |
+
<show_in_store>1</show_in_store>
|
245 |
+
<fields>
|
246 |
+
<active translate="label">
|
247 |
+
<label>Enabled</label>
|
248 |
+
<frontend_type>select</frontend_type>
|
249 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
250 |
+
<sort_order>131</sort_order>
|
251 |
+
<show_in_default>1</show_in_default>
|
252 |
+
<show_in_website>1</show_in_website>
|
253 |
+
<show_in_store>1</show_in_store>
|
254 |
+
</active>
|
255 |
+
<title translate="label">
|
256 |
+
<label>Carrier Title</label>
|
257 |
+
<frontend_type>text</frontend_type>
|
258 |
+
<sort_order>132</sort_order>
|
259 |
+
<show_in_default>1</show_in_default>
|
260 |
+
<show_in_website>1</show_in_website>
|
261 |
+
<show_in_store>1</show_in_store>
|
262 |
+
</title>
|
263 |
+
<price translate="label">
|
264 |
+
<label>Price</label>
|
265 |
+
<frontend_type>text</frontend_type>
|
266 |
+
<frontend_model>smartsend_logistics_block_adminhtml_shipping</frontend_model>
|
267 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
268 |
+
<sort_order>133</sort_order>
|
269 |
+
<show_in_default>1</show_in_default>
|
270 |
+
<show_in_website>1</show_in_website>
|
271 |
+
<show_in_store>1</show_in_store>
|
272 |
+
</price>
|
273 |
+
<cheapestexpensive translate="label">
|
274 |
+
<label>Cheapest or most expensive?</label>
|
275 |
+
<source_model>logistics/system_orderOption</source_model>
|
276 |
+
<frontend_type>radios</frontend_type>
|
277 |
+
<sort_order>134</sort_order>
|
278 |
+
<show_in_default>1</show_in_default>
|
279 |
+
<show_in_website>1</show_in_website>
|
280 |
+
<show_in_store>1</show_in_store>
|
281 |
+
</cheapestexpensive>
|
282 |
+
<excludetax translate="label">
|
283 |
+
<label>Exclude from TAX</label>
|
284 |
+
<comment>Carrier is excluded from TAX even though there is a Shipping Tax defined</comment>
|
285 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
286 |
+
<frontend_type>select</frontend_type>
|
287 |
+
<sort_order>135</sort_order>
|
288 |
+
<show_in_default>1</show_in_default>
|
289 |
+
<show_in_website>1</show_in_website>
|
290 |
+
<show_in_store>1</show_in_store>
|
291 |
+
</excludetax>
|
292 |
+
<listformat translate="label">
|
293 |
+
<label>Dropdown format</label>
|
294 |
+
<comment>How the dropdown is formatted</comment>
|
295 |
+
<source_model>logistics/system_listformat</source_model>
|
296 |
+
<frontend_type>select</frontend_type>
|
297 |
+
<sort_order>136</sort_order>
|
298 |
+
<show_in_default>1</show_in_default>
|
299 |
+
<show_in_website>1</show_in_website>
|
300 |
+
<show_in_store>1</show_in_store>
|
301 |
+
</listformat>
|
302 |
+
<heading translate="label">
|
303 |
+
<label>Services</label>
|
304 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
305 |
+
<sort_order>137</sort_order>
|
306 |
+
<show_in_default>1</show_in_default>
|
307 |
+
<show_in_website>1</show_in_website>
|
308 |
+
<show_in_store>1</show_in_store>
|
309 |
+
</heading>
|
310 |
+
<notemail translate="label">
|
311 |
+
<label>Email notification</label>
|
312 |
+
<frontend_type>select</frontend_type>
|
313 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
314 |
+
<sort_order>138</sort_order>
|
315 |
+
<show_in_default>1</show_in_default>
|
316 |
+
<show_in_website>1</show_in_website>
|
317 |
+
<show_in_store>1</show_in_store>
|
318 |
+
</notemail>
|
319 |
+
<notesms translate="label">
|
320 |
+
<label>SMS notification</label>
|
321 |
+
<frontend_type>select</frontend_type>
|
322 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
323 |
+
<sort_order>139</sort_order>
|
324 |
+
<show_in_default>1</show_in_default>
|
325 |
+
<show_in_website>1</show_in_website>
|
326 |
+
<show_in_store>1</show_in_store>
|
327 |
+
</notesms>
|
328 |
+
<heading_return translate="label">
|
329 |
+
<label>Return</label>
|
330 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
331 |
+
<sort_order>140</sort_order>
|
332 |
+
<show_in_default>1</show_in_default>
|
333 |
+
<show_in_website>1</show_in_website>
|
334 |
+
<show_in_store>1</show_in_store>
|
335 |
+
</heading_return>
|
336 |
+
<return translate="label">
|
337 |
+
<label>Return methode</label>
|
338 |
+
<comment>Which carrier should handle return packages?</comment>
|
339 |
+
<source_model>logistics/system_return</source_model>
|
340 |
+
<frontend_type>select</frontend_type>
|
341 |
+
<sort_order>141</sort_order>
|
342 |
+
<show_in_default>1</show_in_default>
|
343 |
+
<show_in_website>1</show_in_website>
|
344 |
+
<show_in_store>1</show_in_store>
|
345 |
+
</return>
|
346 |
+
</fields>
|
347 |
+
</smartsendgls>
|
348 |
+
<smartsendbring translate="label" module="logistics">
|
349 |
+
<label>Smart Send - Bring</label>
|
350 |
+
<comment>
|
351 |
+
<![CDATA[<div class="smartsend"><p style="background: #FFFFFF;border: 1px solid orange;font-weight: bold; padding: 20px;width:55%">
|
352 |
+
This shipping method may only be used if a valid Smart Send licence is purchased. Please see <a href="http://www.smartsend.dk" target="_blank">Smart Send</a> for further information.
|
353 |
+
</p></div>]]>
|
354 |
+
</comment>
|
355 |
+
<frontend_type>text</frontend_type>
|
356 |
+
<sort_order>93</sort_order>
|
357 |
+
<show_in_default>1</show_in_default>
|
358 |
+
<show_in_website>1</show_in_website>
|
359 |
+
<show_in_store>1</show_in_store>
|
360 |
+
<fields>
|
361 |
+
<active translate="label">
|
362 |
+
<label>Enabled</label>
|
363 |
+
<frontend_type>select</frontend_type>
|
364 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
365 |
+
<sort_order>151</sort_order>
|
366 |
+
<show_in_default>1</show_in_default>
|
367 |
+
<show_in_website>1</show_in_website>
|
368 |
+
<show_in_store>1</show_in_store>
|
369 |
+
</active>
|
370 |
+
<title translate="label">
|
371 |
+
<label>Carrier Title</label>
|
372 |
+
<frontend_type>text</frontend_type>
|
373 |
+
<sort_order>152</sort_order>
|
374 |
+
<show_in_default>1</show_in_default>
|
375 |
+
<show_in_website>1</show_in_website>
|
376 |
+
<show_in_store>1</show_in_store>
|
377 |
+
</title>
|
378 |
+
<price translate="label">
|
379 |
+
<label>Price</label>
|
380 |
+
<frontend_type>text</frontend_type>
|
381 |
+
<frontend_model>smartsend_logistics_block_adminhtml_shipping</frontend_model>
|
382 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
383 |
+
<sort_order>153</sort_order>
|
384 |
+
<show_in_default>1</show_in_default>
|
385 |
+
<show_in_website>1</show_in_website>
|
386 |
+
<show_in_store>1</show_in_store>
|
387 |
+
</price>
|
388 |
+
<cheapestexpensive translate="label">
|
389 |
+
<label>Cheapest or most expensive?</label>
|
390 |
+
<source_model>logistics/system_orderOption</source_model>
|
391 |
+
<frontend_type>radios</frontend_type>
|
392 |
+
<sort_order>153</sort_order>
|
393 |
+
<show_in_default>1</show_in_default>
|
394 |
+
<show_in_website>1</show_in_website>
|
395 |
+
<show_in_store>1</show_in_store>
|
396 |
+
</cheapestexpensive>
|
397 |
+
<excludetax translate="label">
|
398 |
+
<label>Exclude from TAX</label>
|
399 |
+
<comment>Carrier is excluded from TAX even though there is a Shipping Tax defined</comment>
|
400 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
401 |
+
<frontend_type>select</frontend_type>
|
402 |
+
<sort_order>154</sort_order>
|
403 |
+
<show_in_default>1</show_in_default>
|
404 |
+
<show_in_website>1</show_in_website>
|
405 |
+
<show_in_store>1</show_in_store>
|
406 |
+
</excludetax>
|
407 |
+
<listformat translate="label">
|
408 |
+
<label>Dropdown format</label>
|
409 |
+
<comment>How the dropdown is formatted</comment>
|
410 |
+
<source_model>logistics/system_listformat</source_model>
|
411 |
+
<frontend_type>select</frontend_type>
|
412 |
+
<sort_order>155</sort_order>
|
413 |
+
<show_in_default>1</show_in_default>
|
414 |
+
<show_in_website>1</show_in_website>
|
415 |
+
<show_in_store>1</show_in_store>
|
416 |
+
</listformat>
|
417 |
+
<heading translate="label">
|
418 |
+
<label>Services</label>
|
419 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
420 |
+
<sort_order>156</sort_order>
|
421 |
+
<show_in_default>1</show_in_default>
|
422 |
+
<show_in_website>1</show_in_website>
|
423 |
+
<show_in_store>1</show_in_store>
|
424 |
+
</heading>
|
425 |
+
<notemail translate="label">
|
426 |
+
<label>Email notification</label>
|
427 |
+
<frontend_type>select</frontend_type>
|
428 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
429 |
+
<sort_order>157</sort_order>
|
430 |
+
<show_in_default>1</show_in_default>
|
431 |
+
<show_in_website>1</show_in_website>
|
432 |
+
<show_in_store>1</show_in_store>
|
433 |
+
</notemail>
|
434 |
+
<notesms translate="label">
|
435 |
+
<label>SMS notification</label>
|
436 |
+
<frontend_type>select</frontend_type>
|
437 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
438 |
+
<sort_order>158</sort_order>
|
439 |
+
<show_in_default>1</show_in_default>
|
440 |
+
<show_in_website>1</show_in_website>
|
441 |
+
<show_in_store>1</show_in_store>
|
442 |
+
</notesms>
|
443 |
+
<heading_return translate="label">
|
444 |
+
<label>Return</label>
|
445 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
446 |
+
<sort_order>159</sort_order>
|
447 |
+
<show_in_default>1</show_in_default>
|
448 |
+
<show_in_website>1</show_in_website>
|
449 |
+
<show_in_store>1</show_in_store>
|
450 |
+
</heading_return>
|
451 |
+
<return translate="label">
|
452 |
+
<label>Return methode</label>
|
453 |
+
<comment>Which carrier should handle return packages?</comment>
|
454 |
+
<source_model>logistics/system_return</source_model>
|
455 |
+
<frontend_type>select</frontend_type>
|
456 |
+
<sort_order>160</sort_order>
|
457 |
+
<show_in_default>1</show_in_default>
|
458 |
+
<show_in_website>1</show_in_website>
|
459 |
+
<show_in_store>1</show_in_store>
|
460 |
+
</return>
|
461 |
+
</fields>
|
462 |
+
</smartsendbring>
|
463 |
+
<smartsendswipbox translate="label" module="logistics">
|
464 |
+
<label>Smart Send - SwipBox</label>
|
465 |
+
<comment>
|
466 |
+
<![CDATA[<div class="smartsend"><p style="background: #FFFFFF;border: 1px solid orange;font-weight: bold; padding: 20px;width:55%">
|
467 |
+
This shipping method may only be used if a valid Smart Send licence is purchased. Please see <a href="http://www.smartsend.dk" target="_blank">Smart Send</a> for further information.
|
468 |
+
</p></div>]]>
|
469 |
+
</comment>
|
470 |
+
<frontend_type>text</frontend_type>
|
471 |
+
<sort_order>94</sort_order>
|
472 |
+
<show_in_default>1</show_in_default>
|
473 |
+
<show_in_website>1</show_in_website>
|
474 |
+
<show_in_store>1</show_in_store>
|
475 |
+
<fields>
|
476 |
+
<active translate="label">
|
477 |
+
<label>Enabled</label>
|
478 |
+
<frontend_type>select</frontend_type>
|
479 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
480 |
+
<sort_order>110</sort_order>
|
481 |
+
<show_in_default>1</show_in_default>
|
482 |
+
<show_in_website>1</show_in_website>
|
483 |
+
<show_in_store>1</show_in_store>
|
484 |
+
</active>
|
485 |
+
<title translate="label">
|
486 |
+
<label>Carrier Title</label>
|
487 |
+
<frontend_type>text</frontend_type>
|
488 |
+
<sort_order>115</sort_order>
|
489 |
+
<show_in_default>1</show_in_default>
|
490 |
+
<show_in_website>1</show_in_website>
|
491 |
+
<show_in_store>1</show_in_store>
|
492 |
+
</title>
|
493 |
+
<price translate="label">
|
494 |
+
<label>Price</label>
|
495 |
+
<frontend_type>text</frontend_type>
|
496 |
+
<frontend_model>smartsend_logistics_block_adminhtml_shipping</frontend_model>
|
497 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
498 |
+
<sort_order>120</sort_order>
|
499 |
+
<show_in_default>1</show_in_default>
|
500 |
+
<show_in_website>1</show_in_website>
|
501 |
+
<show_in_store>1</show_in_store>
|
502 |
+
</price>
|
503 |
+
<cheapestexpensive translate="label">
|
504 |
+
<label>Cheapest or most expensive?</label>
|
505 |
+
<source_model>logistics/system_orderOption</source_model>
|
506 |
+
<frontend_type>radios</frontend_type>
|
507 |
+
<sort_order>125</sort_order>
|
508 |
+
<show_in_default>1</show_in_default>
|
509 |
+
<show_in_website>1</show_in_website>
|
510 |
+
<show_in_store>1</show_in_store>
|
511 |
+
</cheapestexpensive>
|
512 |
+
<excludetax translate="label">
|
513 |
+
<label>Exclude from TAX</label>
|
514 |
+
<comment>Carrier is excluded from TAX even though there is a Shipping Tax defined</comment>
|
515 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
516 |
+
<frontend_type>select</frontend_type>
|
517 |
+
<sort_order>129</sort_order>
|
518 |
+
<show_in_default>1</show_in_default>
|
519 |
+
<show_in_website>1</show_in_website>
|
520 |
+
<show_in_store>1</show_in_store>
|
521 |
+
</excludetax>
|
522 |
+
<listformat translate="label">
|
523 |
+
<label>Dropdown format</label>
|
524 |
+
<comment>How the dropdown is formatted</comment>
|
525 |
+
<source_model>logistics/system_listformat</source_model>
|
526 |
+
<frontend_type>select</frontend_type>
|
527 |
+
<sort_order>130</sort_order>
|
528 |
+
<show_in_default>1</show_in_default>
|
529 |
+
<show_in_website>1</show_in_website>
|
530 |
+
<show_in_store>1</show_in_store>
|
531 |
+
</listformat>
|
532 |
+
<heading translate="label">
|
533 |
+
<label>Services</label>
|
534 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
535 |
+
<sort_order>135</sort_order>
|
536 |
+
<show_in_default>1</show_in_default>
|
537 |
+
<show_in_website>1</show_in_website>
|
538 |
+
<show_in_store>1</show_in_store>
|
539 |
+
</heading>
|
540 |
+
<size translate="label">
|
541 |
+
<label>Size</label>
|
542 |
+
<source_model>logistics/system_size</source_model>
|
543 |
+
<frontend_type>select</frontend_type>
|
544 |
+
<sort_order>140</sort_order>
|
545 |
+
<show_in_default>1</show_in_default>
|
546 |
+
<show_in_website>1</show_in_website>
|
547 |
+
<show_in_store>1</show_in_store>
|
548 |
+
</size>
|
549 |
+
<heading_return translate="label">
|
550 |
+
<label>Return</label>
|
551 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
552 |
+
<sort_order>145</sort_order>
|
553 |
+
<show_in_default>1</show_in_default>
|
554 |
+
<show_in_website>1</show_in_website>
|
555 |
+
<show_in_store>1</show_in_store>
|
556 |
+
</heading_return>
|
557 |
+
<return translate="label">
|
558 |
+
<label>Return methode</label>
|
559 |
+
<comment>Which carrier should handle return packages?</comment>
|
560 |
+
<source_model>logistics/system_return</source_model>
|
561 |
+
<frontend_type>select</frontend_type>
|
562 |
+
<sort_order>150</sort_order>
|
563 |
+
<show_in_default>1</show_in_default>
|
564 |
+
<show_in_website>1</show_in_website>
|
565 |
+
<show_in_store>1</show_in_store>
|
566 |
+
</return>
|
567 |
+
</fields>
|
568 |
+
</smartsendswipbox>
|
569 |
+
<smartsendpickup translate="label" module="logistics">
|
570 |
+
<label>Smart Send - Closest Pickup</label>
|
571 |
+
<comment>
|
572 |
+
<![CDATA[<div class="smartsend"><p style="background: #FFFFFF;border: 1px solid orange;font-weight: bold; padding: 20px;width:55%">
|
573 |
+
This shipping method may only be used if a valid Smart Send licence is purchased. Please see <a href="http://www.smartsend.dk" target="_blank">Smart Send</a> for further information.
|
574 |
+
</p></div>]]>
|
575 |
+
</comment>
|
576 |
+
<frontend_type>text</frontend_type>
|
577 |
+
<sort_order>95</sort_order>
|
578 |
+
<show_in_default>1</show_in_default>
|
579 |
+
<show_in_website>1</show_in_website>
|
580 |
+
<show_in_store>1</show_in_store>
|
581 |
+
<fields>
|
582 |
+
<active translate="label">
|
583 |
+
<label>Enabled</label>
|
584 |
+
<frontend_type>select</frontend_type>
|
585 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
586 |
+
<sort_order>501</sort_order>
|
587 |
+
<show_in_default>1</show_in_default>
|
588 |
+
<show_in_website>1</show_in_website>
|
589 |
+
<show_in_store>1</show_in_store>
|
590 |
+
</active>
|
591 |
+
<methods translate="label">
|
592 |
+
<label>Shipping Methods</label>
|
593 |
+
<frontend_type>Multiselect</frontend_type>
|
594 |
+
<source_model>logistics/system_pickupMethods</source_model>
|
595 |
+
<sort_order>502</sort_order>
|
596 |
+
<show_in_default>1</show_in_default>
|
597 |
+
<show_in_website>1</show_in_website>
|
598 |
+
<show_in_store>1</show_in_store>
|
599 |
+
</methods>
|
600 |
+
<title translate="label">
|
601 |
+
<label>Carrier Title</label>
|
602 |
+
<frontend_type>text</frontend_type>
|
603 |
+
<sort_order>503</sort_order>
|
604 |
+
<show_in_default>1</show_in_default>
|
605 |
+
<show_in_website>1</show_in_website>
|
606 |
+
<show_in_store>1</show_in_store>
|
607 |
+
</title>
|
608 |
+
<name translate="label">
|
609 |
+
<label>Method Name</label>
|
610 |
+
<frontend_type>text</frontend_type>
|
611 |
+
<sort_order>504</sort_order>
|
612 |
+
<show_in_default>1</show_in_default>
|
613 |
+
<show_in_website>1</show_in_website>
|
614 |
+
<show_in_store>1</show_in_store>
|
615 |
+
</name>
|
616 |
+
<price translate="label">
|
617 |
+
<label>Price</label>
|
618 |
+
<frontend_type>select</frontend_type>
|
619 |
+
<sort_order>505</sort_order>
|
620 |
+
<frontend_model>smartsend_logistics_block_adminhtml_pickupShipping</frontend_model>
|
621 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
622 |
+
<show_in_default>1</show_in_default>
|
623 |
+
<show_in_website>1</show_in_website>
|
624 |
+
<show_in_store>1</show_in_store>
|
625 |
+
</price>
|
626 |
+
<cheapestexpensive translate="label">
|
627 |
+
<label>Cheapest or most expensive?</label>
|
628 |
+
<source_model>logistics/system_orderOption</source_model>
|
629 |
+
<frontend_type>radios</frontend_type>
|
630 |
+
<sort_order>506</sort_order>
|
631 |
+
<show_in_default>1</show_in_default>
|
632 |
+
<show_in_website>1</show_in_website>
|
633 |
+
<show_in_store>1</show_in_store>
|
634 |
+
</cheapestexpensive>
|
635 |
+
<excludetax translate="label">
|
636 |
+
<label>Exclude from TAX</label>
|
637 |
+
<comment>Carrier is excluded from TAX even though there is a Shipping Tax defined</comment>
|
638 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
639 |
+
<frontend_type>select</frontend_type>
|
640 |
+
<sort_order>507</sort_order>
|
641 |
+
<show_in_default>1</show_in_default>
|
642 |
+
<show_in_website>1</show_in_website>
|
643 |
+
<show_in_store>1</show_in_store>
|
644 |
+
</excludetax>
|
645 |
+
<listformat translate="label">
|
646 |
+
<label>Dropdown format</label>
|
647 |
+
<comment>How the dropdown is formatted</comment>
|
648 |
+
<source_model>logistics/system_pickup_listformat</source_model>
|
649 |
+
<frontend_type>select</frontend_type>
|
650 |
+
<sort_order>508</sort_order>
|
651 |
+
<show_in_default>1</show_in_default>
|
652 |
+
<show_in_website>1</show_in_website>
|
653 |
+
<show_in_store>1</show_in_store>
|
654 |
+
</listformat>
|
655 |
+
<heading_return translate="label">
|
656 |
+
<label>Return</label>
|
657 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
658 |
+
<sort_order>509</sort_order>
|
659 |
+
<show_in_default>1</show_in_default>
|
660 |
+
<show_in_website>1</show_in_website>
|
661 |
+
<show_in_store>1</show_in_store>
|
662 |
+
</heading_return>
|
663 |
+
<return translate="label">
|
664 |
+
<label>Return methode</label>
|
665 |
+
<comment>Which carrier should handle return packages?</comment>
|
666 |
+
<source_model>logistics/system_return</source_model>
|
667 |
+
<frontend_type>select</frontend_type>
|
668 |
+
<sort_order>510</sort_order>
|
669 |
+
<show_in_default>1</show_in_default>
|
670 |
+
<show_in_website>1</show_in_website>
|
671 |
+
<show_in_store>1</show_in_store>
|
672 |
+
</return>
|
673 |
+
</fields>
|
674 |
+
</smartsendpickup>
|
675 |
+
<smartsendposten translate="label" module="logistics">
|
676 |
+
<label>Smart Send - Posten</label>
|
677 |
+
<comment>
|
678 |
+
<![CDATA[<div class="smartsend"><p style="background: #FFFFFF;border: 1px solid orange;font-weight: bold; padding: 20px;width:55%">
|
679 |
+
This shipping method may only be used if a valid Smart Send licence is purchased. Please see <a href="http://www.smartsend.dk" target="_blank">Smart Send</a> for further information.
|
680 |
+
</p></div>]]>
|
681 |
+
</comment>
|
682 |
+
<frontend_type>text</frontend_type>
|
683 |
+
<sort_order>96</sort_order>
|
684 |
+
<show_in_default>1</show_in_default>
|
685 |
+
<show_in_website>1</show_in_website>
|
686 |
+
<show_in_store>1</show_in_store>
|
687 |
+
<fields>
|
688 |
+
<active translate="label">
|
689 |
+
<label>Enabled</label>
|
690 |
+
<frontend_type>select</frontend_type>
|
691 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
692 |
+
<sort_order>601</sort_order>
|
693 |
+
<show_in_default>1</show_in_default>
|
694 |
+
<show_in_website>1</show_in_website>
|
695 |
+
<show_in_store>1</show_in_store>
|
696 |
+
</active>
|
697 |
+
<title translate="label">
|
698 |
+
<label>Carrier Title</label>
|
699 |
+
<frontend_type>text</frontend_type>
|
700 |
+
<sort_order>602</sort_order>
|
701 |
+
<show_in_default>1</show_in_default>
|
702 |
+
<show_in_website>1</show_in_website>
|
703 |
+
<show_in_store>1</show_in_store>
|
704 |
+
</title>
|
705 |
+
<price translate="label">
|
706 |
+
<label>Price</label>
|
707 |
+
<frontend_type>text</frontend_type>
|
708 |
+
<frontend_model>smartsend_logistics_block_adminhtml_shipping</frontend_model>
|
709 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
710 |
+
<sort_order>603</sort_order>
|
711 |
+
<show_in_default>1</show_in_default>
|
712 |
+
<show_in_website>1</show_in_website>
|
713 |
+
<show_in_store>1</show_in_store>
|
714 |
+
</price>
|
715 |
+
<cheapestexpensive translate="label">
|
716 |
+
<label>Cheapest or most expensive?</label>
|
717 |
+
<source_model>logistics/system_orderOption</source_model>
|
718 |
+
<frontend_type>radios</frontend_type>
|
719 |
+
<sort_order>604</sort_order>
|
720 |
+
<show_in_default>1</show_in_default>
|
721 |
+
<show_in_website>1</show_in_website>
|
722 |
+
<show_in_store>1</show_in_store>
|
723 |
+
</cheapestexpensive>
|
724 |
+
<excludetax translate="label">
|
725 |
+
<label>Exclude from TAX</label>
|
726 |
+
<comment>Carrier is excluded from TAX even though there is a Shipping Tax defined</comment>
|
727 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
728 |
+
<frontend_type>select</frontend_type>
|
729 |
+
<sort_order>605</sort_order>
|
730 |
+
<show_in_default>1</show_in_default>
|
731 |
+
<show_in_website>1</show_in_website>
|
732 |
+
<show_in_store>1</show_in_store>
|
733 |
+
</excludetax>
|
734 |
+
<listformat translate="label">
|
735 |
+
<label>Listing Format</label>
|
736 |
+
<comment>How the dropdown is formatted</comment>
|
737 |
+
<source_model>logistics/system_listformat</source_model>
|
738 |
+
<frontend_type>select</frontend_type>
|
739 |
+
<sort_order>606</sort_order>
|
740 |
+
<show_in_default>1</show_in_default>
|
741 |
+
<show_in_website>1</show_in_website>
|
742 |
+
<show_in_store>1</show_in_store>
|
743 |
+
</listformat>
|
744 |
+
<heading translate="label">
|
745 |
+
<label>Services</label>
|
746 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
747 |
+
<sort_order>607</sort_order>
|
748 |
+
<show_in_default>1</show_in_default>
|
749 |
+
<show_in_website>1</show_in_website>
|
750 |
+
<show_in_store>1</show_in_store>
|
751 |
+
</heading>
|
752 |
+
<format translate="label">
|
753 |
+
<label>Format</label>
|
754 |
+
<source_model>logistics/system_pacsoftformat</source_model>
|
755 |
+
<frontend_type>select</frontend_type>
|
756 |
+
<sort_order>608</sort_order>
|
757 |
+
<show_in_default>1</show_in_default>
|
758 |
+
<show_in_website>1</show_in_website>
|
759 |
+
<show_in_store>1</show_in_store>
|
760 |
+
</format>
|
761 |
+
<quickid translate="label">
|
762 |
+
<label>Pacsoft QuickID</label>
|
763 |
+
<validate>validate-alphanum</validate>
|
764 |
+
<frontend_type>text</frontend_type>
|
765 |
+
<sort_order>609</sort_order>
|
766 |
+
<show_in_default>1</show_in_default>
|
767 |
+
<show_in_website>1</show_in_website>
|
768 |
+
<show_in_store>1</show_in_store>
|
769 |
+
</quickid>
|
770 |
+
<waybillid translate="label">
|
771 |
+
<label>Waybill ID</label>
|
772 |
+
<comment>Either just an id or a semicolon separated list of 'country,id' (* is all countries). Eg: SE,123;NO,321;*,44</comment>
|
773 |
+
<frontend_type>text</frontend_type>
|
774 |
+
<sort_order>610</sort_order>
|
775 |
+
<show_in_default>1</show_in_default>
|
776 |
+
<show_in_website>1</show_in_website>
|
777 |
+
<show_in_store>1</show_in_store>
|
778 |
+
</waybillid>
|
779 |
+
<notemail translate="label">
|
780 |
+
<label>Email notification</label>
|
781 |
+
<frontend_type>select</frontend_type>
|
782 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
783 |
+
<sort_order>611</sort_order>
|
784 |
+
<show_in_default>1</show_in_default>
|
785 |
+
<show_in_website>1</show_in_website>
|
786 |
+
<show_in_store>1</show_in_store>
|
787 |
+
</notemail>
|
788 |
+
<notesms translate="label">
|
789 |
+
<label>SMS notification</label>
|
790 |
+
<frontend_type>select</frontend_type>
|
791 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
792 |
+
<sort_order>612</sort_order>
|
793 |
+
<show_in_default>1</show_in_default>
|
794 |
+
<show_in_website>1</show_in_website>
|
795 |
+
<show_in_store>1</show_in_store>
|
796 |
+
</notesms>
|
797 |
+
<prenote translate="label">
|
798 |
+
<label>Pre-notification</label>
|
799 |
+
<frontend_type>select</frontend_type>
|
800 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
801 |
+
<sort_order>613</sort_order>
|
802 |
+
<show_in_default>1</show_in_default>
|
803 |
+
<show_in_website>1</show_in_website>
|
804 |
+
<show_in_store>1</show_in_store>
|
805 |
+
</prenote>
|
806 |
+
<prenote_receiver translate="label">
|
807 |
+
<label>Pre-notification receiver</label>
|
808 |
+
<comment>Leave blank if receiver should be the user</comment>
|
809 |
+
<frontend_type>Text</frontend_type>
|
810 |
+
<validate>validate-email</validate>
|
811 |
+
<sort_order>614</sort_order>
|
812 |
+
<show_in_default>1</show_in_default>
|
813 |
+
<show_in_website>1</show_in_website>
|
814 |
+
<show_in_store>1</show_in_store>
|
815 |
+
<depends>
|
816 |
+
<prenote>1</prenote>
|
817 |
+
</depends>
|
818 |
+
</prenote_receiver>
|
819 |
+
<prenote_sender translate="label">
|
820 |
+
<label>Pre-notification sender</label>
|
821 |
+
<frontend_type>Text</frontend_type>
|
822 |
+
<validate>validate-email</validate>
|
823 |
+
<sort_order>615</sort_order>
|
824 |
+
<show_in_default>1</show_in_default>
|
825 |
+
<show_in_website>1</show_in_website>
|
826 |
+
<show_in_store>1</show_in_store>
|
827 |
+
<depends>
|
828 |
+
<prenote>1</prenote>
|
829 |
+
</depends>
|
830 |
+
</prenote_sender>
|
831 |
+
<prenote_message translate="label">
|
832 |
+
<label>Pre-notification message</label>
|
833 |
+
<frontend_type>textarea</frontend_type>
|
834 |
+
<sort_order>616</sort_order>
|
835 |
+
<show_in_default>1</show_in_default>
|
836 |
+
<show_in_website>1</show_in_website>
|
837 |
+
<show_in_store>1</show_in_store>
|
838 |
+
<depends>
|
839 |
+
<prenote>1</prenote>
|
840 |
+
</depends>
|
841 |
+
</prenote_message>
|
842 |
+
<heading_return translate="label">
|
843 |
+
<label>Return</label>
|
844 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
845 |
+
<sort_order>617</sort_order>
|
846 |
+
<show_in_default>1</show_in_default>
|
847 |
+
<show_in_website>1</show_in_website>
|
848 |
+
<show_in_store>1</show_in_store>
|
849 |
+
</heading_return>
|
850 |
+
<return translate="label">
|
851 |
+
<label>Return methode</label>
|
852 |
+
<comment>Which carrier should handle return packages?</comment>
|
853 |
+
<source_model>logistics/system_return</source_model>
|
854 |
+
<frontend_type>select</frontend_type>
|
855 |
+
<sort_order>618</sort_order>
|
856 |
+
<show_in_default>1</show_in_default>
|
857 |
+
<show_in_website>1</show_in_website>
|
858 |
+
<show_in_store>1</show_in_store>
|
859 |
+
</return>
|
860 |
+
</fields>
|
861 |
+
</smartsendposten>
|
862 |
+
</groups>
|
863 |
+
</carriers>
|
864 |
+
</sections>
|
865 |
+
</config>
|
app/code/community/Smartsend/Logistics/sql/logistics_setup/mysql4-install-7.0.1.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/code/community/Smartsend/Logistics/sql/logistics_setup/mysql4-install-7.0.1.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
$installer = $this;
|
27 |
+
|
28 |
+
$installer->startSetup(); //start setup
|
29 |
+
|
30 |
+
$installer->run("
|
31 |
+
DROP TABLE IF EXISTS {$this->getTable('order_shipping_pickup')};
|
32 |
+
DROP TABLE IF EXISTS {$this->getTable('order_shipping_postdanmark')};
|
33 |
+
DROP TABLE IF EXISTS {$this->getTable('order_shipping_posten')};
|
34 |
+
DROP TABLE IF EXISTS {$this->getTable('order_shipping_swipbox')};
|
35 |
+
DROP TABLE IF EXISTS {$this->getTable('order_shipping_bring')};
|
36 |
+
DROP TABLE IF EXISTS {$this->getTable('order_shipping_gls')};
|
37 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('smartsend_pickup')} (
|
38 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
39 |
+
`order_id` int(11) NOT NULL,
|
40 |
+
`store` varchar(255) NOT NULL default '',
|
41 |
+
`pick_up_id` varchar(255) NOT NULL default '',
|
42 |
+
`company` varchar(255) NOT NULL default '',
|
43 |
+
`street` varchar(255) NOT NULL default '',
|
44 |
+
`city` varchar(255) NOT NULL default '',
|
45 |
+
`zip` varchar(255) NOT NULL default '',
|
46 |
+
`country` varchar(255) NOT NULL default '',
|
47 |
+
`carrier` varchar(255) NOT NULL default '',
|
48 |
+
PRIMARY KEY (`id`)
|
49 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
50 |
+
"); //creating table
|
51 |
+
|
52 |
+
/* standard values for the table rate */
|
53 |
+
|
54 |
+
for ($i = 0; $i < 6; $i++) {
|
55 |
+
|
56 |
+
switch ($i) { //shipping method case
|
57 |
+
case 0:
|
58 |
+
$carrier = "groups[smartsendpickup]";
|
59 |
+
break;
|
60 |
+
case 1:
|
61 |
+
$carrier = "groups[smartsendpostdanmark]";
|
62 |
+
break;
|
63 |
+
case 2:
|
64 |
+
$carrier = "groups[smartsendbring]";
|
65 |
+
break;
|
66 |
+
case 3:
|
67 |
+
$carrier = "groups[smartsendswipbox]";
|
68 |
+
break;
|
69 |
+
case 4:
|
70 |
+
$carrier = "groups[smartsendgls]";
|
71 |
+
break;
|
72 |
+
case 5:
|
73 |
+
$carrier = "groups[smartsendposten]";
|
74 |
+
break;
|
75 |
+
}
|
76 |
+
|
77 |
+
$shippingmethods = Mage::getModel('logistics/shippingMethods')->getOptionArray($carrier); //getting shipping methods for carriers
|
78 |
+
|
79 |
+
$priceResult = array();
|
80 |
+
|
81 |
+
$shippingArray_NotStandard = array('DPDguranty', 'Valuemail', 'Valuemailfirstclass', 'Valuemaileconomy', 'Maximail'); //shipping methods not having standard settings
|
82 |
+
|
83 |
+
foreach ($shippingmethods as $key => $value) {
|
84 |
+
|
85 |
+
if (!in_array($value, $shippingArray_NotStandard)) {
|
86 |
+
|
87 |
+
$millisecond = round(microtime(true) * 1000);
|
88 |
+
$id = '_' . $millisecond . '_' . rand(100, 999); //ids for the values
|
89 |
+
|
90 |
+
$defaultResult = array();
|
91 |
+
$defaultResult['orderminprice'] = 0;
|
92 |
+
$defaultResult['ordermaxprice'] = 100000;
|
93 |
+
$defaultResult['orderminweight'] = 0;
|
94 |
+
$defaultResult['ordermaxweight'] = 100000;
|
95 |
+
$defaultResult['pickupshippingfee'] = 10;
|
96 |
+
$defaultResult['countries'] = 'DK';
|
97 |
+
$defaultResult['_id'] = $id;
|
98 |
+
$defaultResult['methods'] = $key;
|
99 |
+
|
100 |
+
if ($i != 0) {
|
101 |
+
$Title = Mage::getModel('logistics/shippingMethods')->getTitleValue($key); //getting title value of the shipping method
|
102 |
+
$defaultResult['method_name'] = $Title;
|
103 |
+
}
|
104 |
+
|
105 |
+
$priceResult[$defaultResult['_id']] = $defaultResult;
|
106 |
+
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
if ($i == 0) {
|
111 |
+
$path = 'carriers/smartsendpickup/price';
|
112 |
+
} elseif ($i == 1) {
|
113 |
+
$path = 'carriers/smartsendpostdanmark/price';
|
114 |
+
} elseif ($i == 2) {
|
115 |
+
$path = 'carriers/smartsendbring/price';
|
116 |
+
} elseif ($i == 3) {
|
117 |
+
$path = 'carriers/smartsendswipbox/price';
|
118 |
+
} elseif ($i == 4) {
|
119 |
+
$path = 'carriers/smartsendgls/price';
|
120 |
+
} elseif ($i == 5) {
|
121 |
+
$path = 'carriers/smartsendposten/price';
|
122 |
+
}
|
123 |
+
|
124 |
+
$data = array();
|
125 |
+
$data['value'] = serialize($priceResult);
|
126 |
+
$data['path'] = $path;
|
127 |
+
$data['scope'] = 'default';
|
128 |
+
$data['scope_id'] = 0;
|
129 |
+
|
130 |
+
$table = Mage::getSingleton('core/resource')->getTableName('core_config_data'); //checking the table rate values in the table
|
131 |
+
$writeAdapter = Mage::getSingleton('core/resource')->getConnection('core_write');
|
132 |
+
$readAdapter = Mage::getSingleton('core/resource')->getConnection('core_read');
|
133 |
+
$query = 'SELECT * FROM ' . $table . ' where path = "' . $data["path"] . '"';
|
134 |
+
$results = $readAdapter->fetchAll($query);
|
135 |
+
|
136 |
+
if (!$results && !empty($priceResult)) { //if table rate value is empty for that carrier
|
137 |
+
$writeAdapter->insert($table, $data);
|
138 |
+
}
|
139 |
+
}
|
140 |
+
$installer->endSetup(); //end setup
|
app/design/adminhtml/default/default/layout/logistics.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<logistics_adminhtml_pickup_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="logistics/adminhtml_pickup" name="logistics" >
|
6 |
+
</block>
|
7 |
+
</reference>
|
8 |
+
</logistics_adminhtml_pickup_index>
|
9 |
+
<logistics_adminhtml_shipping_index>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="logistics/adminhtml_shipping" name="shipping">
|
12 |
+
</block>
|
13 |
+
</reference>
|
14 |
+
</logistics_adminhtml_shipping_index>
|
15 |
+
<adminhtml_sales_order_view> <!-- sales order view update -->
|
16 |
+
<reference name="order_info">
|
17 |
+
<action method="setTemplate">
|
18 |
+
<template>logistics/sales/order/view/info.phtml</template>
|
19 |
+
</action>
|
20 |
+
</reference>
|
21 |
+
|
22 |
+
<reference name="sales_order_tabs">
|
23 |
+
<block type="logistics/adminhtml_sales_order_view_tab_info" name="logistics_order_view_info_tab" template="logistics/sales/order/view/tab/info.phtml" >
|
24 |
+
</block>
|
25 |
+
|
26 |
+
|
27 |
+
<action method="addTab"><name>smart_send_pickup</name><block>logistics_order_view_info_tab</block></action>
|
28 |
+
</reference>
|
29 |
+
</adminhtml_sales_order_view>
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
</layout>
|
app/design/adminhtml/default/default/template/logistics/array_dropdown.phtml
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/design/adminhtml/default/default/template/logistics/array_dropdown.phtml
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
/* dropdown for the admin system config table rates */
|
30 |
+
$_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid(); // id of the table
|
31 |
+
|
32 |
+
$_colspan = 2;
|
33 |
+
if (!$this->_addAfter) {
|
34 |
+
$_colspan -= 1;
|
35 |
+
}
|
36 |
+
$_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
|
37 |
+
?>
|
38 |
+
|
39 |
+
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
40 |
+
<table cellpadding="0" cellspacing="0" class="border">
|
41 |
+
<tbody>
|
42 |
+
|
43 |
+
<tr class="headings" id="headings<?php echo $_htmlId ?>"> <!-- heading for the table rates -->
|
44 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
45 |
+
<th><?php echo $column['label'] ?></th>
|
46 |
+
<?php endforeach;?>
|
47 |
+
<th <?php echo $_colspan?>></th>
|
48 |
+
</tr>
|
49 |
+
|
50 |
+
<tr id="addRow<?php echo $_htmlId ?>"> <!-- standard values rows -->
|
51 |
+
<td colspan="<?php echo count($this->_columns) ?>"></td>
|
52 |
+
<td <?php echo $_colspan?>>
|
53 |
+
<button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>"> <!-- button for adding more standard values rows -->
|
54 |
+
<span><?php echo $this->_addButtonLabel ?></span>
|
55 |
+
</button>
|
56 |
+
</td>
|
57 |
+
</tr>
|
58 |
+
|
59 |
+
</tbody>
|
60 |
+
</table>
|
61 |
+
<input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
|
62 |
+
</div>
|
63 |
+
<div id="empty<?php echo $_htmlId ?>">
|
64 |
+
<button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
|
65 |
+
<span><?php echo $this->_addButtonLabel ?></span>
|
66 |
+
</button>
|
67 |
+
</div>
|
68 |
+
|
69 |
+
<script type="text/javascript">
|
70 |
+
|
71 |
+
//<![CDATA[
|
72 |
+
// create row creator
|
73 |
+
var arrayRow<?php echo $_htmlId ?> = {
|
74 |
+
// define row prototypeJS template
|
75 |
+
template : new Template( //template for the new table rate row
|
76 |
+
'<tr id="#{_id}">'
|
77 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
78 |
+
+'<td>'
|
79 |
+
+'<?php echo $this->_renderCellTemplate($columnName)?>' //column values for the table rate row
|
80 |
+
+'<\/td>'
|
81 |
+
<?php endforeach;?>
|
82 |
+
<?php if ($this->_addAfter):?>
|
83 |
+
+'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo $this->__('Add after') ?><\/span><\/button><\/td>'
|
84 |
+
<?php endif;?>
|
85 |
+
+'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><?php echo $this->__('Delete') ?><\/span><\/button><\/td>' //delete button for the row
|
86 |
+
+'<\/tr>'
|
87 |
+
),
|
88 |
+
|
89 |
+
rowsCount : 0,
|
90 |
+
|
91 |
+
add : function(templateData, insertAfterId)
|
92 |
+
{
|
93 |
+
|
94 |
+
// generate default template data
|
95 |
+
if ('' == templateData) {
|
96 |
+
var d = new Date();
|
97 |
+
var templateData = {
|
98 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
99 |
+
<?php echo $columnName ?> : '',
|
100 |
+
<?php endforeach;?>
|
101 |
+
_id : '_' + d.getTime() + '_' + d.getMilliseconds()
|
102 |
+
};
|
103 |
+
}
|
104 |
+
|
105 |
+
// insert before last row
|
106 |
+
if ('' == insertAfterId) {
|
107 |
+
Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
|
108 |
+
}
|
109 |
+
// insert after specified row
|
110 |
+
else {
|
111 |
+
Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
|
112 |
+
}
|
113 |
+
|
114 |
+
<?php if ($this->_addAfter):?>
|
115 |
+
Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
|
116 |
+
<?php endif;?>
|
117 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
118 |
+
|
119 |
+
var options = $$("select[name*='["+templateData._id+"][<?php echo $columnName?>]"+"'] option");
|
120 |
+
|
121 |
+
for (var index = 0; index < options.length; ++index) {
|
122 |
+
var option = options[index];
|
123 |
+
|
124 |
+
if (option.getAttribute('value') == templateData.<?php echo $columnName?>) {
|
125 |
+
|
126 |
+
option.selected = true
|
127 |
+
}
|
128 |
+
}
|
129 |
+
<?php endforeach;?>
|
130 |
+
|
131 |
+
this.rowsCount += 1;
|
132 |
+
},
|
133 |
+
|
134 |
+
del : function(rowId)
|
135 |
+
{
|
136 |
+
$(rowId).remove();
|
137 |
+
this.rowsCount -= 1;
|
138 |
+
if (0 == this.rowsCount) {
|
139 |
+
this.showButtonOnly();
|
140 |
+
}
|
141 |
+
},
|
142 |
+
|
143 |
+
showButtonOnly : function()
|
144 |
+
{
|
145 |
+
$('grid<?php echo $_htmlId ?>').hide();
|
146 |
+
$('empty<?php echo $_htmlId ?>').show();
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
// bind add action to "Add" button in last row
|
151 |
+
Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
|
152 |
+
|
153 |
+
// add existing rows
|
154 |
+
<?php
|
155 |
+
$_addAfterId = "headings{$_htmlId}";
|
156 |
+
foreach ($this->getArrayRows() as $_rowId => $_row) { //getting the standard values for the table rates
|
157 |
+
echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
|
158 |
+
$_addAfterId = $_rowId;
|
159 |
+
}
|
160 |
+
?>
|
161 |
+
|
162 |
+
// initialize standalone button
|
163 |
+
$('empty<?php echo $_htmlId ?>').hide();
|
164 |
+
Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
|
165 |
+
$('grid<?php echo $_htmlId ?>').show();
|
166 |
+
$('empty<?php echo $_htmlId ?>').hide();
|
167 |
+
arrayRow<?php echo $_htmlId ?>.add('', '');
|
168 |
+
});
|
169 |
+
|
170 |
+
// if no rows, hide grid and show button only
|
171 |
+
<?php if (!$this->getArrayRows()):?>
|
172 |
+
arrayRow<?php echo $_htmlId ?>.showButtonOnly();
|
173 |
+
<?php endif;?>
|
174 |
+
|
175 |
+
// toggle the grid, if element is disabled (depending on scope)
|
176 |
+
<?php if ($this->getElement()->getDisabled()):?>
|
177 |
+
toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
|
178 |
+
<?php endif;?>
|
179 |
+
//]]>
|
180 |
+
</script>
|
app/design/adminhtml/default/default/template/logistics/sales/order/view/info.phtml
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartsend_Logistics
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.smartsend.dk
|
18 |
+
*
|
19 |
+
* @folder /app/design/adminhtml/default/default/template/logistics/sales/order/view/info.phtml
|
20 |
+
* @category Smartsend
|
21 |
+
* @package Smartsend_Logistics
|
22 |
+
* @author Anders Bilfeldt
|
23 |
+
* @url www.smartsend.dk
|
24 |
+
*/
|
25 |
+
$_order = $this->getOrder(); //getting order details
|
26 |
+
$orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true); //admin date of order
|
27 |
+
$orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true); //store date of order
|
28 |
+
?>
|
29 |
+
<div class="box-left">
|
30 |
+
<!--Order Information-->
|
31 |
+
<div class="entry-edit">
|
32 |
+
<?php
|
33 |
+
if ($_order->getEmailSent()):
|
34 |
+
$_email = $this->__('the order confirmation email was sent');
|
35 |
+
else:
|
36 |
+
$_email = $this->__('the order confirmation email was not sent');
|
37 |
+
endif;
|
38 |
+
?>
|
39 |
+
<div class="entry-edit-head">
|
40 |
+
<?php if ($this->getNoUseOrderLink()): ?> <!-- links with on onclick event -->
|
41 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?> (<?php echo $_email ?>)</h4> <!-- orderid of the order -->
|
42 |
+
<?php else: ?>
|
43 |
+
<a href="<?php echo $this->getViewUrl($_order->getId()) ?>"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></a> <!-- orderid of the order -->
|
44 |
+
<strong>(<?php echo $_email ?>)</strong>
|
45 |
+
<?php endif; ?>
|
46 |
+
</div>
|
47 |
+
<div class="fieldset">
|
48 |
+
<table cellspacing="0" class="form-list">
|
49 |
+
<tr>
|
50 |
+
<td class="label"><label><?php echo $this->__('Order Date') ?></label></td>
|
51 |
+
<td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
|
52 |
+
</tr>
|
53 |
+
<?php if ($orderAdminDate != $orderStoreDate): ?>
|
54 |
+
<tr>
|
55 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)', $_order->getCreatedAtStoreDate()->getTimezone()) ?></label></td>
|
56 |
+
<td class="value"><strong><?php echo $orderStoreDate ?></strong></td>
|
57 |
+
</tr>
|
58 |
+
<?php endif; ?>
|
59 |
+
<tr>
|
60 |
+
<td class="label"><label><?php echo $this->__('Order Status') ?></label></td>
|
61 |
+
<td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td> <!-- current status of the order -->
|
62 |
+
</tr>
|
63 |
+
<tr>
|
64 |
+
<td class="label"><label><?php echo $this->__('Purchased From') ?></label></td>
|
65 |
+
<td class="value"><strong><?php echo $this->getOrderStoreName() ?></strong></td> <!-- purchased store of the order -->
|
66 |
+
</tr>
|
67 |
+
<?php if ($_order->getRelationChildId()): ?> <!-- order that links to the other child order -->
|
68 |
+
<tr>
|
69 |
+
<td class="label"><label><?php echo $this->__('Link to the New Order') ?></label></td>
|
70 |
+
<td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationChildId()) ?>">
|
71 |
+
<?php echo $_order->getRelationChildRealId() ?>
|
72 |
+
</a></td>
|
73 |
+
</tr>
|
74 |
+
<?php endif; ?>
|
75 |
+
<?php if ($_order->getRelationParentId()): ?> <!-- order that links to the other parent order -->
|
76 |
+
<tr>
|
77 |
+
<td class="label"><label><?php echo $this->__('Link to the Previous Order') ?></label></td>
|
78 |
+
<td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationParentId()) ?>">
|
79 |
+
<?php echo $_order->getRelationParentRealId() ?>
|
80 |
+
</a></td>
|
81 |
+
</tr>
|
82 |
+
<?php endif; ?>
|
83 |
+
<?php
|
84 |
+
$magentoVersion = Mage::getVersion(); //getting magento version
|
85 |
+
if (version_compare($magentoVersion, '1.7.0.2', '>=')) {
|
86 |
+
?>
|
87 |
+
<?php if ($_order->getRemoteIp() && $this->shouldDisplayCustomerIp()): ?>
|
88 |
+
<tr>
|
89 |
+
<td class="label"><label><?php echo $this->__('Placed from IP') ?></label></td>
|
90 |
+
<td class="value"><strong><?php
|
91 |
+
echo $_order->getRemoteIp(); //ip from where order is placed
|
92 |
+
echo ($_order->getXForwardedFor()) ? ' (' . $this->escapeHtml($_order->getXForwardedFor()) . ')' : '';
|
93 |
+
?></strong></td>
|
94 |
+
</tr>
|
95 |
+
<?php endif; ?>
|
96 |
+
<?php
|
97 |
+
} else {
|
98 |
+
if ($_order->getRemoteIp()):
|
99 |
+
?>
|
100 |
+
<tr>
|
101 |
+
<td class="label"><label><?php echo $this->__('Placed from IP') ?></label></td>
|
102 |
+
<td class="value"><strong><?php
|
103 |
+
echo $_order->getRemoteIp();
|
104 |
+
echo ($_order->getXForwardedFor()) ? ' (' . $_order->getXForwardedFor() . ')' : '';
|
105 |
+
?></strong></td>
|
106 |
+
</tr>
|
107 |
+
<?php
|
108 |
+
endif;
|
109 |
+
}
|
110 |
+
?>
|
111 |
+
|
112 |
+
<?php if ($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?> <!-- order currency codes -->
|
113 |
+
<tr>
|
114 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
|
115 |
+
<td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
|
116 |
+
</tr>
|
117 |
+
<?php endif; ?>
|
118 |
+
<?php if ($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
|
119 |
+
<tr>
|
120 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
|
121 |
+
<td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
|
122 |
+
</tr>
|
123 |
+
<?php endif; ?>
|
124 |
+
</table>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
<div class="box-right">
|
129 |
+
<!--Account Information-->
|
130 |
+
<div class="entry-edit">
|
131 |
+
<div class="entry-edit-head">
|
132 |
+
<h4 class="icon-head head-account"><?php echo $this->__('Account Information') ?></h4>
|
133 |
+
<div class="tools"><?php echo $this->getAccountEditLink() ?></div>
|
134 |
+
</div>
|
135 |
+
<div class="fieldset">
|
136 |
+
<div class="hor-scroll">
|
137 |
+
<table cellspacing="0" class="form-list">
|
138 |
+
<tr>
|
139 |
+
<td class="label"><label><?php echo $this->__('Customer Name') ?></label></td>
|
140 |
+
<td class="value">
|
141 |
+
<?php if ($_customerUrl = $this->getCustomerViewUrl()) : ?> <!-- customer profile url -->
|
142 |
+
<a href="<?php echo $_customerUrl ?>" target="_blank"><strong><?php echo $this->escapeHtml($_order->getCustomerName()) ?></strong></a> <!-- customer name -->
|
143 |
+
<?php else: ?>
|
144 |
+
<strong><?php echo $this->escapeHtml($_order->getCustomerName()) ?></strong>
|
145 |
+
<?php endif; ?>
|
146 |
+
</td>
|
147 |
+
</tr>
|
148 |
+
<tr>
|
149 |
+
<td class="label"><label><?php echo $this->__('Email') ?></label></td>
|
150 |
+
<td class="value"><a href="mailto:<?php echo $_order->getCustomerEmail() ?>"><strong><?php echo $_order->getCustomerEmail() ?></strong></a></td> <!-- customer email -->
|
151 |
+
</tr>
|
152 |
+
<?php if ($_groupName = $this->getCustomerGroupName()) : ?> <!-- customer group -->
|
153 |
+
<tr>
|
154 |
+
<td class="label"><label><?php echo $this->__('Customer Group') ?></label></td>
|
155 |
+
<td class="value"><strong><?php echo $_groupName ?></strong></td>
|
156 |
+
</tr>
|
157 |
+
<?php endif; ?>
|
158 |
+
<?php foreach ($this->getCustomerAccountData() as $data): ?>
|
159 |
+
<tr>
|
160 |
+
<td class="label"><label><?php echo $data['label'] ?></label></td>
|
161 |
+
<td class="value"><strong><?php echo $data['value'] ?></strong></td>
|
162 |
+
</tr>
|
163 |
+
<?php endforeach; ?>
|
164 |
+
</table>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
</div>
|
168 |
+
</div>
|
169 |
+
<div class="clear"></div>
|
170 |
+
|
171 |
+
<div class="box-left">
|
172 |
+
<!--Billing Address-->
|
173 |
+
<div class="entry-edit">
|
174 |
+
<div class="entry-edit-head">
|
175 |
+
<h4 class="icon-head head-billing-address"><?php echo $this->__('Billing Address') ?></h4>
|
176 |
+
<div class="tools"><?php echo $this->getAddressEditLink($_order->getBillingAddress()) ?></div> <!-- customers billing address -->
|
177 |
+
</div>
|
178 |
+
<fieldset>
|
179 |
+
<address><?php echo $_order->getBillingAddress()->getFormated(true) ?></address>
|
180 |
+
</fieldset>
|
181 |
+
</div>
|
182 |
+
</div>
|
183 |
+
<?php if (!$this->getOrder()->getIsVirtual()): ?>
|
184 |
+
<div class="box-right">
|
185 |
+
<!--Shipping Address-->
|
186 |
+
<div class="entry-edit">
|
187 |
+
<div class="entry-edit-head">
|
188 |
+
<h4 class="icon-head head-shipping-address"><?php echo $this->__('Shipping Address') ?></h4>
|
189 |
+
<div class="tools"><?php echo $this->getAddressEditLink($_order->getShippingAddress()) ?></div> <!-- shipping address -->
|
190 |
+
</div>
|
191 |
+
<fieldset>
|
192 |
+
<address><?php echo $_order->getShippingAddress()->getFormated(true) ?></address>
|
193 |
+
</fieldset>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
<div class="clear"></div>
|
197 |
+
<?php
|
198 |
+
endif;
|
199 |
+
if(strrpos($_order->getShippingMethod(), "smartsend") !== FALSE):
|
200 |
+
//if ($_order->getShippingMethod() == "smartsendpickup_pickup" || $_order->getShippingMethod() == "smartsendposten_pickup" || $_order->getShippingMethod() == "smartsendpostdanmark_pickup" || $_order->getShippingMethod() == "smartsendbring_pickup" || $_order->getShippingMethod() == "smartsendgls_pickup" || $_order->getShippingMethod() == "smartsendswipbox_pickup"):
|
201 |
+
?>
|
202 |
+
<div class="box-left">
|
203 |
+
<!--Smart Send Pickup-->
|
204 |
+
<div class="entry-edit">
|
205 |
+
<div class="entry-edit-head">
|
206 |
+
<h4 class="icon-head"><?php echo $this->__('Smart Send Pickup Address') ?></h4>
|
207 |
+
</div>
|
208 |
+
<fieldset>
|
209 |
+
<div style="float: left" >
|
210 |
+
<?php echo $this->__('Shipping method').': '.$_order->getShippingMethod(); ?>
|
211 |
+
</div>
|
212 |
+
<div class="clear"></div>
|
213 |
+
<?php
|
214 |
+
if(($temp = strlen($_order->getShippingMethod()) - strlen('pickup')) >= 0 && strpos($_order->getShippingMethod(), 'pickup', $temp) !== FALSE) {
|
215 |
+
|
216 |
+
$order_id = $_order->getId(); //order id
|
217 |
+
if ($_order->getShippingMethod() == "smartsendgls_pickup") { //smartsend shipping address
|
218 |
+
$pickupModel = Mage::getModel('logistics/gls');
|
219 |
+
} elseif ($_order->getShippingMethod() == "smartsendswipbox_pickup") {
|
220 |
+
$pickupModel = Mage::getModel('logistics/swipbox');
|
221 |
+
} elseif ($_order->getShippingMethod() == "smartsendpostdanmark_pickup") {
|
222 |
+
$pickupModel = Mage::getModel('logistics/postdanmark');
|
223 |
+
} elseif ($_order->getShippingMethod() == "smartsendposten_pickup") {
|
224 |
+
$pickupModel = Mage::getModel('logistics/posten');
|
225 |
+
} elseif ($_order->getShippingMethod() == "smartsendbring_pickup") {
|
226 |
+
$pickupModel = Mage::getModel('logistics/bring');
|
227 |
+
} elseif ($_order->getShippingMethod() == "smartsendpickup_pickup") {
|
228 |
+
$pickupModel = Mage::getModel('logistics/pickup');
|
229 |
+
}
|
230 |
+
|
231 |
+
if ($pickupModel) {
|
232 |
+
$pickupData = $pickupModel->getCollection()->addFieldToFilter('order_id', $order_id)->getFirstItem(); //pickup data
|
233 |
+
|
234 |
+
if ($pickupData->getData()) {
|
235 |
+
if($pickupData->getPickUpId() != '' && $pickupData->getPickUpId() != '000') {
|
236 |
+
echo $this->__("Carrier") . ": ".$pickupData->getCarrier() . "<br><br>";
|
237 |
+
echo $this->__("Pickup Point Id") . ": " . $pickupData->getPickUpId() . "<br>"; //pickup id
|
238 |
+
echo $pickupData->getCompany() . "<br>" . $pickupData->getStreet() . "<br>" . $pickupData->getZip() . " " . $pickupData->getCity() . "<br>" . $pickupData->getCountry(); //pickup address
|
239 |
+
} else {
|
240 |
+
echo $this->__("Shipping to closest pickup point");
|
241 |
+
}
|
242 |
+
} else {
|
243 |
+
echo $this->__("Record not found");
|
244 |
+
}
|
245 |
+
}
|
246 |
+
} else {
|
247 |
+
echo $this->__("Not a pickup point");
|
248 |
+
}
|
249 |
+
?>
|
250 |
+
<div style="float: right" >
|
251 |
+
<input type="button" class="form-button" value="<?php echo Mage::helper('logistics')->__('Generate label') ?>" title="<?php echo Mage::helper('logistics')->__('Generate label') ?>" onclick="setLocation('<?php echo $this->getUrl("logistics/logistics/label",array('order_id' => $_order->getId())); ?>')"/>
|
252 |
+
<input type="button" class="form-button" value="<?php echo Mage::helper('logistics')->__('Generate return label') ?>" title="<?php echo Mage::helper('logistics')->__('Generate return label') ?>" onclick="setLocation('<?php echo $this->getUrl("logistics/logistics/labelreturn",array('order_id' => $_order->getId())); ?>')" />
|
253 |
+
</div>
|
254 |
+
<div class="clear"></div>
|
255 |
+
</fieldset>
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
<div class="clear"></div>
|
259 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/logistics/sales/order/view/tab/info.phtml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartsend_Logistics
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.smartsend.dk
|
18 |
+
*
|
19 |
+
* @folder /app/design/adminhtml/default/default/template/logistics/sales/order/view/info.phtml
|
20 |
+
* @category Smartsend
|
21 |
+
* @package Smartsend_Logistics
|
22 |
+
* @author Anders Bilfeldt
|
23 |
+
* @url www.smartsend.dk
|
24 |
+
*/
|
25 |
+
$_order = $this->getOrder();
|
26 |
+
|
27 |
+
if(strrpos($_order->getShippingMethod(), "smartsend") !== FALSE):
|
28 |
+
|
29 |
+
//if ($_order->getShippingMethod() == "smartsendpickup_pickup" || $_order->getShippingMethod() == "smartsendposten_pickup" || $_order->getShippingMethod() == "smartsendpostdanmark_pickup" || $_order->getShippingMethod() == "smartsendbring_pickup" || $_order->getShippingMethod() == "smartsendgls_pickup" || $_order->getShippingMethod() == "smartsendswipbox_pickup"):
|
30 |
+
?>
|
31 |
+
<div class="box-left">
|
32 |
+
<!--Smart Send Pickup-->
|
33 |
+
<div class="entry-edit">
|
34 |
+
<div class="entry-edit-head">
|
35 |
+
<h4 class="icon-head"><?php echo $this->__('Smart Send Logistics') ?></h4>
|
36 |
+
</div>
|
37 |
+
<fieldset>
|
38 |
+
<div style="float: left" >
|
39 |
+
<?php echo $this->__('Shipping method').': '.$_order->getShippingMethod(); ?>
|
40 |
+
</div>
|
41 |
+
<div class="clear"></div>
|
42 |
+
<?php
|
43 |
+
if(($temp = strlen($_order->getShippingMethod()) - strlen('pickup')) >= 0 && strpos($_order->getShippingMethod(), 'pickup', $temp) !== FALSE) {
|
44 |
+
|
45 |
+
$order_id = $_order->getId(); //order id
|
46 |
+
if ($_order->getShippingMethod() == "smartsendgls_pickup") { //smartsend shipping address
|
47 |
+
$pickupModel = Mage::getModel('logistics/gls');
|
48 |
+
} elseif ($_order->getShippingMethod() == "smartsendswipbox_pickup") {
|
49 |
+
$pickupModel = Mage::getModel('logistics/swipbox');
|
50 |
+
} elseif ($_order->getShippingMethod() == "smartsendpostdanmark_pickup") {
|
51 |
+
$pickupModel = Mage::getModel('logistics/postdanmark');
|
52 |
+
} elseif ($_order->getShippingMethod() == "smartsendposten_pickup") {
|
53 |
+
$pickupModel = Mage::getModel('logistics/posten');
|
54 |
+
} elseif ($_order->getShippingMethod() == "smartsendbring_pickup") {
|
55 |
+
$pickupModel = Mage::getModel('logistics/bring');
|
56 |
+
} elseif ($_order->getShippingMethod() == "smartsendpickup_pickup") {
|
57 |
+
$pickupModel = Mage::getModel('logistics/pickup');
|
58 |
+
}
|
59 |
+
|
60 |
+
if ($pickupModel) {
|
61 |
+
$pickupData = $pickupModel->getCollection()->addFieldToFilter('order_id', $order_id)->getFirstItem(); //pickup data
|
62 |
+
|
63 |
+
if ($pickupData->getData()) {
|
64 |
+
if($pickupData->getPickUpId() != '' && $pickupData->getPickUpId() != '000') {
|
65 |
+
echo $this->__("Carrier") . ": ".$pickupData->getCarrier() . "<br><br>";
|
66 |
+
echo $this->__("Pickup Point Id") . ": " . $pickupData->getPickUpId() . "<br>"; //pickup id
|
67 |
+
echo $pickupData->getCompany() . "<br>" . $pickupData->getStreet() . "<br>" . $pickupData->getZip() . " " . $pickupData->getCity() . "<br>" . $pickupData->getCountry(); //pickup address
|
68 |
+
} else {
|
69 |
+
echo $this->__("Shipping to closest pickup point");
|
70 |
+
}
|
71 |
+
} else {
|
72 |
+
echo $this->__("Record not found");
|
73 |
+
}
|
74 |
+
}
|
75 |
+
} else {
|
76 |
+
echo $this->__("Not a pickup point");
|
77 |
+
}
|
78 |
+
?>
|
79 |
+
<div style="float: right" >
|
80 |
+
<input type="button" class="form-button" value="<?php echo Mage::helper('logistics')->__('Generate label') ?>" title="<?php echo Mage::helper('logistics')->__('Generate label') ?>" onclick="setLocation('<?php echo $this->getUrl("logistics/logistics/label",array('order_id' => $_order->getId())); ?>')"/>
|
81 |
+
<input type="button" class="form-button" value="<?php echo Mage::helper('logistics')->__('Generate return label') ?>" title="<?php echo Mage::helper('logistics')->__('Generate return label') ?>" onclick="setLocation('<?php echo $this->getUrl("logistics/logistics/labelreturn",array('order_id' => $_order->getId())); ?>')" />
|
82 |
+
</div>
|
83 |
+
<div class="clear"></div>
|
84 |
+
</fieldset>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
<div class="clear"></div>
|
88 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/logistics/system/config/excludetax.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Smartsend_Logistics
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License v3.0
|
7 |
+
* that is bundled with this package in the file license.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
17 |
+
* versions in the future. If you wish to customize the plugin for your
|
18 |
+
* needs please refer to http://www.smartsend.dk
|
19 |
+
*
|
20 |
+
* @folder /app/design/adminhtml/default/default/template/logistics/system/config/excludetax.php
|
21 |
+
* @category Smartsend
|
22 |
+
* @package Smartsend_Logistics
|
23 |
+
* @author Anders Bilfeldt
|
24 |
+
* @url www.smartsend.dk
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<input type="hidden" name="<?php echo $this->getNamePrefix() ?>" value="" /><!-- this is send if nothing is checked -->
|
28 |
+
<ul class="checkboxes">
|
29 |
+
<?php foreach ($this->getValues() as $name => $label): ?>
|
30 |
+
<li>
|
31 |
+
<input type="checkbox" value="<?php echo $name?>" name="<?php echo $this->getNamePrefix() ?>[]" id="<?php echo $this->getHtmlId() ?>"<?php echo ($this->getIsChecked($name) ? ' checked="checked"' : '') ?>/>
|
32 |
+
</li>
|
33 |
+
<?php endforeach;?>
|
34 |
+
</ul>
|
app/design/frontend/base/default/layout/logistics.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<checkout_onepage_index>
|
4 |
+
<reference name='head'>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addItem"><type>js</type><name>logistics/jquery-1.6.4.min.js</name></action>
|
7 |
+
<action method="addItem"><type>js</type><name>logistics/noconflict.js</name></action>
|
8 |
+
</reference>
|
9 |
+
</reference>
|
10 |
+
<reference name='checkout.onepage.shipping_method.available'> <!-- available shipping methods -->
|
11 |
+
<action method='setTemplate'>
|
12 |
+
<template>logistics/checkout/onepage/shipping_method/available.phtml</template>
|
13 |
+
</action>
|
14 |
+
</reference>
|
15 |
+
</checkout_onepage_index>
|
16 |
+
<checkout_onepage_shippingmethod>
|
17 |
+
<reference name='root'> <!-- available shipping methods -->
|
18 |
+
<action method='setTemplate'>
|
19 |
+
<template>logistics/checkout/onepage/shipping_method/available.phtml</template>
|
20 |
+
</action>
|
21 |
+
</reference>
|
22 |
+
</checkout_onepage_shippingmethod>
|
23 |
+
<onestepcheckout_index_index>
|
24 |
+
<reference name="head">
|
25 |
+
<action method="addItem"><type>js</type><name>logistics/jquery-1.6.4.min.js</name></action>
|
26 |
+
<action method="addItem"><type>js</type><name>logistics/noconflict.js</name></action>
|
27 |
+
</reference>
|
28 |
+
<reference name ="choose-shipping-method">
|
29 |
+
<action method="setTemplate">
|
30 |
+
<template>logistics/onestepcheckout/shipping_method.phtml</template>
|
31 |
+
</action>
|
32 |
+
</reference>
|
33 |
+
</onestepcheckout_index_index>
|
34 |
+
<onestepcheckout_ajax_save_billing>
|
35 |
+
<reference name="choose-shipping-method">
|
36 |
+
<action method="setTemplate">
|
37 |
+
<template>logistics/onestepcheckout/shipping_method.phtml</template> <!-- show shipping methods -->
|
38 |
+
</action>
|
39 |
+
</reference>
|
40 |
+
</onestepcheckout_ajax_save_billing>
|
41 |
+
</layout>
|
app/design/frontend/base/default/template/logistics/checkout/onepage/shipping_method/available.phtml
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartsend_Logistics
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.smartsend.dk
|
18 |
+
*
|
19 |
+
* @folder /app/design/frontend/default/default/template/logistics/checkout/onepage/shipping_method/available.phtml
|
20 |
+
* @category Smartsend
|
21 |
+
* @package Smartsend_Logistics
|
22 |
+
* @author Anders Bilfeldt
|
23 |
+
* @url www.smartsend.dk
|
24 |
+
*/
|
25 |
+
$pickupShippingFee = Mage::getSingleton('logistics/carrier_pickup')->getPickupShippingFee(); //pickup shipping fees
|
26 |
+
$bringShippingFee = Mage::getSingleton('logistics/carrier_bring')->getBringShippingFee(); //bring shipping fees
|
27 |
+
$swipboxShippingFee = Mage::getSingleton('logistics/carrier_swipbox')->getSwipboxShippingFee(); //swipbox shipping fees
|
28 |
+
$glsShippingFee = Mage::getSingleton('logistics/carrier_gls')->getGlsShippingFee(); //gls shipping fees
|
29 |
+
$postdanmarkShippingFee = Mage::getSingleton('logistics/carrier_postdanmark')->getPostdanmarkShippingFee(); //postdanmark shipping fees
|
30 |
+
$postenShippingFee = Mage::getSingleton('logistics/carrier_posten')->getPostenShippingFee(); //posten shipping fees
|
31 |
+
|
32 |
+
if (!($_shippingRateGroups = $this->getShippingRates())): //if no shipping rates are available
|
33 |
+
?>
|
34 |
+
<p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
|
35 |
+
<?php else: ?>
|
36 |
+
<dl class="sp-methods">
|
37 |
+
<?php $shippingCodePrice = array(); ?>
|
38 |
+
<?php
|
39 |
+
$_sole = count($_shippingRateGroups) == 1;
|
40 |
+
foreach ($_shippingRateGroups as $code => $_rates):
|
41 |
+
?>
|
42 |
+
<dt><?php echo $this->getCarrierName($code) ?></dt> <!-- getting shipping carrier -->
|
43 |
+
<dd>
|
44 |
+
<ul>
|
45 |
+
<?php
|
46 |
+
$_sole = $_sole && count($_rates) == 1;
|
47 |
+
foreach ($_rates as $_rate):
|
48 |
+
if ($_rate->getCode() === 'smartsendpickup_smartsendpickup') { //get shipping code
|
49 |
+
$shippingFee = $pickupShippingFee;
|
50 |
+
} elseif ($_rate->getCode() === 'smartsendswipbox_smartsendswipbox') {
|
51 |
+
$shippingFee = $swipboxShippingFee;
|
52 |
+
} elseif ($_rate->getCode() === 'smartsendpostdanmark_smartsendpostdanmark') {
|
53 |
+
$shippingFee = $postdanmarkShippingFee;
|
54 |
+
} elseif ($_rate->getCode() === 'smartsendposten_smartsendposten') {
|
55 |
+
$shippingFee = $postenShippingFee;
|
56 |
+
} elseif ($_rate->getCode() === 'smartsendgls_smartsendgls') {
|
57 |
+
$shippingFee = $glsShippingFee;
|
58 |
+
} elseif ($_rate->getCode() === 'smartsendbring_smartsendbring') {
|
59 |
+
$shippingFee = $bringShippingFee;
|
60 |
+
} else {
|
61 |
+
$shippingFee = $_rate->getPrice();
|
62 |
+
}
|
63 |
+
|
64 |
+
$_rate->setPrice($shippingFee);
|
65 |
+
?>
|
66 |
+
<?php $shippingCodePrice[] = "'" . $_rate->getCode() . "':" . (float) $_rate->getPrice(); ?> <!-- get shipping code and the price -->
|
67 |
+
<li>
|
68 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
69 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
70 |
+
<?php else: ?>
|
71 |
+
<?php if ($_sole) : ?>
|
72 |
+
<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
|
73 |
+
<?php else: ?>
|
74 |
+
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if ($_rate->getCode() === $this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>
|
75 |
+
|
76 |
+
<?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
|
77 |
+
<script type="text/javascript">
|
78 |
+
//<![CDATA[
|
79 |
+
lastPrice = <?php echo (float) $_rate->getPrice(); ?>;
|
80 |
+
//]]>
|
81 |
+
</script>
|
82 |
+
<?php endif; ?>
|
83 |
+
|
84 |
+
<?php endif; ?>
|
85 |
+
<?php
|
86 |
+
$shipping_method = $_rate->getCode();
|
87 |
+
$carrier = explode('_', $shipping_method);
|
88 |
+
$smartsend_carrier = $carrier['0'];
|
89 |
+
|
90 |
+
if (substr($shipping_method, 0, strlen('smartsend')) === 'smartsend' && Mage::getStoreConfig("carriers/" . $smartsend_carrier . "/excludetax")) {
|
91 |
+
?>
|
92 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?> <!-- get method title and the code -->
|
93 |
+
<?php $_excl = Mage::helper('core')->currency($_rate->getPrice(), true, false); ?> <!-- get shipping price excluding tax if shipping method does not contains tax -->
|
94 |
+
<?php echo $_excl; ?>
|
95 |
+
|
96 |
+
</label>
|
97 |
+
<?php
|
98 |
+
} else {
|
99 |
+
?>
|
100 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?> <!-- get method title and the code -->
|
101 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?> <!-- get shipping price excluding tax -->
|
102 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?> <!-- get shipping price with tax -->
|
103 |
+
<?php echo $_excl; ?>
|
104 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?> <!-- display prices -->
|
105 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
106 |
+
<?php endif; ?>
|
107 |
+
</label>
|
108 |
+
<?php
|
109 |
+
}
|
110 |
+
?>
|
111 |
+
|
112 |
+
<?php
|
113 |
+
$carrier = Mage::getModel('shipping/config')->getCarrierInstance($code); //get shipping carrier
|
114 |
+
if ($carrier->getFormBlock()) {
|
115 |
+
$block = $this->getLayout()->createBlock($carrier->getFormBlock());
|
116 |
+
$block->setMethodCode($code);
|
117 |
+
$block->setRate($_rate);
|
118 |
+
$block->setMethodInstance($carrier);
|
119 |
+
echo $block->_toHtml();
|
120 |
+
}
|
121 |
+
?>
|
122 |
+
<?php endif; ?>
|
123 |
+
</li>
|
124 |
+
<?php endforeach; ?>
|
125 |
+
</ul>
|
126 |
+
</dd>
|
127 |
+
<?php endforeach; ?>
|
128 |
+
</dl>
|
129 |
+
<script type="text/javascript">
|
130 |
+
|
131 |
+
jQuery(document).ready(function() {
|
132 |
+
hideShippingAll();
|
133 |
+
jQuery('input[type="radio"][name="shipping_method"]').click(function() {
|
134 |
+
hideShippingAll();
|
135 |
+
var code = jQuery(this).val();
|
136 |
+
if (jQuery(this).is(':checked')) {
|
137 |
+
showShipping(code);
|
138 |
+
}
|
139 |
+
});
|
140 |
+
jQuery('input[type="radio"][name="shipping_method"]').each(function() {
|
141 |
+
var code = jQuery(this).val();
|
142 |
+
if (jQuery(this).is(":checked")) {
|
143 |
+
showShipping(code);
|
144 |
+
}
|
145 |
+
});
|
146 |
+
});
|
147 |
+
function showShipping(code) {
|
148 |
+
if (jQuery("[id='" + 'shipping_form_' + code + "']").length != 0) {
|
149 |
+
jQuery("[id='" + 'shipping_form_' + code + "']").show();
|
150 |
+
jQuery(this).find('.required-entry').attr('disabled', 'false');
|
151 |
+
}
|
152 |
+
}
|
153 |
+
function hideShippingAll() {
|
154 |
+
jQuery('input[type="radio"][name="shipping_method"]').each(function() {
|
155 |
+
var code = jQuery(this).val();
|
156 |
+
jQuery("[id='" + 'shipping_form_' + code + "']").hide();
|
157 |
+
jQuery(this).find('.required-entry').attr('disabled', 'true');
|
158 |
+
});
|
159 |
+
}
|
160 |
+
</script>
|
161 |
+
<?php endif; ?>
|
162 |
+
|
163 |
+
|
app/design/frontend/base/default/template/logistics/onestepcheckout/shipping_method.phtml
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartsend_Logistics
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.smartsend.dk
|
18 |
+
*
|
19 |
+
* @folder /app/design/frontend/default/default/template/logistics/onestepcheckout/shipping_method.phtml
|
20 |
+
* @category Smartsend
|
21 |
+
* @package Smartsend_Logistics
|
22 |
+
* @author Anders Bilfeldt
|
23 |
+
* @url www.smartsend.dk
|
24 |
+
*/
|
25 |
+
$pickupShippingFee = Mage::getSingleton('logistics/carrier_pickup')->getPickupShippingFee(); //pickup shipping fees
|
26 |
+
$bringShippingFee = Mage::getSingleton('logistics/carrier_bring')->getBringShippingFee(); //bring shipping fees
|
27 |
+
$swipboxShippingFee = Mage::getSingleton('logistics/carrier_swipbox')->getSwipboxShippingFee(); //swipbox shipping fees
|
28 |
+
$glsShippingFee = Mage::getSingleton('logistics/carrier_gls')->getGlsShippingFee(); //gls shipping fees
|
29 |
+
$postdanmarkShippingFee = Mage::getSingleton('logistics/carrier_postdanmark')->getPostdanmarkShippingFee(); //postdanmark shipping fees
|
30 |
+
$postenShippingFee = Mage::getSingleton('logistics/carrier_posten')->getPostenShippingFee(); //posten shipping fees
|
31 |
+
if (!($_shippingRateGroups = $this->getShippingRates())): //if no shipping rates
|
32 |
+
?>
|
33 |
+
<strong><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></strong>
|
34 |
+
<?php else: ?>
|
35 |
+
<?php if (count($_shippingRateGroups) == '1' && Mage::getStoreConfig('onestepcheckout/general/hide_shipping_method')): ?> <!-- if hide shipping method -->
|
36 |
+
<dl class="shipment-methods" style="display: none">
|
37 |
+
<?php foreach ($_shippingRateGroups as $code => $_rates): ?> <!-- shipping group -->
|
38 |
+
<dd><?php echo $this->getCarrierName($code) ?></dd> <!-- shipping carrier name -->
|
39 |
+
<?php
|
40 |
+
foreach ($_rates as $_rate):
|
41 |
+
if ($_rate->getCode() === 'smartsendpickup_smartsendpickup') {
|
42 |
+
$shippingFee = $pickupShippingFee;
|
43 |
+
} elseif ($_rate->getCode() === 'smartsendswipbox_smartsendswipbox') {
|
44 |
+
$shippingFee = $swipboxShippingFee;
|
45 |
+
} elseif ($_rate->getCode() === 'smartsendpostdanmark_smartsendpostdanmark') {
|
46 |
+
$shippingFee = $postdanmarkShippingFee;
|
47 |
+
} elseif ($_rate->getCode() === 'smartsendposten_smartsendposten') {
|
48 |
+
$shippingFee = $postenShippingFee;
|
49 |
+
} elseif ($_rate->getCode() === 'smartsendgls_smartsendgls') {
|
50 |
+
$shippingFee = $glsShippingFee;
|
51 |
+
} elseif ($_rate->getCode() === 'smartsendbring_smartsendbring') {
|
52 |
+
$shippingFee = $bringShippingFee;
|
53 |
+
} else {
|
54 |
+
$shippingFee = $_rate->getPrice();
|
55 |
+
}
|
56 |
+
|
57 |
+
$_rate->setPrice($shippingFee);
|
58 |
+
?>
|
59 |
+
<dt style="margin-bottom: 5px;">
|
60 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
61 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
62 |
+
<?php else: ?>
|
63 |
+
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" />
|
64 |
+
<?php
|
65 |
+
$shipping_method = $_rate->getCode();
|
66 |
+
$carrier = explode('_', $shipping_method);
|
67 |
+
$smartsend_carrier = $carrier['0'];
|
68 |
+
|
69 |
+
if (substr($shipping_method, 0, strlen('smartsend')) === 'smartsend' && Mage::getStoreConfig("carriers/" . $smartsend_carrier . "/excludetax")) {
|
70 |
+
?>
|
71 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?> <!-- get method title and the code -->
|
72 |
+
<strong>
|
73 |
+
<?php $_excl = Mage::helper('core')->currency($_rate->getPrice(), true, false); ?> <!-- get shipping price excluding tax if shipping method does not contains tax -->
|
74 |
+
<?php echo $_excl; ?>
|
75 |
+
</strong>
|
76 |
+
</label>
|
77 |
+
<?php
|
78 |
+
} else {
|
79 |
+
?>
|
80 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?> <!-- get method title and the code -->
|
81 |
+
<strong>
|
82 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?> <!-- get shipping price excluding tax -->
|
83 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?> <!-- get shipping price with tax -->
|
84 |
+
<?php echo $_excl; ?>
|
85 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?> <!-- display prices -->
|
86 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
87 |
+
<?php endif; ?>
|
88 |
+
</strong>
|
89 |
+
</label>
|
90 |
+
<?php
|
91 |
+
}
|
92 |
+
?>
|
93 |
+
|
94 |
+
<?php endif ?>
|
95 |
+
</dt>
|
96 |
+
<?php endforeach; ?>
|
97 |
+
<?php endforeach; ?>
|
98 |
+
</dl>
|
99 |
+
<?php else: ?>
|
100 |
+
<dl class="shipment-methods">
|
101 |
+
<?php foreach ($_shippingRateGroups as $code => $_rates): ?> <!-- getting shipping rates -->
|
102 |
+
<dd><?php echo $this->getCarrierName($code) ?></dd> <!-- getting carrier names -->
|
103 |
+
<?php
|
104 |
+
foreach ($_rates as $_rate):
|
105 |
+
if ($_rate->getCode() === 'smartsendpickup_smartsendpickup') {
|
106 |
+
$shippingFee = $pickupShippingFee;
|
107 |
+
} elseif ($_rate->getCode() === 'smartsendswipbox_smartsendswipbox') {
|
108 |
+
$shippingFee = $swipboxShippingFee;
|
109 |
+
} elseif ($_rate->getCode() === 'smartsendpostdanmark_smartsendpostdanmark') {
|
110 |
+
$shippingFee = $postdanmarkShippingFee;
|
111 |
+
} elseif ($_rate->getCode() === 'smartsendposten_smartsendposten') {
|
112 |
+
$shippingFee = $postenShippingFee;
|
113 |
+
} elseif ($_rate->getCode() === 'smartsendgls_smartsendgls') {
|
114 |
+
$shippingFee = $glsShippingFee;
|
115 |
+
} elseif ($_rate->getCode() === 'smartsendbring_smartsendbring') {
|
116 |
+
$shippingFee = $bringShippingFee;
|
117 |
+
} else {
|
118 |
+
$shippingFee = $_rate->getPrice();
|
119 |
+
}
|
120 |
+
|
121 |
+
$_rate->setPrice($shippingFee);
|
122 |
+
?>
|
123 |
+
<dt style="margin-bottom: 5px;">
|
124 |
+
|
125 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
126 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
127 |
+
<?php else: ?>
|
128 |
+
<input name="shipping_method" type="radio" class="validate-one-required-by-name" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if ($_rate->getCode() === $this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
|
129 |
+
<?php
|
130 |
+
$shipping_method = $_rate->getCode();
|
131 |
+
$carrier = explode('_', $shipping_method);
|
132 |
+
$smartsend_carrier = $carrier['0'];
|
133 |
+
|
134 |
+
if (substr($shipping_method, 0, strlen('smartsend')) === 'smartsend' && Mage::getStoreConfig("carriers/" . $smartsend_carrier . "/excludetax")) {
|
135 |
+
?>
|
136 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?> <!-- get method title and the code -->
|
137 |
+
<strong>
|
138 |
+
<?php $_excl = Mage::helper('core')->currency($_rate->getPrice(), true, false); ?> <!-- get shipping price excluding tax if shipping method does not contains tax -->
|
139 |
+
<?php echo $_excl; ?>
|
140 |
+
</strong>
|
141 |
+
</label>
|
142 |
+
<?php
|
143 |
+
} else {
|
144 |
+
?>
|
145 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?> <!-- get method title and the code -->
|
146 |
+
|
147 |
+
<strong> <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?> <!-- get shipping price excluding tax -->
|
148 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?> <!-- get shipping price with tax -->
|
149 |
+
<?php echo $_excl; ?>
|
150 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?> <!-- display prices -->
|
151 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
152 |
+
<?php endif; ?>
|
153 |
+
</strong>
|
154 |
+
</label>
|
155 |
+
<?php
|
156 |
+
}
|
157 |
+
?>
|
158 |
+
|
159 |
+
<?php
|
160 |
+
$carrier = Mage::getModel('shipping/config')->getCarrierInstance($code); //get carrier instance
|
161 |
+
if ($_rate->getCode() != 'smartsendswipbox_smartsendswipbox' && $_rate->getCode() != 'smartsendpostdanmark_smartsendpostdanmark' && $_rate->getCode() != 'smartsendposten_smartsendposten' && $_rate->getCode() != 'smartsendgls_smartsendgls' && $_rate->getCode() != 'smartsendbring_smartsendbring') {
|
162 |
+
|
163 |
+
if ($carrier->getFormBlock()) {
|
164 |
+
$block = $this->getLayout()->createBlock($carrier->getFormBlock());
|
165 |
+
$block->setMethodCode($code);
|
166 |
+
$block->setRate($_rate);
|
167 |
+
$block->setMethodInstance($carrier);
|
168 |
+
echo $block->_toHtml();
|
169 |
+
}
|
170 |
+
}
|
171 |
+
?>
|
172 |
+
<?php endif ?>
|
173 |
+
</dt>
|
174 |
+
<?php endforeach; ?>
|
175 |
+
<?php endforeach; ?>
|
176 |
+
</dl>
|
177 |
+
<?php endif; ?>
|
178 |
+
<?php endif; ?>
|
179 |
+
<script type="text/javascript">
|
180 |
+
jQuery(document).ready(function() {
|
181 |
+
hideShippingAll();
|
182 |
+
jQuery('input[type="radio"][name="shipping_method"]').click(function() {
|
183 |
+
hideShippingAll();
|
184 |
+
var code = jQuery(this).val();
|
185 |
+
if (jQuery(this).is(':checked')) {
|
186 |
+
showShipping(code);
|
187 |
+
}
|
188 |
+
});
|
189 |
+
jQuery('input[type="radio"][name="shipping_method"]').each(function() {
|
190 |
+
var code = jQuery(this).val();
|
191 |
+
if (jQuery(this).is(":checked")) {
|
192 |
+
showShipping(code);
|
193 |
+
}
|
194 |
+
});
|
195 |
+
});
|
196 |
+
function showShipping(code) {
|
197 |
+
if (jQuery('#' + 'shipping_form_' + code).length != 0) {
|
198 |
+
jQuery('#' + 'shipping_form_' + code).show();
|
199 |
+
jQuery(this).find('.required-entry').attr('disabled', 'false');
|
200 |
+
}
|
201 |
+
}
|
202 |
+
function hideShippingAll() {
|
203 |
+
jQuery('input[type="radio"][name="shipping_method"]').each(function() {
|
204 |
+
var code = jQuery(this).val();
|
205 |
+
jQuery('#' + 'shipping_form_' + code).hide();
|
206 |
+
jQuery(this).find('.required-entry').attr('disabled', 'true');
|
207 |
+
});
|
208 |
+
}
|
209 |
+
</script>
|
app/design/frontend/base/default/template/logistics/pickup.phtml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Smartsend_Logistics
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@smartsend.dk so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.smartsend.dk
|
18 |
+
*
|
19 |
+
* @folder /app/design/frontend/default/default/template/logistics/pickup.phtml
|
20 |
+
* @category Smartsend
|
21 |
+
* @package Smartsend_Logistics
|
22 |
+
* @author Anders Bilfeldt
|
23 |
+
* @url www.smartsend.dk
|
24 |
+
*/
|
25 |
+
$_rate = $this->getRate(); //shipping method rate
|
26 |
+
$carrier = explode('_', $_rate->getCode()); //shipping method carrier
|
27 |
+
$method = $_rate->getMethod(); //shipping method
|
28 |
+
if ($method == 'pickup' || $carrier[1] == 'smartsendpickup') { //if shipping method is delivery ponint or is pickup then the pickup points will show
|
29 |
+
$_code = $this->getMethodCode(); //shipping method code
|
30 |
+
$carrier = $this->getMethodInstance();
|
31 |
+
$pickupData = $this->getQuote()->getPickupData(); //shipping method pickup
|
32 |
+
$result = $this->getPickupData(); //shipping method pickup data
|
33 |
+
|
34 |
+
if (!isset($pickupData['store'])) {
|
35 |
+
$pickupData['store'] = -1;
|
36 |
+
}
|
37 |
+
if (!isset($pickupData['name'])) {
|
38 |
+
$pickupData['name'] = '';
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
<ul class="form-list" id="shipping_form_<?php echo $_rate->getCode() ?>" style="display:none;">
|
42 |
+
<li>
|
43 |
+
<?php
|
44 |
+
if (count($result) <= 0 || $result == FALSE) { //if no pickup data available
|
45 |
+
?>
|
46 |
+
<span id="no_record_<?php echo $_rate->getCode() ?>"><?php echo $this->__('Delivered to closest pickup point'); ?></span>
|
47 |
+
<!-- <script type="text/javascript">
|
48 |
+
jQuery(document).ready(function() {
|
49 |
+
var rm = jQuery("#no_record_<?php //echo $_rate->getCode() ?>").parent('li').parent('ul').parent('li').parent('ul').parent('dd');
|
50 |
+
jQuery(rm).prev('dt').remove();
|
51 |
+
jQuery(rm).remove();
|
52 |
+
/* hack for onepagecheckout */
|
53 |
+
var op = jQuery("#shipping_form_<?php //echo $_rate->getCode() ?>").parent("dt");
|
54 |
+
jQuery(op).prev("dd").remove();
|
55 |
+
jQuery(op).remove();
|
56 |
+
/* hack for onepagecheckout */
|
57 |
+
});
|
58 |
+
</script> -->
|
59 |
+
<?php
|
60 |
+
} else { //displaying pickup data
|
61 |
+
?>
|
62 |
+
<label for="<?php echo $_code ?>_store" class="required"><em>*</em><?php echo $this->__('Choose Store Location:') ?></label>
|
63 |
+
<span class="input-box">
|
64 |
+
<select class="required-entry" name="shipping_pickup[store][<?php echo $_rate->getCode() ?>]"> <!-- table rate shipping code -->
|
65 |
+
<option value=''><?php echo $this->__('Select Store..'); ?></option>
|
66 |
+
<?php
|
67 |
+
foreach ($result as $key => $value) {
|
68 |
+
$s = '';
|
69 |
+
foreach ($value as $k => $val) {
|
70 |
+
if ($k == 'zip_code') {
|
71 |
+
$s .= $val . " ";
|
72 |
+
} else {
|
73 |
+
$s .= $val . ", ";
|
74 |
+
}
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
<option value='<?php echo $key ?>'><?php echo substr($s, 0, -2) ?></option>
|
78 |
+
<?php
|
79 |
+
}
|
80 |
+
?>
|
81 |
+
</select>
|
82 |
+
</span>
|
83 |
+
<?php } ?>
|
84 |
+
</li>
|
85 |
+
</ul>
|
86 |
+
<?php } ?>
|
app/etc/modules/Smartsend_Logistics.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Smartsend_Logistics>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Smartsend_Logistics>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/da_DK/Smartsend_Logistics.csv
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Username, Brugernavn
|
2 |
+
Licencekey, Licenskode
|
3 |
+
Combine PDF files?, Kombiner PDF filer?
|
4 |
+
Seperate pdf's, Opdel PDF'er
|
5 |
+
Combine pdf's into one file, Saml PDF filer til én
|
6 |
+
Method, Metode
|
7 |
+
Min Price,Min pris
|
8 |
+
Max Price,Maks pris
|
9 |
+
Min Weight,Min vægt
|
10 |
+
Max Weight,Maks vægt
|
11 |
+
Shipping Fee,Fragt pris
|
12 |
+
Countries, Lande
|
13 |
+
Add Rate,Tilføj Rate
|
14 |
+
Enabled,Aktiveret
|
15 |
+
Disabled,Deaktiveret
|
16 |
+
Delete,Slet
|
17 |
+
the order confirmation email was sent,ordrebekræftelses e-mail blev sendt
|
18 |
+
the order confirmation email was not sent,ordrebekræftelses e-mail blev ikke sendt
|
19 |
+
Order Date,Ordre dato
|
20 |
+
Order Status,Ordrestatus
|
21 |
+
Purchased From,Indkøbt fra
|
22 |
+
Link to the New Order,Link til den nye orden
|
23 |
+
Link to the Previous Order,Link til den tidligere ordre
|
24 |
+
Placed from IP,Placeret fra IP
|
25 |
+
Account Information,Kontooplysninger
|
26 |
+
Customer Name,Kundenavn
|
27 |
+
Email,Email
|
28 |
+
Email notification,Email notifikation
|
29 |
+
SMS notification,SMS notifikation
|
30 |
+
Pre-notification,Pre-notifikation
|
31 |
+
Return,Retur
|
32 |
+
Return methode,Retur metode
|
33 |
+
Which carrier should handle return packages?,Hvilket fragtfirma skal håndtere returpakker?
|
34 |
+
Customer Group,Customer Group
|
35 |
+
Billing Address,Faktureringsadresse
|
36 |
+
Shipping Address,Leveringsadresse
|
37 |
+
Smart Send Pickup Address,Smart Send Afhentningsadresse
|
38 |
+
Pickup Point Id: ,Afhentnings ID:
|
39 |
+
Shipping Method: ,Forsendelses Metode:
|
40 |
+
Record not found,Optag ikke fundet
|
41 |
+
Choose Store Location:,Vælg afhentningssted:
|
42 |
+
Select Store..,Vælg afhentningssted..
|
43 |
+
"Sorry, no quotes are available for this order at this time.","Beklager, ingen fragtpris er til rådighed for denne ordre på nuværende tidspunkt."
|
44 |
+
Incl. Tax,Inkl. Moms
|
45 |
+
Title,Titel
|
46 |
+
Carrier Title,Titel på fragtfirma
|
47 |
+
Method Name,Metode navn
|
48 |
+
Consumer ID,Forbruger ID
|
49 |
+
Price,Pris
|
50 |
+
Cheapest or most expensive?,Billigste eller dyreste?
|
51 |
+
Cheapest, Billigste
|
52 |
+
Most Expensive, Dyreste
|
53 |
+
PDF file, PDF fil
|
54 |
+
Yes, Ja
|
55 |
+
No, Nej
|
56 |
+
Displayed Error Message,Vist fejlmeddelelse
|
57 |
+
Timeout,Timeout
|
58 |
+
Number Of Results,Antal resultater
|
59 |
+
Dropdown format,Dropdown format
|
60 |
+
"This shipping method is currently unavailable.####### If you would like to ship using this shipping method, please contact us.","Denne forsendelsesmetode er ikke tilgængelig i øjeblikket . ####### Hvis du ønsker at sende ved hjælp af denne forsendelsesmetode , så kontakt os."
|
61 |
+
Closest Pickup,Nærmeste afhentningssted
|
62 |
+
Small,Lille
|
63 |
+
Medium,Medium
|
64 |
+
Large,Stor
|
65 |
+
Delivered to closest pickup point, Leveres til nærmeste afhentningssted
|
66 |
+
Username and licencekey must be entered in settings, Brugernavn og licenskode skal indtastes i indstillingerne før brug
|
67 |
+
Unknown carrier, Ukendt fragtmetode
|
68 |
+
No orders selected, Ingen ordre valgt
|
69 |
+
Method not yet implemented, Metoden er ikke implementeret endnu
|
70 |
+
Trying to send empty order array, Prøver at sende et tomt order array
|
71 |
+
An error occurred while sending order, En fejl opstod mens ordren blev sendt
|
72 |
+
Response, Svar
|
73 |
+
Unknown status, Ukendt status
|
74 |
+
Unknown content type, Ukendt indholds format
|
75 |
+
Had shipments, Havde forsendelser
|
76 |
+
Unknown pickup method, Ukendt pickup metode
|
77 |
+
Unable to fetch pickup data, Kunne ikke læse data om pickup
|
78 |
+
Not a pickup shipping method, Ikke en pickup forsendelsesmetode
|
79 |
+
Unsupported carrier, Ikke understøttet fragtfirma
|
80 |
+
Unsupported shipping method, Ikke understøttet forsendelses metode
|
81 |
+
Unknown carrier, Ukendt fragtfirma
|
82 |
+
Unknown carrier when adding services, Ukendt fragtfirma ved tilføjelse af service
|
83 |
+
Generate label, Lav label
|
84 |
+
Generate return label, Lav retur label,
|
85 |
+
How the dropdown is formatted, Formatet af dropdown listen
|
86 |
+
Carrier is excluded from TAX even though there is a Shipping Tax defined, Der udregnes ikke moms af fragten selvom der er defineret en moms for fragt
|
87 |
+
Order has no shipments without trace code and cannot be shipped, Ordren har ikke en forsendelse uden track&trace kode
|
88 |
+
Failed to insert tracecode, Kunne ikke indsætte track and trace kode
|
89 |
+
Unable to determine carrier for pickup shipping method, Kunne ikke bestemme fragtfirma for pickup forsendelsesmetode
|
90 |
+
No items that could be shipped, Ingen produkter kunne sendes
|
91 |
+
Shipping to closest pickup point, Sendes til nærmeste afhentningssted
|
92 |
+
"Either just an id or a semicolon separated list of 'country,id' (* is all countries). Eg: SE,123;NO,321;*,44", "Enten blot et id eller en semikolon separeret liste af 'land,id' (* er all lande). Fx: SE,123;NO,321;*,44"
|
93 |
+
No parcels without trace code, Ingen forsendelser uden tracking nummer
|
94 |
+
No unshipped items, Ingen usendte varer
|
95 |
+
No parcels to ship, Ingen varer kan sendes
|
js/logistics/jquery-1.6.4.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
|
2 |
+
(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete
|
3 |
+
t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|object|embed|option|style)/i,bb=/checked\s*(?:[^=]|=\s*.checked.)/i,bc=/\/(java|ecma)script/i,bd=/^\s*<!(?:\[CDATA\[|\-\-)/,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bb.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!ba.test(a[0])&&(f.support.checkClone||!bb.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean
|
4 |
+
(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bk(k[i]);else bk(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bc.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/([A-Z]|^ms)/g,bp=/^-?\d+(?:px)?$/i,bq=/^-?\d/,br=/^([\-+])=([\-+.\de]+)/,bs={position:"absolute",visibility:"hidden",display:"block"},bt=["Left","Right"],bu=["Top","Bottom"],bv,bw,bx;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bv(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=br.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bv)return bv(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return by(a,b,d);f.swap(a,bs,function(){e=by(a,b,d)});return e}},set:function(a,b){if(!bp.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cr(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cq("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cq("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cr(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cq("show",1),slideUp:cq("hide",1),slideToggle:cq("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return d.step(a)}var d=this,e=f.fx;this.startTime=cn||co(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&f.timers.push(g)&&!cl&&(cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||co(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cs=/^t(?:able|d|h)$/i,ct=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cu(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cs.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
|
js/logistics/noconflict.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery.noConflict();
|
package.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Smartsend_Logistics</name>
|
4 |
+
<version>7.0.5</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.gnu.org/licenses/gpl.html">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Shipping methods for Post Danmark, GLS, Bring, SwipBox and Posten.</summary>
|
10 |
+
<description>Shipping methods for Post Danmark, GLS, Bring, SwipBox and Posten.
|
11 |
+
Description :: Shipping methods for Post Danmark, GLS, Bring, SwipBox and Posten.
|
12 |
+

|
13 |
+
This modules enables table rate shipping methods for all the listed carriers. The module includes pickup points where the customer are presented a dropdown with nearby pickup locations based on shipping address.
|
14 |
+

|
15 |
+
The module can also create labels for the shipments.</description>
|
16 |
+
<notes>Lates stable release</notes>
|
17 |
+
<authors><author><name>Smart Send ApS</name><user>SmartSendDK</user><email>anders@smartsend.dk</email></author></authors>
|
18 |
+
<date>2015-08-04</date>
|
19 |
+
<time>18:31:40</time>
|
20 |
+
<contents><target name="magecommunity"><dir name="Smartsend"><dir name="Logistics"><dir name="Block"><dir name="Adminhtml"><file name="PickupShipping.php" hash="caca818fedd479b76a405b8238b2d002"/><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Info.php" hash="1e5269928626d3817b62cd4f382ac47a"/></dir></dir></dir></dir><file name="Shipping.php" hash="1afb1a9495366a2583f50dc7233a22df"/><dir name="System"><dir name="Config"><file name="Excludetax.php" hash="cf6ee2a8f49bca55781ec9f9372b065b"/></dir></dir></dir><file name="Bring.php" hash="a42e6e7c448902d7644012d409f84260"/><file name="Gls.php" hash="711d248f9e4575a91b1a86c7d8127681"/><file name="Pickup.php" hash="8962c1e695c16390a80080d38abf5322"/><file name="Postdanmark.php" hash="a24825141eeb2c9cbe07fbaf1caa6bba"/><file name="Posten.php" hash="6ca7e2336c659f032fde01a5a90152ad"/><file name="Swipbox.php" hash="4fe9c67f82e031c69c52e39e07bac148"/></dir><dir name="Helper"><file name="Data.php" hash="2a7ebc0b1cc73dbfa20179294a4db144"/></dir><dir name="Model"><file name="Bring.php" hash="d085d49eb215752102ab74926a0d5c79"/><dir name="Carrier"><file name="Bring.php" hash="62840c94debe7792396c5fcbab1db9ff"/><file name="Gls.php" hash="ff0e230e167337a82285c846cdc79caf"/><file name="Pickup.php" hash="8f652de7f2bf11893a2f02649f107b38"/><file name="Postdanmark.php" hash="f5adfe23cc73e7239372f69d3f59421a"/><file name="Posten.php" hash="14657ff2445cfa6cf60bde02e6c0bdb9"/><file name="Swipbox.php" hash="2fc3cd65e7e334ed61eac3ac03e15e7b"/></dir><file name="Gls.php" hash="a40e74472e611bbd955c752f97d9769c"/><dir name="Mysql4"><dir name="Bring"><file name="Collection.php" hash="fbab7b8475845cd8c724f81f8da318cd"/></dir><file name="Bring.php" hash="2761ca69301f65d7c50dab039f832489"/><dir name="Gls"><file name="Collection.php" hash="ff85ba1838f20c88909cac240d484e90"/></dir><file name="Gls.php" hash="c6c4d58ebf7bde0fd13d010efc34771a"/><dir name="Pickup"><file name="Collection.php" hash="51b13cbc4eba93b1a4f97e15c403738b"/></dir><file name="Pickup.php" hash="a227429c1b4e405e96b42ca48a8f83fd"/><dir name="Postdanmark"><file name="Collection.php" hash="340ad97e9348c794b6c5af36c063c716"/></dir><file name="Postdanmark.php" hash="0eb4991832f7a7915e4b683aec0dd5bf"/><dir name="Posten"><file name="Collection.php" hash="0ce6dbb1ce831f71c53d924fb7bab360"/></dir><file name="Posten.php" hash="82adc2661f43b5fb1cd7e1cd8a77c367"/><dir name="Swipbox"><file name="Collection.php" hash="75b0c0ea34408963902fe138fa5365ca"/></dir><file name="Swipbox.php" hash="f102c53886fc157b3a82d8640738c396"/></dir><file name="Observer.php" hash="e323d6eda0f7b9462923f4f6d345c6a3"/><file name="Order.php" hash="a54ca26d6df8c2014679788ad3f4e80b"/><file name="Pickup.php" hash="accf417ad67bec5432ba7ee328776c64"/><file name="Postdanmark.php" hash="049fd41acaeb28e3acbe6741fd2c3f1f"/><file name="Posten.php" hash="054949a6cd0f076f78587668e07cd723"/><dir name="Rewrite"><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Shipping.php" hash="8cbeeb87faa1894729bda69eb84d2a6c"/><file name="Tax.php" hash="ffe46d9acdf5c6675deaa79db7b9f3bd"/></dir></dir></dir></dir><file name="ShippingMethods.php" hash="e5a27d0288de87bcdc9843055f83e651"/><file name="Status.php" hash="1e747a56f6fa5bfdff090d503178363a"/><file name="Swipbox.php" hash="095ca2a9420043b648831eadf765f8aa"/><dir name="System"><file name="CombinePdf.php" hash="5943d5b5f5091c0cca79366255c01d0e"/><file name="Listformat.php" hash="38cbc44456711d3dd275ba53609fb6a1"/><file name="OrderOption.php" hash="1261cd9302ef30ae3a1efc785990e3b0"/><file name="Pacsoftformat.php" hash="9b188ba263db84ba53065b934f1e7b58"/><dir name="Pickup"><file name="Listformat.php" hash="251eac7e1d2768787bc67e9ca038ce0d"/></dir><file name="PickupMethods.php" hash="66bf089dd5dd04b5e32ae5b9308a4d26"/><file name="Return.php" hash="357ae4d4cd7214dfc6f2be19b4533c16"/><file name="Size.php" hash="72f40a99360d5adb90ad9d5558f43571"/></dir></dir><dir name="controllers"><file name="LogisticsController.php" hash="6d39e924b192ec1e2d23309aa464467d"/></dir><dir name="etc"><file name="config.xml" hash="a649a03271e167e0425a8960fe92ef38"/><file name="system.xml" hash="a5acfd1f538f3ab5ff8cf6f0a5b97f40"/></dir><dir name="sql"><dir name="logistics_setup"><file name="mysql4-install-7.0.1.php" hash="19b72dc9f075dc0920d6f74840b637ce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="logistics.xml" hash="b29335c04ab5dd624da41604f4c06b20"/></dir><dir name="template"><dir name="logistics"><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="info.phtml" hash="73eff637d40c99cb6400f4e64ef2926e"/></dir><file name="info.phtml" hash="8ee1a2c05e4b19e5f9a20a5d526455a0"/></dir></dir></dir><dir name="system"><dir name="config"><file name="excludetax.phtml" hash="8e67e3bf0d3817cfc32d718e0435f8e6"/></dir></dir><file name="array_dropdown.phtml" hash="734326ecd1c545c4166c42d4410ab33c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="logistics.xml" hash="9c56854ed306a7bcd5d8855ecf1b183e"/></dir><dir name="template"><dir name="logistics"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="512dc29908a55f1bd0d48eed5a3053b2"/></dir></dir></dir><dir name="onestepcheckout"><file name="shipping_method.phtml" hash="f844d1f8fb2d782452edd106420db4c0"/></dir><file name="pickup.phtml" hash="0e045ffdaa3a42c35f5359019f327c8a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Smartsend_Logistics.xml" hash="f54aeead0ec93bc9e7d5150bac2b6907"/></dir></target><target name="magelocale"><dir name="da_DK"><file name="Smartsend_Logistics.csv" hash="dd4f03fb66555411cbcdb0310ab788a4"/></dir></target><target name="mageweb"><dir name="js"><dir name="logistics"><file name="jquery-1.6.4.min.js" hash="9118381924c51c89d9414a311ec9c97f"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir></dir></target></contents>
|
21 |
+
<compatible/>
|
22 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9</max></package><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
|
23 |
+
</package>
|