Version Notes
i-parcel Global Access Extension
Download this release
Release Info
Developer | Patryk Grudniewski |
Extension | iparcel_connect |
Version | 2.4.1.5 |
Comparing to | |
See all releases |
Version 2.4.1.5
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Checkitems/Button.php +29 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Mapping/Button.php +32 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Iparcel/Dashboard.php +32 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs.php +38 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs/Grid.php +68 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php +23 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Invoice/Totals.php +23 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Form.php +23 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php +23 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Totals.php +24 -0
- app/code/community/Iparcel/Shipping/Block/Adminhtml/Salesrule/Rule/Sync.php +32 -0
- app/code/community/Iparcel/Shipping/Block/Catalog/Product.php +20 -0
- app/code/community/Iparcel/Shipping/Block/Catalog/Product/List.php +74 -0
- app/code/community/Iparcel/Shipping/Block/Cpf.php +27 -0
- app/code/community/Iparcel/Shipping/Block/Html/Head/Iparcel.php +19 -0
- app/code/community/Iparcel/Shipping/Block/Html/Head/Jquery.php +19 -0
- app/code/community/Iparcel/Shipping/Block/Html/Head/Post.php +24 -0
- app/code/community/Iparcel/Shipping/Block/Payment/Info.php +34 -0
- app/code/community/Iparcel/Shipping/Block/Sales/Order/Creditmemo/Totals.php +23 -0
- app/code/community/Iparcel/Shipping/Block/Sales/Order/Invoice/Totals.php +22 -0
- app/code/community/Iparcel/Shipping/Block/Sales/Order/Totals.php +23 -0
- app/code/community/Iparcel/Shipping/Helper/Api.php +550 -0
- app/code/community/Iparcel/Shipping/Helper/Api/External.php +82 -0
- app/code/community/Iparcel/Shipping/Helper/Data.php +36 -0
- app/code/community/Iparcel/Shipping/Helper/International.php +57 -0
- app/code/community/Iparcel/Shipping/Helper/Sales/Data.php +118 -0
- app/code/community/Iparcel/Shipping/Helper/String.php +20 -0
- app/code/community/Iparcel/Shipping/Helper/Tax.php +47 -0
- app/code/community/Iparcel/Shipping/Model/Api/External/Sales/Order.php +382 -0
- app/code/community/Iparcel/Shipping/Model/Api/Log.php +149 -0
- app/code/community/Iparcel/Shipping/Model/Carrier/Iparcel.php +201 -0
- app/code/community/Iparcel/Shipping/Model/Catalog/Mapping.php +18 -0
- app/code/community/Iparcel/Shipping/Model/Catalog/Product/Observer.php +63 -0
- app/code/community/Iparcel/Shipping/Model/Config/Catalog/Mapping.php +68 -0
- app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Monthday.php +22 -0
- app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Weekday.php +22 -0
- app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Hour.php +22 -0
- app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Minute.php +22 -0
- app/code/community/Iparcel/Shipping/Model/Config/Guid.php +21 -0
- app/code/community/Iparcel/Shipping/Model/Config/Script/Js.php +90 -0
- app/code/community/Iparcel/Shipping/Model/Cpf.php +37 -0
- app/code/community/Iparcel/Shipping/Model/Cpf/Order.php +30 -0
- app/code/community/Iparcel/Shipping/Model/Cpf/Quote.php +30 -0
- app/code/community/Iparcel/Shipping/Model/Parcel.php +30 -0
- app/code/community/Iparcel/Shipping/Model/Payment/Iparcel.php +16 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Collection.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order/Collection.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote/Collection.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Parcel.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Parcel/Collection.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Setup.php +11 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals/Collection.php +17 -0
- app/code/community/Iparcel/Shipping/Model/Sales/Order.php +23 -0
- app/code/community/Iparcel/Shipping/Model/Sales/Order/Observer.php +242 -0
- app/code/community/Iparcel/Shipping/Model/Sales/Order/Shipment/Observer.php +77 -0
- app/code/community/Iparcel/Shipping/Model/Sales/Quote/Observer.php +60 -0
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Configurable/Price.php +25 -0
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Mode.php +27 -0
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute.php +30 -0
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php +33 -0
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Date/Weekday.php +29 -0
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Sales/Order/Status.php +23 -0
- app/code/community/Iparcel/Shipping/Model/System/Config/Source/Tax/Mode.php +27 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Calculation.php +40 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals.php +30 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Abstract.php +109 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Creditmemo.php +27 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Invoice.php +27 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Quote.php +60 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Creditmemo.php +27 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Invoice.php +27 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Quote.php +76 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Creditmemo.php +27 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Invoice.php +27 -0
- app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Quote.php +62 -0
- app/code/community/Iparcel/Shipping/controllers/Adminhtml/LogController.php +40 -0
- app/code/community/Iparcel/Shipping/controllers/Adminhtml/Sync/AjaxController.php +173 -0
- app/code/community/Iparcel/Shipping/controllers/Adminhtml/SyncController.php +16 -0
- app/code/community/Iparcel/Shipping/controllers/AjaxController.php +49 -0
- app/code/community/Iparcel/Shipping/controllers/DevController.php +81 -0
- app/code/community/Iparcel/Shipping/controllers/InternationalController.php +47 -0
- app/code/community/Iparcel/Shipping/controllers/OrderController.php +116 -0
- app/code/community/Iparcel/Shipping/etc/adminhtml.xml +46 -0
- app/code/community/Iparcel/Shipping/etc/config.xml +427 -0
- app/code/community/Iparcel/Shipping/etc/system.xml +595 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.2.0.php +26 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.3.0.php +26 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-2.3.4.2.php +110 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.2.0-0.3.0.php +45 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.0-0.3.1.php +32 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.1-0.3.2.php +37 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.2-2.0.0.php +49 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.0.0-2.3.4.2.php +8 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.2-2.3.4.4.php +8 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.3-2.3.4.4.php +8 -0
- app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.0.3-2.4.1.0.php +23 -0
- app/design/adminhtml/default/default/layout/externalsales.xml +38 -0
- app/design/adminhtml/default/default/template/iparcel/sales/order/shipment/view/tracking.phtml +41 -0
- app/design/adminhtml/default/default/template/iparcel/sync/ajax/catalog.phtml +21 -0
- app/design/adminhtml/default/default/template/iparcel/sync/ajax/checkitems.phtml +21 -0
- app/design/frontend/base/default/layout/externalshipping.xml +29 -0
- app/design/frontend/base/default/template/shippingip/cpf.phtml +11 -0
- app/design/frontend/base/default/template/shippingip/html/head/iparcel.phtml +14 -0
- app/design/frontend/base/default/template/shippingip/html/head/jquery.phtml +12 -0
- app/design/frontend/base/default/template/shippingip/html/head/post.phtml +9 -0
- app/design/frontend/base/default/template/shippingip/post.phtml +11 -0
- app/design/frontend/base/default/template/shippingip/post/list.phtml +23 -0
- app/etc/modules/Iparcel_Shipping.xml +9 -0
- js/iparcel/adminhtml/label.js +33 -0
- js/iparcel/adminhtml/sync.js +87 -0
- js/iparcel/cpf.js +61 -0
- js/iparcel/jQuery.js +4 -0
- js/iparcel/lib.js +45 -0
- js/iparcel/post.js +97 -0
- media/font/code128.ttf +0 -0
- package.xml +18 -0
- skin/adminhtml/default/default/iparcel/ajaxSync.css +4 -0
app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Checkitems/Button.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend Model Class for catalog_mapping/check_items/check_items config button
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Catalog_Checkitems_Button extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get Button Html
|
13 |
+
*
|
14 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
18 |
+
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync_ajax/checkitems");
|
19 |
+
|
20 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
21 |
+
->setType('button')
|
22 |
+
->setClass('scalable')
|
23 |
+
->setLabel('Populate now')
|
24 |
+
->setOnClick("window.location.href='" . $url . "'")
|
25 |
+
->toHtml();
|
26 |
+
|
27 |
+
return $html;
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Catalog/Mapping/Button.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend Model Class for catalog_mapping/upload/upload config button
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Catalog_Mapping_Button extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get Button Html
|
13 |
+
*
|
14 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
18 |
+
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync_ajax/catalog");
|
19 |
+
|
20 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
21 |
+
->setType('button')
|
22 |
+
->setClass('scalable')
|
23 |
+
->setLabel('Upload Now')
|
24 |
+
->setOnClick("window.location.href='" . $url . "'")
|
25 |
+
->toHtml();
|
26 |
+
|
27 |
+
return $html;
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
}
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Iparcel/Dashboard.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend Model Class for carriers/i-parcel/additionalfields config button
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Iparcel_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get Button Html
|
13 |
+
*
|
14 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
18 |
+
$url = 'http://globalaccess.i-parcel.com';
|
19 |
+
|
20 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
21 |
+
->setType('button')
|
22 |
+
->setClass('scalable')
|
23 |
+
->setLabel('Go to i-parcel Dashboard')
|
24 |
+
->setOnClick("window.location.href='" . $url . "'")
|
25 |
+
->toHtml();
|
26 |
+
|
27 |
+
return $html;
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
}
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adminhtml i-parcel logs grid container block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Logs extends Mage_Adminhtml_Block_Widget_Grid_Container{
|
10 |
+
/**
|
11 |
+
* Initialize factory instance
|
12 |
+
*/
|
13 |
+
public function __construct(){
|
14 |
+
$this->_blockGroup = 'shippingip';
|
15 |
+
$this->_controller = 'adminhtml_logs';
|
16 |
+
$this->_headerText = $this->__('Logs');
|
17 |
+
|
18 |
+
parent::__construct();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Preparing child blocks for each added button ,removing add button, adding clear button
|
23 |
+
*
|
24 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Logs
|
25 |
+
*/
|
26 |
+
protected function _prepareLayout()
|
27 |
+
{
|
28 |
+
$this->_removeButton('add');
|
29 |
+
|
30 |
+
$this->_addButton('clear',array(
|
31 |
+
'label' => $this->__('Clear'),
|
32 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/clear').'\')'
|
33 |
+
));
|
34 |
+
|
35 |
+
return parent::_prepareLayout();
|
36 |
+
}
|
37 |
+
}
|
38 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Logs/Grid.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Iparcel Logs Adminhtml Grid Block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Logs_Grid extends Mage_Adminhtml_Block_Widget_Grid{
|
10 |
+
/**
|
11 |
+
* Internal constructor, that is called from real constructor
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
protected function _construct(){
|
15 |
+
$this->setFilterVisibility(false);
|
16 |
+
$this->setPagerVisibility(false);
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Prepare grid collection object
|
21 |
+
*
|
22 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Logs_Grid
|
23 |
+
*/
|
24 |
+
protected function _prepareCollection(){
|
25 |
+
$collection = Mage::getModel('shippingip/api_log')->getJson();
|
26 |
+
$this->setCollection($collection);
|
27 |
+
|
28 |
+
return parent::_prepareCollection();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Prepare grid columns
|
33 |
+
*
|
34 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Logs_Grid
|
35 |
+
*/
|
36 |
+
protected function _prepareColumns(){
|
37 |
+
$this->addColumn('timestamp',array(
|
38 |
+
'header' => $this->__('Timestamp'),
|
39 |
+
'index' => 'timestamp',
|
40 |
+
'width' => '200px'
|
41 |
+
));
|
42 |
+
$this->addColumn('controller',array(
|
43 |
+
'header' => $this->__('API Controller'),
|
44 |
+
'index' => 'controller',
|
45 |
+
'width' => '200px'
|
46 |
+
));
|
47 |
+
$this->addColumn('request',array(
|
48 |
+
'header' => $this->__('Request'),
|
49 |
+
'index' => 'request'
|
50 |
+
));
|
51 |
+
$this->addColumn('response',array(
|
52 |
+
'header' => $this->__('Response'),
|
53 |
+
'index' => 'response'
|
54 |
+
));
|
55 |
+
|
56 |
+
return parent::_prepareColumns();
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get Grid Row's Class
|
61 |
+
*
|
62 |
+
* $return string
|
63 |
+
*/
|
64 |
+
public function getRowClass() {
|
65 |
+
return 'read';
|
66 |
+
}
|
67 |
+
}
|
68 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Creditmemo/Totals.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Iparcel order creditmemo shipping tax&duty totals block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals{
|
10 |
+
/**
|
11 |
+
* Initialize creditmemo totals array
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals
|
14 |
+
*/
|
15 |
+
protected function _initTotals(){
|
16 |
+
parent::_initTotals();
|
17 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total){
|
18 |
+
$this->addTotal($total, array('shipping','tax'));
|
19 |
+
}
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Invoice/Totals.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Iparcel order invoice shipping tax&duty totals block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals extends Mage_Adminhtml_Block_Sales_Order_Invoice_Totals{
|
10 |
+
/**
|
11 |
+
* Initialize order totals array
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals
|
14 |
+
*/
|
15 |
+
protected function _initTotals(){
|
16 |
+
parent::_initTotals();
|
17 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total){
|
18 |
+
$this->addTotal($total, array('shipping','tax'));
|
19 |
+
}
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Form.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipment view form
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Form extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Form{
|
10 |
+
/**
|
11 |
+
* Get create label button html
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getCreateLabelButton(){
|
16 |
+
if ($this->getShipment()->getOrder()->getShippingCarrier()->getCarrierCode() == "i-parcel"){
|
17 |
+
return NULL;
|
18 |
+
}else{
|
19 |
+
return parent::getCreateLabelButton();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipment tracking control form
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Tracking{
|
10 |
+
/**
|
11 |
+
* Get relevant path to template
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getTemplate(){
|
16 |
+
if($this->getShipment()->getOrder()->getShippingMethod(true)->getCarrierCode() == 'i-parcel'){
|
17 |
+
return 'iparcel/sales/order/shipment/view/tracking.phtml';
|
18 |
+
}else{
|
19 |
+
return parent::getTemplate();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Sales/Order/Totals.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Iparcel order shipping tax&duty totals block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals{
|
10 |
+
/**
|
11 |
+
* Initialize order totals array
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals
|
14 |
+
*/
|
15 |
+
protected function _initTotals(){
|
16 |
+
parent::_initTotals();
|
17 |
+
$totalCollection = Mage::helper('shippingip/tax')->getTotal($this->getOrder());
|
18 |
+
foreach ($totalCollection as $total){
|
19 |
+
$this->addTotal($total, array('shipping','tax'));
|
20 |
+
}
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Adminhtml/Salesrule/Rule/Sync.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend Model Class for salesrules/upload/sync config button
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Adminhtml_Salesrule_Rule_Sync extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get Button Html
|
13 |
+
*
|
14 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
18 |
+
$url = Mage::helper('adminhtml')->getUrl("shippingip/sync/salesrule");
|
19 |
+
|
20 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
21 |
+
->setType('button')
|
22 |
+
->setClass('scalable')
|
23 |
+
->setLabel('Synchronize')
|
24 |
+
->setOnClick("window.location.href='" . $url . "'")
|
25 |
+
->toHtml();
|
26 |
+
|
27 |
+
return $html;
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
}
|
app/code/community/Iparcel/Shipping/Block/Catalog/Product.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Product for i-parcel shipping extension
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Catalog_Product extends Mage_Catalog_Block_Product_View{
|
10 |
+
/**
|
11 |
+
* Retrieve qty for product
|
12 |
+
*
|
13 |
+
* @param Mage_Catalog_Model_Product $product
|
14 |
+
* $return float
|
15 |
+
*/
|
16 |
+
public function getStock(){
|
17 |
+
return Mage::getModel('cataloginventory/stock_item')->loadByProduct($this->getProduct())->getQty();
|
18 |
+
}
|
19 |
+
}
|
20 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Catalog/Product/List.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Product list for i-parcel shipping extension
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List{
|
10 |
+
/**
|
11 |
+
* Retrieve loaded category collection
|
12 |
+
*
|
13 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
14 |
+
*/
|
15 |
+
protected function _getProductCollection()
|
16 |
+
{
|
17 |
+
if (is_null($this->_productCollection)) {
|
18 |
+
$layer = $this->getLayer();
|
19 |
+
/* @var $layer Mage_Catalog_Model_Layer */
|
20 |
+
if ($this->getShowRootCategory()) {
|
21 |
+
$this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
|
22 |
+
}
|
23 |
+
|
24 |
+
// if this is a product view page
|
25 |
+
if (Mage::registry('product')) {
|
26 |
+
// get collection of categories this product is associated with
|
27 |
+
$categories = Mage::registry('product')->getCategoryCollection()
|
28 |
+
->setPage(1, 1)
|
29 |
+
->load();
|
30 |
+
// if the product is associated with any category
|
31 |
+
if ($categories->count()) {
|
32 |
+
// show products from this category
|
33 |
+
$this->setCategoryId(current($categories->getIterator()));
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
$origCategory = null;
|
38 |
+
if ($this->getCategoryId()) {
|
39 |
+
$category = Mage::getModel('catalog/category')->load($this->getCategoryId());
|
40 |
+
if ($category->getId()) {
|
41 |
+
$origCategory = $layer->getCurrentCategory();
|
42 |
+
$layer->setCurrentCategory($category);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$this->_productCollection = $layer->getProductCollection();
|
46 |
+
|
47 |
+
$helper = Mage::helper('shippingip/international');
|
48 |
+
// if international customer enabled and it is international customer
|
49 |
+
if ($helper->checkEnabled() && $helper->getInternational()){
|
50 |
+
// add international visibility attribute to filter
|
51 |
+
$this->_productCollection->addAttributeToFilter($helper->getVisibilityAttributeName(),true);
|
52 |
+
}
|
53 |
+
|
54 |
+
$this->prepareSortableFieldsByCategory($layer->getCurrentCategory());
|
55 |
+
|
56 |
+
if ($origCategory) {
|
57 |
+
$layer->setCurrentCategory($origCategory);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
return $this->_productCollection;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Retrieve qty for product
|
66 |
+
*
|
67 |
+
* @param Mage_Catalog_Model_Product $product
|
68 |
+
* $return float
|
69 |
+
*/
|
70 |
+
public function getStock($product){
|
71 |
+
return Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Cpf.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel cpf block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Cpf extends Mage_Core_Block_Template{
|
10 |
+
/**
|
11 |
+
* Geting formated array with cpfs list
|
12 |
+
*
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function getCpf(){
|
16 |
+
$cpfCollection = Mage::getModel('shippingip/cpf')->getCollection();
|
17 |
+
$response = array();
|
18 |
+
foreach ($cpfCollection as $cpf){
|
19 |
+
$response[$cpf->getCountryCode()] = array(
|
20 |
+
'name' => $cpf->getName(),
|
21 |
+
'required' => $cpf->getRequired()
|
22 |
+
);
|
23 |
+
}
|
24 |
+
return $response;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Html/Head/Iparcel.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel frontend scripts block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Html_Head_Iparcel extends Mage_Core_Block_Template{
|
10 |
+
/**
|
11 |
+
* Checking if frontend scripts are enabled
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getFlag(){
|
16 |
+
return Mage::getStoreConfigFlag('iparcel/scripts/scripts');
|
17 |
+
}
|
18 |
+
}
|
19 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Html/Head/Jquery.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel jQuery block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Html_Head_Jquery extends Mage_Core_Block_Template{
|
10 |
+
/**
|
11 |
+
* Checking if i-parcel's jQuery is enabled
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getFlag(){
|
16 |
+
return Mage::getStoreConfigFlag('iparcel/scripts/jquery');
|
17 |
+
}
|
18 |
+
}
|
19 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Html/Head/Post.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel custom post script block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Html_Head_Post extends Mage_Core_Block_Template{
|
10 |
+
/**
|
11 |
+
* Checking if there's store config for custom post script, if yes returning script directory, if not returning default directory
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getScript(){
|
16 |
+
$file = Mage::getStoreConfig('iparcel/scripts/post');
|
17 |
+
if ($file){
|
18 |
+
return Mage::getModel('shippingip/config_script_js')->getUploadDir('post').$file;
|
19 |
+
}else{
|
20 |
+
return 'iparcel/post.js';
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Payment/Info.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel payment method info block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Payment_Info extends Mage_Payment_Block_Info{
|
10 |
+
/**
|
11 |
+
* Prepare information specific to current payment method
|
12 |
+
*
|
13 |
+
* @param Varien_Object|array $transport
|
14 |
+
* @return Varien_Object
|
15 |
+
*/
|
16 |
+
protected function _prepareSpecificInformation($transport = null){
|
17 |
+
if (null === $this->_paymentSpecificInformation){
|
18 |
+
if (null === $transport){
|
19 |
+
$transport = new Varien_Object();
|
20 |
+
}elseif (is_array($transport)){
|
21 |
+
$transport = new Varien_Object($transport);
|
22 |
+
}
|
23 |
+
Mage::dispatchEvent('payment_info_block_prepare_specific_information', array(
|
24 |
+
'transport' => $transport,
|
25 |
+
'payment' => $this->getInfo(),
|
26 |
+
'block' => $this,
|
27 |
+
));
|
28 |
+
$transport->addData(array('i-parcel' => "Order was placed using External Sales API"));
|
29 |
+
$this->_paymentSpecificInformation = $transport;
|
30 |
+
}
|
31 |
+
return $this->_paymentSpecificInformation;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Sales/Order/Creditmemo/Totals.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Block for i-parcel tax&duty creditmemo totals
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals extends Mage_Sales_Block_Order_Creditmemo_Totals{
|
10 |
+
/**
|
11 |
+
* Initialize order totals array
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals
|
14 |
+
*/
|
15 |
+
protected function _initTotals(){
|
16 |
+
parent::_initTotals();
|
17 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total){
|
18 |
+
$this->addTotal($total, array('shipping','tax'));
|
19 |
+
}
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Sales/Order/Invoice/Totals.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* i-parcel shipping tax&duty invoice totals block
|
3 |
+
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
+
*/
|
8 |
+
class Iparcel_Shipping_Block_Sales_Order_Invoice_Totals extends Mage_Sales_Block_Order_Invoice_Totals{
|
9 |
+
/**
|
10 |
+
* Initialize order totals array
|
11 |
+
*
|
12 |
+
* @return Iparcel_Shipping_Block_Sales_Order_Invoice_Totals
|
13 |
+
*/
|
14 |
+
protected function _initTotals(){
|
15 |
+
parent::_initTotals();
|
16 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total){
|
17 |
+
$this->addTotal($total, array('shipping','tax'));
|
18 |
+
}
|
19 |
+
return $this;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
?>
|
app/code/community/Iparcel/Shipping/Block/Sales/Order/Totals.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel shipping tax&duty order totals block
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals{
|
10 |
+
/**
|
11 |
+
* Initialize order totals array
|
12 |
+
*
|
13 |
+
* @return Iparce-Shipping_Block_Sales_Order_Totals
|
14 |
+
*/
|
15 |
+
protected function _initTotals(){
|
16 |
+
parent::_initTotals();
|
17 |
+
foreach (Mage::helper('shippingip/tax')->getTotal($this->getOrder()) as $total){
|
18 |
+
$this->addTotal($total, array('shipping','tax'));
|
19 |
+
}
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Helper/Api.php
ADDED
@@ -0,0 +1,550 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel sending API helper
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Helper_Api{
|
10 |
+
protected $_submitCatalog = 'http://globalaccesswebservices.azurewebsites.net/api/SubmitCatalog';
|
11 |
+
protected $_quote = 'http://globalaccesswebservices.azurewebsites.net/api/Quote';
|
12 |
+
protected $_submitParcel = 'http://globalaccesswebservices.azurewebsites.net/api/SubmitParcel';
|
13 |
+
protected $_businessSettings = 'http://globalaccesswebservices.azurewebsites.net/api/BusinessSettings';
|
14 |
+
protected $_checkItems = 'http://globalaccesswebservices.azurewebsites.net/api/CheckItems';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Sending REST
|
18 |
+
*
|
19 |
+
* @param string $post, string $url, array $header
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
protected function _rest($post, $url, array $header){
|
23 |
+
$curl = curl_init($url);
|
24 |
+
|
25 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
26 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
27 |
+
curl_setopt($curl, CURLOPT_POST, true);
|
28 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
|
29 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, "$post");
|
30 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
31 |
+
|
32 |
+
$response = curl_exec($curl);
|
33 |
+
|
34 |
+
curl_close($curl);
|
35 |
+
|
36 |
+
return $response;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Sending REST XML
|
41 |
+
*
|
42 |
+
* @param SimpleXMLElement $xml, string $url
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
protected function _restXML($xml, $url){
|
46 |
+
return $this->_rest($xml->asXml, $url, array('Content-Type: text/xml'));
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Sending REST JSON
|
51 |
+
*
|
52 |
+
* @param string $json, string $url
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
protected function _restJSON($json, $url){
|
56 |
+
return $this->_rest(json_encode($json),$url, array('Content-Type: text/json'));
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Sending Submit Catalog request
|
61 |
+
*
|
62 |
+
* @param Varien_Data_Collection $productCollection
|
63 |
+
* @return int
|
64 |
+
*/
|
65 |
+
public function submitCatalog(Varien_Data_Collection $productCollection){
|
66 |
+
//init log
|
67 |
+
$log = Mage::getModel('shippingip/api_log');
|
68 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
69 |
+
$log->setController('Submit Catalog');
|
70 |
+
|
71 |
+
$hsCode = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/hscodeus'));
|
72 |
+
/* var $hsCode Mage_Eav_Model_Entity_Attribute */
|
73 |
+
$shipAlone = Mage::getModel('eav/entity_attribute')->load(Mage::getStoreConfig('catalog_mapping/attributes/shipalone'));
|
74 |
+
/* var $shipAlone Mage_Eav_Model_Entity_Attribute */
|
75 |
+
|
76 |
+
$numberUploaded = 0;
|
77 |
+
|
78 |
+
$json = array();
|
79 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
80 |
+
|
81 |
+
$skus = $json['SKUs'] = array();
|
82 |
+
|
83 |
+
foreach ($productCollection as $product){
|
84 |
+
$product=Mage::getModel('catalog/product')->load($product->getId());
|
85 |
+
/* var $product Mage_Catalog_Model_Product */
|
86 |
+
|
87 |
+
$sku = $product->getSku() ?: '';
|
88 |
+
$name = $product->getName() ?: '';
|
89 |
+
if (empty($sku) || empty($name)){
|
90 |
+
continue;
|
91 |
+
}
|
92 |
+
|
93 |
+
$item = array();
|
94 |
+
|
95 |
+
$item['SKU'] = $sku;
|
96 |
+
$item['ProductName'] = $name;
|
97 |
+
|
98 |
+
for ($i=0; $i<6; $i++){
|
99 |
+
$_attribute = Mage::getModel('eav/entity_attribute')
|
100 |
+
->load(Mage::getStoreConfig(sprintf('catalog_mapping/attributes/attribute%d',$i)));
|
101 |
+
/* var $_attributeCollection[] Mage_Eav_Model_Entity_Attribute */
|
102 |
+
// if attribute exists
|
103 |
+
if ($_attribute !== null){
|
104 |
+
// and has attribute_code
|
105 |
+
if ($code = $_attribute->getAttributeCode()){
|
106 |
+
// then productAttribute value is product's attribute_text (if exists) or product's data (if not)
|
107 |
+
$productAttribute = strip_tags($product->getAttributeText($code) ?: $product->getData($code));
|
108 |
+
}
|
109 |
+
}
|
110 |
+
$item[sprintf('Attribute%d',$i+1)] = substr($productAttribute,0,255);
|
111 |
+
}
|
112 |
+
|
113 |
+
$price = NULL;
|
114 |
+
// if it's simple product and config is to get parent's price
|
115 |
+
if($product->getTypeId() == 'simple' && Mage::getStoreConfig('catalog_mapping/attributes/price') == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_Price::CONFIGURABLE){
|
116 |
+
// get parentIds
|
117 |
+
$parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()) ?: Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
118 |
+
// get price
|
119 |
+
$price = $parentIds ? Mage::getModel('catalog/product')->load($parentIds[0])->getPrice() : $product->getPrice();
|
120 |
+
}
|
121 |
+
// if there's no price
|
122 |
+
if(!$price){
|
123 |
+
//get current product's price
|
124 |
+
$price = $product->getPrice();
|
125 |
+
}
|
126 |
+
|
127 |
+
$item['CountryOfOrigin'] = $product->getCountryOfManufacture();
|
128 |
+
$item['CurrentPrice'] = (float)$price;
|
129 |
+
$item['Delete'] = $product->getIsDeleted() ? true : false;
|
130 |
+
$item['HSCodeCA'] = '';
|
131 |
+
|
132 |
+
if ($code = $hsCode->getAttributeCode()){
|
133 |
+
$item['HSCodeUS'] = trim($product->getAttributeText($code)) ?: $product->getData($code);
|
134 |
+
}else{
|
135 |
+
$item['HSCodeUS'] = '';
|
136 |
+
}
|
137 |
+
|
138 |
+
$item['Height'] = (float)$product->getHeight();
|
139 |
+
$item['Length'] = (float)$product->getLength();
|
140 |
+
$item['ProductURL'] = $product->getUrlPath();
|
141 |
+
$item['SKN'] = '';
|
142 |
+
if ($code = $shipAlone->getAttributeCode()){
|
143 |
+
$item['ShipAlone'] = $product->getAttributeText($code) == 'Yes' ? true : false;
|
144 |
+
}
|
145 |
+
$item['Width'] = (float)$product->getWidth();
|
146 |
+
$item['Weight'] = (float)$product->getWeight();
|
147 |
+
|
148 |
+
$numberUploaded++;
|
149 |
+
|
150 |
+
$json['SKUs'][] = $item;
|
151 |
+
}
|
152 |
+
|
153 |
+
$log->setRequest(json_encode($json));
|
154 |
+
|
155 |
+
if ($numberUploaded > 0){
|
156 |
+
$response = $this->_restJSON($json, $this->_submitCatalog);
|
157 |
+
|
158 |
+
$log->setResponse($response);
|
159 |
+
$log->save();
|
160 |
+
|
161 |
+
if (!preg_match('/.*Success.*/',$response)){
|
162 |
+
$numberUploaded = -1;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return $numberUploaded;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Sending Quote request
|
170 |
+
*
|
171 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
172 |
+
* @return stdClass
|
173 |
+
*/
|
174 |
+
public function quote(Mage_Shipping_Model_Rate_Request $request){
|
175 |
+
// log init
|
176 |
+
$log = Mage::getModel('shippingip/api_log');
|
177 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
178 |
+
$log->setController('Quote');
|
179 |
+
|
180 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
181 |
+
/* var $quote Mage_Sales_Model_Quote */
|
182 |
+
$shippingAddress = $quote->getShippingAddress();
|
183 |
+
/* var $shippingAddress Mage_Sales_Model_Quote_Address */
|
184 |
+
$billingAddress = $quote->getBillingAddress();
|
185 |
+
/* var $billingAddress Mage_Sales_Model_Quote_Address */
|
186 |
+
|
187 |
+
$json = array();
|
188 |
+
$addressInfo = array();
|
189 |
+
|
190 |
+
$billingStreet = $billingAddress->getStreet();
|
191 |
+
|
192 |
+
$billing = array();
|
193 |
+
$billing['City'] = $billingAddress->getCity();
|
194 |
+
$billing['CountryCode'] = $billingAddress->getCountryId();
|
195 |
+
$billing['Email'] = $quote->getCustomerEmail();
|
196 |
+
$billing['FirstName'] = $billingAddress->getFirstname();
|
197 |
+
$billing['LastName'] = $billingAddress->getLastname();
|
198 |
+
$billing['Phone'] = $billingAddress->getTelephone();
|
199 |
+
$billing['PostCode'] = $billingAddress->getPostcode();
|
200 |
+
$billing['Region'] = $billingAddress->getRegion();
|
201 |
+
for ($i=0; $i<count($billingStreet); $i++){
|
202 |
+
$billing['Street'.($i+1)] = $billingStreet[$i];
|
203 |
+
}
|
204 |
+
|
205 |
+
$addressInfo['Billing'] = $billing;
|
206 |
+
|
207 |
+
$shippingStreet = $shippingAddress->getStreet();
|
208 |
+
|
209 |
+
$shipping = array();
|
210 |
+
|
211 |
+
$shipping['City'] = $shippingAddress->getCity();
|
212 |
+
$shipping['CountryCode'] = $shippingAddress->getCountryId();
|
213 |
+
$shipping['Email'] = $quote->getCustomerEmail();
|
214 |
+
$shipping['FirstName'] = $shippingAddress->getFirstname();
|
215 |
+
$shipping['LastName'] = $shippingAddress->getLastname();
|
216 |
+
$shipping['Phone'] = $shippingAddress->getTelephone();
|
217 |
+
$shipping['PostCode'] = $shippingAddress->getPostcode();
|
218 |
+
$shipping['Region'] = $shippingAddress->getRegion();
|
219 |
+
for ($i=0; $i<count($shippingStreet); $i++){
|
220 |
+
$shipping['Street'.($i+1)] = $billingStreet[$i];
|
221 |
+
}
|
222 |
+
|
223 |
+
$addressInfo['Shipping'] = $shipping;
|
224 |
+
|
225 |
+
$addressInfo['ControlNumber'] = $quote->getCpf();
|
226 |
+
|
227 |
+
$json['AddressInfo'] = $addressInfo;
|
228 |
+
|
229 |
+
$json['CurrencyCode'] = $quote->getQuoteCurrencyCode();
|
230 |
+
$json['DDP'] = true;
|
231 |
+
|
232 |
+
$itemsList = array();
|
233 |
+
|
234 |
+
foreach ($request->getAllItems() as $item){
|
235 |
+
/* var $item Mage_Sales_Model_Quote_Item */
|
236 |
+
|
237 |
+
$itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
|
238 |
+
/* var $itemProduct Mage_Catalog_Model_Product */
|
239 |
+
|
240 |
+
//get item price
|
241 |
+
$itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
|
242 |
+
// if not price and item has parent (is configurable)
|
243 |
+
if (!$itemPrice && ($parent=$item->getParentItem())){
|
244 |
+
// get parent price
|
245 |
+
$itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
|
246 |
+
}
|
247 |
+
// if still not price
|
248 |
+
if (!$itemPrice){
|
249 |
+
// get product price
|
250 |
+
$itemPrice = (float)$item->getProduct()->getPrice();
|
251 |
+
}
|
252 |
+
|
253 |
+
// if product isn't virtual and is configurable or downloadable
|
254 |
+
if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(),array('configurable','downloadable'))){
|
255 |
+
// add line item node
|
256 |
+
$lineItem = array();
|
257 |
+
|
258 |
+
$lineItem['Quantity'] = $item->getTotalQty();
|
259 |
+
$lineItem['SKU'] = $item->getSku();
|
260 |
+
$lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
261 |
+
$lineItem['ValueShopperCurrency'] = $itemPrice;
|
262 |
+
$lineItem['ValueUSD'] = $itemPrice;
|
263 |
+
|
264 |
+
$itemsList[] = $lineItem;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
$json['ItemDetailsList'] = $itemsList;
|
269 |
+
|
270 |
+
// Get discounts
|
271 |
+
$totals = $quote->getTotals();
|
272 |
+
$discount = 0;
|
273 |
+
if(isset($totals['discount']) && $totals['discount']->getValue())
|
274 |
+
$discount = -1 * $totals['discount']->getValue();
|
275 |
+
|
276 |
+
$json['OtherDiscount'] = $discount;
|
277 |
+
$json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
|
278 |
+
$json['ParcelID'] = 0;
|
279 |
+
$json['ServiceLevel'] = 115;
|
280 |
+
$json['SessionID'] = '';
|
281 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
282 |
+
|
283 |
+
$log->setRequest(json_encode($json));
|
284 |
+
|
285 |
+
$response = $this->_restJSON($json, $this->_quote);
|
286 |
+
|
287 |
+
$log->setResponse($response);
|
288 |
+
$log->save();
|
289 |
+
|
290 |
+
return json_decode($response);
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Sending Submit Parcel request
|
295 |
+
*
|
296 |
+
* $param Mage_Sales_Model_Order $order
|
297 |
+
* $return stdClass
|
298 |
+
*/
|
299 |
+
public function submitParcel(Mage_Sales_Model_Order $order){
|
300 |
+
// init log
|
301 |
+
$log = Mage::getModel('shippingip/api_log');
|
302 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
303 |
+
$log->setController('Submit Parcel');
|
304 |
+
|
305 |
+
$quote = $order->getQuote();
|
306 |
+
/* var $quote Mage_Sales_Model_Quote */
|
307 |
+
$shippingAddress = $quote->getShippingAddress();
|
308 |
+
/* var $shippingAddress Mage_Sales_Model_Quote_Address */
|
309 |
+
$billingAddress = $quote->getBillingAddress();
|
310 |
+
/* var $billingAddress Mage_Sales_Model_Quote_Address */
|
311 |
+
|
312 |
+
$json = array();
|
313 |
+
|
314 |
+
$addressInfo = array();
|
315 |
+
|
316 |
+
$billingStreet = $billingAddress->getStreet();
|
317 |
+
|
318 |
+
$billing = array();
|
319 |
+
|
320 |
+
$billing['City'] = $billingAddress->getCity();
|
321 |
+
$billing['CountryCode'] = $billingAddress->getCountryId();
|
322 |
+
$billing['Email'] = $quote->getCustomerEmail();
|
323 |
+
$billing['FirstName'] = $billingAddress->getFirstname();
|
324 |
+
$billing['LastName'] = $billingAddress->getLastname();
|
325 |
+
$billing['Phone'] = $billingAddress->getTelephone();
|
326 |
+
$billing['PostCode'] = $billingAddress->getPostcode();
|
327 |
+
$billing['Region'] = $billingAddress->getRegion();
|
328 |
+
$billing['Street1'] = $billingStreet[0];
|
329 |
+
$billing['Street2'] = $billingStreet[1];
|
330 |
+
|
331 |
+
$addressInfo['Billing'] = $billing;
|
332 |
+
|
333 |
+
$shippingStreet = $shippingAddress->getStreet();
|
334 |
+
|
335 |
+
$shipping = array();
|
336 |
+
|
337 |
+
$shipping['City'] = $shippingAddress->getCity();
|
338 |
+
$shipping['CountryCode'] = $shippingAddress->getCountryId();
|
339 |
+
$shipping['Email'] = $quote->getCustomerEmail();
|
340 |
+
$shipping['FirstName'] = $shippingAddress->getFirstname();
|
341 |
+
$shipping['LastName'] = $shippingAddress->getLastname();
|
342 |
+
$shipping['Phone'] = $shippingAddress->getTelephone();
|
343 |
+
$shipping['PostCode'] = $shippingAddress->getPostcode();
|
344 |
+
$shipping['Region'] = $shippingAddress->getRegion();
|
345 |
+
$shipping['Street1'] = $shippingStreet[0];
|
346 |
+
$shipping['Street2'] = $shippingStreet[1];
|
347 |
+
|
348 |
+
$addressInfo['Shipping'] = $shipping;
|
349 |
+
|
350 |
+
$addressInfo['ControlNumber'] = $order->getCpf();
|
351 |
+
|
352 |
+
$json['AddressInfo'] = $addressInfo;
|
353 |
+
|
354 |
+
$json['CurrencyCode'] = $quote->getQuoteCurrencyCode();
|
355 |
+
$json['DDP'] = true;
|
356 |
+
|
357 |
+
$itemsList = array();
|
358 |
+
foreach ($order->getAllItems() as $item){
|
359 |
+
/* var $item Mage_Sales_Model_Order_Item */
|
360 |
+
$itemProduct = Mage::getModel('catalog/product')->load($item->getProductId());
|
361 |
+
/* var $itemProduct Mage_Catalog_Model_Product */
|
362 |
+
|
363 |
+
//get item price
|
364 |
+
$itemPrice = (float)$item->getFinalPrice() ?: (float)$item->getPrice();
|
365 |
+
// if not price and item has parent (is configurable)
|
366 |
+
if (!$itemPrice && ($parent=$item->getParentItem())){
|
367 |
+
// get parent price
|
368 |
+
$itemPrice = (float)$parent->getFinalPrice() ?: (float)$parent->getPrice();
|
369 |
+
}
|
370 |
+
// if still not price
|
371 |
+
if (!$itemPrice){
|
372 |
+
// get product price
|
373 |
+
$itemPrice = (float)$item->getProduct()->getPrice();
|
374 |
+
}
|
375 |
+
|
376 |
+
// if product isn't virtual and is configurable or downloadable
|
377 |
+
if ($item["is_virtual"] == false && !in_array($itemProduct->getTypeId(),array('configurable','downloadable'))){
|
378 |
+
// add line item node
|
379 |
+
$lineItem = array();
|
380 |
+
|
381 |
+
$lineItem['Quantity'] = $item->getQtyOrdered();
|
382 |
+
$lineItem['SKU'] = $item->getSku();
|
383 |
+
$lineItem['ShopperCurrency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
384 |
+
$lineItem['ValueShopperCurrency'] = $itemPrice;
|
385 |
+
$lineItem['ValueUSD'] = $itemPrice;
|
386 |
+
|
387 |
+
$itemsList[] = $lineItem;
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
$json['ItemDetailsList'] = $itemsList;
|
392 |
+
|
393 |
+
// if order_reference is set add it to request
|
394 |
+
if (Mage::getStoreConfig('carriers/i-parcel/order_reference')){
|
395 |
+
$json['OrderReference'] = $order->getIncrementId();
|
396 |
+
}
|
397 |
+
|
398 |
+
// Get discounts
|
399 |
+
$totals = $quote->getTotals();
|
400 |
+
$discount = 0;
|
401 |
+
if(isset($totals['discount']) && $totals['discount']->getValue())
|
402 |
+
$discount = -1 * $totals['discount']->getValue();
|
403 |
+
|
404 |
+
$json['OtherDiscount'] = $discount;
|
405 |
+
$json['OtherDiscountCurrency'] = $quote->getQuoteCurrencyCode();
|
406 |
+
$json['ParcelID'] = Mage::getSingleton('customer/session')->getParcelId();
|
407 |
+
$json['ServiceLevel'] = 115;
|
408 |
+
$json['SessionID'] = '';
|
409 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
410 |
+
|
411 |
+
$log->setRequest(json_encode($json));
|
412 |
+
|
413 |
+
$response = $this->_restJSON($json, $this->_submitParcel);
|
414 |
+
|
415 |
+
$log->setResponse($response);
|
416 |
+
$log->save();
|
417 |
+
|
418 |
+
return json_decode($response);
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Sending Business Settings request
|
423 |
+
*
|
424 |
+
* @return stdClass
|
425 |
+
*/
|
426 |
+
public function businessSettings(){
|
427 |
+
// init log
|
428 |
+
$log = Mage::getModel('shippingip/api_log');
|
429 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
430 |
+
$log->setController('Business Settings');
|
431 |
+
|
432 |
+
$json = Mage::helper('shippingip')->getGuid();
|
433 |
+
|
434 |
+
$log->setRequest(json_encode($json));
|
435 |
+
|
436 |
+
$response = $this->_restJSON($json, $this->_businessSettings);
|
437 |
+
|
438 |
+
$log->setResponse($response);
|
439 |
+
$log->save();
|
440 |
+
|
441 |
+
return json_decode($response);
|
442 |
+
}
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Sending Check Items request
|
446 |
+
*
|
447 |
+
* @params Varien_Data_Collection $collection
|
448 |
+
* @return int
|
449 |
+
*/
|
450 |
+
public function checkItems(Varien_Data_Collection $collection){
|
451 |
+
//init log
|
452 |
+
$log = Mage::getModel('shippingip/api_log');
|
453 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
454 |
+
$log->setController('Check Items');
|
455 |
+
|
456 |
+
$json = array();
|
457 |
+
|
458 |
+
$json['SessionID'] = 'SESSION';
|
459 |
+
$json['ItemDetailsList'] = array();
|
460 |
+
|
461 |
+
foreach ($collection as $product){
|
462 |
+
/* var $product Mage_Catalog_Model_Product */
|
463 |
+
if (!$product->getSku()){
|
464 |
+
continue;
|
465 |
+
}
|
466 |
+
$item = array();
|
467 |
+
$item['SKU'] = $product->getSku();
|
468 |
+
$item['Quantity'] = 1;
|
469 |
+
$item['itemStyle'] = null;
|
470 |
+
|
471 |
+
$json['ItemDetailsList'][] = $item;
|
472 |
+
}
|
473 |
+
|
474 |
+
$json['AddressInfo'] = array();
|
475 |
+
|
476 |
+
$json['AddressInfo']['Billing'] = array();
|
477 |
+
$json['AddressInfo']['Shipping'] = array();
|
478 |
+
|
479 |
+
$json['AddressInfo']['Shipping']['CountryCode'] = "CA";
|
480 |
+
$json['AddressInfo']['Shipping']['PostCode'] = "A1A1A1";
|
481 |
+
|
482 |
+
$json['CurrencyCode'] = "CAN";
|
483 |
+
$json['DDP'] = true;
|
484 |
+
$json['Insurance'] = false;
|
485 |
+
$json['ServiceLevel'] = 115;
|
486 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
487 |
+
|
488 |
+
$log->setRequest(json_encode($json));
|
489 |
+
|
490 |
+
$response = $this->_restJSON($json, $this->_checkItems);
|
491 |
+
|
492 |
+
$log->setResponse($response);
|
493 |
+
$log->save();
|
494 |
+
|
495 |
+
$response = json_decode($response);
|
496 |
+
if ($response->ItemDetailsList){
|
497 |
+
return count($response->ItemDetailsList);
|
498 |
+
}else{
|
499 |
+
return 0;
|
500 |
+
}
|
501 |
+
}
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Sending Sales Rule request
|
505 |
+
*
|
506 |
+
* @params Mage_SalesRule_Model_Resource_Rule_Collection
|
507 |
+
*/
|
508 |
+
public function salesRule(Mage_SalesRule_Model_Resource_Rule_Collection $_collection){
|
509 |
+
$log = Mage::getModel('shippingip/api_log');
|
510 |
+
/* var $log Iparcel_Shipping_Model_Api_Log */
|
511 |
+
$log->setController('Sales Rule');
|
512 |
+
|
513 |
+
$json = array();
|
514 |
+
$json['key'] = Mage::helper('shippingip')->getGuid();
|
515 |
+
$json['ItemDetailsList'] = array();
|
516 |
+
|
517 |
+
foreach ($_collection as $_rule){
|
518 |
+
/* var $_rule Mage_SalesRule_Model_Rule */
|
519 |
+
$item = array();
|
520 |
+
$item['Name'] = $_rule->getName();
|
521 |
+
$item['FormDate'] = $_rule->getFromDate();
|
522 |
+
$item['ToDate'] = $_rule->getToDate();
|
523 |
+
$item['IsActive'] = $_rule->getIsActive();
|
524 |
+
$item['StopRulesProcessing'] = $_rule->getStopRulesProcessing();
|
525 |
+
$item['SimpleAction'] = $_rule->getSimpleAction();
|
526 |
+
$item['DiscountAmount'] = $_rule->getDiscountAmount();
|
527 |
+
$item['DiscountQty'] = $_rule->getDiscountQty();
|
528 |
+
$item['DiscountStep'] = $_rule->getDiscountStep();
|
529 |
+
$item['SimpleFreeShipping'] = $_rule->getSimpleFreeShipping();
|
530 |
+
$item['ApplyToShipping'] = $_rule->getApplyToShipping();
|
531 |
+
$item['TimesUsed'] = $_rule->getTimesUsed();
|
532 |
+
$item['CouponType'] = $_rule->getCouponType();
|
533 |
+
|
534 |
+
$item['Conditions'] = unserialize($_rule->getConditionsSerialized());
|
535 |
+
$item['Actions'] = unserialize($_rule->getActionsSerialized());
|
536 |
+
|
537 |
+
$json['ItemDetailsList'][] = $item;
|
538 |
+
}
|
539 |
+
|
540 |
+
$log->setRequest(json_encode($json));
|
541 |
+
|
542 |
+
$response = $this->_restJSON($json, null);
|
543 |
+
|
544 |
+
$log->setResponse($response);
|
545 |
+
$log->save();
|
546 |
+
|
547 |
+
return json_decode($response);
|
548 |
+
}
|
549 |
+
}
|
550 |
+
?>
|
app/code/community/Iparcel/Shipping/Helper/Api/External.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* External API Helper
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Helper_Api_External{
|
10 |
+
/*
|
11 |
+
* var $_allowedAddr array
|
12 |
+
*
|
13 |
+
* List of allowed addresses and subnets
|
14 |
+
*/
|
15 |
+
protected $_allowedAddr = array(
|
16 |
+
'47.19.112.64/27',
|
17 |
+
'23.96.0.0/18',
|
18 |
+
'23.96.64.0/28',
|
19 |
+
'23.96.64.64/26',
|
20 |
+
'23.96.64.128/27',
|
21 |
+
'23.96.64.160/28',
|
22 |
+
'23.96.80.0/20',
|
23 |
+
'23.96.96.0/19',
|
24 |
+
'23.100.16.0/20',
|
25 |
+
'137.116.112.0/20',
|
26 |
+
'137.117.32.0/19',
|
27 |
+
'137.117.64.0/18',
|
28 |
+
'137.135.64.0/18',
|
29 |
+
'157.56.176.0/21',
|
30 |
+
'168.61.32.0/20',
|
31 |
+
'168.61.48.0/21',
|
32 |
+
'168.62.32.0/19',
|
33 |
+
'168.62.160.0/19',
|
34 |
+
'138.91.96.0/25',
|
35 |
+
'138.91.96.128/26',
|
36 |
+
'138.91.96.192/28',
|
37 |
+
'138.91.112.0/20',
|
38 |
+
'191.234.32.0/19',
|
39 |
+
'191.236.0.0/19',
|
40 |
+
'191.238.0.0/25',
|
41 |
+
'191.238.0.128/26',
|
42 |
+
'191.238.0.192/23',
|
43 |
+
'191.238.1.0/24',
|
44 |
+
'191.238.2.0/23',
|
45 |
+
'191.238.4.0/24',
|
46 |
+
'191.238.8.0/21',
|
47 |
+
'191.238.16.0/20',
|
48 |
+
'191.238.32.0/19',
|
49 |
+
);
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Checking if ip address matches range
|
53 |
+
*
|
54 |
+
* @param string $ip, string $range
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
protected function _cidrMatch ($ip, $range){
|
58 |
+
list ($subnet, $bits) = explode('/', $range);
|
59 |
+
$ip = ip2long($ip);
|
60 |
+
$subnet = ip2long($subnet);
|
61 |
+
$mask = -1 << (32 - $bits);
|
62 |
+
$subnet &= $mask;
|
63 |
+
return ($ip & $mask) == $subnet;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Checking if request ip address is allowed
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function isAllowed(){
|
72 |
+
//return true;
|
73 |
+
$ip = Mage::helper('core/http')->getRemoteAddr();
|
74 |
+
foreach ($this->_allowedAddr as $range){
|
75 |
+
if ($this->_cidrMatch($ip, $range)){
|
76 |
+
return true;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
?>
|
app/code/community/Iparcel/Shipping/Helper/Data.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Iparcel_Shipping default data Helper
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Helper_Data extends Mage_Core_Helper_Abstract {
|
10 |
+
/**
|
11 |
+
* Getting GUID key
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getGuid(){
|
16 |
+
return Mage::getStoreConfig('iparcel/config/userid');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Getting Customer ID
|
21 |
+
*
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function getCustomerID(){
|
25 |
+
return Mage::getStoreConfig('iparcel/config/custid');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Getting external JS Scripts URL
|
30 |
+
*
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public function getScriptUrl(){
|
34 |
+
return '//script.i-parcel.com/';
|
35 |
+
}
|
36 |
+
}
|
app/code/community/Iparcel/Shipping/Helper/International.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel international customer helper
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Helper_International{
|
10 |
+
/**
|
11 |
+
* Get international flag from customer session
|
12 |
+
*
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
public function getInternational(){
|
16 |
+
return Mage::getSingleton('customer/session')->getInternationalFlag();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Set international flag to customer session, respond with new state
|
21 |
+
*
|
22 |
+
* @param bool $v
|
23 |
+
* @return bool
|
24 |
+
*/
|
25 |
+
public function setInternational(bool $v){
|
26 |
+
Mage::getSingleton('customer/session')->setInternationalFlag($v);
|
27 |
+
return Mage::getSingleton('customer/session')->getInternationalFlag();
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Checking if international customer is enabled
|
32 |
+
*
|
33 |
+
* @return bool
|
34 |
+
*/
|
35 |
+
public function checkEnabled(){
|
36 |
+
return Mage::getStoreConfigFlag('iparcel/international_customer/enable');
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get international visibility attribute ID
|
41 |
+
*
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function getVisibilityAttributeId(){
|
45 |
+
return Mage::getStoreConfig('iparcel/international_customer/visibility');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get international visibility attribute name
|
50 |
+
*
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public function getVisibilityAttributeName(){
|
54 |
+
return Mage::getModel('catalog/resource_eav_attribute')->load($this->getVisibilityAttributeId())->getName();
|
55 |
+
}
|
56 |
+
}
|
57 |
+
?>
|
app/code/community/Iparcel/Shipping/Helper/Sales/Data.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sales module base helper extended with i-parcel orders surpressing emails
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Helper_Sales_Data extends Mage_Sales_Helper_Data{
|
10 |
+
/**
|
11 |
+
* Check allow to send new order confirmation email
|
12 |
+
*
|
13 |
+
* @param mixed $store
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
+
public function canSendNewOrderConfirmationEmail($store = null)
|
17 |
+
{
|
18 |
+
$parent = parent::canSendNewOrderConfirmationEmail($store);
|
19 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Check allow to send new order email
|
24 |
+
*
|
25 |
+
* @param mixed $store
|
26 |
+
* @return bool
|
27 |
+
*/
|
28 |
+
public function canSendNewOrderEmail($store = null)
|
29 |
+
{
|
30 |
+
$parent = parent::canSendNewOrderEmail($store);
|
31 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Check allow to send order comment email
|
36 |
+
*
|
37 |
+
* @param mixed $store
|
38 |
+
* @return bool
|
39 |
+
*/
|
40 |
+
public function canSendOrderCommentEmail($store = null)
|
41 |
+
{
|
42 |
+
$parent = parent::canSendOrderCommentEmail($store);
|
43 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Check allow to send new shipment email
|
48 |
+
*
|
49 |
+
* @param mixed $store
|
50 |
+
* @return bool
|
51 |
+
*/
|
52 |
+
public function canSendNewShipmentEmail($store = null)
|
53 |
+
{
|
54 |
+
$parent = parent::canSendNewShipmentEmail($store);
|
55 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Check allow to send shipment comment email
|
60 |
+
*
|
61 |
+
* @param mixed $store
|
62 |
+
* @return bool
|
63 |
+
*/
|
64 |
+
public function canSendShipmentCommentEmail($store = null)
|
65 |
+
{
|
66 |
+
$parent = parent::canSendShipmentCommentEmail($store);
|
67 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Check allow to send new invoice email
|
72 |
+
*
|
73 |
+
* @param mixed $store
|
74 |
+
* @return bool
|
75 |
+
*/
|
76 |
+
public function canSendNewInvoiceEmail($store = null)
|
77 |
+
{
|
78 |
+
$parent = parent::canSendNewInvoiceEmail($store);
|
79 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Check allow to send invoice comment email
|
84 |
+
*
|
85 |
+
* @param mixed $store
|
86 |
+
* @return bool
|
87 |
+
*/
|
88 |
+
public function canSendInvoiceCommentEmail($store = null)
|
89 |
+
{
|
90 |
+
$parent = parent::canSendInvoiceCommentEmail($store);
|
91 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Check allow to send new creditmemo email
|
96 |
+
*
|
97 |
+
* @param mixed $store
|
98 |
+
* @return bool
|
99 |
+
*/
|
100 |
+
public function canSendNewCreditmemoEmail($store = null)
|
101 |
+
{
|
102 |
+
$parent = parent::canSendNewCreditmemoEmail($store);
|
103 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Check allow to send creditmemo comment email
|
108 |
+
*
|
109 |
+
* @param mixed $store
|
110 |
+
* @return bool
|
111 |
+
*/
|
112 |
+
public function canSendCreditmemoCommentEmail($store = null)
|
113 |
+
{
|
114 |
+
$parent = parent::canSendCreditmemoCommentEmail($store);
|
115 |
+
return Mage::registry('isExternalSale') ? $parent && !Mage::getStoreConfigFlag('external_api/sales/transactional_emails') : $parent;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
?>
|
app/code/community/Iparcel/Shipping/Helper/String.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel shipping helper for strings
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiocoders.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Helper_String{
|
10 |
+
/**
|
11 |
+
* Checking if string has integer value
|
12 |
+
*
|
13 |
+
* @param string $str
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
+
public function isInteger(string $str){
|
17 |
+
return (int)$str == $str;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
?>
|
app/code/community/Iparcel/Shipping/Helper/Tax.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel helper for shipping tax&duty
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Helper_Tax extends Mage_Core_Helper_Abstract{
|
10 |
+
/**
|
11 |
+
* Getting shipping tax&duty totals for order
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order $order
|
14 |
+
* @return Varien_Data_Connection
|
15 |
+
*/
|
16 |
+
public function getTotal(Mage_Sales_Model_Order $order){
|
17 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($order->getId());
|
18 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
19 |
+
$collection = new Varien_Data_Collection();
|
20 |
+
switch($taxduty->getMode()){
|
21 |
+
case '2':
|
22 |
+
$collection->addItem(new Varien_Object(array(
|
23 |
+
'code' => 'shippingip_duty',
|
24 |
+
'value' => $taxduty->getDuty(),
|
25 |
+
'base_value' => $taxduty->getDuty(),
|
26 |
+
'label' => Mage::getStoreConfig('iparcel/tax/duty_label')
|
27 |
+
)));
|
28 |
+
$collection->addItem(new Varien_Object(array(
|
29 |
+
'code' => 'shippingip_tax',
|
30 |
+
'value' => $taxduty->getTax(),
|
31 |
+
'base_value' => $taxduty->getTax(),
|
32 |
+
'label' => Mage::getStoreConfig('iparcel/tax/tax_label')
|
33 |
+
)));
|
34 |
+
break;
|
35 |
+
case '1':
|
36 |
+
$collection->addItem(new Varien_Object(array(
|
37 |
+
'code' => 'shippingip_tax',
|
38 |
+
'value' => $taxduty->getTax()+$taxduty->getDuty(),
|
39 |
+
'base_value' => $taxduty->getTax()+$taxduty->getDuty(),
|
40 |
+
'label' => Mage::getStoreConfig('iparcel/tax/tax_duty_label')
|
41 |
+
)));
|
42 |
+
break;
|
43 |
+
}
|
44 |
+
return $collection;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Api/External/Sales/Order.php
ADDED
@@ -0,0 +1,382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel External Sales API processing model
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Api_External_Sales_Order extends Varien_Object{
|
10 |
+
/**
|
11 |
+
* Initialize adminhtml quote session
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
14 |
+
*/
|
15 |
+
protected function _initSession(){
|
16 |
+
$_orderData = $this->getOrderData();
|
17 |
+
/* var $_orderData array */
|
18 |
+
$data = $_orderData['session'];
|
19 |
+
/* var $data array */
|
20 |
+
if (!$data){
|
21 |
+
Mage::throwException('Session data not specified');
|
22 |
+
}
|
23 |
+
if (empty($data['customer_id'])){
|
24 |
+
Mage::throwException('Customer ID not specified');
|
25 |
+
}
|
26 |
+
Mage::getSingleton('adminhtml/session_quote')->setCustomerId((int) $data['customer_id']);
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Processing quote
|
32 |
+
*
|
33 |
+
* @return Iparcel_Shipping_MOdel_Api_External_Sales_Order
|
34 |
+
*/
|
35 |
+
protected function _processQuote(){
|
36 |
+
$data = $this->getOrderData();
|
37 |
+
/* var $data array */
|
38 |
+
if (empty($data['order'])){
|
39 |
+
Mage::throwException('Order Data not specified');
|
40 |
+
}
|
41 |
+
if (empty($data['add_products'])){
|
42 |
+
Mage::throwException('No products specified');
|
43 |
+
}
|
44 |
+
$_orderCreate = Mage::getSingleton('adminhtml/sales_order_create');
|
45 |
+
/* var $_orderCreate Mage_Adminhtml_Model_Sales_Order_Create */
|
46 |
+
$_orderCreate->importPostData($data['order']);
|
47 |
+
$_orderCreate->getBillingAddress();
|
48 |
+
$_orderCreate->setShippingAsBilling(true);
|
49 |
+
$_orderCreate->addProducts($data['add_products']);
|
50 |
+
$_orderCreate->getQuote()->getPayment()->addData($data['payment']);
|
51 |
+
$_orderCreate->setPaymentData($data['payment']);
|
52 |
+
$_orderCreate->initRuleData()->saveQuote();
|
53 |
+
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Customer setter
|
59 |
+
*
|
60 |
+
* @param array $user, int $websiteId
|
61 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
62 |
+
*/
|
63 |
+
public function setCustomer($user, $websiteId){
|
64 |
+
$customer = Mage::getModel('customer/customer');
|
65 |
+
/* var $customer Mage_Customer_Model_Customer */
|
66 |
+
if ($websiteId){
|
67 |
+
$customer->setWebsiteId($websiteId);
|
68 |
+
}
|
69 |
+
$customer->loadByEmail($user['email']);
|
70 |
+
// if customer exists set existing
|
71 |
+
if ($customer->getId()){
|
72 |
+
parent::setCustomer($customer);
|
73 |
+
}else{
|
74 |
+
$customer->setEmail($user['email']);
|
75 |
+
$customer->setFirstname($user['firstname']);
|
76 |
+
$customer->setLastname($user['lastname']);
|
77 |
+
$customer->setPassword($user['password']);
|
78 |
+
$customer->setConfirmation(null);
|
79 |
+
$customer->save();
|
80 |
+
// else create new one
|
81 |
+
parent::setCustomer($customer);
|
82 |
+
}
|
83 |
+
// set customer email and return
|
84 |
+
$this->setCustomerEmail($user['email']);
|
85 |
+
return $this;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Customer Address setter
|
90 |
+
*
|
91 |
+
* @param array $_address
|
92 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
93 |
+
*/
|
94 |
+
public function setCustomerAddress($_address){
|
95 |
+
$address = Mage::getModel('customer/address');
|
96 |
+
/* var $address Mage_Customer_Model_Address */
|
97 |
+
$customer = $this->getCustomer();
|
98 |
+
/* var $customer Mage_Customer_Model_Customer */
|
99 |
+
// throw exception if customer is not specified
|
100 |
+
if (!$customer){
|
101 |
+
Mage::throwException('Customer not specified');
|
102 |
+
}
|
103 |
+
$address->setCustomerId($customer->getId());
|
104 |
+
$address->setFirstname($_address['firstname']);
|
105 |
+
$address->setLastname($_address['lastname']);
|
106 |
+
$address->setCountryId($_address['country_id']);
|
107 |
+
$address->setStreet($_address['street']);
|
108 |
+
$address->setPostcode($_address['postcode']);
|
109 |
+
$address->setCity($_address['city']);
|
110 |
+
$address->setTelephone(isset($_address['telephone']) ? $_address['telephone'] : '');
|
111 |
+
$address->setRegion(isset($_address['region_id']) ? $_address['region_id'] : '');
|
112 |
+
$address->save();
|
113 |
+
return parent::setCustomerAddress($address);
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Setting default address for customer
|
118 |
+
*
|
119 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
120 |
+
*/
|
121 |
+
public function setDefaultCustomerAddress(){
|
122 |
+
$customer = $this->getCustomer();
|
123 |
+
/* var $customer Mage_Customer_Model_Customer */
|
124 |
+
if (!$customer){
|
125 |
+
Mage::throwException('Customer is not specified');
|
126 |
+
}
|
127 |
+
$address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
|
128 |
+
/* var $address Mage_Customer_Model_Address */
|
129 |
+
return parent::setCustomerAddress($address);
|
130 |
+
}
|
131 |
+
|
132 |
+
/** Order data setter
|
133 |
+
*
|
134 |
+
* @param array $data
|
135 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
136 |
+
*/
|
137 |
+
public function setOrderData($data){
|
138 |
+
$_products = array();
|
139 |
+
$_options = new Varien_Data_Collection();
|
140 |
+
foreach ($data as $product){
|
141 |
+
$_product = Mage::getModel('catalog/product')->getCollection()
|
142 |
+
->addAttributeToFilter('sku',$product['sku'])
|
143 |
+
->addAttributeToSelect('*')
|
144 |
+
->getFirstItem();
|
145 |
+
/* var $_product Mage_Catalog_Model_Product */
|
146 |
+
$_product->load($_product->getId());
|
147 |
+
$_products[$_product->getId()] = array(
|
148 |
+
'qty' => $product['qty'],
|
149 |
+
'price' => is_string($product['price']) ? (float)str_replace(",",".",$product['price']) : $product['price']
|
150 |
+
);
|
151 |
+
foreach ($product['options'] as $code => $value){
|
152 |
+
$_options->addItem(new Varien_Object(
|
153 |
+
array(
|
154 |
+
'product' => $_product,
|
155 |
+
'code' => $code,
|
156 |
+
'value' => $value
|
157 |
+
)
|
158 |
+
));
|
159 |
+
}
|
160 |
+
}
|
161 |
+
// set products and options
|
162 |
+
$this->setProducts($_products);
|
163 |
+
$this->setOptions($_options);
|
164 |
+
|
165 |
+
$_customerAddress = $this->getCustomerAddress();
|
166 |
+
/* var $_customerAddress Mage_Customer_Model_Address */
|
167 |
+
$_customer = $this->getCustomer();
|
168 |
+
/* var $_customer Mage_Customer_Model_Customer */
|
169 |
+
$_orderData = array(
|
170 |
+
'session' => array(
|
171 |
+
'customer_id' => $_customer->getId(),
|
172 |
+
'store_id' => $this->getStoreId()
|
173 |
+
),
|
174 |
+
'payment' => array(
|
175 |
+
'method' => 'iparcel'
|
176 |
+
),
|
177 |
+
'add_products' => $_products,
|
178 |
+
'order' => array(
|
179 |
+
'currency' => 'USD',
|
180 |
+
'account' => array(
|
181 |
+
'group_id' => '1',
|
182 |
+
'email' => $_customer->getEmail()
|
183 |
+
),
|
184 |
+
'billing_address' => array(
|
185 |
+
'customer_address_id' => $_customerAddress->getId(),
|
186 |
+
'prefix' => '',
|
187 |
+
'firstname' => $_customerAddress->getFirstname(),
|
188 |
+
'middlename' => '',
|
189 |
+
'lastname' => $_customerAddress->getLastname(),
|
190 |
+
'suffix' => '',
|
191 |
+
'company' => '',
|
192 |
+
'street' => $_customerAddress->getStreet(),
|
193 |
+
'city' => $_customerAddress->getCity(),
|
194 |
+
'country_id' => $_customerAddress->getCountryId(),
|
195 |
+
'region' => $_customerAddress->getRegion(),
|
196 |
+
'region_id' => '',
|
197 |
+
'postcode' => $_customerAddress->getPostcode(),
|
198 |
+
'telephone' => $_customerAddress->getTelephone(),
|
199 |
+
'fax' => ''
|
200 |
+
),
|
201 |
+
'shipping_address' => array(
|
202 |
+
'customer_address_id' => $_customerAddress->getId(),
|
203 |
+
'prefix' => '',
|
204 |
+
'firstname' => $_customerAddress->getFirstname(),
|
205 |
+
'middlename' => '',
|
206 |
+
'lastname' => $_customerAddress->getLastname(),
|
207 |
+
'suffix' => '',
|
208 |
+
'company' => '',
|
209 |
+
'street' => $_customerAddress->getStreet(),
|
210 |
+
'city' => $_customerAddress->getCity(),
|
211 |
+
'country_id' => $_customerAddress->getCountryId(),
|
212 |
+
'region' => $_customerAddress->getRegion(),
|
213 |
+
'region_id' => '',
|
214 |
+
'postcode' => $_customerAddress->getPostcode(),
|
215 |
+
'telephone' => $_customerAddress->getTelephone(),
|
216 |
+
'fax' => ''
|
217 |
+
),
|
218 |
+
'shipping_method' => 'i-parcel_auto',
|
219 |
+
'comment' => array(
|
220 |
+
'customer_note' => 'This order has ben programmatically created via I-Parcel extension'
|
221 |
+
),
|
222 |
+
'send_confirmation' => '0'
|
223 |
+
),
|
224 |
+
);
|
225 |
+
return parent::setOrderData($_orderData);
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Creating order method
|
230 |
+
*
|
231 |
+
* @return Mage_Sales_Model_Order
|
232 |
+
*/
|
233 |
+
public function createOrder(){
|
234 |
+
$orderData = $this->getOrderData();
|
235 |
+
/* var $orderData array */
|
236 |
+
if (!$orderData){
|
237 |
+
Mage::throwException('Order Data is not specified');
|
238 |
+
}
|
239 |
+
|
240 |
+
$tax = $this->getTax() ?: 0;
|
241 |
+
$shippingCosts = $this->getShippingCosts();
|
242 |
+
$this->_initSession();
|
243 |
+
$this->_processQuote();
|
244 |
+
|
245 |
+
$_orderCreator = Mage::getSingleton('adminhtml/sales_order_create');
|
246 |
+
/* var $_orderCreator Mage_Adminhtml_Sales_Order_Create */
|
247 |
+
|
248 |
+
$subtotal = 0;
|
249 |
+
|
250 |
+
// processing order's items, setting prices, totals etc
|
251 |
+
foreach ($this->getProducts() as $id => $productData){
|
252 |
+
$_product = Mage::getModel('catalog/product')->load($id);
|
253 |
+
/* var $_product Mage_Catalog_Model_Product */
|
254 |
+
$item = Mage::getSingleton('adminhtml/sales_order_create')->getQuote()->getItemByProduct($_product);
|
255 |
+
/* var $item Mage_Sales_Model_Quote_Item */
|
256 |
+
if (!$item) continue;
|
257 |
+
foreach ($this->getOptions() as $option){
|
258 |
+
if ($option['product']->getId() == $_product->getId()){
|
259 |
+
$item->addOption($option);
|
260 |
+
}
|
261 |
+
}
|
262 |
+
$price = empty($productData['price']) ? $_product->getFinalPrice() : $productData['price'];
|
263 |
+
$qty = $productData['qty'];
|
264 |
+
$item->setCustomPrice($price);
|
265 |
+
$item->setOriginalCustomPrice($price);
|
266 |
+
$rowtotal = (float)$qty * (float)$price;
|
267 |
+
$subtotal += $rowtotal;
|
268 |
+
$item->setRowTotal($rowtotal);
|
269 |
+
}
|
270 |
+
|
271 |
+
// calc grand total
|
272 |
+
$grandtotal = $subtotal+$tax+$shippingCosts;
|
273 |
+
|
274 |
+
// set currency
|
275 |
+
if (!$this->getCurrency()){
|
276 |
+
Mage::throwException('Currency is not specified');
|
277 |
+
}
|
278 |
+
$currency = $this->getCurrency();
|
279 |
+
|
280 |
+
// generate shipping rate
|
281 |
+
$ship = Mage::getModel('shipping/rate_result_method');
|
282 |
+
/* var $ship Mage_Shipping_Model_Rate_Result_Method */
|
283 |
+
$ship->setCarrier('i-parcel');
|
284 |
+
$ship->setCarrierTitle('i-parcel');
|
285 |
+
$ship->setMethod('auto');
|
286 |
+
$ship->setMethodTitle('Auto');
|
287 |
+
$ship->setPrice($shippingCosts);
|
288 |
+
$ship->setCost($shippingCosts);
|
289 |
+
$ship->setMethodDescription(Mage::getStoreConfig('carriers/i-parcel/whitelabelship').': '.Mage::getStoreConfig('carriers/i-parcel/backend_name'));
|
290 |
+
|
291 |
+
// import order's post data and shipping rate
|
292 |
+
$_orderCreator->importPostData($orderData['order'])
|
293 |
+
->getQuote()
|
294 |
+
->getShippingAddress()
|
295 |
+
->addShippingRate(Mage::getModel('sales/quote_address_rate')->importShippingRate($ship));
|
296 |
+
|
297 |
+
try{
|
298 |
+
// create order
|
299 |
+
$_order = $_orderCreator->createOrder();
|
300 |
+
/* var $_order Mage_Sales_Model_Order */
|
301 |
+
}catch(Exception $e){
|
302 |
+
$errors = array();
|
303 |
+
|
304 |
+
$messages = Mage::getSingleton('adminhtml/session_quote')->getMessages();
|
305 |
+
/* var $messages Mage_Core_Model_Message_Collection */
|
306 |
+
foreach ($messages->getErrors() as $error){
|
307 |
+
/* var $error Mage_Core_Model_Message_Error */
|
308 |
+
$errors[] = $error->getText();
|
309 |
+
$messages->deleteMessageByIdentifier($error->getIdentifier());
|
310 |
+
}
|
311 |
+
$errors = implode("\n",$errors);
|
312 |
+
|
313 |
+
$message = $e->getMessage();
|
314 |
+
$message = trim($message);
|
315 |
+
if($message != ''){
|
316 |
+
$errors .= "\n{$message}";
|
317 |
+
}
|
318 |
+
|
319 |
+
Mage::throwException($errors);
|
320 |
+
}
|
321 |
+
|
322 |
+
$_order->setShippingDescription($ship->getMethodDescription());
|
323 |
+
$_order->setBaseShippingAmount($ship->getPrice());
|
324 |
+
$_order->setShippingAmount($ship->getPrice());
|
325 |
+
$_order->setGlobalCurrencyCode($currency);
|
326 |
+
$_order->setBaseCurrencyCode($currency);
|
327 |
+
$_order->setStoreCurrencyCode($currency);
|
328 |
+
$_order->setOrderCurrencyCode($currency);
|
329 |
+
$_order->setTaxAmount($tax);
|
330 |
+
$_order->setSubtotal($subtotal);
|
331 |
+
$_order->setGrandTotal($grandtotal);
|
332 |
+
$_order->setBaseGrandTotal($grandtotal-$tax);
|
333 |
+
$_order->save();
|
334 |
+
$_order->sendNewOrderEmail();
|
335 |
+
|
336 |
+
Mage::getSingleton('adminhtml/session_quote')->clear();
|
337 |
+
Mage::unregister('rule_data');
|
338 |
+
|
339 |
+
$this->setOrder($_order);
|
340 |
+
return $_order;
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Creating invoice for the order
|
345 |
+
*
|
346 |
+
* @return Mage_Sales_Model_Order_Invoice
|
347 |
+
*/
|
348 |
+
public function createInvoice(){
|
349 |
+
$order = $this->getOrder();
|
350 |
+
/* var $order Mage_Sales_Model_Order */
|
351 |
+
if(!$order->canInvoice()){
|
352 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
|
353 |
+
}
|
354 |
+
$invoice = Mage::getModel('sales/service_order',$order)->prepareInvoice();
|
355 |
+
/* var $invoice = Mage_Sales_Model_Order_Invoice */
|
356 |
+
if (!$invoice->getTotalQty()){
|
357 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create invoice without products.'));
|
358 |
+
}
|
359 |
+
$invoice->setRequestCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
|
360 |
+
$invoice->register();
|
361 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
362 |
+
->addObject($invoice)
|
363 |
+
->addObject($invoice->getOrder());
|
364 |
+
/* var $transactionSave Mage_Core_Model_Resource_Transaction */
|
365 |
+
$transactionSave->save();
|
366 |
+
$invoice->sendEmail();
|
367 |
+
$this->setInvoice($invoice);
|
368 |
+
return $invoice;
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Setter for tracking number
|
373 |
+
*
|
374 |
+
* @param string $number
|
375 |
+
* @return Iparcel_Shipping_Model_Api_External_Sales_Order
|
376 |
+
*/
|
377 |
+
public function setTrackingNumber($number){
|
378 |
+
Mage::getSingleton('customer/session')->setTrackingNumber($number);
|
379 |
+
return parent::setTrackingNumber($number);
|
380 |
+
}
|
381 |
+
}
|
382 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Api/Log.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel XML log model
|
4 |
+
*
|
5 |
+
* Category Iparcel
|
6 |
+
* Package Iparcel_Shipping
|
7 |
+
* Author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Api_Log extends Varien_Object{
|
10 |
+
const LOG_FILENAME = "iparcel.log";
|
11 |
+
|
12 |
+
protected $_jsonData;
|
13 |
+
/**
|
14 |
+
* Internal constructor
|
15 |
+
*/
|
16 |
+
protected function _construct(){
|
17 |
+
$this->setLogFilename(Mage::getBaseDir('log').'/'.self::LOG_FILENAME);
|
18 |
+
$this->setJson($this->_read());
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Read log file method
|
23 |
+
*
|
24 |
+
* @return Varien_Data_Collection
|
25 |
+
*/
|
26 |
+
protected function _read(){
|
27 |
+
$response = new Varien_Data_Collection();
|
28 |
+
|
29 |
+
if (!file_exists($this->getLogFilename())){
|
30 |
+
$this->_jsonData = array();
|
31 |
+
return $response;
|
32 |
+
}
|
33 |
+
|
34 |
+
$file = fopen($this->getLogFilename(),"r");
|
35 |
+
$this->_jsonData = json_decode(fread($file,filesize($this->getLogFilename())),true);
|
36 |
+
fclose($file);
|
37 |
+
|
38 |
+
if (!is_array($this->_jsonData)){
|
39 |
+
if (!$this->_clear()){
|
40 |
+
Mage::throwException('Access Forbidden for i-parcel log file');
|
41 |
+
}
|
42 |
+
$this->_jsonData = array();
|
43 |
+
return $response;
|
44 |
+
}
|
45 |
+
|
46 |
+
// for each json log node append Varien Object to Varien Data Collection
|
47 |
+
foreach ($this->_jsonData['logs'] as $log){
|
48 |
+
$_log = new Varien_Object(array(
|
49 |
+
'timestamp' => $log['Timestamp'],
|
50 |
+
'controller' => $log['Controller'],
|
51 |
+
'response' => $log['Response'],
|
52 |
+
'request' => $log['Request']
|
53 |
+
));
|
54 |
+
$response->addItem($_log);
|
55 |
+
}
|
56 |
+
return $response;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Internal save method
|
61 |
+
*
|
62 |
+
* @return bool
|
63 |
+
*/
|
64 |
+
protected function _save(){
|
65 |
+
try{
|
66 |
+
$file = fopen($this->getLogFilename(),'w');
|
67 |
+
fwrite($file,json_encode($this->_jsonData));
|
68 |
+
fclose($file);
|
69 |
+
return true;
|
70 |
+
}catch (Exception $e){
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Internal create JSON file method
|
77 |
+
*
|
78 |
+
* @return bool
|
79 |
+
*/
|
80 |
+
protected function _create(){
|
81 |
+
$this->_jsonData['created'] = $this->getTimestamp();
|
82 |
+
$this->_jsonData['edited'] = $this->getTimestamp();
|
83 |
+
$this->_jsonData['logs'] = array();
|
84 |
+
|
85 |
+
$this->_appendLog();
|
86 |
+
return $this->_save();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Internal append XML to file method
|
91 |
+
*
|
92 |
+
* @return bool
|
93 |
+
*/
|
94 |
+
protected function _append(){
|
95 |
+
$this->_jsonData['edited'] = $this->getTimestamp();
|
96 |
+
|
97 |
+
$this->_appendLog();
|
98 |
+
return $this->_save();
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Internal clear XML file method
|
103 |
+
*
|
104 |
+
* @return bool
|
105 |
+
*/
|
106 |
+
protected function _clear(){
|
107 |
+
return unlink($this->getLogFilename());
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Internal append log nodes to SimpleXMLExtended object
|
112 |
+
*/
|
113 |
+
protected function _appendLog(){
|
114 |
+
$log = array();
|
115 |
+
$log['Timestamp'] = $this->getTimestamp();
|
116 |
+
$log['Controller'] = $this->getController();
|
117 |
+
$log['Request'] = $this->getRequest();
|
118 |
+
$log['Response'] = $this->getResponse();
|
119 |
+
|
120 |
+
$this->_jsonData['logs'][] = $log;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Save log file method
|
125 |
+
*
|
126 |
+
* @return bool
|
127 |
+
*/
|
128 |
+
public function save(){
|
129 |
+
$this->setTimestamp(date('d/m/Y h:i:sA T'));
|
130 |
+
$_request = $this->getRequest();
|
131 |
+
$_response = $this->getResponse();
|
132 |
+
$_controller = $this->getController();
|
133 |
+
if (!($_request !== NULL && $_response !== NULL && $_controller)){
|
134 |
+
Mage::throwException('Log data is not filled');
|
135 |
+
}
|
136 |
+
// append if file exists, if not create new
|
137 |
+
return file_exists($this->getLogFilename()) ? $this->_append() : $this->_create();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Clear log file method
|
142 |
+
*
|
143 |
+
* @return bool
|
144 |
+
*/
|
145 |
+
public function clear(){
|
146 |
+
return $this->_clear();
|
147 |
+
}
|
148 |
+
}
|
149 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Carrier/Iparcel.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel shipping method model
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
10 |
+
protected $_code = 'i-parcel';
|
11 |
+
protected $_carrier = 'i-parcel';
|
12 |
+
protected $_trackingUrl = 'https://tracking.i-parcel.com/secure/track.aspx?track=';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Check if carrier has shipping label option available
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
public function isShippingLabelsAvailable(){
|
20 |
+
return true;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Check if carrier has shipping tracking option available
|
25 |
+
*
|
26 |
+
* @return bool
|
27 |
+
*/
|
28 |
+
public function isTrackingAvailable(){
|
29 |
+
return true;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get info for track order page
|
34 |
+
*
|
35 |
+
* @param string $number
|
36 |
+
* @return Varien_Object
|
37 |
+
*/
|
38 |
+
public function getTrackingInfo($number){
|
39 |
+
return new Varien_Object(array(
|
40 |
+
'tracking' => $number,
|
41 |
+
'carrier_title' => $this->_carrier,
|
42 |
+
'url' => $this->_trackingUrl.$number
|
43 |
+
));
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Return container types of carrier
|
48 |
+
*
|
49 |
+
* @return array
|
50 |
+
*/
|
51 |
+
public function getContainerTypes(Varien_Object $params=NULL){
|
52 |
+
return array('DEFAULT' => Mage::helper('shippingip')->__('Default box'));
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Do request to shipment
|
57 |
+
*
|
58 |
+
* @param Mage_Shipping_Model_Shipment_Request $request
|
59 |
+
* @return Varien_Object
|
60 |
+
*/
|
61 |
+
public function requestToShipment(Mage_Shipping_Model_Shipment_Request $request){
|
62 |
+
$shipping = $request->getOrderShipment();
|
63 |
+
/* var $shipping Mage_Sales_Model_Order_Shipment */
|
64 |
+
$tracking = $shipping->getAllTracks();
|
65 |
+
if (empty($tracking)){
|
66 |
+
Mage::throwException('Invalid Request To Shipment Call');
|
67 |
+
}
|
68 |
+
$tracking = $tracking[0];
|
69 |
+
/* var $tracking Mage_Sales_Model_Order_Shipment_Track */
|
70 |
+
|
71 |
+
// prepare label PDF
|
72 |
+
$pdf = new Zend_Pdf();
|
73 |
+
$number = $tracking->getNumber();
|
74 |
+
$pdfPage = $pdf->pages[] = new Zend_Pdf_Page(('162:75'));
|
75 |
+
$barcodeFont = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir('media').'/font/code128.ttf');
|
76 |
+
$courier = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
|
77 |
+
$pdfPage->setFont($courier, 10);
|
78 |
+
$pdfPage->drawText($number,15,10);
|
79 |
+
$pdfPage->setFont($barcodeFont, 40);
|
80 |
+
$pdfPage->drawText($number,15,25);
|
81 |
+
|
82 |
+
$info = array();
|
83 |
+
$info[] = array(
|
84 |
+
'label_content' => $pdf->render(),
|
85 |
+
'tracking_number' => $number
|
86 |
+
);
|
87 |
+
|
88 |
+
// prepare response
|
89 |
+
$response = new Varien_Object();
|
90 |
+
$response->setTrackingNumer($number);
|
91 |
+
$response->setInfo($info);
|
92 |
+
|
93 |
+
return $response;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Collect shipping rates for i-parcel shipping
|
98 |
+
*
|
99 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
100 |
+
* @return Mage_Shipping_Model_Rate_Result
|
101 |
+
*/
|
102 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
103 |
+
try {
|
104 |
+
if(Mage::getStoreConfig('carriers/i-parcel/active'))
|
105 |
+
{
|
106 |
+
$iparcel = array();
|
107 |
+
// array for tax&duty totals
|
108 |
+
|
109 |
+
$result = Mage::getModel('shipping/rate_result');
|
110 |
+
/*var $result Mage_Shipping_Model_Rate_Result */
|
111 |
+
$businessSettings = Mage::helper('shippingip/api')->businessSettings();
|
112 |
+
/* var $businessSettings stdClass */
|
113 |
+
|
114 |
+
// collect rates only if the business settings model is 2 or 3
|
115 |
+
if(/*true || */in_array($businessSettings->model,array (2,3)))
|
116 |
+
{
|
117 |
+
$quote = Mage::helper('shippingip/api')->quote($request);
|
118 |
+
/* var $quote stdClass */
|
119 |
+
|
120 |
+
// set parcelId to session
|
121 |
+
Mage::getSingleton('customer/session')->setParcelId($quote->ParcelID);
|
122 |
+
|
123 |
+
$serviceLevel = $quote->ServiceLevels;
|
124 |
+
|
125 |
+
//$serviceLevel = (object)array(
|
126 |
+
//(object)array(
|
127 |
+
//'ServiceLevelID' => 'test1',
|
128 |
+
//'DutyCompanyCurrency' => '2.33',
|
129 |
+
//'TaxCompanyCurrency' => '3.33',
|
130 |
+
//'ShippingChargeCompanyCurrency' => '4.33'
|
131 |
+
//),
|
132 |
+
//(object)array(
|
133 |
+
//'ServiceLevelID' => 'test2',
|
134 |
+
//'DutyCompanyCurrency' => '3.33',
|
135 |
+
//'TaxCompanyCurrency' => '4.33',
|
136 |
+
//'ShippingChargeCompanyCurrency' => '5.33'
|
137 |
+
//)
|
138 |
+
//);
|
139 |
+
|
140 |
+
// Handling serviceLevels results and set up the shipping method
|
141 |
+
foreach ($serviceLevel as $ci) {
|
142 |
+
// setting up values
|
143 |
+
$servicename = $ci->ServiceLevelID;
|
144 |
+
|
145 |
+
$cursym = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
146 |
+
|
147 |
+
$duty = number_format((float) $ci->DutyCompanyCurrency, 2, '.', '');
|
148 |
+
$tax = number_format((float) $ci->TaxCompanyCurrency, 2, '.', '');
|
149 |
+
$shipping = number_format((float) $ci->ShippingChargeCompanyCurrency, 2, '.', '');
|
150 |
+
|
151 |
+
$tax_flag = Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::DISABLED;
|
152 |
+
// true if tax intercepting is disabled
|
153 |
+
|
154 |
+
$total = number_format($tax_flag ? (float)$duty+$tax+$shipping : (float)$shipping, 2, '.', '');
|
155 |
+
$shiplabel = Mage::getStoreConfig('carriers/i-parcel/whitelabelship');
|
156 |
+
$title = $tax_flag ? $shiplabel.'(Shipping Price: '.$cursym.$shipping.' Duty: '.$cursym.$duty.' Tax: '.$cursym.$tax.')' : $shiplabel;
|
157 |
+
|
158 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
159 |
+
$method->setCarrier('i-parcel');
|
160 |
+
$method->setCarrierTitle('i-parcel');
|
161 |
+
$method->setMethod($servicename);
|
162 |
+
$method->setMethodTitle($title);
|
163 |
+
$method->setPrice($total);
|
164 |
+
$method->setCost($total);
|
165 |
+
$method->setPriceOriginal($total);
|
166 |
+
$method->setPriceDuty($duty);
|
167 |
+
$method->setPriceTax($tax);
|
168 |
+
$method->setPriceInsurance($total);
|
169 |
+
$method->setPackageWeight($request->getPackageWeight());
|
170 |
+
$method->setMethodDescription(Mage::getStoreConfig('carriers/i-parcel/whitelabelship').': '.Mage::getStoreConfig('carriers/i-parcel/backend_name'));
|
171 |
+
|
172 |
+
// append method to result
|
173 |
+
$result->append($method);
|
174 |
+
|
175 |
+
$iparcel['i-parcel_'.$servicename] = array(
|
176 |
+
'duty' => $duty,
|
177 |
+
'tax' => $tax
|
178 |
+
);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
Mage::unregister('iparcel');
|
182 |
+
Mage::register('iparcel',$iparcel);
|
183 |
+
return $result;
|
184 |
+
}
|
185 |
+
}catch(Exception $e){
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Get Allowed Shipping Methods
|
191 |
+
*
|
192 |
+
* @return array
|
193 |
+
*/
|
194 |
+
public function getAllowedMethods() {
|
195 |
+
return array(
|
196 |
+
'i-parcel' => $this->_carrier,
|
197 |
+
'auto' => 'Auto'
|
198 |
+
);
|
199 |
+
}
|
200 |
+
|
201 |
+
}
|
app/code/community/Iparcel/Shipping/Model/Catalog/Mapping.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Model for catalog mapping cron
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Catalog_Mapping{
|
10 |
+
/**
|
11 |
+
* Method called by cron
|
12 |
+
*/
|
13 |
+
public function sync(){
|
14 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection();
|
15 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Catalog/Product/Observer.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog_Product observer class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Catalog_Product_Observer{
|
10 |
+
/**
|
11 |
+
* Checking if catalog upload on product save is enabled
|
12 |
+
*
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
protected function _isEnabled(){
|
16 |
+
return Mage::getStoreConfig('catalog_mapping/config/auto_upload') == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode::ON_UPDATE;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* catalog_product_save_after event handler
|
21 |
+
*/
|
22 |
+
public function product_save($observer){
|
23 |
+
if ($this->_isEnabled()){
|
24 |
+
$product = $observer->getProduct();
|
25 |
+
$productCollection = new Varien_Data_Collection();
|
26 |
+
$productCollection->addItem($product);
|
27 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* catalog_product_attribute_update_before event handler
|
33 |
+
*/
|
34 |
+
public function product_massUpdate($observer){
|
35 |
+
if ($this->_isEnabled()){
|
36 |
+
$productIds = $observer->getProductIds();
|
37 |
+
$attributesData = $observer->getAttributesData();
|
38 |
+
$productCollection = new Varien_Data_Collection();
|
39 |
+
foreach ($productIds as $id){
|
40 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
41 |
+
foreach ($attributesData as $code => $value){
|
42 |
+
$product->setData($code,$value);
|
43 |
+
}
|
44 |
+
$productCollection->addItem($product);
|
45 |
+
}
|
46 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* catalog_product_delete_before event handler
|
52 |
+
*/
|
53 |
+
public function product_delete($observer){
|
54 |
+
if ($this->_isEnabled()){
|
55 |
+
$product = $observer->getProduct();
|
56 |
+
$product->setIsDeleted(true);
|
57 |
+
$productCollection = new Varien_Data_Collection();
|
58 |
+
$productCollection->addItem($product);
|
59 |
+
Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Config/Catalog/Mapping.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend model of auto catalog updates config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Catalog_Mapping extends Mage_Core_Model_Config_Data{
|
10 |
+
const CRON_STRING_PATH = 'crontab/jobs/iparcel_catalog_mapping/schedule/cron_expr';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Getting i-parcel cron string path
|
14 |
+
*
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getCron(){
|
18 |
+
return Mage::getModel('core/config_data')->load(self::CRON_STRING_PATH,'path');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Method called after config save
|
23 |
+
* Checking if value is cron and enabling/disabling cron
|
24 |
+
*/
|
25 |
+
protected function _afterSave(){
|
26 |
+
if ($this->getValue() == Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode::CRON){
|
27 |
+
$params = Mage::app()->getRequest()->getParams();
|
28 |
+
$params = $params["groups"]["config"]["fields"];
|
29 |
+
/* var $params array */
|
30 |
+
|
31 |
+
$freq = $params['cron_frequency']['value'];
|
32 |
+
$cron_expr = array();
|
33 |
+
$cron_expr[3] = '*';
|
34 |
+
switch ($freq){
|
35 |
+
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY:
|
36 |
+
$cron_expr[2] = $params['cron_monthday']['value'];
|
37 |
+
$cron_expr[4] = '*';
|
38 |
+
break;
|
39 |
+
case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY:
|
40 |
+
$cron_expr[4] = $params['cron_weekday']['value'];
|
41 |
+
$cron_expr[2] = '*';
|
42 |
+
}
|
43 |
+
$cron_expr[0] = $params['cron_minute']['value'];
|
44 |
+
$cron_expr[1] = $params['cron_hour']['value'];
|
45 |
+
|
46 |
+
ksort($cron_expr, SORT_NUMERIC);
|
47 |
+
$cron_expr = trim(implode(' ',$cron_expr));
|
48 |
+
|
49 |
+
try{
|
50 |
+
$this->_getCron()
|
51 |
+
->setValue($cron_expr)
|
52 |
+
->setPath(self::CRON_STRING_PATH)
|
53 |
+
->save();
|
54 |
+
}catch (Exception $e){
|
55 |
+
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression'));
|
56 |
+
}
|
57 |
+
}else{
|
58 |
+
try{
|
59 |
+
$this->_getCron()
|
60 |
+
->delete();
|
61 |
+
}catch (Exception $e){
|
62 |
+
throw new Exception(Mage::helper('cron')->__('Unable to remove the cron expression'));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
?>
|
68 |
+
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Monthday.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend model for monthday config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Date_Monthday extends Mage_Core_Model_Config_Data{
|
10 |
+
/**
|
11 |
+
* Saving monthday if proper value
|
12 |
+
*/
|
13 |
+
public function save(){
|
14 |
+
$_monthday = $this->getValue();
|
15 |
+
if (Mage::helper('shippingip/string')->isInteger($_monthday) && $_monthday<=31 && $_monthday>0){
|
16 |
+
return parent::save();
|
17 |
+
}else{
|
18 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong day of month'));
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Date/Weekday.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend model for weekday config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Date_Weekday extends Mage_Core_Model_Config_Data{
|
10 |
+
/**
|
11 |
+
* Saving weekday if proper value
|
12 |
+
*/
|
13 |
+
public function save(){
|
14 |
+
$_weekday = $this->getValue();
|
15 |
+
if (Mage::helper('shippingip/string')->isInteger($_weekday) && $_weekday<=7 && $_weekday>0){
|
16 |
+
return parent::save();
|
17 |
+
}else{
|
18 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong day of week'));
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Hour.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend model for time hour config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Time_Hour extends Mage_Core_Model_Config_Data{
|
10 |
+
/**
|
11 |
+
* Saving hour if proper value
|
12 |
+
*/
|
13 |
+
public function save(){
|
14 |
+
$_hour = $this->getValue();
|
15 |
+
if (Mage::helper('shippingip/string')->isInteger($_hour) && $_hour<24 && $_hour>=0){
|
16 |
+
return parent::save();
|
17 |
+
}else{
|
18 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong hour'));
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Config/Data/Time/Minute.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend model for time minute config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Data_Time_Minute extends Mage_Core_Model_Config_Data{
|
10 |
+
/**
|
11 |
+
* Saving minute if proper value
|
12 |
+
*/
|
13 |
+
public function save(){
|
14 |
+
$_minute = $this->getValue();
|
15 |
+
if (Mage::helper('shippingip/string')->isInteger($_minute) && $_minute<60 && $_minute>=0){
|
16 |
+
return parent::save();
|
17 |
+
}else{
|
18 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong minute'));
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Config/Guid.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** Backend model for i-parcel GUID config field
|
3 |
+
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
+
*/
|
8 |
+
class Iparcel_Shipping_Model_Config_Guid extends Mage_Core_Model_Config_Data{
|
9 |
+
/**
|
10 |
+
* Saving config if proper value
|
11 |
+
*/
|
12 |
+
public function save(){
|
13 |
+
$_guid = $this->getValue();
|
14 |
+
if (preg_match('/^[0-9A-Z]{8}-([0-9A-Z]{4}-){3}[0-9A-Z]{12}$/i',$_guid)){
|
15 |
+
return parent::save();
|
16 |
+
}else{
|
17 |
+
Mage::throwException(Mage::helper('shippingip')->__('Wrong GUID'));
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
21 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Config/Script/Js.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backend model for JavaScript file config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>, Maciej Jarmuła <maciej.jarmula@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Config_Script_Js extends Mage_Adminhtml_Model_System_Config_Backend_File
|
10 |
+
{
|
11 |
+
const UPLOAD_ROOT = 'js';
|
12 |
+
const UPLOAD_DIR = 'iparcel_custom';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Method called before config save
|
16 |
+
* Unlinking old or deleted file
|
17 |
+
*/
|
18 |
+
protected function _beforeSave(){
|
19 |
+
$uploadDir = $this->_getUploadDir();
|
20 |
+
|
21 |
+
$file = $uploadDir.'/'.$this->getValue();
|
22 |
+
|
23 |
+
// if it's delete action and file exists
|
24 |
+
if($delete && file_exists($file)){
|
25 |
+
unlink($file);
|
26 |
+
}
|
27 |
+
|
28 |
+
// if it's set new action and old file exists
|
29 |
+
$file = $uploadDir.'/'. $_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
|
30 |
+
if(file_exists($file)){
|
31 |
+
unlink($file);
|
32 |
+
}
|
33 |
+
parent::_beforeSave();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Getting directory where scripts are uploaded
|
38 |
+
*
|
39 |
+
* @param string $field
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function getUploadDir($field){
|
43 |
+
$uploadDir = self::UPLOAD_DIR;
|
44 |
+
|
45 |
+
$uploadDir = $uploadDir.'/'.$field. '/';
|
46 |
+
return $uploadDir;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Getting directory wher to upload
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
protected function _getUploadDir(){
|
55 |
+
$uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT);
|
56 |
+
$uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR.'/'.$this->getField());
|
57 |
+
|
58 |
+
$uploadDir = $uploadRoot .'/'. $uploadDir;
|
59 |
+
return $uploadDir;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Returning if scope info should be added
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
protected function _addWhetherScopeInfo()
|
68 |
+
{
|
69 |
+
return true;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Returning array of proper extensions
|
74 |
+
*
|
75 |
+
* @return array
|
76 |
+
*/
|
77 |
+
protected function _getAllowedExtensions()
|
78 |
+
{
|
79 |
+
return array('js');
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Getting upload root directory
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
protected function _getUploadRoot($token) {
|
88 |
+
return Mage::getBaseDir()."/$token";
|
89 |
+
}
|
90 |
+
}
|
app/code/community/Iparcel/Shipping/Model/Cpf.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Db model for cpfs' types
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Cpf extends Mage_Core_Model_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing model in internal constructor
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/cpf');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Processing data before model save
|
19 |
+
*/
|
20 |
+
protected function _beforeSave(){
|
21 |
+
$this->setCountryCode(strtoupper($this->getCountryCode()));
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Load CPF by country code
|
26 |
+
*
|
27 |
+
* @param string $code, string $attributes
|
28 |
+
* @return Iparcel_Shipping_Model_Cpf
|
29 |
+
*/
|
30 |
+
public function loadByCountryCode($code, $attributes = '*'){
|
31 |
+
$collection = $this->getResourceCollection()
|
32 |
+
->addFieldToSelect($attributes)
|
33 |
+
->addFieldToFilter('country_code',$code);
|
34 |
+
return $collection->getFirstItem();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Cpf/Order.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Db model for order's cpfs' values
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Cpf_Order extends Mage_Core_Model_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing model in internal constructor
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/cpf_order');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Load CPF by order_id
|
19 |
+
*
|
20 |
+
* @param int $orderId, string $fields='*'
|
21 |
+
* @return Iparcel_Shipping_Model_Cpf_Order
|
22 |
+
*/
|
23 |
+
public function loadByOrderId($orderId, $fields='*'){
|
24 |
+
return $this->getCollection()
|
25 |
+
->addFieldToSelect($fields)
|
26 |
+
->addFieldToFilter('order_id',$orderId)
|
27 |
+
->getFirstItem();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Cpf/Quote.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Db model for quote's cpfs' values
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Cpf_Quote extends Mage_Core_Model_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing model in internal constructor
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/cpf_quote');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Load CPF by quote_id
|
19 |
+
*
|
20 |
+
* @param int $quoteId, string $fields='*'
|
21 |
+
* @return Iparcel_Shipping_Model_Cpf_Quote
|
22 |
+
*/
|
23 |
+
public function loadByQuoteId($quoteId, $fields='*'){
|
24 |
+
return $this->getCollection()
|
25 |
+
->addFieldToSelect($fields)
|
26 |
+
->addFieldToFilter('quote_id',$quoteId)
|
27 |
+
->getFirstItem();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Parcel.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Db model for cpfs' types
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Parcel extends Mage_Core_Model_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing model in internal constructor
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/parcel');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Load Parcel by Order ID
|
19 |
+
*
|
20 |
+
* @param string $orderId, string $attributes
|
21 |
+
* @return Iparcel_Shipping_Model_Cpf
|
22 |
+
*/
|
23 |
+
public function loadByOrderId($orderId, $attributes = '*'){
|
24 |
+
$collection = $this->getResourceCollection()
|
25 |
+
->addFieldToSelect($attributes)
|
26 |
+
->addFieldToFilter('order_id',$orderId);
|
27 |
+
return $collection->getFirstItem();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Payment/Iparcel.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for i-parcel external sales API payment method
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Payment_Iparcel extends Mage_Payment_Model_Method_Abstract{
|
10 |
+
protected $_code = 'iparcel';
|
11 |
+
protected $_infoBlockType = 'shippingip/payment_info';
|
12 |
+
protected $_canUseCheckout = false;
|
13 |
+
protected $_canUseForMultishipping = false;
|
14 |
+
protected $_canUseInternal = false;
|
15 |
+
}
|
16 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Model for Iparcel_Shipping_Model_Cpf class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf extends Mage_Core_Model_Resource_Db_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/cpf','id');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Collection.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Collection Model for Iparcel_Shipping_Model_Cpf class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource Collection
|
12 |
+
*/
|
13 |
+
public function _construct(){
|
14 |
+
$this->_init('shippingip/cpf');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Model for Iparcel_Shipping_Model_Cpf_Order class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Order extends Mage_Core_Model_Resource_Db_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/cpf_order','id');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Order/Collection.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Collection Model for Iparcel_Shipping_Model_Cpf_Order class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Order_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource Collection
|
12 |
+
*/
|
13 |
+
public function _construct(){
|
14 |
+
$this->_init('shippingip/cpf_order');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Model for Iparcel_Shipping_Model_Cpf_Quote class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Quote extends Mage_Core_Model_Resource_Db_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/cpf_quote','id');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Cpf/Quote/Collection.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Collection Model for Iparcel_Shipping_Model_Cpf_Quote class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Cpf_Quote_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource Collection
|
12 |
+
*/
|
13 |
+
public function _construct(){
|
14 |
+
$this->_init('shippingip/cpf_quote');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Parcel.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Model for Iparcel_Shipping_Model_Cpf class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Parcel extends Mage_Core_Model_Resource_Db_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/parcel','parcel_id');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Parcel/Collection.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Collection Model for Iparcel_Shipping_Model_Cpf class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Parcel_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource Collection
|
12 |
+
*/
|
13 |
+
public function _construct(){
|
14 |
+
$this->_init('shippingip/parcel');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Setup Resource class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup{
|
10 |
+
}
|
11 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Model for Iparcel_Shipping_Model_Tax_Totals class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Tax_Totals extends Mage_Core_Model_Resource_Db_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/tax_totals','id');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Resource/Tax/Totals/Collection.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Collection Model for Iparcel_Shipping_Model_Tax_Totals class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Resource_Tax_Totals_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing Resource Collection
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/tax_totals');
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Sales/Order.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Rewrite of Mage_Sales_Model_Order for i-parcel extension
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Order extends Mage_Sales_Model_Order{
|
10 |
+
/**
|
11 |
+
* Check order state before saving
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Model_Sales_Order
|
14 |
+
*/
|
15 |
+
protected function _checkState(){
|
16 |
+
if (Mage::registry('isExternalSale') && Mage::getStoreConfig('external_api/sales/order_status') != Mage_Sales_Model_Order::STATE_COMPLETE){
|
17 |
+
return $this;
|
18 |
+
}else{
|
19 |
+
return parent::_checkState();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Sales/Order/Observer.php
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sales_Order observer class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Order_Observer{
|
10 |
+
/**
|
11 |
+
* Initializing CPF
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order $order
|
14 |
+
*/
|
15 |
+
protected function _initCpf($order){
|
16 |
+
$cpf = Mage::getModel('shippingip/cpf_order')->loadByOrderId($order->getId());
|
17 |
+
/* var $cpf Iparcel_Shippingip_Model_Cpf_Order */
|
18 |
+
if($cpf->getId()){
|
19 |
+
$order->setCpf($cpf->getValue());
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initializing Parcel
|
25 |
+
*
|
26 |
+
* @param Mage_Sales_Model_Order $order
|
27 |
+
*/
|
28 |
+
protected function _initParcel($order){
|
29 |
+
$parcel = Mage::getModel('shippingip/parcel')->loadByOrderId($order->getId());
|
30 |
+
if ($parcel->getParcelId()){
|
31 |
+
$order->setParcel($parcel->getParcelId());
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Searching for traching number in order comments
|
37 |
+
*
|
38 |
+
* @param Mage_Sales_Model_Order $order
|
39 |
+
* @return Mage_Sales_Model_Order_Status_History
|
40 |
+
*/
|
41 |
+
protected function _searchForTrackingNumber($order){
|
42 |
+
foreach ($order->getStatusHistoryCollection() as $status){
|
43 |
+
/* var $status Mage_Sales_Model_Order_Status_History */
|
44 |
+
if (preg_match('/^i-parcel tracking number: ([0-9A-Z]+)$/', $status->getComment()) == 1){
|
45 |
+
return $status;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
return NULL;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Creating shipment for an order
|
53 |
+
*
|
54 |
+
* @param Mage_Sales_Model_Order $order
|
55 |
+
*/
|
56 |
+
protected function _createShipment($order){
|
57 |
+
if ($order->getQuote()){
|
58 |
+
// if it's i-parcel shipping method
|
59 |
+
if ($order->getShippingCarrier()->getCarrierCode() == 'i-parcel'){
|
60 |
+
if (!Mage::registry('isExternalSale') && Mage::getStoreConfigFlag('iparcel/config/submit_parcel')){
|
61 |
+
/* var $submitParcel stdClass */
|
62 |
+
$submitParcel = Mage::helper('shippingip/api')->submitParcel($order);
|
63 |
+
if ($submitParcel->ParcelID){
|
64 |
+
$this->_createParcel($order, $submitParcel->ParcelID);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
$tracking = Mage::getSingleton('customer/session')->getTrackingNumber();
|
68 |
+
if (!$tracking && isset($submitParcel)){
|
69 |
+
$tracking = $submitParcel->CarrierTrackingNumber;
|
70 |
+
}
|
71 |
+
/* var $tracking string */
|
72 |
+
if ($tracking && !$this->_searchForTrackingNumber($order)){
|
73 |
+
$order->addStatusHistoryComment('i-parcel tracking number: '.$tracking);
|
74 |
+
}
|
75 |
+
// if autoship is enabled and order can be shipped
|
76 |
+
if (Mage::getStoreConfigFlag('carriers/i-parcel/autoship')){
|
77 |
+
if ($order->canShip()){
|
78 |
+
$converter = Mage::getModel('sales/convert_order');
|
79 |
+
/* var $converter Mage_Sales_Model_Convert_Order */
|
80 |
+
$shipment = $converter->toShipment($order);
|
81 |
+
/* var $shipment Mage_Sales_Model_Order_Shipment */
|
82 |
+
foreach ($order->getAllItems() as $orderItem){
|
83 |
+
/* var $orderItem Mage_Sales_Model_Order_Item */
|
84 |
+
// continue if it is virtual or there is no quantity to ship
|
85 |
+
if (!$orderItem->getQtyToShip()) continue;
|
86 |
+
if ($order->getIsVirtual()) continue;
|
87 |
+
$item = $converter->itemToShipmentItem($orderItem);
|
88 |
+
/* var $item Mage_Sales_Model_Order_Shipment_Item */
|
89 |
+
$item->setQty($orderItem->getQtyToShip());
|
90 |
+
$shipment->addItem($item);
|
91 |
+
}
|
92 |
+
$shipment->register();
|
93 |
+
$shipment->getOrder()->setIsInProcess(true);
|
94 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
95 |
+
->addObject($shipment)
|
96 |
+
->addObject($order);
|
97 |
+
/* var $transactionSave Mage_Core_Model_Resource_Transaction */
|
98 |
+
$transactionSave->save();
|
99 |
+
$shipment->save();
|
100 |
+
$shipment->sendEmail();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Creating CPF for an order
|
109 |
+
*
|
110 |
+
* @param Mage_Sales_Model_Order $order
|
111 |
+
*/
|
112 |
+
protected function _createCpf($order){
|
113 |
+
if ($quote = $order->getQuote()){
|
114 |
+
/* var $quote Mage_Sales_Model_Quote */
|
115 |
+
$cpf = Mage::getModel('shippingip/cpf_order')->loadByOrderId($order->getId());
|
116 |
+
/* var $cpf Iparcel_Shipping_Model_Cpf_Order */
|
117 |
+
// create CPF for order if quote has CPF
|
118 |
+
if($quote->getCpf()){
|
119 |
+
$cpf->setOrderId($order->getId());
|
120 |
+
$cpf->setValue($quote->getCpf());
|
121 |
+
$cpf->save();
|
122 |
+
}elseif($cpf->getId()){
|
123 |
+
$cpf->delete();
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Creating Parcel for an order
|
130 |
+
*
|
131 |
+
* @param Mage_Sales_Model_Order $order
|
132 |
+
*/
|
133 |
+
protected function _createParcel($order, $parcel_id){
|
134 |
+
$parcel = Mage::getModel('shippingip/parcel')
|
135 |
+
->setOrderId($order->getId())
|
136 |
+
->setParcelId($parcel_id);
|
137 |
+
$parcel->save();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Saving Shipping Tax&Duty Totals
|
142 |
+
*
|
143 |
+
* @param Mage_Sales_Model_Order $order
|
144 |
+
*/
|
145 |
+
protected function _saveTaxDuty($order){
|
146 |
+
$custSess = Mage::getSingleton('customer/session');
|
147 |
+
/* var $custSess Mage_Customer_Model_Session */
|
148 |
+
$_taxduty = $custSess->getTaxDutyTotal();
|
149 |
+
/* var $_taxduty array */
|
150 |
+
$custSess->unsTaxDutyTotal();
|
151 |
+
if ($_taxduty && $order->getShippingCarrier()->getCarrierCode() == 'i-parcel'){
|
152 |
+
try{
|
153 |
+
$taxduty = Mage::getModel('shippingip/tax_totals');
|
154 |
+
$taxduty->setMode($_taxduty['mode']);
|
155 |
+
$taxduty->setOrderId($order->getId());
|
156 |
+
$taxduty->setTax($_taxduty['tax']);
|
157 |
+
$taxduty->setDuty($_taxduty['duty']);
|
158 |
+
$taxduty->save();
|
159 |
+
}catch (Exception $e){}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Processing Shipping Tax&Duty Totals
|
165 |
+
* Setting correct order grand_total
|
166 |
+
*
|
167 |
+
* @param Mage_Sales_Model_Order $order
|
168 |
+
*/
|
169 |
+
protected function _processTaxDuty($order){
|
170 |
+
$_taxduty = Mage::getSingleton('customer/session')->getTaxDutyTotal();
|
171 |
+
/* var $_taxduty array */
|
172 |
+
$order->setBaseGrandTotal($order->getBaseGrandTotal()+$_taxduty['tax']+$_taxduty['duty']);
|
173 |
+
$order->setGrandTotal($order->getGrandTotal()+$_taxduty['tax']+$_taxduty['duty']);
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Setting order prefix for an order
|
178 |
+
*
|
179 |
+
* @param Mage_Sales_Model_Order $order
|
180 |
+
*/
|
181 |
+
protected function _setOrderPrefix($order){
|
182 |
+
// if prefix is specified and shipping carrier is i-parcel
|
183 |
+
if(Mage::getStoreConfig('carriers/i-parcel/prefix') && $order->getShippingCarrier()->getCarrierCode() == 'i-parcel'){
|
184 |
+
// and there's no prefix at the beginning
|
185 |
+
if (strpos($order->getIncrementId(),Mage::getStoreConfig('carriers/i-parcel/prefix')) !== 0){
|
186 |
+
// add prefix at the beginning of increment ID
|
187 |
+
$order->setIncrementId(Mage::getStoreConfig('carriers/i-parcel/prefix').$order->getIncrementId());
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Handling external sales API orders
|
194 |
+
* Setting choosen order status
|
195 |
+
*
|
196 |
+
* @param Mage_Sales_Model_Order $order
|
197 |
+
*/
|
198 |
+
protected function _handleExternal($order){
|
199 |
+
// if external sale is registered and choosen order status is not STATE_COMPLETE
|
200 |
+
if (Mage::registry('isExternalSale') && ($status=Mage::getStoreConfig('external_api/sales/order_status')) != Mage_Sales_Model_Order::STATE_COMPLETE){
|
201 |
+
// set new state
|
202 |
+
$order->setState($status, $status);
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* sales_order_save_before event handler
|
208 |
+
*/
|
209 |
+
public function before_save($observer){
|
210 |
+
$order = $observer->getOrder();
|
211 |
+
$this->_setOrderPrefix($order);
|
212 |
+
$this->_processTaxDuty($order);
|
213 |
+
$this->_handleExternal($order);
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* sales_order_save_after event handler
|
218 |
+
*/
|
219 |
+
public function after_save($observer){
|
220 |
+
$order = $observer->getOrder();
|
221 |
+
$this->_saveTaxDuty($order);
|
222 |
+
$this->_createCpf($order);
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* sales_order_load_after event handler
|
227 |
+
*/
|
228 |
+
public function after_load($observer){
|
229 |
+
$order = $observer->getOrder();
|
230 |
+
$this->_initCpf($order);
|
231 |
+
$this->_initParcel($order);
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* sales_order_place_after event handler
|
236 |
+
*/
|
237 |
+
public function after_place($observer){
|
238 |
+
$order = $observer->getOrder();
|
239 |
+
$this->_createShipment($order);
|
240 |
+
}
|
241 |
+
}
|
242 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Sales/Order/Shipment/Observer.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sales_Order_Shipment observer class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Order_Shipment_Observer{
|
10 |
+
/**
|
11 |
+
* Getting tracking number from order's comments
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order $order
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function _getTrackingNumber($order){
|
17 |
+
$trackingNumber = '';
|
18 |
+
foreach ($order->getStatusHistoryCollection() as $status){
|
19 |
+
preg_replace_callback('/^i-parcel tracking number: ([0-9A-Z]+)$/', function($matches) use (&$trackingNumber){
|
20 |
+
$trackingNumber = $matches[1];
|
21 |
+
}, $status->getComment());
|
22 |
+
}
|
23 |
+
return $trackingNumber;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Creating shipping label
|
28 |
+
*
|
29 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
30 |
+
*/
|
31 |
+
protected function _createShippingLabel($shipment){
|
32 |
+
$request = Mage::getModel('shipping/shipment_request');
|
33 |
+
/* var $request Mage_Shipping_Model_Shipment_Request */
|
34 |
+
$request->setOrderShipment($shipment);
|
35 |
+
$response = $shipment->getOrder()->getShippingCarrier()->requestToShipment($request);
|
36 |
+
$info = $response->getInfo();
|
37 |
+
$pdfContent = $info[0]['label_content'];
|
38 |
+
|
39 |
+
// parse PDF content
|
40 |
+
$outputPdf = new Zend_Pdf();
|
41 |
+
$outputPdf = Zend_Pdf::parse($pdfContent);
|
42 |
+
$shipment->setShippingLabel($outputPdf->render());
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Creating tracking
|
47 |
+
*
|
48 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
49 |
+
*/
|
50 |
+
protected function _createTracking($shipment){
|
51 |
+
// do nothing if shipment has any tracks
|
52 |
+
if (count($shipment->getAllTracks())){
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
$trackingNumber = $this->_getTrackingNumber($shipment->getOrder());
|
56 |
+
if ($trackingNumber != ''){
|
57 |
+
$tracking = Mage::getModel('sales/order_shipment_track')
|
58 |
+
->setNumber($trackingNumber)
|
59 |
+
->setCarrierCode('i-parcel')
|
60 |
+
->setTitle('i-parcel');
|
61 |
+
/* var $tracking Mage_Sales_Model_Order_Shipment_Track */
|
62 |
+
$shipment->addTrack($tracking);
|
63 |
+
$this->_createShippingLabel($shipment);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* sales_order_shipment_save_before event handler
|
69 |
+
*/
|
70 |
+
public function before_save($observer){
|
71 |
+
$shipment = $observer->getShipment();
|
72 |
+
if ($shipment->getOrder()->getShippingCarrier()->getCarrierCode() == 'i-parcel'){
|
73 |
+
$this->_createTracking($shipment);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Sales/Quote/Observer.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sales_Quote observer class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Sales_Quote_Observer{
|
10 |
+
/**
|
11 |
+
* sales_quote_save_before event handler
|
12 |
+
*/
|
13 |
+
public function before_save($observer){
|
14 |
+
$quote = $observer->getQuote();
|
15 |
+
/* var $quote Mage_Sales_Model_Quote */
|
16 |
+
$_post = Mage::app()->getFrontController()->getRequest()->getPost();
|
17 |
+
// adding CPF field to quote
|
18 |
+
if (isset($_post['shipping']) && isset($_post['shipping']['cpf'])){
|
19 |
+
$_cpf = $_post['shipping']['cpf'];
|
20 |
+
}elseif (isset($_post['billing']) && isset($_post['billing']['cpf'])){
|
21 |
+
$_cpf = $_post['billing']['cpf'];
|
22 |
+
}else{
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
$quote->setCpf($_cpf);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* sales_quote_save_after event handler
|
30 |
+
*/
|
31 |
+
public function after_save($observer){
|
32 |
+
$quote = $observer->getQuote();
|
33 |
+
/* var $quote Mage_Sales_Model_Quote */
|
34 |
+
// creating CPF for quote
|
35 |
+
$cpf = Mage::getModel('shippingip/cpf_quote')->loadByQuoteId($quote->getId());
|
36 |
+
/* var $cpf Iparcel_Shipping_Model_Cpf_Quote */
|
37 |
+
if ($quote->getCpf() !== NULL){
|
38 |
+
$cpf->setQuoteId($quote->getId());
|
39 |
+
$cpf->setValue($quote->getCpf());
|
40 |
+
$cpf->save();
|
41 |
+
}elseif ($cpf->getId()){
|
42 |
+
$cpf->delete();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* sales_quote_load_after event handler
|
48 |
+
*/
|
49 |
+
public function after_load($observer){
|
50 |
+
$quote = $observer->getQuote();
|
51 |
+
/* var $quote Mage_Sales_Model_Quote */
|
52 |
+
// appending existing cpf to loaded quote
|
53 |
+
$cpf = Mage::getModel('shippingip/cpf_quote')->loadByQuoteId($quote->getId());
|
54 |
+
/* var $cpf Iparcel_Shipping_Model_Cpf_Quote */
|
55 |
+
if ($cpf->getId()){
|
56 |
+
$quote->setCpf($cpf->getValue());
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Configurable/Price.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model for catalog_mapping/attributes/price config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Configurable_Price{
|
10 |
+
const CONFIGURABLE = "0";
|
11 |
+
const SIMPLE = "1";
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Options list
|
15 |
+
*
|
16 |
+
* @return array
|
17 |
+
*/
|
18 |
+
public function toOptionArray(){
|
19 |
+
return array(
|
20 |
+
array('value' => self::CONFIGURABLE, 'label' => Mage::helper('shippingip')->__("Parent product's price")),
|
21 |
+
array('value' => self::SIMPLE, 'label' => Mage::helper('shippingip')->__("Default"))
|
22 |
+
);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Mapping/Mode.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model for catalog_mapping/config/auto_upload config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Mapping_Mode{
|
10 |
+
const DISABLED = "0";
|
11 |
+
const ON_UPDATE = "1";
|
12 |
+
const CRON = "2";
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Options list
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function toOptionArray(){
|
20 |
+
return array(
|
21 |
+
array('value' => self::DISABLED, 'label' => Mage::helper('shippingip')->__('Disabled')),
|
22 |
+
array('value' => self::ON_UPDATE, 'label' => Mage::helper('shippingip')->__('On product save')),
|
23 |
+
array('value' => self::CRON, 'label' => Mage::helper('shippingip')->__('Cron job'))
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model class for backend config fields with product atributes list
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute{
|
10 |
+
/**
|
11 |
+
* Options list
|
12 |
+
*
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function toOptionArray(){
|
16 |
+
$_attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter();
|
17 |
+
/* var $_attributeCollection Mage_Catalog_Model_Resource_Product_Attribute_Collecton */
|
18 |
+
$attributeCollection = array(array('value' => 0, 'label' => '<empty>'));
|
19 |
+
foreach ($_attributeCollection as $_attribute){
|
20 |
+
/* var $_attribute Mage_Catalog_Model_Product_Attribute_Collection */
|
21 |
+
$label = $_attribute->getFrontendLabel();
|
22 |
+
$attributeCollection[] = array(
|
23 |
+
'value' => $_attribute->getAttributeId(),
|
24 |
+
'label' => (empty($label)) ? Mage::helper('catalog')->__($_attribute->getAttributeCode()) : Mage::helper('catalog')->__($label)
|
25 |
+
);
|
26 |
+
}
|
27 |
+
return $attributeCollection;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Catalog/Product/Attribute/Boolean.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model class for backend config fields with boolean product atributes
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Catalog_Product_Attribute_Boolean{
|
10 |
+
/**
|
11 |
+
* Options list
|
12 |
+
*
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function toOptionArray(){
|
16 |
+
$_attributeCollection = Mage::getResourceModel('catalog/product_attribute_collection')
|
17 |
+
->addVisibleFilter()
|
18 |
+
->addFieldToFilter('frontend_input','boolean');
|
19 |
+
/* var $_attributeCollection Mage_Catalog_Model_Resource_Product_Attribute_Collection */
|
20 |
+
$attributeCollection = array(array('value' => 0, 'label' => '<empty>'));
|
21 |
+
foreach ($_attributeCollection as $_attribute){
|
22 |
+
/* var $_attribute Mage_Catalog_Model_Product_Attribute */
|
23 |
+
$label = $_attribute->getFrontendLabel();
|
24 |
+
$attributeCollection[] = array(
|
25 |
+
'value' => $_attribute->getAttributeId(),
|
26 |
+
'label' => (empty($label)) ? Mage::helper('catalog')->__($_attribute->getAttributeCode()) : Mage::helper('catalog')->__($label)
|
27 |
+
);
|
28 |
+
}
|
29 |
+
return $attributeCollection;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
?>
|
33 |
+
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Date/Weekday.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model for catalog_mapping/config/cron_weekday config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Date_Weekday{
|
10 |
+
/**
|
11 |
+
* Options list
|
12 |
+
*
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function toOptionArray(){
|
16 |
+
$array = array();
|
17 |
+
for ($i=1; $i<8; $i++){
|
18 |
+
$time = mktime(0,0,0,1,$i,1970);
|
19 |
+
$dayofweek = date('N', $time);
|
20 |
+
$array[$dayofweek] = array(
|
21 |
+
'value' => $dayofweek,
|
22 |
+
'label' => Mage::helper('shippingip')->__(date('l',$time))
|
23 |
+
);
|
24 |
+
}
|
25 |
+
ksort($array, SORT_NUMERIC);
|
26 |
+
return $array;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Sales/Order/Status.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model class for external_api/sales/order_status config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Sales_Order_Status{
|
10 |
+
/**
|
11 |
+
* Options list
|
12 |
+
*
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function toOptionArray(){
|
16 |
+
return array(
|
17 |
+
array('value' => Mage_Sales_Model_Order::STATE_COMPLETE, 'label' => Mage::helper('shippingip')->__('Complete')),
|
18 |
+
array('value' => 'pending', 'label' => Mage::helper('shippingip')->__('Pending')),
|
19 |
+
array('value' => Mage_Sales_Model_Order::STATE_PROCESSING, 'label' => Mage::helper('shippingip')->__('Processing'))
|
20 |
+
);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/System/Config/Source/Tax/Mode.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model for iparcel/tax/mode config field
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_System_Config_Source_Tax_Mode{
|
10 |
+
const DISABLED = "0";
|
11 |
+
const CUMULATIVELY = "1";
|
12 |
+
const SEPARATELY = "2";
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Options list
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function toOptionArray(){
|
20 |
+
return array(
|
21 |
+
array('value' => self::DISABLED, 'label' => Mage::helper('shippingip')->__('Disabled')),
|
22 |
+
array('value' => self::CUMULATIVELY, 'label' => Mage::helper('shippingip')->__('Enabled - Tax and Duty cumulatively')),
|
23 |
+
array('value' => self::SEPARATELY, 'label' => Mage::helper('shippingip')->__('Enabled - Tax and Duty separately'))
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Calculation.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel's rewritement of tax/calculation class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Calculation extends Mage_Tax_Model_Calculation{
|
10 |
+
/**
|
11 |
+
* Get calculation tax rate by specific request
|
12 |
+
*
|
13 |
+
* @param Varien_Object $request
|
14 |
+
* @return float
|
15 |
+
*/
|
16 |
+
public function getRate($request)
|
17 |
+
{
|
18 |
+
if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
|
19 |
+
return 0;
|
20 |
+
}
|
21 |
+
// if i-parcel tax&duty intercepting is disabled go to parent
|
22 |
+
if (Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::DISABLED){
|
23 |
+
return parent::getRate($request);
|
24 |
+
}
|
25 |
+
// set tax rate value to 0
|
26 |
+
$cacheKey = $this->_getRequestCacheKey($request);
|
27 |
+
/* var $cacheKey string */
|
28 |
+
if (!isset($this->_rateCache[$cacheKey])) {
|
29 |
+
$this->unsCalculationProcess();
|
30 |
+
$this->unsEventModuleId();
|
31 |
+
$this->setRateValue(0);
|
32 |
+
Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$request));
|
33 |
+
$this->setCalculationProcess($this->_formCalculationProcess());
|
34 |
+
$this->_rateCache[$cacheKey] = $this->getRateValue();
|
35 |
+
$this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
|
36 |
+
}
|
37 |
+
return $this->_rateCache[$cacheKey];
|
38 |
+
}
|
39 |
+
}
|
40 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Db model for i-parcel's tax intercepting
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals extends Mage_Core_Model_Abstract{
|
10 |
+
/**
|
11 |
+
* Initializing model in internal constructor
|
12 |
+
*/
|
13 |
+
protected function _construct(){
|
14 |
+
$this->_init('shippingip/tax_totals');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Load totals by order_id
|
19 |
+
*
|
20 |
+
* @param int $orderId, string $fields='*'
|
21 |
+
* @return Iparcel_Shipping_Model_Tax_Totals
|
22 |
+
*/
|
23 |
+
public function loadByOrderId($orderId, $attributes = '*'){
|
24 |
+
$collection = $this->getResourceCollection()
|
25 |
+
->addFieldToSelect($attributes)
|
26 |
+
->addFieldToFilter('order_id', $orderId);
|
27 |
+
return $collection->getFirstItem();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Abstract.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Abstract class for i-parcel shipping tax&duty tax and totals
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
abstract class Iparcel_Shipping_Model_Tax_Totals_Abstract extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
10 |
+
protected $_tax;
|
11 |
+
protected $_duty;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Those constants have to be redefined in derived class
|
15 |
+
*/
|
16 |
+
const XPATH_LABEL = null;
|
17 |
+
const TOTAL_CODE = null;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Checking if current total is enabled
|
21 |
+
*
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
protected abstract function _isEnabled();
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Adding amount to total
|
28 |
+
*/
|
29 |
+
protected abstract function _addAmountToTotal();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Getting mode od i-parcel shipping tax&duty
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
protected function _getMode(){
|
37 |
+
return Mage::getStoreConfig('iparcel/tax/mode');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Getting label for current total
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
protected function _getLabel(){
|
46 |
+
return Mage::getStoreConfig($this::XPATH_LABEL);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Setting total code in constructor
|
51 |
+
*/
|
52 |
+
public function __construct(){
|
53 |
+
$this->setCode($this::TOTAL_CODE);
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Collect totals process.
|
58 |
+
*
|
59 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
60 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Abstract
|
61 |
+
*/
|
62 |
+
public function collect(Mage_Sales_Model_Quote_Address $address){
|
63 |
+
if ($this->_isEnabled()){
|
64 |
+
$quote = $address->getQuote();
|
65 |
+
/* var $quote Mage_Sales_Model_Quote */
|
66 |
+
// return if it's virtual quote
|
67 |
+
if ($quote->isVirtual()){
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
// we need shipping address
|
71 |
+
if (($address->getAddressType() == 'billing')){
|
72 |
+
$address = $address->getQuote()->getShippingAddress();
|
73 |
+
}
|
74 |
+
$this->_setAddress($address);
|
75 |
+
$_tax = 0;
|
76 |
+
$_duty = 0;
|
77 |
+
$_shipping = $address->getShippingMethod();
|
78 |
+
/* var $_shipping string */
|
79 |
+
$tax = Mage::registry('iparcel');
|
80 |
+
/* var $tax array */
|
81 |
+
if (isset($tax[$_shipping])){
|
82 |
+
$tax = $tax[$_shipping];
|
83 |
+
$rates = $address->getShippingRatesCollection();
|
84 |
+
/* var $rates Mage_Eav_Model_Entity_Collection_Abstract */
|
85 |
+
foreach ($rates as $rate){
|
86 |
+
/* var $rate Mage_Sales_Model_Quote_Address_Rate */
|
87 |
+
if (($name = $rate->getCarrier().'_'.$rate->getMethod()) == $_shipping){
|
88 |
+
$_tax = $tax['tax'];
|
89 |
+
$_duty = $tax['duty'];
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
$this->_tax = $_tax;
|
94 |
+
$this->_duty = $_duty;
|
95 |
+
$this->_addAmountToTotal();
|
96 |
+
$address->setShippingipTotalTax($_tax);
|
97 |
+
$address->setShippingipTotalDuty($_duty);
|
98 |
+
if ($_tax+$_duty){
|
99 |
+
Mage::getSingleton('customer/session')->setTaxDutyTotal(array(
|
100 |
+
'mode' => $this->_getMode(),
|
101 |
+
'tax' => $_tax,
|
102 |
+
'duty' => $_duty
|
103 |
+
));
|
104 |
+
}
|
105 |
+
}
|
106 |
+
return $this;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Creditmemo.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping duty tax for creditmemo total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Duty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract{
|
10 |
+
/**
|
11 |
+
* Collect credit memo subtotal
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
14 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Duty_Creditmemo
|
15 |
+
*/
|
16 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo){
|
17 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
|
18 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
19 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY){
|
20 |
+
$amount = $taxduty->getDuty();
|
21 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
|
22 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Invoice.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping duty tax for invoice total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Duty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract{
|
10 |
+
/**
|
11 |
+
* Collect invoice subtotal
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
14 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Duty_Invoice
|
15 |
+
*/
|
16 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice){
|
17 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
|
18 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
19 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY){
|
20 |
+
$amount = $taxduty->getDuty();
|
21 |
+
$invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
|
22 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Duty/Quote.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping duty tax for quote total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Duty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract{
|
10 |
+
const XPATH_LABEL = 'iparcel/tax/duty_label';
|
11 |
+
const TOTAL_CODE = 'shippingip_total_duty';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Checking if current total is enabled
|
15 |
+
*
|
16 |
+
* @return bool
|
17 |
+
*/
|
18 |
+
protected function _isEnabled(){
|
19 |
+
return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Adding amount to total
|
24 |
+
*/
|
25 |
+
protected function _addAmountToTotal(){
|
26 |
+
$this->_addAmount($this->_duty);
|
27 |
+
$this->_addBaseAmount($this->_duty);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Fetching current total to quote
|
32 |
+
*
|
33 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
34 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Duty_Quote
|
35 |
+
*/
|
36 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address){
|
37 |
+
if ($this->_isEnabled()){
|
38 |
+
$quote = $address->getQuote();
|
39 |
+
/* var $quote Mage_Sales_Model_Quote */
|
40 |
+
// do nothing if it's virtual quote
|
41 |
+
if ($quote->isVirtual()){
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
// shipping address needed (it's shipping depended tax)
|
45 |
+
if (($address->getAddressType() == 'billing')){
|
46 |
+
$address = $address->getQuote()->getShippingAddress();
|
47 |
+
}
|
48 |
+
$this->_setAddress($address);
|
49 |
+
$_duty = $address->getShippingipTotalDuty();
|
50 |
+
if ($_duty){
|
51 |
+
$address->addTotal(array(
|
52 |
+
'code' => $this->getCode(),
|
53 |
+
'title' => $this->_getLabel(),
|
54 |
+
'value' => $_duty
|
55 |
+
));
|
56 |
+
}
|
57 |
+
}
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Creditmemo.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping tax tax for creditmemo total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Tax_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract{
|
10 |
+
/**
|
11 |
+
* Collect credit memo subtotal
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
14 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Tax_Creditmemo
|
15 |
+
*/
|
16 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo){
|
17 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
|
18 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
19 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY){
|
20 |
+
$amount = $taxduty->getTax();
|
21 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
|
22 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Invoice.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping tax tax for invoice total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Tax_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract{
|
10 |
+
/**
|
11 |
+
* Collect invoice subtotal
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
14 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Tax_Invoice
|
15 |
+
*/
|
16 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice){
|
17 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
|
18 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
19 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY){
|
20 |
+
$amount = $taxduty->getTax();
|
21 |
+
$invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
|
22 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Tax/Quote.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping tax tax for quote total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Tax_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract{
|
10 |
+
const XPATH_LABEL = 'iparcel/tax/tax_label';
|
11 |
+
const TOTAL_CODE = 'shippingip_total_tax';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Checking if current total is enabled
|
15 |
+
*
|
16 |
+
* @return bool
|
17 |
+
*/
|
18 |
+
protected function _isEnabled(){
|
19 |
+
return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::SEPARATELY;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Getting label for current total
|
24 |
+
*
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
protected function _getLabel(){
|
28 |
+
return Mage::getStoreConfig('iparcel/tax/tax_label');
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Adding amount to total
|
33 |
+
*/
|
34 |
+
protected function _addAmountToTotal(){
|
35 |
+
$this->_addAmount($this->_tax);
|
36 |
+
$this->_addBaseAmount($this->_tax);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Setting total code in constructor
|
41 |
+
*/
|
42 |
+
public function __construct(){
|
43 |
+
$this->setCode('shippingip_total_tax');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Fetching current total to quote
|
48 |
+
*
|
49 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
50 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Tax_Quote
|
51 |
+
*/
|
52 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address){
|
53 |
+
if ($this->_isEnabled()){
|
54 |
+
$quote = $address->getQuote();
|
55 |
+
/* var $quote Mage_Sales_Model_Quote */
|
56 |
+
// do nothing if it's virtual quote
|
57 |
+
if ($quote->isVirtual()){
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
// shipping address needed (it's shipping depended tax)
|
61 |
+
if (($address->getAddressType() == 'billing')){
|
62 |
+
$address = $address->getQuote()->getShippingAddress();
|
63 |
+
}
|
64 |
+
$this->_setAddress($address);
|
65 |
+
$_tax = $address->getShippingipTotalTax();
|
66 |
+
if ($_tax){
|
67 |
+
$address->addTotal(array(
|
68 |
+
'code' => $this->getCode(),
|
69 |
+
'title' => $this->_getLabel(),
|
70 |
+
'value' => $_tax
|
71 |
+
));
|
72 |
+
}
|
73 |
+
}
|
74 |
+
return $this;
|
75 |
+
}
|
76 |
+
}
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Creditmemo.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping tax&duty tax for creditmemo total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract{
|
10 |
+
/**
|
11 |
+
* Collect credit memo subtotal
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
14 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Creditmemo
|
15 |
+
*/
|
16 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo){
|
17 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($creditmemo->getOrder()->getId());
|
18 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
19 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY){
|
20 |
+
$amount = $taxduty->getTax()+$taxduty->getDuty();
|
21 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$amount);
|
22 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$amount);
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Invoice.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping tax&duty tax for invoice total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract{
|
10 |
+
/**
|
11 |
+
* Collect invoice subtotal
|
12 |
+
*
|
13 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
14 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Invoice
|
15 |
+
*/
|
16 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice){
|
17 |
+
$taxduty = Mage::getModel('shippingip/tax_totals')->loadByOrderId($invoice->getOrder()->getId());
|
18 |
+
/* var $taxduty Iparcel_Shipping_Model_Tax_Totals */
|
19 |
+
if ($taxduty->getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY){
|
20 |
+
$amount = $taxduty->getTax()+$taxduty->getDuty();
|
21 |
+
$invoice->setGrandTotal($invoice->getGrandTotal()+$amount);
|
22 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$amount);
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/community/Iparcel/Shipping/Model/Tax/Totals/Taxduty/Quote.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shipping tax&duty tax for quote total class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Model_Tax_Totals_Taxduty_Quote extends Iparcel_Shipping_Model_Tax_Totals_Abstract{
|
10 |
+
const TOTAL_CODE = 'shippingip_total_taxduty';
|
11 |
+
const XPATH_LABEL = 'iparcel/tax/tax_duty_label';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Checking if current total is enabled
|
15 |
+
*
|
16 |
+
* @return bool
|
17 |
+
*/
|
18 |
+
protected function _isEnabled(){
|
19 |
+
return $this->_getMode() == Iparcel_Shipping_Model_System_Config_Source_Tax_Mode::CUMULATIVELY;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Adding amount to total
|
24 |
+
*/
|
25 |
+
protected function _addAmountToTotal(){
|
26 |
+
$this->_addAmount($this->_tax+$this->_duty);
|
27 |
+
$this->_addBaseAmount($this->_tax+$this->_duty);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Fetching current total to quote
|
32 |
+
*
|
33 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
34 |
+
* @return Iparcel_Shipping_Model_Tax_Totals_Taxduty_Quote
|
35 |
+
*/
|
36 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address){
|
37 |
+
if ($this->_isEnabled()){
|
38 |
+
$quote = $address->getQuote();
|
39 |
+
/* var $quote Mage_Sales_Model_Quote */
|
40 |
+
// do nothing if it's virtual quote
|
41 |
+
if ($quote->isVirtual()){
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
// shipping address needed (it's shipping depended tax)
|
45 |
+
if (($address->getAddressType() == 'billing')){
|
46 |
+
$address = $address->getQuote()->getShippingAddress();
|
47 |
+
}
|
48 |
+
$this->_setAddress($address);
|
49 |
+
$_tax = $address->getShippingipTotalTax();
|
50 |
+
$_duty = $address->getShippingipTotalDuty();
|
51 |
+
if ($_tax+$_duty){
|
52 |
+
$address->addTotal(array(
|
53 |
+
'code' => $this->getCode(),
|
54 |
+
'title' => $this->_getLabel(),
|
55 |
+
'value' => $_tax+$_duty
|
56 |
+
));
|
57 |
+
|
58 |
+
}
|
59 |
+
}
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
}
|
app/code/community/Iparcel/Shipping/controllers/Adminhtml/LogController.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adminhtml i-parcel logs controller
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action{
|
10 |
+
/**
|
11 |
+
* Init adminhtml response
|
12 |
+
*
|
13 |
+
* @return Iparcel_Shipping_Adminhtml_LogController
|
14 |
+
*/
|
15 |
+
protected function _init(){
|
16 |
+
$this->loadLayout()
|
17 |
+
->_setActiveMenu('iparcel/log')
|
18 |
+
->_title($this->__('Logs'))->_title($this->__('i-parcel Shipping'))
|
19 |
+
->_addBreadcrumb($this->__('Logs'),$this->__('Logs'))
|
20 |
+
->_addBreadcrumb($this->__('i-parcel Shipping'),$this->__('iparcel Shipping'));
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Show grid action
|
26 |
+
*/
|
27 |
+
public function indexAction(){
|
28 |
+
$this->_init()
|
29 |
+
->renderLayout();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Clear log action
|
34 |
+
*/
|
35 |
+
public function clearAction(){
|
36 |
+
Mage::getModel('shippingip/api_log')->clear();
|
37 |
+
$this->_redirect('*/*/index');
|
38 |
+
}
|
39 |
+
}
|
40 |
+
?>
|
app/code/community/Iparcel/Shipping/controllers/Adminhtml/Sync/AjaxController.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ajax Sync Controller
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Adminhtml_Sync_AjaxController extends Mage_Adminhtml_Controller_Action{
|
10 |
+
/**
|
11 |
+
* Preparing handles for controller
|
12 |
+
*
|
13 |
+
* @params array $handles
|
14 |
+
* @return Iparcel_Shipping_Adminhtml_Sync_AjaxController
|
15 |
+
*/
|
16 |
+
protected function _setupHandles(array $handles){
|
17 |
+
$update = $this->getLayout()->getUpdate();
|
18 |
+
/* @var $update Mage_Core_Model_Layout_Update */
|
19 |
+
$update->resetHandles();
|
20 |
+
$update->addHandle('shippingip_sync_ajax');
|
21 |
+
foreach ($handles as $handle){
|
22 |
+
if (is_string($handle)){
|
23 |
+
$update->addHandle($handle);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
$this->addActionLayoutHandles();
|
27 |
+
$this->loadLayoutUpdates();
|
28 |
+
$this->generateLayoutXml();
|
29 |
+
$this->generateLayoutBlocks();
|
30 |
+
$this->_isLayoutLoaded = true;
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Response for init querry
|
36 |
+
*
|
37 |
+
* @return array
|
38 |
+
*/
|
39 |
+
protected function _initResponse(){
|
40 |
+
$step = Mage::getStoreConfig('catalog_mapping/upload/step');
|
41 |
+
return array('count' => Mage::getModel('catalog/product')->getCollection()->getSize()-floor(Mage::getStoreConfig('catalog_mapping/upload/offset')/$step)*$step);
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Response for initCatalog querry
|
46 |
+
*
|
47 |
+
* @alias _initResponse
|
48 |
+
* @return array
|
49 |
+
*/
|
50 |
+
protected function _initCatalogResponse(){
|
51 |
+
return $this->_initResponse();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Response for initCheckitems querry
|
56 |
+
*
|
57 |
+
* @alias _initResponse
|
58 |
+
* @return array
|
59 |
+
*/
|
60 |
+
protected function _initCheckitemsResponse(){
|
61 |
+
return $this->_initResponse();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Response for uploadCatalog querry
|
66 |
+
*
|
67 |
+
* @param array $params
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
protected function _uploadCatalogResponse($params){
|
71 |
+
$page = $params['page'];
|
72 |
+
$step = $params['step'];
|
73 |
+
|
74 |
+
$offset = Mage::getStoreConfig('catalog_mapping/upload/offset');
|
75 |
+
$page += floor($offset/$step);
|
76 |
+
|
77 |
+
$productCollection = Mage::getModel('catalog/product')
|
78 |
+
->getCollection()
|
79 |
+
->setPageSize($step)
|
80 |
+
->setCurPage($page);
|
81 |
+
/* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
|
82 |
+
|
83 |
+
$n = Mage::helper('shippingip/api')->submitCatalog($productCollection);
|
84 |
+
|
85 |
+
if ($n != -1){
|
86 |
+
return array(
|
87 |
+
'page'=>$page,
|
88 |
+
'step'=>$step,
|
89 |
+
'uploaded'=>$n
|
90 |
+
);
|
91 |
+
}else{
|
92 |
+
return array(
|
93 |
+
'error'=>'1'
|
94 |
+
);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Response for _uploadCheckitems querry
|
100 |
+
*
|
101 |
+
* @param array $params
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
+
protected function _uploadCheckitemsResponse($params){
|
105 |
+
$page = $params['page'];
|
106 |
+
$step = $params['step'];
|
107 |
+
|
108 |
+
$productCollection = Mage::getModel('catalog/product')
|
109 |
+
->getCollection()
|
110 |
+
->setPageSize($step)
|
111 |
+
->setCurPage($page);
|
112 |
+
/* var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
|
113 |
+
|
114 |
+
$n = Mage::helper('shippingip/api')->checkItems($productCollection);
|
115 |
+
|
116 |
+
if ($n != -1){
|
117 |
+
return array(
|
118 |
+
'page' => $page,
|
119 |
+
'step' => $step,
|
120 |
+
'uploaded' => $n
|
121 |
+
);
|
122 |
+
}else{
|
123 |
+
return array(
|
124 |
+
'error' => '1'
|
125 |
+
);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Submit Catalog request action
|
131 |
+
*/
|
132 |
+
public function catalogAction(){
|
133 |
+
// if is xmlHttp Request
|
134 |
+
if ($this->getRequest()->isXmlHttpRequest()){
|
135 |
+
// proceed it
|
136 |
+
$params = $this->getRequest()->getParams();
|
137 |
+
$params['type'] = '_'.$params['type'].'CatalogResponse';
|
138 |
+
if (method_exists($this, $params['type'])){
|
139 |
+
$_response = $this->$params['type']($params);
|
140 |
+
$this->getResponse()
|
141 |
+
->setHeader('Content-Type', 'application/json')
|
142 |
+
->setBody(json_encode($_response));
|
143 |
+
}
|
144 |
+
}else{
|
145 |
+
// show layout if not
|
146 |
+
$this->_setupHandles(array('shippingip_sync_ajax_catalog'))
|
147 |
+
->renderLayout();
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Check Items request action
|
153 |
+
*/
|
154 |
+
public function checkitemsAction(){
|
155 |
+
// if is xmlHttp Request
|
156 |
+
if ($this->getRequest()->isXmlHttpRequest()){
|
157 |
+
// proceed it
|
158 |
+
$params = $this->getRequest()->getParams();
|
159 |
+
$params['type'] = '_'.$params['type'].'CheckItemsResponse';
|
160 |
+
if (method_exists($this, $params['type'])){
|
161 |
+
$_response = $this->$params['type']($params);
|
162 |
+
$this->getResponse()
|
163 |
+
->setHeader('Content-Type', 'application/json')
|
164 |
+
->setBody(json_encode($_response));
|
165 |
+
}
|
166 |
+
}else{
|
167 |
+
// show layout if not
|
168 |
+
$this->_setupHandles(array('shippingip_sync_ajax_checkitems'))
|
169 |
+
->renderLayout();
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
?>
|
app/code/community/Iparcel/Shipping/controllers/Adminhtml/SyncController.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adminhtml i-parcel sync controller
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_Adminhtml_SyncController extends Mage_Adminhtml_Controller_Action{
|
10 |
+
public function salesruleAction(){
|
11 |
+
$_salesRuleCollection = Mage::getResourceModel('salesrule/rule_collection');
|
12 |
+
/* var $_salesRuleCollection Mage_SalesRule_Model_Resource_Rule_Collection */
|
13 |
+
Mage::helper('shippingip/api')->salesRule($_salesRuleCollection);
|
14 |
+
$this->_redirectReferer();
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Iparcel/Shipping/controllers/AjaxController.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel frontend ajax controller
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_AjaxController extends Mage_Core_Controller_Front_Action{
|
10 |
+
/**
|
11 |
+
* Configurable products action for post script
|
12 |
+
*/
|
13 |
+
public function configurableAction(){
|
14 |
+
$sku = $this->getRequest()->getParam('sku');
|
15 |
+
$super_attribute = $this->getRequest()->getParam('super_attribute');
|
16 |
+
// var $product Mage_Catalog_Model_Product
|
17 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
|
18 |
+
// var $child Mage_Catalog_Model_Product
|
19 |
+
$child = Mage::getModel('catalog/product_type_configurable')->getProductByAttributes($super_attribute,$product);
|
20 |
+
// var $typeInstance Mage_Catalog_Model_Product_Type_Abstract
|
21 |
+
$typeInstance = $product->getTypeInstance(true);
|
22 |
+
if (!$typeInstance instanceof Mage_Catalog_Model_Product_Type_Configurable){
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
$attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
|
26 |
+
// var $attributes array
|
27 |
+
$options = array();
|
28 |
+
foreach ($attributes as $attribute){
|
29 |
+
$id = $attribute->getAttributeId();
|
30 |
+
foreach ($attribute->getPrices() as $value){
|
31 |
+
if ($value['value_index'] == $super_attribute[$id]){
|
32 |
+
$options[$attribute->getProductAttribute()->getAttributeCode()] = $value['label'];
|
33 |
+
break;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
if ($child){
|
38 |
+
$this->getResponse()
|
39 |
+
->clearHeaders()
|
40 |
+
->setHeader('Content-Type', 'application/json');
|
41 |
+
echo json_encode(array(
|
42 |
+
'sku' => $child->getSku(),
|
43 |
+
'attributes' => $options,
|
44 |
+
'stock' => Mage::getModel('cataloginventory/stock_item')->loadByProduct($child)->getQty()
|
45 |
+
));
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
?>
|
app/code/community/Iparcel/Shipping/controllers/DevController.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* External Ajax request controller
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_DevController extends Mage_Core_Controller_Front_Action{
|
10 |
+
/**
|
11 |
+
* Preparing headers for external ajax
|
12 |
+
*/
|
13 |
+
protected function _prepareHeaders(){
|
14 |
+
$this->getResponse()
|
15 |
+
->clearHeaders()
|
16 |
+
->setHeader('Access-Control-Allow-Origin','*');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Responding with region list for uri-specified country
|
21 |
+
*/
|
22 |
+
public function regionAction(){
|
23 |
+
$this->_prepareHeaders();
|
24 |
+
$countryId = $this->getRequest()->getParam('country_id');
|
25 |
+
$_country = Mage::getModel('directory/country')->loadByCode($countryId);
|
26 |
+
/* var $_country Mage_Directory_Model_Country */
|
27 |
+
$iso3 = $_country->getIso3Code();
|
28 |
+
$_regionCollection = Mage::getModel('directory/region')
|
29 |
+
->getCollection()
|
30 |
+
->addCountryCodeFilter($iso3);
|
31 |
+
/* var $_regionCollection Mage_Directory_Model_Resource_Region_Collection */
|
32 |
+
$response = array();
|
33 |
+
foreach ($_regionCollection as $_region){
|
34 |
+
$response[$_region->getCode()] = $_region->getDefaultName();
|
35 |
+
}
|
36 |
+
$this->getResponse()
|
37 |
+
->setHeader('Content-Type', 'application/json');
|
38 |
+
echo json_encode($response);
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Responding with recent orders of uri-specified user
|
43 |
+
*/
|
44 |
+
public function recentOrdersAction(){
|
45 |
+
$this->_prepareHeaders();
|
46 |
+
$email = $this->getRequest()->getParam('email');
|
47 |
+
$count = $this->getRequest()->getParam('count');
|
48 |
+
try{
|
49 |
+
if (!$email){
|
50 |
+
Mage::throwException('User e-mail address is not specified');
|
51 |
+
}
|
52 |
+
if (!$count){
|
53 |
+
Mage::throwException('Order count is not specified');
|
54 |
+
}
|
55 |
+
$customerId = Mage::getModel('customer/customer')
|
56 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
57 |
+
->loadByEmail($email)
|
58 |
+
->getId();
|
59 |
+
if (!$customerId){
|
60 |
+
Mage::throwException('User with specified e-mail does not exist');
|
61 |
+
}
|
62 |
+
$_orderCollection = Mage::getResourceModel('sales/order_collection')
|
63 |
+
->addFieldToFilter('customer_id',$customerId)
|
64 |
+
->setOrder('entity_id','DESC')
|
65 |
+
->setPageSize($count)
|
66 |
+
->setCurPage(1);
|
67 |
+
/* var $_orderCollection Mage_Sales_Model_Resource_Order_Collection */
|
68 |
+
$response = array();
|
69 |
+
foreach ($_orderCollection as $_order){
|
70 |
+
$response[] = array(
|
71 |
+
'increment_id' => $_order->getIncrementId(),
|
72 |
+
'created_at' => $_order->getCreatedAt()
|
73 |
+
);
|
74 |
+
}
|
75 |
+
echo json_encode($response);
|
76 |
+
}catch (Mage_Core_Exception $e){
|
77 |
+
echo $e->getMessage();
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
?>
|
app/code/community/Iparcel/Shipping/controllers/InternationalController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel International Customer controller
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_InternationalController extends Mage_Core_Controller_Front_Action{
|
10 |
+
/**
|
11 |
+
* Preparing headers for external ajax
|
12 |
+
*/
|
13 |
+
protected function _prepareHeaders(){
|
14 |
+
$this->getResponse()
|
15 |
+
->clearHeaders()
|
16 |
+
->setHeader('Access-Control-Allow-Origin','*');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Changing international flag to true and printing if there was flag change
|
21 |
+
*/
|
22 |
+
public function enableAction(){
|
23 |
+
$this->_prepareHeaders();
|
24 |
+
$current = Mage::helper('shippingip/international')->getInternational();
|
25 |
+
if ($current){
|
26 |
+
echo 'false';
|
27 |
+
} else {
|
28 |
+
Mage::helper('shippingip/international')->setInternational(true);
|
29 |
+
echo 'true';
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Changing international flag to false and printing if there was flag change
|
35 |
+
*/
|
36 |
+
public function disableAction(){
|
37 |
+
$this->_prepareHeaders();
|
38 |
+
$current = Mage::helper('shippingip/international')->getInternational();
|
39 |
+
if ($current){
|
40 |
+
Mage::helper('shippingip/international')->setInternational(false);
|
41 |
+
echo 'true';
|
42 |
+
} else {
|
43 |
+
echo 'false';
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
?>
|
app/code/community/Iparcel/Shipping/controllers/OrderController.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* External API order controller
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com
|
8 |
+
*/
|
9 |
+
class Iparcel_Shipping_OrderController extends Mage_Core_Controller_Front_Action {
|
10 |
+
/**
|
11 |
+
* Checking if external sales API is enabled
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected function _isEnabled(){
|
16 |
+
return Mage::getStoreConfigFlag('external_api/sales/enabled');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Checking if request is allowed
|
21 |
+
*
|
22 |
+
* @return Mage_Core_Controller_Request_Http
|
23 |
+
*/
|
24 |
+
protected function _checkRequest(){
|
25 |
+
$request = $this->getRequest();
|
26 |
+
//var $request Mage_Core_Controller_Request_Http
|
27 |
+
// checking if External Sales API is enabled
|
28 |
+
if(!$this->_isEnabled()){
|
29 |
+
Mage::throwException('External Sales API is disabled');
|
30 |
+
}
|
31 |
+
// checking if it is POST request
|
32 |
+
if ($request->getMethod() != 'POST'){
|
33 |
+
Mage::throwException('Wrong HTTP request');
|
34 |
+
}
|
35 |
+
// checking if POST GUID key is correct
|
36 |
+
if (strcasecmp($request->getPost('key'), Mage::helper('shippingip')->getGuid())){
|
37 |
+
Mage::throwException('Wrong GUID key');
|
38 |
+
}
|
39 |
+
// checking if request IP is allowed
|
40 |
+
if (!Mage::helper('shippingip/api_external')->isAllowed()){
|
41 |
+
Mage::throwException('Access Forbidden');
|
42 |
+
}
|
43 |
+
return $request;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Adding new order
|
48 |
+
*/
|
49 |
+
public function AddAction(){
|
50 |
+
// register global flag
|
51 |
+
Mage::register('isExternalSale',true);
|
52 |
+
try{
|
53 |
+
$request = $this->_checkRequest();
|
54 |
+
$orders = $request->getPost('orders');
|
55 |
+
$tax = $request->getPost('tax');
|
56 |
+
$tax = is_string($tax) ? (float)str_replace(",",".",$tax) : $tax;
|
57 |
+
$shipping = $request->getPost('shipping');
|
58 |
+
$shipping = is_string($shipping) ? (float)str_replace(",",".",$shipping) : $shipping;
|
59 |
+
$currency = $request->getPost('currency');
|
60 |
+
$tracking = $request->getPost('tracking');
|
61 |
+
$model = Mage::getModel('shippingip/api_external_sales_order');
|
62 |
+
// var $model Iparcel_Shipping_Model_Api_External_Sales_Order
|
63 |
+
// terminate if there's no orders in request
|
64 |
+
if (count($orders) == 0){
|
65 |
+
Mage::throwException('There are no orders in your request');
|
66 |
+
}
|
67 |
+
$user = $request->getPost('user');
|
68 |
+
// checking if user's email is specified
|
69 |
+
if (!isset($user['email'])){
|
70 |
+
Mage::throwException('There is no customer email address in your request');
|
71 |
+
}
|
72 |
+
$model->setCustomer($user, Mage::app()->getWebsite()->getId());
|
73 |
+
if ($user['address']['new'] == 1){
|
74 |
+
$model->setCustomerAddress($user['address']);
|
75 |
+
}
|
76 |
+
else{
|
77 |
+
$model->setDefaultCustomerAddress();
|
78 |
+
}
|
79 |
+
$model->setOrderData($orders);
|
80 |
+
$model->setShippingCosts($shipping);
|
81 |
+
$model->setTax($tax);
|
82 |
+
// if tracking specified set tracking number
|
83 |
+
if ($tracking !== NULL){
|
84 |
+
$model->setTrackingNumber($tracking['number']);
|
85 |
+
}
|
86 |
+
$model->setCurrency($currency);
|
87 |
+
// if order created successfully
|
88 |
+
$model->setStoreId(Mage::app()->getStore()->getId());
|
89 |
+
if ($order = $model->createOrder()){
|
90 |
+
$invoice = $model->createInvoice();
|
91 |
+
echo $order->getIncrementId();
|
92 |
+
}
|
93 |
+
}catch (Mage_Core_Exception $e){
|
94 |
+
echo $e->getMessage();
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Canceling an order
|
100 |
+
*/
|
101 |
+
public function CancelAction(){
|
102 |
+
try{
|
103 |
+
$request = $this->_checkRequest();
|
104 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($request->getPost('order'));
|
105 |
+
// var $order Mage_Sales_Model_Order
|
106 |
+
if ($order->getId()){
|
107 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
|
108 |
+
echo 'Order #'.$request->getPost('order').' cancelled.';
|
109 |
+
}else{
|
110 |
+
Mage::throwException('Order no longer exists');
|
111 |
+
}
|
112 |
+
}catch(Mage_Core_Exception $e){
|
113 |
+
echo $e->getMessage();
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
app/code/community/Iparcel/Shipping/etc/adminhtml.xml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<menu>
|
3 |
+
<iparcel translate="title" module="shippingip">
|
4 |
+
<title>i-parcel</title>
|
5 |
+
<sort_order>999</sort_order>
|
6 |
+
<children>
|
7 |
+
<config translate="title" module="shippingip">
|
8 |
+
<title>Configuration</title>
|
9 |
+
<sort_order>0</sort_order>
|
10 |
+
<action>adminhtml/system_config/edit/section/iparcel</action>
|
11 |
+
</config>
|
12 |
+
<sync translate="title" module="shippingip">
|
13 |
+
<title>Synchronization</title>
|
14 |
+
<sort_order>5</sort_order>
|
15 |
+
<children>
|
16 |
+
<catalog_mapping translate="title" module="shippingip">
|
17 |
+
<title>Catalog Mapping</title>
|
18 |
+
<sort_order>5</sort_order>
|
19 |
+
<action>adminhtml/system_config/edit/section/catalog_mapping</action>
|
20 |
+
</catalog_mapping>
|
21 |
+
<!--<salesrules translate="title" module="shippingip">-->
|
22 |
+
<!--<title>Sales Rules</title>-->
|
23 |
+
<!--<sort_order>10</sort_order>-->
|
24 |
+
<!--<action>adminhtml/system_config/edit/section/salesrules</action>-->
|
25 |
+
<!--</salesrules>-->
|
26 |
+
</children>
|
27 |
+
</sync>
|
28 |
+
<shipping translate="title" module="shippingip">
|
29 |
+
<title>Shipping Methods</title>
|
30 |
+
<sort_order>10</sort_order>
|
31 |
+
<action>adminhtml/system_config/edit/section/carriers</action>
|
32 |
+
</shipping>
|
33 |
+
<external_api translate="title" module="shippingip">
|
34 |
+
<title>External API</title>
|
35 |
+
<sort_order>15</sort_order>
|
36 |
+
<action>adminhtml/system_config/edit/section/external_api</action>
|
37 |
+
</external_api>
|
38 |
+
<log>
|
39 |
+
<title>Logs</title>
|
40 |
+
<sort_order>20</sort_order>
|
41 |
+
<action>shippingip/log/index</action>
|
42 |
+
</log>
|
43 |
+
</children>
|
44 |
+
</iparcel>
|
45 |
+
</menu>
|
46 |
+
</config>
|
app/code/community/Iparcel/Shipping/etc/config.xml
ADDED
@@ -0,0 +1,427 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Iparcel_Shipping>
|
5 |
+
<version>2.4.1.5</version>
|
6 |
+
</Iparcel_Shipping>
|
7 |
+
</modules>
|
8 |
+
<crontab>
|
9 |
+
<jobs>
|
10 |
+
<iparcel_catalog_mapping>
|
11 |
+
<run>
|
12 |
+
<model>shippingip/catalog_mapping::sync</model>
|
13 |
+
</run>
|
14 |
+
</iparcel_catalog_mapping>
|
15 |
+
</jobs>
|
16 |
+
</crontab>
|
17 |
+
<frontend>
|
18 |
+
<routers>
|
19 |
+
<ship>
|
20 |
+
<use>standard</use>
|
21 |
+
<args>
|
22 |
+
<module>Iparcel_Shipping</module>
|
23 |
+
<frontName>shippingip</frontName>
|
24 |
+
</args>
|
25 |
+
</ship>
|
26 |
+
</routers>
|
27 |
+
<layout>
|
28 |
+
<updates>
|
29 |
+
<shippingip>
|
30 |
+
<file>externalshipping.xml</file>
|
31 |
+
</shippingip>
|
32 |
+
</updates>
|
33 |
+
</layout>
|
34 |
+
</frontend>
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<shippingip>
|
38 |
+
<use>admin</use>
|
39 |
+
<args>
|
40 |
+
<module>Iparcel_Shipping_Adminhtml</module>
|
41 |
+
<frontName>shippingip</frontName>
|
42 |
+
</args>
|
43 |
+
</shippingip>
|
44 |
+
</routers>
|
45 |
+
</admin>
|
46 |
+
<adminhtml>
|
47 |
+
<layout>
|
48 |
+
<updates>
|
49 |
+
<shippingip>
|
50 |
+
<file>externalsales.xml</file>
|
51 |
+
</shippingip>
|
52 |
+
</updates>
|
53 |
+
</layout>
|
54 |
+
<acl>
|
55 |
+
<resources>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<system>
|
59 |
+
<children>
|
60 |
+
<config>
|
61 |
+
<children>
|
62 |
+
<catalog_mapping>
|
63 |
+
<title>i-parcel Catalog Mapping</title>
|
64 |
+
</catalog_mapping>
|
65 |
+
<salesrules>
|
66 |
+
<title>i-parcel Sales Rules Synchronization</title>
|
67 |
+
</salesrules>
|
68 |
+
<external_api>
|
69 |
+
<title>i-parcel External API</title>
|
70 |
+
</external_api>
|
71 |
+
<iparcel>
|
72 |
+
<title>i-parcel Configuration</title>
|
73 |
+
</iparcel>
|
74 |
+
</children>
|
75 |
+
</config>
|
76 |
+
</children>
|
77 |
+
</system>
|
78 |
+
</children>
|
79 |
+
</admin>
|
80 |
+
</resources>
|
81 |
+
</acl>
|
82 |
+
</adminhtml>
|
83 |
+
<global>
|
84 |
+
<models>
|
85 |
+
<shippingip>
|
86 |
+
<class>Iparcel_Shipping_Model</class>
|
87 |
+
<resourceModel>shippingip_resource</resourceModel>
|
88 |
+
</shippingip>
|
89 |
+
<shippingip_resource>
|
90 |
+
<class>Iparcel_Shipping_Model_Resource</class>
|
91 |
+
<entities>
|
92 |
+
<api_order>
|
93 |
+
<!-- DEPRECATED in v2.3.4.2 -->
|
94 |
+
<table>iparcel_shipping_api_orders</table>
|
95 |
+
</api_order>
|
96 |
+
<cpf>
|
97 |
+
<table>iparcel_shipping_cpf</table>
|
98 |
+
</cpf>
|
99 |
+
<cpf_order>
|
100 |
+
<table>iparcel_shipping_cpf_order</table>
|
101 |
+
</cpf_order>
|
102 |
+
<cpf_quote>
|
103 |
+
<table>iparcel_shipping_cpf_quote</table>
|
104 |
+
</cpf_quote>
|
105 |
+
<parcel>
|
106 |
+
<table>iparcel_shipping_parcel</table>
|
107 |
+
</parcel>
|
108 |
+
<tax_totals>
|
109 |
+
<table>iparcel_shipping_tax_totals</table>
|
110 |
+
</tax_totals>
|
111 |
+
</entities>
|
112 |
+
</shippingip_resource>
|
113 |
+
<sales>
|
114 |
+
<rewrite>
|
115 |
+
<order>Iparcel_Shipping_Model_Sales_Order</order>
|
116 |
+
</rewrite>
|
117 |
+
</sales>
|
118 |
+
<tax>
|
119 |
+
<rewrite>
|
120 |
+
<calculation>Iparcel_Shipping_Model_Tax_Calculation</calculation>
|
121 |
+
</rewrite>
|
122 |
+
</tax>
|
123 |
+
</models>
|
124 |
+
<events>
|
125 |
+
<catalog_product_save_after>
|
126 |
+
<observers>
|
127 |
+
<iparcel_catalog_product_observer>
|
128 |
+
<type>singleton</type>
|
129 |
+
<class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
|
130 |
+
<method>product_save</method>
|
131 |
+
</iparcel_catalog_product_observer>
|
132 |
+
</observers>
|
133 |
+
</catalog_product_save_after>
|
134 |
+
<catalog_product_attribute_update_before>
|
135 |
+
<observers>
|
136 |
+
<iparcel_catalog_product_observer>
|
137 |
+
<type>singleton</type>
|
138 |
+
<class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
|
139 |
+
<method>product_massUpdate</method>
|
140 |
+
</iparcel_catalog_product_observer>
|
141 |
+
</observers>
|
142 |
+
</catalog_product_attribute_update_before>
|
143 |
+
<catalog_product_delete_before>
|
144 |
+
<observers>
|
145 |
+
<iparcel_catalog_product_observer>
|
146 |
+
<type>singleton</type>
|
147 |
+
<class>Iparcel_Shipping_Model_Catalog_Product_Observer</class>
|
148 |
+
<method>product_delete</method>
|
149 |
+
</iparcel_catalog_product_observer>
|
150 |
+
</observers>
|
151 |
+
</catalog_product_delete_before>
|
152 |
+
<sales_order_load_after>
|
153 |
+
<observers>
|
154 |
+
<iparcel_sales_order_load_after_observer>
|
155 |
+
<type>singleton</type>
|
156 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
157 |
+
<method>after_load</method>
|
158 |
+
</iparcel_sales_order_load_after_observer>
|
159 |
+
</observers>
|
160 |
+
</sales_order_load_after>
|
161 |
+
<sales_order_place_after>
|
162 |
+
<observers>
|
163 |
+
<iparcel_sales_order_place_after_observer>
|
164 |
+
<type>singleton</type>
|
165 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
166 |
+
<method>after_place</method>
|
167 |
+
</iparcel_sales_order_place_after_observer>
|
168 |
+
</observers>
|
169 |
+
</sales_order_place_after>
|
170 |
+
<sales_order_save_before>
|
171 |
+
<observers>
|
172 |
+
<iparcel_sales_order_save_before_observer>
|
173 |
+
<type>singleton</type>
|
174 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
175 |
+
<method>before_save</method>
|
176 |
+
</iparcel_sales_order_save_before_observer>
|
177 |
+
</observers>
|
178 |
+
</sales_order_save_before>
|
179 |
+
<sales_order_save_after>
|
180 |
+
<observers>
|
181 |
+
<iparcel_sales_order_save_after_observer>
|
182 |
+
<type>singleton</type>
|
183 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Observer</class>
|
184 |
+
<method>after_save</method>
|
185 |
+
</iparcel_sales_order_save_after_observer>
|
186 |
+
</observers>
|
187 |
+
</sales_order_save_after>
|
188 |
+
<sales_order_shipment_save_before>
|
189 |
+
<observers>
|
190 |
+
<iparcel_sales_order_shipment_save_before_observer>
|
191 |
+
<type>singleton</type>
|
192 |
+
<class>Iparcel_Shipping_Model_Sales_Order_Shipment_Observer</class>
|
193 |
+
<method>before_save</method>
|
194 |
+
</iparcel_sales_order_shipment_save_before_observer>
|
195 |
+
</observers>
|
196 |
+
</sales_order_shipment_save_before>
|
197 |
+
<sales_quote_load_after>
|
198 |
+
<observers>
|
199 |
+
<iparcel_sales_quote_load_after_observer>
|
200 |
+
<type>singleton</type>
|
201 |
+
<class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
|
202 |
+
<method>after_load</method>
|
203 |
+
</iparcel_sales_quote_load_after_observer>
|
204 |
+
</observers>
|
205 |
+
</sales_quote_load_after>
|
206 |
+
<sales_quote_save_after>
|
207 |
+
<observers>
|
208 |
+
<iparcel_sales_quote_save_after_observer>
|
209 |
+
<type>singleton</type>
|
210 |
+
<class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
|
211 |
+
<method>after_save</method>
|
212 |
+
</iparcel_sales_quote_save_after_observer>
|
213 |
+
</observers>
|
214 |
+
</sales_quote_save_after>
|
215 |
+
<sales_quote_save_before>
|
216 |
+
<observers>
|
217 |
+
<iparcel_sales_quote_save_before_observer>
|
218 |
+
<type>singleton</type>
|
219 |
+
<class>Iparcel_Shipping_Model_Sales_Quote_Observer</class>
|
220 |
+
<method>before_save</method>
|
221 |
+
</iparcel_sales_quote_save_before_observer>
|
222 |
+
</observers>
|
223 |
+
</sales_quote_save_before>
|
224 |
+
</events>
|
225 |
+
<resources>
|
226 |
+
<shippingip_setup>
|
227 |
+
<setup>
|
228 |
+
<module>Iparcel_Shipping</module>
|
229 |
+
<class>Iparcel_Shipping_Model_Resource_Setup</class>
|
230 |
+
</setup>
|
231 |
+
<connection>
|
232 |
+
<use>core_setup</use>
|
233 |
+
</connection>
|
234 |
+
</shippingip_setup>
|
235 |
+
<shippingip_write>
|
236 |
+
<connection>
|
237 |
+
<use>core_write</use>
|
238 |
+
</connection>
|
239 |
+
</shippingip_write>
|
240 |
+
<shippingip_read>
|
241 |
+
<connection>
|
242 |
+
<use>core_read</use>
|
243 |
+
</connection>
|
244 |
+
</shippingip_read>
|
245 |
+
</resources>
|
246 |
+
<blocks>
|
247 |
+
<adminhtml>
|
248 |
+
<rewrite>
|
249 |
+
<sales_order_shipment_view_form>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Form</sales_order_shipment_view_form>
|
250 |
+
<sales_order_shipment_view_tracking>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking</sales_order_shipment_view_tracking>
|
251 |
+
<sales_order_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
|
252 |
+
<sales_order_invoice_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
|
253 |
+
<sales_order_creditmemo_totals>Iparcel_Shipping_Block_Adminhtml_Sales_Order_Creditmemo_Totals</sales_order_creditmemo_totals>
|
254 |
+
</rewrite>
|
255 |
+
</adminhtml>
|
256 |
+
<catalog>
|
257 |
+
<rewrite>
|
258 |
+
<product_list>Iparcel_Shipping_Block_Catalog_Product_List</product_list>
|
259 |
+
</rewrite>
|
260 |
+
</catalog>
|
261 |
+
<sales>
|
262 |
+
<rewrite>
|
263 |
+
<order_totals>Iparcel_Shipping_Block_Sales_Order_Totals</order_totals>
|
264 |
+
<order_invoice_totals>Iparcel_Shipping_Block_Sales_Order_Invoice_Totals</order_invoice_totals>
|
265 |
+
<order_creditmemo_totals>Iparcel_Shipping_Block_Sales_Order_Creditmemo_Totals</order_creditmemo_totals>
|
266 |
+
</rewrite>
|
267 |
+
</sales>
|
268 |
+
<shippingip>
|
269 |
+
<class>Iparcel_Shipping_Block</class>
|
270 |
+
</shippingip>
|
271 |
+
</blocks>
|
272 |
+
<helpers>
|
273 |
+
<shippingip>
|
274 |
+
<class>Iparcel_Shipping_Helper</class>
|
275 |
+
</shippingip>
|
276 |
+
<sales>
|
277 |
+
<rewrite>
|
278 |
+
<data>Iparcel_Shipping_Helper_Sales_Data</data>
|
279 |
+
</rewrite>
|
280 |
+
</sales>
|
281 |
+
</helpers>
|
282 |
+
<sales>
|
283 |
+
<quote>
|
284 |
+
<totals>
|
285 |
+
<shippingip_totals_taxduty>
|
286 |
+
<class>shippingip/tax_totals_taxduty_quote</class>
|
287 |
+
<after>shipping</after>
|
288 |
+
<before>grand_total</before>
|
289 |
+
</shippingip_totals_taxduty>
|
290 |
+
<shippingip_totals_tax>
|
291 |
+
<class>shippingip/tax_totals_tax_quote</class>
|
292 |
+
<after>shipping</after>
|
293 |
+
<before>grand_total</before>
|
294 |
+
</shippingip_totals_tax>
|
295 |
+
<shippingip_totals_duty>
|
296 |
+
<class>shippingip/tax_totals_duty_quote</class>
|
297 |
+
<after>shipping</after>
|
298 |
+
<before>grand_total</before>
|
299 |
+
</shippingip_totals_duty>
|
300 |
+
</totals>
|
301 |
+
</quote>
|
302 |
+
<order_invoice>
|
303 |
+
<totals>
|
304 |
+
<shippingip_totals_taxduty>
|
305 |
+
<class>shippingip/tax_totals_taxduty_invoice</class>
|
306 |
+
<after>shipping</after>
|
307 |
+
<before>grand_total</before>
|
308 |
+
</shippingip_totals_taxduty>
|
309 |
+
<shippingip_totals_tax>
|
310 |
+
<class>shippingip/tax_totals_tax_invoice</class>
|
311 |
+
<after>shipping</after>
|
312 |
+
<before>grand_total</before>
|
313 |
+
</shippingip_totals_tax>
|
314 |
+
<shippingip_totals_duty>
|
315 |
+
<class>shippingip/tax_totals_duty_invoice</class>
|
316 |
+
<after>shipping</after>
|
317 |
+
<before>grand_total</before>
|
318 |
+
</shippingip_totals_duty>
|
319 |
+
<discount>
|
320 |
+
<after>nominal,subtotal,msrp,freeshipping,tax_subtotal,weee</after>
|
321 |
+
<before>shipping</before>
|
322 |
+
</discount>
|
323 |
+
<shipping>
|
324 |
+
<after>discount</after>
|
325 |
+
<before>tax_shipping</before>
|
326 |
+
</shipping>
|
327 |
+
<tax_shipping>
|
328 |
+
<after>shipping</after>
|
329 |
+
<before>tax</before>
|
330 |
+
</tax_shipping>
|
331 |
+
<tax>
|
332 |
+
<after>tax_shipping</after>
|
333 |
+
<before>grand_total</before>
|
334 |
+
</tax>
|
335 |
+
</totals>
|
336 |
+
</order_invoice>
|
337 |
+
<order_creditmemo>
|
338 |
+
<totals>
|
339 |
+
<shippingip_totals_taxduty>
|
340 |
+
<class>shippingip/tax_totals_taxduty_creditmemo</class>
|
341 |
+
<after>shipping</after>
|
342 |
+
<before>grand_total</before>
|
343 |
+
</shippingip_totals_taxduty>
|
344 |
+
<shippingip_totals_tax>
|
345 |
+
<class>shippingip/tax_totals_tax_creditmemo</class>
|
346 |
+
<after>shipping</after>
|
347 |
+
<before>grand_total</before>
|
348 |
+
</shippingip_totals_tax>
|
349 |
+
<shippingip_totals_duty>
|
350 |
+
<class>shippingip/tax_totals_duty_creditmemo</class>
|
351 |
+
<after>shipping</after>
|
352 |
+
<before>grand_total</before>
|
353 |
+
</shippingip_totals_duty>
|
354 |
+
</totals>
|
355 |
+
</order_creditmemo>
|
356 |
+
</sales>
|
357 |
+
</global>
|
358 |
+
<default>
|
359 |
+
<carriers>
|
360 |
+
<i-parcel>
|
361 |
+
<active>1</active>
|
362 |
+
<model>shippingip/carrier_iparcel</model>
|
363 |
+
<title>I-Parcel</title>
|
364 |
+
<sort_order>10</sort_order>
|
365 |
+
<sallowspecific>0</sallowspecific>
|
366 |
+
<username>custtest</username>
|
367 |
+
<password>custtest</password>
|
368 |
+
<autoship>1</autoship>
|
369 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
370 |
+
<whitelabelpay>i-parcel</whitelabelpay>
|
371 |
+
<whitelabelship>i-parcel</whitelabelship>
|
372 |
+
</i-parcel>
|
373 |
+
</carriers>
|
374 |
+
<payment>
|
375 |
+
<iparcel>
|
376 |
+
<active>1</active>
|
377 |
+
<model>shippingip/payment_iparcel</model>
|
378 |
+
</iparcel>
|
379 |
+
</payment>
|
380 |
+
<iparcel>
|
381 |
+
<config>
|
382 |
+
<submit_parcel>1</submit_parcel>
|
383 |
+
</config>
|
384 |
+
<scripts>
|
385 |
+
<jquery>0</jquery>
|
386 |
+
<scripts>0</scripts>
|
387 |
+
</scripts>
|
388 |
+
<tax>
|
389 |
+
<mode>0</mode>
|
390 |
+
<tax_duty_label><![CDATA[Tax&Duty]]></tax_duty_label>
|
391 |
+
<tax_label>Tax</tax_label>
|
392 |
+
<duty_label>Duty</duty_label>
|
393 |
+
</tax>
|
394 |
+
</iparcel>
|
395 |
+
<external_api>
|
396 |
+
<sales>
|
397 |
+
<enabled>1</enabled>
|
398 |
+
<transactional_emails>0</transactional_emails>
|
399 |
+
<order_status>complete</order_status>
|
400 |
+
</sales>
|
401 |
+
</external_api>
|
402 |
+
<sales>
|
403 |
+
<totals_sort>
|
404 |
+
<shippingip_total_taxduty>35</shippingip_total_taxduty>
|
405 |
+
<shippingip_total_tax>36</shippingip_total_tax>
|
406 |
+
<shippingip_total_duty>37</shippingip_total_duty>
|
407 |
+
</totals_sort>
|
408 |
+
</sales>
|
409 |
+
<dev>
|
410 |
+
<i-parcel>
|
411 |
+
<debug>0</debug>
|
412 |
+
</i-parcel>
|
413 |
+
</dev>
|
414 |
+
<catalog_mapping>
|
415 |
+
<config>
|
416 |
+
<auto_upload>1</auto_upload>
|
417 |
+
</config>
|
418 |
+
<upload>
|
419 |
+
<step>100</step>
|
420 |
+
<offset>0</offset>
|
421 |
+
</upload>
|
422 |
+
<attributes>
|
423 |
+
<price>1</price>
|
424 |
+
</attributes>
|
425 |
+
</catalog_mapping>
|
426 |
+
</default>
|
427 |
+
</config>
|
app/code/community/Iparcel/Shipping/etc/system.xml
ADDED
@@ -0,0 +1,595 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<i-parcel translate="label" module="shippingip">
|
5 |
+
<label>i-parcel</label>
|
6 |
+
<sort_order>500</sort_order>
|
7 |
+
</i-parcel>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<carriers>
|
11 |
+
<groups>
|
12 |
+
<i-parcel translate="label">
|
13 |
+
<label>i-parcel</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>99</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<active translate="label">
|
21 |
+
<label>Enabled</label>
|
22 |
+
<frontend_type>select</frontend_type>
|
23 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
</active>
|
29 |
+
<whitelabelship>
|
30 |
+
<label>Name of Displayed Shipping Method (frontend)</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<sort_order>100</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>1</show_in_store>
|
36 |
+
</whitelabelship>
|
37 |
+
<whitelabelpay>
|
38 |
+
<label>Name of Displayed Payment Method</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>105</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</whitelabelpay>
|
45 |
+
<backend_name>
|
46 |
+
<label>Name of Displayed Shipping Method (backend)</label>
|
47 |
+
<frontend_type>text</frontend_type>
|
48 |
+
<sort_order>102</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</backend_name>
|
53 |
+
<autoship>
|
54 |
+
<label>Auto Generate Shipment</label>
|
55 |
+
<frontend_type>select</frontend_type>
|
56 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
57 |
+
<sort_order>108</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</autoship>
|
62 |
+
<prefix>
|
63 |
+
<label>Completed Orders Use Different Order Prefix (Blank for None)</label>
|
64 |
+
<frontend_type>text</frontend_type>
|
65 |
+
<sort_order>110</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>1</show_in_website>
|
68 |
+
<show_in_store>1</show_in_store>
|
69 |
+
</prefix>
|
70 |
+
<order_reference>
|
71 |
+
<label>Send Order Number as Reference</label>
|
72 |
+
<frontend_type>select</frontend_type>
|
73 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
74 |
+
<sort_order>112</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>1</show_in_store>
|
78 |
+
</order_reference>
|
79 |
+
<additionalfields>
|
80 |
+
<label>Dashboard</label>
|
81 |
+
<frontend_type>button</frontend_type>
|
82 |
+
<frontend_model>shippingip/adminhtml_iparcel_dashboard</frontend_model>
|
83 |
+
<sort_order>115</sort_order>
|
84 |
+
<show_in_default>1</show_in_default>
|
85 |
+
<show_in_website>1</show_in_website>
|
86 |
+
<show_in_store>1</show_in_store>
|
87 |
+
</additionalfields>
|
88 |
+
</fields>
|
89 |
+
</i-parcel>
|
90 |
+
</groups>
|
91 |
+
</carriers>
|
92 |
+
<payment>
|
93 |
+
<groups>
|
94 |
+
<iparcel translate="label" module="shippingip">
|
95 |
+
<label>i-parcel</label>
|
96 |
+
<sort_order>9999</sort_order>
|
97 |
+
<show_in_default>0</show_in_default>
|
98 |
+
<show_in_website>0</show_in_website>
|
99 |
+
<show_in_store>0</show_in_store>
|
100 |
+
</iparcel>
|
101 |
+
</groups>
|
102 |
+
</payment>
|
103 |
+
<iparcel>
|
104 |
+
<label>Configuration</label>
|
105 |
+
<tab>i-parcel</tab>
|
106 |
+
<frontent_type>text</frontent_type>
|
107 |
+
<sort_order>0</sort_order>
|
108 |
+
<show_in_default>1</show_in_default>
|
109 |
+
<show_in_website>1</show_in_website>
|
110 |
+
<show_in_store>0</show_in_store>
|
111 |
+
<groups>
|
112 |
+
<config translate="label">
|
113 |
+
<label>General</label>
|
114 |
+
<frontend_type>text</frontend_type>
|
115 |
+
<sort_order>0</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>0</show_in_store>
|
119 |
+
<fields>
|
120 |
+
<custid translate="label">
|
121 |
+
<label>Company ID</label>
|
122 |
+
<frontend_type>text</frontend_type>
|
123 |
+
<sort_order>2</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>0</show_in_store>
|
127 |
+
<tooltip>This is the Customer ID provided by i-parcel.</tooltip>
|
128 |
+
</custid>
|
129 |
+
<userid translate="label">
|
130 |
+
<label>Web Service Key (GUID)</label>
|
131 |
+
<backend_model>shippingip/config_guid</backend_model>
|
132 |
+
<sort_order>3</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>1</show_in_website>
|
135 |
+
<show_in_store>0</show_in_store>
|
136 |
+
<tooltip>This is Web Service Key provided by i-parcel.</tooltip>
|
137 |
+
</userid>
|
138 |
+
<submit_parcel translate="label">
|
139 |
+
<label>Submit Parcel on Checkout</label>
|
140 |
+
<frontend_type>select</frontend_type>
|
141 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
142 |
+
<sort_order>10</sort_order>
|
143 |
+
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>1</show_in_website>
|
145 |
+
<show_in_store>0</show_in_store>
|
146 |
+
</submit_parcel>
|
147 |
+
</fields>
|
148 |
+
</config>
|
149 |
+
<scripts translate="label">
|
150 |
+
<label>Scripts</label>
|
151 |
+
<frontend_type>text</frontend_type>
|
152 |
+
<sort_order>5</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>0</show_in_store>
|
156 |
+
<fields>
|
157 |
+
<scripts translate="label">
|
158 |
+
<label>Enable Frontend Scripts</label>
|
159 |
+
<frontend_type>select</frontend_type>
|
160 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
161 |
+
<sort_order>5</sort_order>
|
162 |
+
<show_in_default>1</show_in_default>
|
163 |
+
<show_in_website>1</show_in_website>
|
164 |
+
<show_in_store>0</show_in_store>
|
165 |
+
</scripts>
|
166 |
+
<jquery translate="label">
|
167 |
+
<label>Enable jQuery</label>
|
168 |
+
<comment>Set it to "no" if you're using another jQuery library</comment>
|
169 |
+
<frontend_type>select</frontend_type>
|
170 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
171 |
+
<sort_order>10</sort_order>
|
172 |
+
<show_in_default>1</show_in_default>
|
173 |
+
<show_in_website>0</show_in_website>
|
174 |
+
<show_in_store>0</show_in_store>
|
175 |
+
</jquery>
|
176 |
+
<post translate="label">
|
177 |
+
<label>Custom POST scripts</label>
|
178 |
+
<frontend_type>file</frontend_type>
|
179 |
+
<backend_model>shippingip/config_script_js</backend_model>
|
180 |
+
<sort_order>15</sort_order>
|
181 |
+
<show_in_default>1</show_in_default>
|
182 |
+
<show_in_website>1</show_in_website>
|
183 |
+
<show_in_store>1</show_in_store>
|
184 |
+
</post>
|
185 |
+
</fields>
|
186 |
+
</scripts>
|
187 |
+
<international_customer translate="label">
|
188 |
+
<label>International Customer</label>
|
189 |
+
<frontend_type>text</frontend_type>
|
190 |
+
<sort_order>10</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>1</show_in_store>
|
194 |
+
<fields>
|
195 |
+
<enable translate="label">
|
196 |
+
<label>Enabled</label>
|
197 |
+
<frontend_type>select</frontend_type>
|
198 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
199 |
+
<sort_order>0</sort_order>
|
200 |
+
<show_in_default>1</show_in_default>
|
201 |
+
<show_in_website>1</show_in_website>
|
202 |
+
<show_in_store>1</show_in_store>
|
203 |
+
</enable>
|
204 |
+
<visibility translate="label">
|
205 |
+
<label>Catalog product visibility attribute</label>
|
206 |
+
<frontend_type>select</frontend_type>
|
207 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute_boolean</source_model>
|
208 |
+
<sort_order>1</sort_order>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>1</show_in_store>
|
212 |
+
<tooltip>If chosen attribute has value 'true' catalog product will be visible for international customer</tooltip>
|
213 |
+
</visibility>
|
214 |
+
</fields>
|
215 |
+
</international_customer>
|
216 |
+
<tax translate="label">
|
217 |
+
<label>Tax Intercepting</label>
|
218 |
+
<frontend_type>text</frontend_type>
|
219 |
+
<sort_order>15</sort_order>
|
220 |
+
<show_in_default>1</show_in_default>
|
221 |
+
<show_in_website>1</show_in_website>
|
222 |
+
<show_in_store>1</show_in_store>
|
223 |
+
<fields>
|
224 |
+
<mode translate="label">
|
225 |
+
<label>Mode</label>
|
226 |
+
<frontend_type>select</frontend_type>
|
227 |
+
<source_model>shippingip/system_config_source_tax_mode</source_model>
|
228 |
+
<sort_order>0</sort_order>
|
229 |
+
<show_in_default>1</show_in_default>
|
230 |
+
<show_in_website>1</show_in_website>
|
231 |
+
<show_in_store>1</show_in_store>
|
232 |
+
</mode>
|
233 |
+
<tax_duty_label translate="label">
|
234 |
+
<label><![CDATA[Tax&Duty Label]]></label>
|
235 |
+
<frontend_type>text</frontend_type>
|
236 |
+
<sort_order>5</sort_order>
|
237 |
+
<show_in_default>1</show_in_default>
|
238 |
+
<show_in_website>1</show_in_website>
|
239 |
+
<show_in_store>1</show_in_store>
|
240 |
+
<depends>
|
241 |
+
<mode>1</mode>
|
242 |
+
</depends>
|
243 |
+
</tax_duty_label>
|
244 |
+
<tax_label translate="label">
|
245 |
+
<label>Tax Label</label>
|
246 |
+
<frontend_type>text</frontend_type>
|
247 |
+
<sort_order>10</sort_order>
|
248 |
+
<show_in_default>1</show_in_default>
|
249 |
+
<show_in_website>1</show_in_website>
|
250 |
+
<show_in_store>1</show_in_store>
|
251 |
+
<depends>
|
252 |
+
<mode>2</mode>
|
253 |
+
</depends>
|
254 |
+
</tax_label>
|
255 |
+
<duty_label translate="label">
|
256 |
+
<label>Duty Label</label>
|
257 |
+
<frontend_type>text</frontend_type>
|
258 |
+
<sort_order>15</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 |
+
<depends>
|
263 |
+
<mode>2</mode>
|
264 |
+
</depends>
|
265 |
+
</duty_label>
|
266 |
+
</fields>
|
267 |
+
</tax>
|
268 |
+
</groups>
|
269 |
+
</iparcel>
|
270 |
+
<catalog_mapping>
|
271 |
+
<label>Catalog Mapping</label>
|
272 |
+
<tab>i-parcel</tab>
|
273 |
+
<frontend_type>text</frontend_type>
|
274 |
+
<sort_order>5</sort_order>
|
275 |
+
<show_in_default>1</show_in_default>
|
276 |
+
<show_in_website>1</show_in_website>
|
277 |
+
<show_in_store>0</show_in_store>
|
278 |
+
<groups>
|
279 |
+
<config translate="label">
|
280 |
+
<label>Configuration</label>
|
281 |
+
<frontend_type>text</frontend_type>
|
282 |
+
<sort_order>0</sort_order>
|
283 |
+
<show_in_default>1</show_in_default>
|
284 |
+
<show_in_website>1</show_in_website>
|
285 |
+
<show_in_store>0</show_in_store>
|
286 |
+
<fields>
|
287 |
+
<auto_upload translate="label">
|
288 |
+
<label>Auto Catalog Updates</label>
|
289 |
+
<frontend_type>select</frontend_type>
|
290 |
+
<source_model>shippingip/system_config_source_catalog_mapping_mode</source_model>
|
291 |
+
<backend_model>shippingip/config_catalog_mapping</backend_model>
|
292 |
+
<sort_order>5</sort_order>
|
293 |
+
<show_in_default>1</show_in_default>
|
294 |
+
<show_in_website>1</show_in_website>
|
295 |
+
<show_in_store>0</show_in_store>
|
296 |
+
</auto_upload>
|
297 |
+
<cron_frequency translate="label">
|
298 |
+
<label>Frequency</label>
|
299 |
+
<frontend_type>select</frontend_type>
|
300 |
+
<source_model>adminhtml/system_config_source_cron_frequency</source_model>
|
301 |
+
<sort_order>99</sort_order>
|
302 |
+
<show_in_default>1</show_in_default>
|
303 |
+
<show_in_website>1</show_in_website>
|
304 |
+
<show_in_store>0</show_in_store>
|
305 |
+
<depends>
|
306 |
+
<auto_upload>2</auto_upload>
|
307 |
+
</depends>
|
308 |
+
</cron_frequency>
|
309 |
+
<cron_hour translate="label">
|
310 |
+
<label>Hour</label>
|
311 |
+
<frontend_type>text</frontend_type>
|
312 |
+
<sort_order>100</sort_order>
|
313 |
+
<backend_model>shippingip/config_data_time_hour</backend_model>
|
314 |
+
<show_in_default>1</show_in_default>
|
315 |
+
<show_in_website>1</show_in_website>
|
316 |
+
<show_in_store>0</show_in_store>
|
317 |
+
<depends>
|
318 |
+
<auto_upload>2</auto_upload>
|
319 |
+
</depends>
|
320 |
+
</cron_hour>
|
321 |
+
<cron_minute translate="label">
|
322 |
+
<label>Minute</label>
|
323 |
+
<frontend_type>text</frontend_type>
|
324 |
+
<sort_order>101</sort_order>
|
325 |
+
<backend_model>shippingip/config_data_time_minute</backend_model>
|
326 |
+
<show_in_default>1</show_in_default>
|
327 |
+
<show_in_website>1</show_in_website>
|
328 |
+
<show_in_store>0</show_in_store>
|
329 |
+
<depends>
|
330 |
+
<auto_upload>2</auto_upload>
|
331 |
+
</depends>
|
332 |
+
</cron_minute>
|
333 |
+
<cron_monthday translate="label">
|
334 |
+
<label>Day of Month</label>
|
335 |
+
<frontend_type>text</frontend_type>
|
336 |
+
<sort_order>103</sort_order>
|
337 |
+
<backend_model>shippingip/config_data_date_monthday</backend_model>
|
338 |
+
<show_in_default>1</show_in_default>
|
339 |
+
<show_in_website>1</show_in_website>
|
340 |
+
<show_in_store>0</show_in_store>
|
341 |
+
<depends>
|
342 |
+
<auto_upload>2</auto_upload>
|
343 |
+
<cron_frequency>M</cron_frequency>
|
344 |
+
</depends>
|
345 |
+
</cron_monthday>
|
346 |
+
<cron_weekday translate="label">
|
347 |
+
<label>Day of Week</label>
|
348 |
+
<frontend_type>select</frontend_type>
|
349 |
+
<source_model>shippingip/system_config_source_date_weekday</source_model>
|
350 |
+
<sort_order>102</sort_order>
|
351 |
+
<backend_model>shippingip/config_data_date_weekday</backend_model>
|
352 |
+
<show_in_default>1</show_in_default>
|
353 |
+
<show_in_website>1</show_in_website>
|
354 |
+
<show_in_store>0</show_in_store>
|
355 |
+
<depends>
|
356 |
+
<auto_upload>2</auto_upload>
|
357 |
+
<cron_frequency>W</cron_frequency>
|
358 |
+
</depends>
|
359 |
+
</cron_weekday>
|
360 |
+
</fields>
|
361 |
+
</config>
|
362 |
+
<upload translate="label">
|
363 |
+
<label>Upload</label>
|
364 |
+
<frontend_type>text</frontend_type>
|
365 |
+
<sort_order>0</sort_order>
|
366 |
+
<show_in_default>1</show_in_default>
|
367 |
+
<show_in_website>1</show_in_website>
|
368 |
+
<show_in_store>0</show_in_store>
|
369 |
+
<fields>
|
370 |
+
<upload translate="label">
|
371 |
+
<label>Upload Catalog</label>
|
372 |
+
<frontend_type>button</frontend_type>
|
373 |
+
<frontend_model>shippingip/adminhtml_catalog_mapping_button</frontend_model>
|
374 |
+
<sort_order>1</sort_order>
|
375 |
+
<show_in_default>1</show_in_default>
|
376 |
+
<show_in_website>1</show_in_website>
|
377 |
+
<show_in_store>0</show_in_store>
|
378 |
+
<tooltip>If this button is pressed, the catalog will be uploaded to i-parcel.</tooltip>
|
379 |
+
<comment>This may take some time</comment>
|
380 |
+
</upload>
|
381 |
+
<step translate="label">
|
382 |
+
<label>Upload Step Size</label>
|
383 |
+
<frontend_type>text</frontend_type>
|
384 |
+
<sort_order>10</sort_order>
|
385 |
+
<show_in_default>1</show_in_default>
|
386 |
+
<show_in_website>0</show_in_website>
|
387 |
+
<show_in_store>0</show_in_store>
|
388 |
+
<validate>validate-number validate-greater-than-zero</validate>
|
389 |
+
</step>
|
390 |
+
<offset translate="label">
|
391 |
+
<label>Upload offset</label>
|
392 |
+
<frontend_type>text</frontend_type>
|
393 |
+
<sort_order>20</sort_order>
|
394 |
+
<show_in_default>1</show_in_default>
|
395 |
+
<show_in_website>0</show_in_website>
|
396 |
+
<show_in_store>0</show_in_store>
|
397 |
+
<validate>validate-number validate-zero-or-greater</validate>
|
398 |
+
</offset>
|
399 |
+
</fields>
|
400 |
+
</upload>
|
401 |
+
<!--<check_items translate="label">-->
|
402 |
+
<!--<label>Populate cache</label>-->
|
403 |
+
<!--<frontend_type>text</frontend_type>-->
|
404 |
+
<!--<sort_order>2</sort_order>-->
|
405 |
+
<!--<show_in_default>1</show_in_default>-->
|
406 |
+
<!--<show_in_website>1</show_in_website>-->
|
407 |
+
<!--<show_in_store>0</show_in_store>-->
|
408 |
+
<!--<fields>-->
|
409 |
+
<!--<check_items translate="label">-->
|
410 |
+
<!--<label>Populate Catalog Items</label>-->
|
411 |
+
<!--<frontend_type>button</frontend_type>-->
|
412 |
+
<!--<frontend_model>shippingip/adminhtml_catalog_checkitems_button</frontend_model>-->
|
413 |
+
<!--<sort_order>10</sort_order>-->
|
414 |
+
<!--<show_in_default>1</show_in_default>-->
|
415 |
+
<!--<show_in_website>1</show_in_website>-->
|
416 |
+
<!--<show_in_store>0</show_in_store>-->
|
417 |
+
<!--<comment>This may take some time</comment>-->
|
418 |
+
<!--</check_items>-->
|
419 |
+
<!--</fields>-->
|
420 |
+
<!--</check_items>-->
|
421 |
+
<attributes translate="label">
|
422 |
+
<label>Catalog Mapping Attributes</label>
|
423 |
+
<frontend_type>text</frontend_type>
|
424 |
+
<sort_order>5</sort_order>
|
425 |
+
<show_in_default>1</show_in_default>
|
426 |
+
<show_in_website>0</show_in_website>
|
427 |
+
<show_in_store>0</show_in_store>
|
428 |
+
<fields>
|
429 |
+
<attribute1 translate="label">
|
430 |
+
<label>Attribute 1</label>
|
431 |
+
<frontend_type>select</frontend_type>
|
432 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
|
433 |
+
<sort_order>6</sort_order>
|
434 |
+
<show_in_default>1</show_in_default>
|
435 |
+
<show_in_website>1</show_in_website>
|
436 |
+
<show_in_store>0</show_in_store>
|
437 |
+
</attribute1>
|
438 |
+
<attribute2 translate="label">
|
439 |
+
<label>Attribute 2</label>
|
440 |
+
<frontend_type>select</frontend_type>
|
441 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
|
442 |
+
<sort_order>11</sort_order>
|
443 |
+
<show_in_default>1</show_in_default>
|
444 |
+
<show_in_website>1</show_in_website>
|
445 |
+
<show_in_store>0</show_in_store>
|
446 |
+
</attribute2>
|
447 |
+
<attribute3 translate="label">
|
448 |
+
<label>Attribute 3</label>
|
449 |
+
<frontend_type>select</frontend_type>
|
450 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
|
451 |
+
<sort_order>16</sort_order>
|
452 |
+
<show_in_default>1</show_in_default>
|
453 |
+
<show_in_website>1</show_in_website>
|
454 |
+
<show_in_store>0</show_in_store>
|
455 |
+
</attribute3>
|
456 |
+
<attribute4 translate="label">
|
457 |
+
<label>Attribute 4</label>
|
458 |
+
<frontend_type>select</frontend_type>
|
459 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
|
460 |
+
<sort_order>21</sort_order>
|
461 |
+
<show_in_default>1</show_in_default>
|
462 |
+
<show_in_website>1</show_in_website>
|
463 |
+
<show_in_store>0</show_in_store>
|
464 |
+
</attribute4>
|
465 |
+
<attribute5 translate="label">
|
466 |
+
<label>Attribute 5</label>
|
467 |
+
<frontend_type>select</frontend_type>
|
468 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
|
469 |
+
<sort_order>26</sort_order>
|
470 |
+
<show_in_default>1</show_in_default>
|
471 |
+
<show_in_website>1</show_in_website>
|
472 |
+
<show_in_store>0</show_in_store>
|
473 |
+
</attribute5>
|
474 |
+
<attribute6 translate="label">
|
475 |
+
<label>Attribute 6</label>
|
476 |
+
<frontend_type>select</frontend_type>
|
477 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
|
478 |
+
<sort_order>31</sort_order>
|
479 |
+
<show_in_default>1</show_in_default>
|
480 |
+
<show_in_website>1</show_in_website>
|
481 |
+
<show_in_store>0</show_in_store>
|
482 |
+
</attribute6>
|
483 |
+
<hscodeus translate="label">
|
484 |
+
<label>HS Code</label>
|
485 |
+
<frontend_type>select</frontend_type>
|
486 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute</source_model>
|
487 |
+
<sort_order>36</sort_order>
|
488 |
+
<show_in_default>1</show_in_default>
|
489 |
+
<show_in_website>1</show_in_website>
|
490 |
+
<show_in_store>0</show_in_store>
|
491 |
+
</hscodeus>
|
492 |
+
<shipalone translate="label">
|
493 |
+
<label>Ship Alone</label>
|
494 |
+
<frontend_type>select</frontend_type>
|
495 |
+
<source_model>shippingip/system_config_source_catalog_product_attribute_boolean</source_model>
|
496 |
+
<sort_order>41</sort_order>
|
497 |
+
<show_in_default>1</show_in_default>
|
498 |
+
<show_in_website>1</show_in_website>
|
499 |
+
<show_in_store>0</show_in_store>
|
500 |
+
<comment>Only boolean attributes</comment>
|
501 |
+
</shipalone>
|
502 |
+
<price translate="label">
|
503 |
+
<label>Price Type</label>
|
504 |
+
<frontend_type>select</frontend_type>
|
505 |
+
<source_model>shippingip/system_config_source_catalog_mapping_configurable_price</source_model>
|
506 |
+
<sort_order>46</sort_order>
|
507 |
+
<show_in_default>1</show_in_default>
|
508 |
+
<show_in_website>1</show_in_website>
|
509 |
+
<show_in_store>0</show_in_store>
|
510 |
+
<comment>Price type for configurable products</comment>
|
511 |
+
</price>
|
512 |
+
</fields>
|
513 |
+
</attributes>
|
514 |
+
</groups>
|
515 |
+
</catalog_mapping>
|
516 |
+
<external_api>
|
517 |
+
<label>External API</label>
|
518 |
+
<tab>i-parcel</tab>
|
519 |
+
<frontend_type>text</frontend_type>
|
520 |
+
<sort_order>10</sort_order>
|
521 |
+
<show_in_default>1</show_in_default>
|
522 |
+
<show_in_website>0</show_in_website>
|
523 |
+
<show_in_store>0</show_in_store>
|
524 |
+
<groups>
|
525 |
+
<sales translate="label">
|
526 |
+
<label>Sales</label>
|
527 |
+
<frontend_type>text</frontend_type>
|
528 |
+
<sort_order>0</sort_order>
|
529 |
+
<show_in_default>1</show_in_default>
|
530 |
+
<show_in_website>1</show_in_website>
|
531 |
+
<show_in_store>1</show_in_store>
|
532 |
+
<fields>
|
533 |
+
<enabled>
|
534 |
+
<label>Enable External Sales API</label>
|
535 |
+
<frontend_type>select</frontend_type>
|
536 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
537 |
+
<sort_order>0</sort_order>
|
538 |
+
<show_in_default>1</show_in_default>
|
539 |
+
<show_in_website>1</show_in_website>
|
540 |
+
<show_in_store>1</show_in_store>
|
541 |
+
</enabled>
|
542 |
+
<transactional_emails>
|
543 |
+
<label>Suppress Transactional e-mails</label>
|
544 |
+
<frontend_type>select</frontend_type>
|
545 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
546 |
+
<sort_order>5</sort_order>
|
547 |
+
<show_in_default>1</show_in_default>
|
548 |
+
<show_in_website>1</show_in_website>
|
549 |
+
<show_in_store>1</show_in_store>
|
550 |
+
</transactional_emails>
|
551 |
+
<order_status>
|
552 |
+
<label>New Order Status</label>
|
553 |
+
<frontend_type>select</frontend_type>
|
554 |
+
<source_model>shippingip/system_config_source_sales_order_status</source_model>
|
555 |
+
<sort_order>114</sort_order>
|
556 |
+
<show_in_default>1</show_in_default>
|
557 |
+
<show_in_website>1</show_in_website>
|
558 |
+
<show_in_store>1</show_in_store>
|
559 |
+
</order_status>
|
560 |
+
</fields>
|
561 |
+
</sales>
|
562 |
+
</groups>
|
563 |
+
</external_api>
|
564 |
+
<!--<salesrules>-->
|
565 |
+
<!--<label>Sales Rules Synchronization</label>-->
|
566 |
+
<!--<tab>i-parcel</tab>-->
|
567 |
+
<!--<frontend_type>text</frontend_type>-->
|
568 |
+
<!--<sort_order>7</sort_order>-->
|
569 |
+
<!--<show_in_default>1</show_in_default>-->
|
570 |
+
<!--<show_in_website>1</show_in_website>-->
|
571 |
+
<!--<show_in_store>0</show_in_store>-->
|
572 |
+
<!--<groups>-->
|
573 |
+
<!--<upload>-->
|
574 |
+
<!--<label>Upload</label>-->
|
575 |
+
<!--<frontend_type>text</frontend_type>-->
|
576 |
+
<!--<sort_order>10</sort_order>-->
|
577 |
+
<!--<show_in_default>1</show_in_default>-->
|
578 |
+
<!--<show_in_website>1</show_in_website>-->
|
579 |
+
<!--<show_in_store>0</show_in_store>-->
|
580 |
+
<!--<fields>-->
|
581 |
+
<!--<sync>-->
|
582 |
+
<!--<label>Synchronize SalesRules</label>-->
|
583 |
+
<!--<frontend_type>button</frontend_type>-->
|
584 |
+
<!--<frontend_model>shippingip/adminhtml_salesrule_rule_sync</frontend_model>-->
|
585 |
+
<!--<sort_order>1</sort_order>-->
|
586 |
+
<!--<show_in_default>1</show_in_default>-->
|
587 |
+
<!--<show_in_website>1</show_in_website>-->
|
588 |
+
<!--<show_in_store>0</show_in_store>-->
|
589 |
+
<!--</sync>-->
|
590 |
+
<!--</fields>-->
|
591 |
+
<!--</upload>-->
|
592 |
+
<!--</groups>-->
|
593 |
+
<!--</salesrules>-->
|
594 |
+
</sections>
|
595 |
+
</config>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.2.0.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true){
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/api_order'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false
|
16 |
+
), 'Order Id')
|
17 |
+
->addColumn('transactional_emails', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
18 |
+
'nullable' => false,
|
19 |
+
'default' => 1
|
20 |
+
), 'Transactional Emails Enabled');
|
21 |
+
$installer->getConnection()->createTable($table);
|
22 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/api_order'), 'IDX_ORDER', 'order_id');
|
23 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID',$installer->getTable('shippingip/api_order'),'order_id',$installer->getTable('sales/order'),'entity_id');
|
24 |
+
}
|
25 |
+
$installer->endSetup();
|
26 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-0.3.0.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) !== true){
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/api_order'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false
|
16 |
+
), 'Order Id')
|
17 |
+
->addColumn('transactional_emails', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
18 |
+
'nullable' => false,
|
19 |
+
'default' => 1
|
20 |
+
), 'Transactional Emails Enabled');
|
21 |
+
$installer->getConnection()->createTable($table);
|
22 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/api_order'), 'IDX_ORDER', 'order_id');
|
23 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_API_ORDER_ID',$installer->getTable('shippingip/api_order'),'order_id',$installer->getTable('sales/order'),'entity_id');
|
24 |
+
}
|
25 |
+
$installer->endSetup();
|
26 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-install-2.3.4.2.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true){
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/tax_totals'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('tax', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
14 |
+
'nullable' => false
|
15 |
+
), 'Tax')
|
16 |
+
->addColumn('duty', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
17 |
+
'nullable' => true
|
18 |
+
), 'Duty')
|
19 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'unsigned' => true,
|
21 |
+
'nullable' => false
|
22 |
+
), 'Order Id')
|
23 |
+
->addColumn('mode', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
|
24 |
+
'nullable' => false,
|
25 |
+
'default' => 0
|
26 |
+
), 'Mode');
|
27 |
+
$installer->getConnection()->createTable($table);
|
28 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/tax_totals'), 'IDX_ORDER', 'order_id');
|
29 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_TOTALS_ORDER_ID',$installer->getTable('shippingip/tax_totals'),'order_id',$installer->getTable('sales/order'),'entity_id');
|
30 |
+
}
|
31 |
+
|
32 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true){
|
33 |
+
$table = $installer->getConnection()
|
34 |
+
->newTable($installer->getTable('shippingip/cpf'))
|
35 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
36 |
+
'identity' => true,
|
37 |
+
'unsigned' => true,
|
38 |
+
'nullable' => false,
|
39 |
+
'primary' => true
|
40 |
+
), 'Id')
|
41 |
+
->addColumn('country_code', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
42 |
+
'nullable' => false,
|
43 |
+
'unique' => true
|
44 |
+
), 'Country Code')
|
45 |
+
->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
46 |
+
'nullable' => false
|
47 |
+
), 'Name')
|
48 |
+
->addColumn('required', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
49 |
+
'nullable' => false,
|
50 |
+
'default' => false
|
51 |
+
), 'Required');
|
52 |
+
$installer->getConnection()->createTable($table);
|
53 |
+
|
54 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
55 |
+
$cpf->setCountryCode('BR');
|
56 |
+
$cpf->setName('CPF');
|
57 |
+
$cpf->save();
|
58 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
59 |
+
$cpf->setCountryCode('KR');
|
60 |
+
$cpf->setName('Control Number');
|
61 |
+
$cpf->save();
|
62 |
+
}
|
63 |
+
|
64 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true){
|
65 |
+
$table = $installer->getConnection()
|
66 |
+
->newTable($installer->getTable('shippingip/cpf_order'))
|
67 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
68 |
+
'identity' => true,
|
69 |
+
'unsigned' => true,
|
70 |
+
'nullable' => false,
|
71 |
+
'primary' => true
|
72 |
+
), 'Id')
|
73 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
74 |
+
'unsigned' => true,
|
75 |
+
'nullable' => false,
|
76 |
+
'unique' => true
|
77 |
+
), 'Order Id')
|
78 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
79 |
+
'default' => '',
|
80 |
+
'nullable' => false,
|
81 |
+
), 'Value');
|
82 |
+
$installer->getConnection()->createTable($table);
|
83 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_order'), 'IDX_ORDER', 'order_id');
|
84 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID',$installer->getTable('shippingip/cpf_order'),'order_id',$installer->getTable('sales/order'),'entity_id');
|
85 |
+
}
|
86 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true){
|
87 |
+
$table = $installer->getConnection()
|
88 |
+
->newTable($installer->getTable('shippingip/cpf_quote'))
|
89 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
90 |
+
'identity' => true,
|
91 |
+
'unsigned' => true,
|
92 |
+
'nullable' => false,
|
93 |
+
'primary' => true
|
94 |
+
), 'Id')
|
95 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
96 |
+
'unsigned' => true,
|
97 |
+
'nullable' => false,
|
98 |
+
'unique' => true
|
99 |
+
), 'Quote Id')
|
100 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
101 |
+
'default' => '',
|
102 |
+
'nullable' => false,
|
103 |
+
), 'Value');
|
104 |
+
$installer->getConnection()->createTable($table);
|
105 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_quote'), 'IDX_QUOTE', 'quote_id');
|
106 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID',$installer->getTable('shippingip/cpf_quote'),'quote_id',$installer->getTable('sales/quote'),'entity_id');
|
107 |
+
}
|
108 |
+
|
109 |
+
$installer->endSetup();
|
110 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.2.0-0.3.0.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$resource = Mage::getSingleton('core/resource');
|
5 |
+
$config = Mage::getModel('core/config');
|
6 |
+
$readConnection = $resource->getConnection('core_read');
|
7 |
+
$query = 'SELECT `path`, `value` FROM '.$resource->getTableName('core/config_data')." WHERE
|
8 |
+
`path` LIKE '%iparcel/catalog_mapping%' OR
|
9 |
+
`path` LIKE '%sales/external%' OR
|
10 |
+
`path` LIKE '%iparcel/config%' OR
|
11 |
+
`path` LIKE '%carriers/i-parcel/custid' OR
|
12 |
+
`path` LIKE '%carriers/i-parcel/userid'";
|
13 |
+
foreach ($readConnection->fetchAll($query) as $variable){
|
14 |
+
$uri = explode('/',$variable['path']);
|
15 |
+
switch($variable['path']){
|
16 |
+
case 'carriers/i-parcel/custid':
|
17 |
+
case 'carriers/i-parcel/userid':
|
18 |
+
$config->saveConfig('iparcel/config/'.$uri[2],$variable['value']);
|
19 |
+
break;
|
20 |
+
case 'iparcel/catalog_mapping/attribute1':
|
21 |
+
case 'iparcel/catalog_mapping/attribute2':
|
22 |
+
case 'iparcel/catalog_mapping/attribute3':
|
23 |
+
case 'iparcel/catalog_mapping/attribute4':
|
24 |
+
case 'iparcel/catalog_mapping/attribute5':
|
25 |
+
case 'iparcel/catalog_mapping/attribute6':
|
26 |
+
case 'iparcel/catalog_mapping/hscodeus':
|
27 |
+
case 'iparcel/catalog_mapping/shipalone':
|
28 |
+
$config->saveConfig('catalog_mapping/attributes/'.$uri[2],$variable['value']);
|
29 |
+
break;
|
30 |
+
case 'sales/external/enabled':
|
31 |
+
case 'sales/external/transactional_emails':
|
32 |
+
$config->saveConfig('external_api/sales'.$uri[2],$variable['value']);
|
33 |
+
break;
|
34 |
+
case 'iparcel/config/scripts':
|
35 |
+
case 'iparcel/config/jquery':
|
36 |
+
$config->saveConfig('iparcel/scripts'.$uri[2],$variable['value']);
|
37 |
+
break;
|
38 |
+
case 'iparcel/catalog_mapping/upload_from':
|
39 |
+
case 'iparcel/catalog_mapping/upload_to':
|
40 |
+
$config->saveConfig('catalog_mapping/upload/'.$uri[2]=='upload_to' ? 'to' : 'from',$variable['value']);
|
41 |
+
break;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
$installer->endSetup();
|
45 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.0-0.3.1.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/tax_totals')) !== true){
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/tax_totals'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('tax', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
14 |
+
'nullable' => false
|
15 |
+
), 'Tax')
|
16 |
+
->addColumn('duty', Varien_Db_Ddl_Table::TYPE_FLOAT, null, array(
|
17 |
+
'nullable' => true
|
18 |
+
), 'Duty')
|
19 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'unsigned' => true,
|
21 |
+
'nullable' => false
|
22 |
+
), 'Order Id')
|
23 |
+
->addColumn('mode', Varien_Db_Ddl_Table::TYPE_TINYINT, null, array(
|
24 |
+
'nullable' => false,
|
25 |
+
'default' => 0
|
26 |
+
), 'Mode');
|
27 |
+
$installer->getConnection()->createTable($table);
|
28 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/tax_totals'), 'IDX_ORDER', 'order_id');
|
29 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_TOTALS_ORDER_ID',$installer->getTable('shippingip/tax_totals'),'order_id',$installer->getTable('sales/order'),'entity_id');
|
30 |
+
}
|
31 |
+
$installer->endSetup();
|
32 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.1-0.3.2.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf')) !== true){
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/cpf'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('country_code', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
14 |
+
'nullable' => false,
|
15 |
+
'unique' => true
|
16 |
+
), 'Country Code')
|
17 |
+
->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
18 |
+
'nullable' => false
|
19 |
+
), 'Name')
|
20 |
+
->addColumn('required', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
|
21 |
+
'nullable' => false,
|
22 |
+
'default' => false
|
23 |
+
), 'Required');
|
24 |
+
$installer->getConnection()->createTable($table);
|
25 |
+
|
26 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
27 |
+
$cpf->setCountryCode('BR');
|
28 |
+
$cpf->setName('CPF');
|
29 |
+
$cpf->save();
|
30 |
+
$cpf = Mage::getModel('shippingip/cpf');
|
31 |
+
$cpf->setCountryCode('KR');
|
32 |
+
$cpf->setName('Control Number');
|
33 |
+
$cpf->save();
|
34 |
+
}
|
35 |
+
|
36 |
+
$installer->endSetup();
|
37 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-0.3.2-2.0.0.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_order')) !== true){
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/cpf_order'))
|
7 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false,
|
16 |
+
'unique' => true
|
17 |
+
), 'Order Id')
|
18 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
19 |
+
'default' => '',
|
20 |
+
'nullable' => false,
|
21 |
+
), 'Value');
|
22 |
+
$installer->getConnection()->createTable($table);
|
23 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_order'), 'IDX_ORDER', 'order_id');
|
24 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_ORDER_ID',$installer->getTable('shippingip/cpf_order'),'order_id',$installer->getTable('sales/order'),'entity_id');
|
25 |
+
}
|
26 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/cpf_quote')) !== true){
|
27 |
+
$table = $installer->getConnection()
|
28 |
+
->newTable($installer->getTable('shippingip/cpf_quote'))
|
29 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
30 |
+
'identity' => true,
|
31 |
+
'unsigned' => true,
|
32 |
+
'nullable' => false,
|
33 |
+
'primary' => true
|
34 |
+
), 'Id')
|
35 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
36 |
+
'unsigned' => true,
|
37 |
+
'nullable' => false,
|
38 |
+
'unique' => true
|
39 |
+
), 'Quote Id')
|
40 |
+
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
41 |
+
'default' => '',
|
42 |
+
'nullable' => false,
|
43 |
+
), 'Value');
|
44 |
+
$installer->getConnection()->createTable($table);
|
45 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/cpf_quote'), 'IDX_QUOTE', 'quote_id');
|
46 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_CPF_QUOTE_ID',$installer->getTable('shippingip/cpf_quote'),'quote_id',$installer->getTable('sales/quote'),'entity_id');
|
47 |
+
}
|
48 |
+
$installer->endSetup();
|
49 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.0.0-2.3.4.2.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/api_order')) === true){
|
5 |
+
$installer->getConnection()->dropTable($installer->getTable('shippingip/api_order'));
|
6 |
+
}
|
7 |
+
$installer->endSetup();
|
8 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.2-2.3.4.4.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)){
|
5 |
+
unlink(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME);
|
6 |
+
}
|
7 |
+
$installer->endSetup();
|
8 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.3.4.3-2.3.4.4.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if (file_exists(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME)){
|
5 |
+
unlink(Mage::getBaseDir('log').'/'.Iparcel_Shipping_Model_Api_Log::LOG_FILENAME);
|
6 |
+
}
|
7 |
+
$installer->endSetup();
|
8 |
+
?>
|
app/code/community/Iparcel/Shipping/sql/shippingip_setup/mysql4-upgrade-2.4.0.3-2.4.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('shippingip/parcel')) !== true){
|
5 |
+
$table = $installer->getConnection()
|
6 |
+
->newTable($installer->getTable('shippingip/parcel'))
|
7 |
+
->addColumn('parcel_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
8 |
+
'identity' => true,
|
9 |
+
'unsigned' => true,
|
10 |
+
'nullable' => false,
|
11 |
+
'primary' => true
|
12 |
+
), 'Id')
|
13 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
14 |
+
'unsigned' => true,
|
15 |
+
'nullable' => false,
|
16 |
+
), 'Order Id');
|
17 |
+
$installer->getConnection()->createTable($table);
|
18 |
+
$installer->getConnection()->addKey($installer->getTable('shippingip/parcel'), 'IDX_ORDER', 'order_id', 'UNIQUE');
|
19 |
+
$installer->getConnection()->addConstraint('FK_IPARCEL_PARCEL_ORDER_ID',$installer->getTable('shippingip/parcel'),'order_id',$installer->getTable('sales/order'),'entity_id');
|
20 |
+
}
|
21 |
+
$installer->endSetup();
|
22 |
+
?>
|
23 |
+
?>
|
app/design/adminhtml/default/default/layout/externalsales.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout>
|
2 |
+
<adminhtml_sales_order_shipment_view>
|
3 |
+
<reference name="head">
|
4 |
+
<action method="addJs"><script>iparcel/adminhtml/label.js</script></action>
|
5 |
+
</reference>
|
6 |
+
</adminhtml_sales_order_shipment_view>
|
7 |
+
<shippingip_sync_ajax>
|
8 |
+
<block type="adminhtml/page" name="root" output="toHtml" template="page.phtml">
|
9 |
+
<block type="adminhtml/page_head" name="head" as="head" template="page/head.phtml">
|
10 |
+
<action method="addJs"><script>iparcel/jQuery.js</script></action>
|
11 |
+
<action method="addJs"><script>iparcel/adminhtml/sync.js</script></action>
|
12 |
+
<action method="addCss"><stylesheet>iparcel/ajaxSync.css</stylesheet></action>
|
13 |
+
</block>
|
14 |
+
<block type="core/text_list" name="content" as="content" />
|
15 |
+
</block>
|
16 |
+
</shippingip_sync_ajax>
|
17 |
+
<shippingip_sync_ajax_catalog>
|
18 |
+
<reference name="head">
|
19 |
+
<action method="setTitle"><title>i-parcel Catalog Upload</title></action>
|
20 |
+
</reference>
|
21 |
+
<reference name="content">
|
22 |
+
<block type="core/template" name="catalog.sync" template="iparcel/sync/ajax/catalog.phtml"/>
|
23 |
+
</reference>
|
24 |
+
</shippingip_sync_ajax_catalog>
|
25 |
+
<shippingip_sync_ajax_checkitems>
|
26 |
+
<reference name="head">
|
27 |
+
<action method="setTitle"><title>i-parcel Check Items</title></action>
|
28 |
+
</reference>
|
29 |
+
<reference name="content">
|
30 |
+
<block type="core/template" name="checkitems.sync" template="iparcel/sync/ajax/checkitems.phtml" />
|
31 |
+
</reference>
|
32 |
+
</shippingip_sync_ajax_checkitems>
|
33 |
+
<shippingip_log_index>
|
34 |
+
<reference name="content">
|
35 |
+
<block type="shippingip/adminhtml_logs" name="iparcel.logs" as="logs" />
|
36 |
+
</reference>
|
37 |
+
</shippingip_log_index>
|
38 |
+
</layout>
|
app/design/adminhtml/default/default/template/iparcel/sales/order/shipment/view/tracking.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Iparcel_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Tracking
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div class="field-row grid" id="shipment_tracking_info">
|
10 |
+
<table cellspacing="0" class="data">
|
11 |
+
<col width="100" />
|
12 |
+
<col />
|
13 |
+
<col />
|
14 |
+
<col width="80" />
|
15 |
+
<thead>
|
16 |
+
<tr class="headings">
|
17 |
+
<th><?php echo Mage::helper('sales')->__('Carrier') ?></th>
|
18 |
+
<th><?php echo Mage::helper('sales')->__('Title') ?></th>
|
19 |
+
<th><?php echo Mage::helper('sales')->__('Number') ?></th>
|
20 |
+
</tr>
|
21 |
+
</thead>
|
22 |
+
<?php if($_tracks = $this->getShipment()->getAllTracks()): ?>
|
23 |
+
<tbody>
|
24 |
+
<?php $i=0;foreach ($_tracks as $_track):$i++ ?>
|
25 |
+
<tr class="<?php echo ($i%2==0)?'even':'odd' ?>">
|
26 |
+
<td><?php echo $this->escapeHtml($this->getCarrierTitle($_track->getCarrierCode())) ?></td>
|
27 |
+
<td><?php echo $this->escapeHtml($_track->getTitle()) ?></td>
|
28 |
+
<td>
|
29 |
+
<?php if ($_track->isCustom()): ?>
|
30 |
+
<?php echo $this->escapeHtml($_track->getNumber()) ?>
|
31 |
+
<?php else: ?>
|
32 |
+
<a href="#" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_track) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')"><?php echo $this->escapeHtml($_track->getNumber()) ?></a>
|
33 |
+
<div id="shipment_tracking_info_response_<?php echo $_track->getId() ?>"></div>
|
34 |
+
<?php endif; ?>
|
35 |
+
</td>
|
36 |
+
</tr>
|
37 |
+
<?php endforeach; ?>
|
38 |
+
</tbody>
|
39 |
+
<?php endif; ?>
|
40 |
+
</table>
|
41 |
+
</div>
|
app/design/adminhtml/default/default/template/iparcel/sync/ajax/catalog.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Mage_Core_Block_Template
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div id="starting">
|
10 |
+
<p>Starting catalog synchronization</p>
|
11 |
+
</div>
|
12 |
+
<div id="sync">
|
13 |
+
<p><span>0</span> items from <span>0</span> uploaded</p>
|
14 |
+
</div>
|
15 |
+
<div id="end">
|
16 |
+
<p><span>0</span> items from <span>0</span> successfully uploaded</p>
|
17 |
+
<p>There was <span>0</span> errors when uploading catalog</p>
|
18 |
+
</div>
|
19 |
+
<script type="text/javascript">
|
20 |
+
var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('shippingip/sync_ajax/catalog') ?>?isAjax=true', <?php echo Mage::getStoreConfig('catalog_mapping/upload/step'); ?>);
|
21 |
+
</script>
|
app/design/adminhtml/default/default/template/iparcel/sync/ajax/checkitems.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Mage_Core_Block_Template
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div id="starting">
|
10 |
+
<p>Starting checking items</p>
|
11 |
+
</div>
|
12 |
+
<div id="sync">
|
13 |
+
<p><span>0</span> items from <span>0</span> checked</p>
|
14 |
+
</div>
|
15 |
+
<div id="end">
|
16 |
+
<p><span>0</span> items from <span>0</span> successfully checked</p>
|
17 |
+
<p>There was <span>0</span> errors when checking items</p>
|
18 |
+
</div>
|
19 |
+
<script type="text/javascript">
|
20 |
+
var sync = new iparcelSync.sync('<?php echo Mage::helper('adminhtml')->getUrl('shippingip/sync_ajax/checkitems') ?>?isAjax=true', 1);
|
21 |
+
</script>
|
app/design/frontend/base/default/layout/externalshipping.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<block type="shippingip/html_head_jquery" name="jquery" template="shippingip/html/head/jquery.phtml" />
|
6 |
+
<block type="shippingip/html_head_iparcel" name="html.head.iparcel" template="shippingip/html/head/iparcel.phtml" />
|
7 |
+
</reference>
|
8 |
+
</default>
|
9 |
+
<catalog_product_view>
|
10 |
+
<reference name="head">
|
11 |
+
<action method="addJs"><script>iparcel/lib.js</script></action>
|
12 |
+
<block type="shippingip/html_head_post" name="iparcel_post" template="shippingip/html/head/post.phtml" />
|
13 |
+
<block type="shippingip/catalog_product" name="shippingip_sku" template="shippingip/post.phtml" />
|
14 |
+
</reference>
|
15 |
+
</catalog_product_view>
|
16 |
+
<catalog_category_view>
|
17 |
+
<reference name="head">
|
18 |
+
<action method="addJs"><script>iparcel/lib.js</script></action>
|
19 |
+
<block type="shippingip/html_head_post" name="iparcel_post" template="shippingip/html/head/post.phtml" />
|
20 |
+
<block type="shippingip/catalog_product_list" name="shippingip_sku.list" template="shippingip/post/list.phtml" />
|
21 |
+
</reference>
|
22 |
+
</catalog_category_view>
|
23 |
+
<checkout_onepage_index>
|
24 |
+
<reference name="head">
|
25 |
+
<action method="addJs"><script>iparcel/cpf.js</script></action>
|
26 |
+
<block type="shippingip/cpf" name="shippingip_cpf" template="shippingip/cpf.phtml" />
|
27 |
+
</reference>
|
28 |
+
</checkout_onepage_index>
|
29 |
+
</layout>
|
app/design/frontend/base/default/template/shippingip/cpf.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Iparcel_Shipping_Block_Cpf
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<script type="text/javascript">
|
10 |
+
iparcel.cpf(<?php echo json_encode($this->getCpf()); ?>);
|
11 |
+
</script>
|
app/design/frontend/base/default/template/shippingip/html/head/iparcel.phtml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Iparcel_Shipping_Block_Html_Head_Jquery
|
7 |
+
*/
|
8 |
+
$helper = Mage::helper('shippingip');
|
9 |
+
?>
|
10 |
+
<?php if($this->getFlag()): ?>
|
11 |
+
<script type="text/javascript" src="<?php echo $helper->getScriptUrl(); ?>/JavaScript/Merchant/<?php echo Mage::helper('shippingip')->getCustomerId(); ?>/1"></script>
|
12 |
+
<script type="text/javascript">var ipar_is_mage = true;</script>
|
13 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $helper->getScriptUrl(); ?>/CSS/Merchant/<?php echo Mage::helper('shippingip')->getCustomerId(); ?>/1" />
|
14 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/shippingip/html/head/jquery.phtml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Iparcel_Shipping_Block_Html_Head_Jquery
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php if($this->getFlag()): ?>
|
10 |
+
<script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>iparcel/jQuery.js"></script>
|
11 |
+
<script type="text/javascript">jQuery.noConflict();</script>
|
12 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/shippingip/html/head/post.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Iparcel_Shipping_Block_Html_Head_Post
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS).$this->getScript(); ?>"></script>
|
app/design/frontend/base/default/template/shippingip/post.phtml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Iparcel_Shipping_Block_Catalog_Product
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<script type="text/javascript">
|
10 |
+
iparcelPost.single('<?php echo $this->getProduct()->getSku(); ?>', '<?php echo substr(Mage::getBaseUrl(),5); ?>', '<?php echo $this->getStock(); ?>');
|
11 |
+
</script>
|
app/design/frontend/base/default/template/shippingip/post/list.phtml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package Iparcel_Shipping
|
5 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
6 |
+
* @class Iparcel_Shipping_Block_Catalog_Product_List
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
$_productCollection = $this->getLoadedProductCollection();
|
11 |
+
?>
|
12 |
+
<script type="text/javascript">
|
13 |
+
iparcelPost.sku_list({
|
14 |
+
<?php foreach ($_productCollection as $_product): ?>
|
15 |
+
"<?php echo $_product->getSku(); ?>": "<?php echo $_product->getName(); ?>",
|
16 |
+
<?php endforeach; ?>
|
17 |
+
});
|
18 |
+
iparcelPost.stock_list({
|
19 |
+
<?php foreach ($_productCollection as $_product): ?>
|
20 |
+
"<?php echo $_product->getName(); ?>": "<?php echo $this->getStock($_product); ?>",
|
21 |
+
<?php endforeach; ?>
|
22 |
+
});
|
23 |
+
</script>
|
app/etc/modules/Iparcel_Shipping.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Iparcel_Shipping>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
<active>true</active>
|
7 |
+
</Iparcel_Shipping>
|
8 |
+
</modules>
|
9 |
+
</config>
|
js/iparcel/adminhtml/label.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Label Printing script for i-parcel shipping
|
3 |
+
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski
|
7 |
+
*/
|
8 |
+
var iparcel = {
|
9 |
+
xhr: function (url, obj, async, cfunc){
|
10 |
+
object=obj;
|
11 |
+
if (XMLHttpRequest){
|
12 |
+
xmlhttp=new XMLHttpRequest ();
|
13 |
+
}else{
|
14 |
+
xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
|
15 |
+
}
|
16 |
+
xmlhttp.onreadystatechange=cfunc;
|
17 |
+
xmlhttp.open("GET", url, async);
|
18 |
+
xmlhttp.send();
|
19 |
+
},
|
20 |
+
|
21 |
+
print_label: function(url){
|
22 |
+
this.xhr(url, null, true, function(){
|
23 |
+
if (xmlhttp.readyState == 4 && xmlhttp.status == 200 && xmlhttp.response.isJSON()){
|
24 |
+
var response = xmlhttp.response.evalJSON();
|
25 |
+
if (response.error){
|
26 |
+
packaging.messages.show().innerHTML = response.message;
|
27 |
+
}else if(response.ok){
|
28 |
+
packaging.labelCreatedCallback(response);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
});
|
32 |
+
}
|
33 |
+
}
|
js/iparcel/adminhtml/sync.js
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* js lib for i-parcel's ajax sync
|
3 |
+
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
+
*/
|
8 |
+
var iparcelSync = {
|
9 |
+
item: null,
|
10 |
+
sync: null,
|
11 |
+
end: null,
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Initialize sync ajax callback
|
15 |
+
*/
|
16 |
+
init: function (data){
|
17 |
+
iparcelSync.item.count = data.count;
|
18 |
+
iparcelSync.sync.eq(1).text(iparcelSync.item.count);
|
19 |
+
iparcelSync.end.eq(1).text(iparcelSync.item.count);
|
20 |
+
$('#starting').hide();
|
21 |
+
$('#sync').show();
|
22 |
+
$.get(iparcelSync.item.url,{
|
23 |
+
page: ++iparcelSync.item.page,
|
24 |
+
step: iparcelSync.item.step,
|
25 |
+
type: 'upload'
|
26 |
+
},iparcelSync.refresh);
|
27 |
+
},
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Refresh sync ajax callback
|
31 |
+
*/
|
32 |
+
refresh: function(data){
|
33 |
+
if (!data.error){
|
34 |
+
iparcelSync.item.progress += data.uploaded;
|
35 |
+
iparcelSync.item.errors += iparcelSync.item.step-data.uploaded;
|
36 |
+
iparcelSync.sync.eq(0).text(iparcelSync.item.progress);
|
37 |
+
iparcelSync.end.eq(0).text(iparcelSync.item.progress);
|
38 |
+
}else{
|
39 |
+
if (iparcelSync.item.page*iparcelSync.item.step > iparcelSync.item.count){
|
40 |
+
iparcelSync.item.errors += iparcelSync.item.count - iparcelSync.item.progress;
|
41 |
+
}else{
|
42 |
+
iparcelSync.item.errors += iparcelSync.item.step;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
if (iparcelSync.item.progress+iparcelSync.item.errors < iparcelSync.item.count){
|
46 |
+
$.get(iparcelSync.item.url,{
|
47 |
+
page: ++iparcelSync.item.page,
|
48 |
+
step: iparcelSync.item.step,
|
49 |
+
type: 'upload'
|
50 |
+
},iparcelSync.refresh);
|
51 |
+
}else{
|
52 |
+
iparcelSync.finish();
|
53 |
+
}
|
54 |
+
},
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Finish sync
|
58 |
+
*/
|
59 |
+
finish: function(){
|
60 |
+
iparcelSync.end.eq(2).text(iparcelSync.item.errors);
|
61 |
+
$('#sync').hide();
|
62 |
+
$('#end').show();
|
63 |
+
},
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Sync object
|
67 |
+
*/
|
68 |
+
sync: function(url, step){
|
69 |
+
this.url = url;
|
70 |
+
this.step = step;
|
71 |
+
this.progress = 0;
|
72 |
+
this.errors = 0;
|
73 |
+
this.count = 0;
|
74 |
+
this.page = 0;
|
75 |
+
|
76 |
+
iparcelSync.sync = $('#sync span');
|
77 |
+
iparcelSync.end = $('#end span');
|
78 |
+
|
79 |
+
this.run = function (){
|
80 |
+
$.get(this.url,{type: 'init'}, iparcelSync.init);
|
81 |
+
}
|
82 |
+
|
83 |
+
iparcelSync.item = this;
|
84 |
+
|
85 |
+
this.run();
|
86 |
+
}
|
87 |
+
}
|
js/iparcel/cpf.js
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* i-parcel's CPF field processing script
|
3 |
+
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
+
*/
|
8 |
+
var iparcel = {
|
9 |
+
/**
|
10 |
+
* Processing Shipping/Billing country changes
|
11 |
+
*/
|
12 |
+
cpf: function(field_data){
|
13 |
+
var $jip = jQuery.noConflict();
|
14 |
+
$jip(document).ready(function(){
|
15 |
+
$jip('select[id="billing:country_id"]').change(function(){
|
16 |
+
$jip('#cpf-billing').remove();
|
17 |
+
if ($jip(this).val() in field_data){
|
18 |
+
iparcel.addCpfField('billing', field_data[$jip(this).val()]);
|
19 |
+
}
|
20 |
+
});
|
21 |
+
$jip('select[id="shipping:country_id"]').change(function(){
|
22 |
+
$jip('#cpf-shipping').remove();
|
23 |
+
if ($jip(this).val() in field_data){
|
24 |
+
iparcel.addCpfField('shipping', field_data[$jip(this).val()]);
|
25 |
+
}
|
26 |
+
});
|
27 |
+
});
|
28 |
+
},
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Adding proper CPF field
|
32 |
+
*/
|
33 |
+
addCpfField: function(form, data){
|
34 |
+
var $jip = jQuery.noConflict();
|
35 |
+
var $list_item = $jip('<li>');
|
36 |
+
$list_item.attr('id','cpf-'+form);
|
37 |
+
var $label = $jip('<label>');
|
38 |
+
$label.attr('for',form+':cpf');
|
39 |
+
var $div = $jip('<div>');
|
40 |
+
$div.addClass('input-box');
|
41 |
+
var $input = $jip('<input>');
|
42 |
+
$input.attr({
|
43 |
+
id: form+':cpf',
|
44 |
+
class: 'input-text',
|
45 |
+
type: 'text',
|
46 |
+
value: '',
|
47 |
+
name: form+'[cpf]',
|
48 |
+
title: data['name']
|
49 |
+
});
|
50 |
+
if (data['required'] != '0'){
|
51 |
+
$label.addClass('required');
|
52 |
+
$input.addClass('required-entry');
|
53 |
+
$label[0].innerHTML = '<em>*</em>'
|
54 |
+
}
|
55 |
+
$label[0].innerHTML += data['name'];
|
56 |
+
$div.append($input);
|
57 |
+
$list_item.append($label);
|
58 |
+
$list_item.append($div);
|
59 |
+
$jip('#co-'+form+'-form .fieldset ul').append($list_item);
|
60 |
+
}
|
61 |
+
}
|
js/iparcel/jQuery.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
|
2 |
+
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f
|
3 |
+
}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=$.test(e)?this.mouseHooks:Z.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||z),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||z,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==db()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===db()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=z.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===L&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault())?bb:cb):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:cb,isPropagationStopped:cb,isImmediatePropagationStopped:cb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=bb,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=bb,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submitBubbles||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?b.form:void 0;c&&!n._data(c,"submitBubbles")&&(n.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),n._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.changeBubbles||(n.event.special.change={setup:function(){return Y.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),n.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),n.event.simulate("change",this,a,!0)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;Y.test(b.nodeName)&&!n._data(b,"changeBubbles")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a,!0)}),n._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!Y.test(this.nodeName)}}),l.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=cb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return n().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=cb),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});function eb(a){var b=fb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var fb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gb=/ jQuery\d+="(?:null|\d+)"/g,hb=new RegExp("<(?:"+fb+")[\\s/>]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/<tbody/i,mb=/<|&#?\w+;/,nb=/<(?:script|style|link)/i,ob=/checked\s*(?:[^=]|=\s*.checked.)/i,pb=/^$|\/(?:java|ecma)script/i,qb=/^true\/(.*)/,rb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,sb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1></$2>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?"<table>"!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Db[0].contentWindow||Db[0].contentDocument).document,b.write(),b.close(),c=Fb(a,b),Db.detach()),Eb[a]=c),c}!function(){var a,b,c=z.createElement("div"),d="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],a.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(a.style.opacity),l.cssFloat=!!a.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===c.style.backgroundClip,a=c=null,l.shrinkWrapBlocks=function(){var a,c,e,f;if(null==b){if(a=z.getElementsByTagName("body")[0],!a)return;f="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",c=z.createElement("div"),e=z.createElement("div"),a.appendChild(c).appendChild(e),b=!1,typeof e.style.zoom!==L&&(e.style.cssText=d+";width:1px;padding:1px;zoom:1",e.innerHTML="<div></div>",e.firstChild.style.width="5px",b=3!==e.offsetWidth),a.removeChild(c),a=c=e=null}return b}}();var Hb=/^margin/,Ib=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Jb,Kb,Lb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Jb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),Ib.test(g)&&Hb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):z.documentElement.currentStyle&&(Jb=function(a){return a.currentStyle},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ib.test(g)&&!Lb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Mb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h=z.createElement("div"),i="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",j="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",b=h.getElementsByTagName("a")[0],b.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(b.style.opacity),l.cssFloat=!!b.style.cssFloat,h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,b=h=null,n.extend(l,{reliableHiddenOffsets:function(){if(null!=c)return c;var a,b,d,e=z.createElement("div"),f=z.getElementsByTagName("body")[0];if(f)return e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=z.createElement("div"),a.style.cssText=i,f.appendChild(a).appendChild(e),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=e.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",d=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display="none",c=d&&0===b[0].offsetHeight,f.removeChild(a),e=f=null,c},boxSizing:function(){return null==d&&k(),d},boxSizingReliable:function(){return null==e&&k(),e},pixelPosition:function(){return null==f&&k(),f},reliableMarginRight:function(){var b,c,d,e;if(null==g&&a.getComputedStyle){if(b=z.getElementsByTagName("body")[0],!b)return;c=z.createElement("div"),d=z.createElement("div"),c.style.cssText=i,b.appendChild(c).appendChild(d),e=d.appendChild(z.createElement("div")),e.style.cssText=d.style.cssText=j,e.style.marginRight=e.style.width="0",d.style.width="1px",g=!parseFloat((a.getComputedStyle(e,null)||{}).marginRight),b.removeChild(c)}return g}});function k(){var b,c,h=z.getElementsByTagName("body")[0];h&&(b=z.createElement("div"),c=z.createElement("div"),b.style.cssText=i,h.appendChild(b).appendChild(c),c.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",n.swap(h,null!=h.style.zoom?{zoom:1}:{},function(){d=4===c.offsetWidth}),e=!0,f=!1,g=!0,a.getComputedStyle&&(f="1%"!==(a.getComputedStyle(c,null)||{}).top,e="4px"===(a.getComputedStyle(c,null)||{width:"4px"}).width),h.removeChild(b),c=h=null)}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Nb=/alpha\([^)]*\)/i,Ob=/opacity\s*=\s*([^)]*)/,Pb=/^(none|table(?!-c[ea]).+)/,Qb=new RegExp("^("+T+")(.*)$","i"),Rb=new RegExp("^([+-])=("+T+")","i"),Sb={position:"absolute",visibility:"hidden",display:"block"},Tb={letterSpacing:0,fontWeight:400},Ub=["Webkit","O","Moz","ms"];function Vb(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ub.length;while(e--)if(b=Ub[e]+c,b in a)return b;return d}function Wb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=n._data(d,"olddisplay",Gb(d.nodeName)))):f[g]||(e=V(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Xb(a,b,c){var d=Qb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Yb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Zb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Jb(a),g=l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Kb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ib.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Yb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Kb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=Vb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Rb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]="",i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Vb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Kb(a,b,d)),"normal"===f&&b in Tb&&(f=Tb[b]),""===c||c?(e=parseFloat(f),c===!0||n.isNumeric(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Pb.test(n.css(a,"display"))?n.swap(a,Sb,function(){return Zb(a,b,d)}):Zb(a,b,d):void 0},set:function(a,c,d){var e=d&&Jb(a);return Xb(a,c,d?Yb(a,b,d,l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Ob.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Nb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Nb.test(f)?f.replace(Nb,e):f+" "+e)}}),n.cssHooks.marginRight=Mb(l.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},Kb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Hb.test(a)||(n.cssHooks[a+b].set=Xb)}),n.fn.extend({css:function(a,b){return W(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Jb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)
|
4 |
+
},a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:_b||gc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(kc(k,j.opts.specialEasing);g>f;f++)if(d=ec[f].call(j,a,k,j.opts))return d;return n.map(k,ic,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(lc,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],fc[c]=fc[c]||[],fc[c].unshift(b)},prefilter:function(a,b){b?ec.unshift(a):ec.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=lc(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&dc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(hc(b,!0),a,d,e)}}),n.each({slideDown:hc("show"),slideUp:hc("hide"),slideToggle:hc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(_b=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),_b=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ac||(ac=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(ac),ac=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e=z.createElement("div");e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=e.getElementsByTagName("a")[0],c=z.createElement("select"),d=c.appendChild(z.createElement("option")),b=e.getElementsByTagName("input")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==e.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=d.selected,l.enctype=!!z.createElement("form").enctype,c.disabled=!0,l.optDisabled=!d.disabled,b=z.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value,a=b=c=d=e=null}();var mc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.text(a)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nc,oc,pc=n.expr.attrHandle,qc=/^(?:checked|selected)$/i,rc=l.getSetAttribute,sc=l.input;n.fn.extend({attr:function(a,b){return W(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===L?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?oc:nc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(F);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?sc&&rc||!qc.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(rc?c:d)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),oc={set:function(a,b,c){return b===!1?n.removeAttr(a,c):sc&&rc||!qc.test(c)?a.setAttribute(!rc&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=pc[b]||n.find.attr;pc[b]=sc&&rc||!qc.test(b)?function(a,b,d){var e,f;return d||(f=pc[b],pc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,pc[b]=f),e}:function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),sc&&rc||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):nc&&nc.set(a,b,c)}}),rc||(nc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},pc.id=pc.name=pc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:nc.set},n.attrHooks.contenteditable={set:function(a,b,c){nc.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var tc=/^(?:input|select|textarea|button|object)$/i,uc=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return W(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):tc.test(a.nodeName)||uc.test(a.nodeName)&&a.href?0:-1}}}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var vc=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(F)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===L||"boolean"===c)&&(this.className&&n._data(this,"__className__",this.className),this.className=this.className||a===!1?"":n._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(vc," ").indexOf(b)>=0)return!0;return!1}}),n.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 contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var wc=n.now(),xc=/\?/,yc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(yc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var zc,Ac,Bc=/#.*$/,Cc=/([?&])_=[^&]*/,Dc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ec=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fc=/^(?:GET|HEAD)$/,Gc=/^\/\//,Hc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ic={},Jc={},Kc="*/".concat("*");try{Ac=location.href}catch(Lc){Ac=z.createElement("a"),Ac.href="",Ac=Ac.href}zc=Hc.exec(Ac.toLowerCase())||[];function Mc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(F)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nc(a,b,c,d){var e={},f=a===Jc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Oc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Pc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Qc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ac,type:"GET",isLocal:Ec.test(zc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Oc(Oc(a,n.ajaxSettings),b):Oc(n.ajaxSettings,a)},ajaxPrefilter:Mc(Ic),ajaxTransport:Mc(Jc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Dc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||Ac)+"").replace(Bc,"").replace(Gc,zc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(F)||[""],null==k.crossDomain&&(c=Hc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===zc[1]&&c[2]===zc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(zc[3]||("http:"===zc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),Nc(Ic,k,b,v),2===t)return v;h=k.global,h&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Fc.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(xc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Cc.test(e)?e.replace(Cc,"$1_="+wc++):e+(xc.test(e)?"&":"?")+"_="+wc++)),k.ifModified&&(n.lastModified[e]&&v.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&v.setRequestHeader("If-None-Match",n.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Kc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Nc(Jc,k,b,v)){v.readyState=1,h&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Pc(k,v,c)),u=Qc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(n.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!l.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||n.css(a,"display"))},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var Rc=/%20/g,Sc=/\[\]$/,Tc=/\r?\n/g,Uc=/^(?:submit|button|image|reset|file)$/i,Vc=/^(?:input|select|textarea|keygen)/i;function Wc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Sc.test(a)?d(a,e):Wc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Wc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Wc(c,a[c],b,e);return d.join("&").replace(Rc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Vc.test(this.nodeName)&&!Uc.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Tc,"\r\n")}}):{name:b.name,value:c.replace(Tc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&$c()||_c()}:$c;var Xc=0,Yc={},Zc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Yc)Yc[a](void 0,!0)}),l.cors=!!Zc&&"withCredentials"in Zc,Zc=l.ajax=!!Zc,Zc&&n.ajaxTransport(function(a){if(!a.crossDomain||l.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Xc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Yc[g],b=void 0,f.onreadystatechange=n.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Yc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function $c(){try{return new a.XMLHttpRequest}catch(b){}}function _c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=z.head||n("head")[0]||z.documentElement;return{send:function(d,e){b=z.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var ad=[],bd=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=ad.pop()||n.expando+"_"+wc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(bd.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&bd.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(bd,"$1"+e):b.jsonp!==!1&&(b.url+=(xc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,ad.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||z;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var cd=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&cd)return cd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h,a.length),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&n.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n});
|
js/iparcel/lib.js
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* i-parcel frontend lib for post scripts
|
3 |
+
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski <patryk.grudniewski@sabiosystem.com>
|
7 |
+
*/
|
8 |
+
var iparcelMage = {
|
9 |
+
displayEligibility: function(){
|
10 |
+
try{
|
11 |
+
$_ipar.fn.iparcel.ux.displayEligibility();
|
12 |
+
}catch(exception){}
|
13 |
+
},
|
14 |
+
ajax: {
|
15 |
+
post: function(sku, super_attribute, url){
|
16 |
+
var $jip = jQuery.noConflict();
|
17 |
+
var data = super_attribute+'sku='+sku;
|
18 |
+
$jip.ajax({
|
19 |
+
'url': url,
|
20 |
+
'data': data,
|
21 |
+
type: 'POST',
|
22 |
+
async: true,
|
23 |
+
success: function(data){
|
24 |
+
if (data){
|
25 |
+
$jip('.iparcelsku').text(data.sku);
|
26 |
+
|
27 |
+
iparcelPost.setStock('true');
|
28 |
+
|
29 |
+
var $options = $jip('.iparceloptions');
|
30 |
+
$options.empty();
|
31 |
+
$jip.each(data.attributes, function(key, value){
|
32 |
+
var $block = $jip('<div/>');
|
33 |
+
$block.attr('id',key);
|
34 |
+
$block.text(value);
|
35 |
+
$options.append($block);
|
36 |
+
});
|
37 |
+
|
38 |
+
$jip('.iparcelstockquantity').text(data.stock);
|
39 |
+
}
|
40 |
+
iparcelMage.displayEligibility();
|
41 |
+
}
|
42 |
+
});
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
js/iparcel/post.js
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Default i-parcel's post script
|
3 |
+
*
|
4 |
+
* @category Iparcel
|
5 |
+
* @package Iparcel_Shipping
|
6 |
+
* @author Patryk Grudniewski
|
7 |
+
*/
|
8 |
+
var iparcelPost = {
|
9 |
+
single: function(sku, url, qty){
|
10 |
+
var $jip = jQuery.noConflict();
|
11 |
+
iparcelPost.stock(qty);
|
12 |
+
url+='shippingip/ajax/configurable';
|
13 |
+
$jip(document).ready(function(){
|
14 |
+
var $sku = $jip("<div/>");
|
15 |
+
$sku.css("display","none");
|
16 |
+
$sku.attr("class","iparcelsku");
|
17 |
+
$sku.text(sku);
|
18 |
+
$jip('.add-to-cart').append($sku);
|
19 |
+
|
20 |
+
var $options = $jip("<div/>");
|
21 |
+
$options.css("display","none");
|
22 |
+
$options.attr("class","iparceloptions");
|
23 |
+
$jip('.add-to-cart').append($options);
|
24 |
+
|
25 |
+
var $stockqty = $jip("<div/>");
|
26 |
+
$stockqty.css("display","none");
|
27 |
+
$stockqty.attr("class","iparcelstockquantity");
|
28 |
+
$stockqty.text(qty);
|
29 |
+
$jip('.add-to-cart').append($stockqty);
|
30 |
+
|
31 |
+
var change = function(){
|
32 |
+
iparcelPost.setStock('false');
|
33 |
+
var validate = true;
|
34 |
+
var super_attribute = '';
|
35 |
+
$jip('.super-attribute-select').each(function(){
|
36 |
+
var $this = $jip(this);
|
37 |
+
if ($this.val().length == 0){
|
38 |
+
validate = false;
|
39 |
+
}
|
40 |
+
super_attribute+=$this.attr('name')+'='+$this.val()+'&';
|
41 |
+
});
|
42 |
+
if (!validate){
|
43 |
+
iparcelMage.displayEligibility();
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
iparcelMage.ajax.post(sku, super_attribute, url);
|
47 |
+
}
|
48 |
+
change();
|
49 |
+
$jip('.super-attribute-select').change(function(){
|
50 |
+
change();
|
51 |
+
});
|
52 |
+
});
|
53 |
+
},
|
54 |
+
stock: function(qty){
|
55 |
+
var $jip = jQuery.noConflict();
|
56 |
+
$jip(document).ready(function(){
|
57 |
+
var $stock = $jip("<div/>");
|
58 |
+
$stock.css("display","none");
|
59 |
+
$stock.attr("class","iparcelstock");
|
60 |
+
$stock.text(qty > 0 ? 'true' : 'false');
|
61 |
+
$jip('.add-to-cart').append($stock);
|
62 |
+
});
|
63 |
+
},
|
64 |
+
setStock: function(value){
|
65 |
+
jQuery('.iparcelstock').text(value);
|
66 |
+
},
|
67 |
+
sku_list: function(sku_list){
|
68 |
+
var $jip = jQuery.noConflict();
|
69 |
+
$jip(document).ready(function(){
|
70 |
+
$jip.each(sku_list, function(sku,name){
|
71 |
+
var $sku = $jip("<div/>");
|
72 |
+
$sku.css("display","none");
|
73 |
+
$sku.attr("class","iparcelsku");
|
74 |
+
$sku.text(sku);
|
75 |
+
$jip('.item>a[title="'+name+'"]').parent().find('.actions').append($sku);
|
76 |
+
});
|
77 |
+
});
|
78 |
+
},
|
79 |
+
stock_list: function(stock_list){
|
80 |
+
var $jip = jQuery.noConflict();
|
81 |
+
$jip(document).ready(function(){
|
82 |
+
$jip.each(stock_list, function(name,qty){
|
83 |
+
var $stock = $jip("<div/>");
|
84 |
+
$stock.css("display","none");
|
85 |
+
$stock.attr("class","iparcelstock");
|
86 |
+
$stock.text(qty > 0 ? 'true' : 'false');
|
87 |
+
$jip('.item>a[title="'+name+'"]').parent().find('.actions').append($stock);
|
88 |
+
|
89 |
+
var $stockQty = $jip("<div/>");
|
90 |
+
$stockQty.css('display','none');
|
91 |
+
$stockQty.attr('class','iparcelstockquantity');
|
92 |
+
$stockQty.text(qty);
|
93 |
+
$jip('.item>a[title="'+name+'"]').parent().find('.actions').append($stockQty);
|
94 |
+
});
|
95 |
+
});
|
96 |
+
}
|
97 |
+
}
|
media/font/code128.ttf
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>iparcel_connect</name>
|
4 |
+
<version>2.4.1.5</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Summary</summary>
|
10 |
+
<description>Description</description>
|
11 |
+
<notes>i-parcel Global Access Extension</notes>
|
12 |
+
<authors><author><name>Patryk Grudniewski</name><user>pgrudniewski</user><email>patryk.grudniewski@sabiocoders.com</email></author><author><name>Maciej Jarmuła</name><user>mjarmula</user><email>maciej.jarmula@sabiosystem.com</email></author></authors>
|
13 |
+
<date>2014-10-07</date>
|
14 |
+
<time>07:37:27</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="."><dir name="Iparcel"><dir name="Shipping"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Checkitems"><file name="Button.php" hash="3fd84bf9d108bf6bd685a903dc9f481c"/></dir><dir name="Mapping"><file name="Button.php" hash="c258c70a783f5175bf5d89234fde422e"/></dir></dir><dir name="Iparcel"><file name="Dashboard.php" hash="70f5cab243fd7a076c9adaf7c0e38757"/></dir><dir name="Logs"><file name="Grid.php" hash="07fdafbd7dcb42768e6c4632a6c550fe"/></dir><file name="Logs.php" hash="a165e882e3dd9d4f567b9548db6d4c4c"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="25eb21505aa91e8d21b2bf85e984ba85"/></dir><dir name="Invoice"><file name="Totals.php" hash="f1ca6fe7b9e4c269f4ad423a9489f11b"/></dir><dir name="Shipment"><dir name="View"><file name="Form.php" hash="0ab9ba2136fcf58898ae6a09315992f3"/><file name="Tracking.php" hash="ce269e77cd33f323c7df5655431f13de"/></dir></dir><file name="Totals.php" hash="3b3bd8e9cfe1c25fd200f2934203a4f8"/></dir></dir><dir name="Salesrule"><dir name="Rule"><file name="Sync.php" hash="0c112e8012b1552e777210896681fe7c"/></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="a7ecf1aa9ce6f630ba9a96bf51bb6350"/></dir><file name="Product.php" hash="741377869da5089c3dc5210e570812d5"/></dir><file name="Cpf.php" hash="b27d012e7d72d94065511865e3704898"/><dir name="Html"><dir name="Head"><file name="Iparcel.php" hash="affbc0197df7e2f278acd400da1ec730"/><file name="Jquery.php" hash="94178a9604c79ded9227b0d621bbfe98"/><file name="Post.php" hash="94e5cfa14a18cd92ec89c893943e53db"/></dir></dir><dir name="Payment"><file name="Info.php" hash="38ca3568e92ea58efb09b44931b865b9"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="65a60642a34b8a07647fe6ded1535a08"/></dir><dir name="Invoice"><file name="Totals.php" hash="01dd4224a342ece4b764637383f55b8c"/></dir><file name="Totals.php" hash="47581971cad89781df29a37c6542f8d5"/></dir></dir></dir><dir name="Helper"><dir name="Api"><file name="External.php" hash="173e8eea03200e50c386e9c4750a34d5"/></dir><file name="Api.php" hash="415e016826ede68766a5e8fda13705f6"/><file name="Data.php" hash="03ebb38af475053fb0e0e92df1cf4c97"/><file name="International.php" hash="1a0c3769f2736da5af124bd309615d55"/><dir name="Sales"><file name="Data.php" hash="d2b61bc5609092860d5fabb889559272"/></dir><file name="String.php" hash="e22caeea60053038641e250a9dd0cf98"/><file name="Tax.php" hash="0f2b7b5cbd8c53f1204def64c87a77c9"/></dir><dir name="Model"><dir name="Api"><dir name="External"><dir name="Sales"><file name="Order.php" hash="770ade941b8cb6c24b164ecd83530b9f"/></dir></dir><file name="Log.php" hash="88c1443918c13aec4991faec7a66bdee"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="9ac935dc4c480c593992573b1ad38322"/></dir><dir name="Catalog"><file name="Mapping.php" hash="238bf4f34621014b5c92d542916d7fe8"/><dir name="Product"><file name="Observer.php" hash="8b2e34f1afd45f8e5d1863d25f2b6fa0"/></dir></dir><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="fb840497ebb561ae48aecc26d01cf1b9"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="453e2a3aa27dc715a18043aaa4efda27"/><file name="Weekday.php" hash="48657e67f0ed06663219e81f67ab25b9"/></dir><dir name="Time"><file name="Hour.php" hash="4b245127d92ae776623f59ed0e0f9558"/><file name="Minute.php" hash="727b1bcae3a74683e367844fd3291b52"/></dir></dir><file name="Guid.php" hash="d8dab34428e6b73b28027b04827ad3f1"/><dir name="Script"><file name="Js.php" hash="1836896d995d93b96508290409d341c3"/></dir></dir><dir name="Cpf"><file name="Order.php" hash="0e4e23b32211a22378a92c49b9f92369"/><file name="Quote.php" hash="83512346a79c739d7654e67d159ff884"/></dir><file name="Cpf.php" hash="e4df52c78f87931b7dc17269a8407f8a"/><file name="Parcel.php" hash="49cd6442d3605cd100840d7d3d18ca7b"/><dir name="Payment"><file name="Iparcel.php" hash="4a1f0f56d5c0c331d16f0b13d9fa1a91"/></dir><dir name="Resource"><dir name="Cpf"><file name="Collection.php" hash="9eaa178f4ad4a1c1bb6a1349e31fff9f"/><dir name="Order"><file name="Collection.php" hash="80f857487b8eecfa9d8aa3802b5e7880"/></dir><file name="Order.php" hash="28a4c0b6e0f077a81cd84e75eb414f3c"/><dir name="Quote"><file name="Collection.php" hash="63f11a1f00016ca3de879e6f1da5c3a5"/></dir><file name="Quote.php" hash="acc75e3e583ac3082cefd0edddd1af6d"/></dir><file name="Cpf.php" hash="20cc2a00effa23d63989afc72fb2cfef"/><dir name="Parcel"><file name="Collection.php" hash="ce9cdf56464a1233e7d86ecc419318bd"/></dir><file name="Parcel.php" hash="d818f043bab60faeda2414281e723258"/><file name="Setup.php" hash="5d7fcf77d90c05abe170fa1666bed876"/><dir name="Tax"><dir name="Totals"><file name="Collection.php" hash="fad71177f9fc5c18a51659216781c8a6"/></dir><file name="Totals.php" hash="3673353ccaffa6b03b700cd793093c59"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Observer.php" hash="4b9bb22dc7c4cb42f9795d38479e891e"/><dir name="Shipment"><file name="Observer.php" hash="20f3458d033726667a3df49fa5d788fe"/></dir></dir><file name="Order.php" hash="dfa017ef6c15c5083c91eb62172b9476"/><dir name="Quote"><file name="Observer.php" hash="978329f9fe6776da26a75424633ea30c"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="6fdb4fa44c6dd50b7dceae729b49ac4f"/></dir><file name="Mode.php" hash="37d29183ddd30a4da6727836a01b4f3e"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="05da459a04e7565aeaacd582ce1f1a6a"/></dir><file name="Attribute.php" hash="f9b5953fadafc676014e78755abcb3d0"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="81e4d5b013a56c3a82ce2ae885b63318"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="95eef49f59423c0ae2df2f20d7a56c2d"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="cc06ac85e4e99776853e90acc8fd8fa4"/></dir></dir></dir></dir><dir name="Tax"><file name="Calculation.php" hash="bd8c6bc6c249e0f873cd65db150bd0e8"/><dir name="Totals"><file name="Abstract.php" hash="5b8edf21501529ef741dfc35a5077e84"/><dir name="Duty"><file name="Creditmemo.php" hash="0e444b977f39602a0fddf7fc6d97e2b9"/><file name="Invoice.php" hash="3801efca779d34904a7ad019767afcca"/><file name="Quote.php" hash="e2d66074efddc16daea8e9ee5ed5d24d"/></dir><dir name="Tax"><file name="Creditmemo.php" hash="d56d7de09d71496eaa57a74d215f504a"/><file name="Invoice.php" hash="9acc37b2ec8615910246f19eb435a566"/><file name="Quote.php" hash="6d7d8d2bb9fce1ba3d7757ededd1b3ac"/></dir><dir name="Taxduty"><file name="Creditmemo.php" hash="947113f2b6d4c6381ac19e17ea438928"/><file name="Invoice.php" hash="ee1374d7fa9b7219a1cfd6dffcf7f2c8"/><file name="Quote.php" hash="eb245bc094a7ecbc798bafd2bcbaa06f"/></dir></dir><file name="Totals.php" hash="f0e3be01e88a0123e189e2e36aec351c"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="e52eb2deb7b12d04f2a939e2d8c76baf"/><dir name="Sync"><file name="AjaxController.php" hash="5f4a48c904796bb8e705f190cc410a8c"/></dir><file name="SyncController.php" hash="bcb67a0a9cf037ecfa0e24f9c501dfb9"/></dir><file name="AjaxController.php" hash="fe0a406a495b770b31141b0000310f47"/><file name="DevController.php" hash="6d038a7966504f7add2782be08adda39"/><file name="InternationalController.php" hash="54c7d62aa8acea6c4c308ddfc9726f63"/><file name="OrderController.php" hash="83f5cf75d77c10e2ebaa591073973961"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c341465d8c67fa8a4f16efe48d939917"/><file name="config.xml" hash="5841812880ec42af94a52afc9a84e3cc"/><file name="system.xml" hash="90476240dbc3ce8a47bae841b0403519"/></dir><dir name="sql"><dir name="shippingip_setup"><file name="mysql4-install-0.2.0.php" hash="38e0aaa7ab303df1e1cfab49d4ae6ab5"/><file name="mysql4-install-0.3.0.php" hash="38e0aaa7ab303df1e1cfab49d4ae6ab5"/><file name="mysql4-install-2.3.4.2.php" hash="cee98377d2b270582d6d626789f5a946"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="b52a574e73039d731d06510a24ad28e2"/><file name="mysql4-upgrade-0.3.0-0.3.1.php" hash="ee096cbfd164ac5d9e18ff0c417b01b5"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="2d0f66de3a04d7f0f4dc5a6f51dbc4ed"/><file name="mysql4-upgrade-0.3.2-2.0.0.php" hash="745afe83a490a7373300b7c6f8229109"/><file name="mysql4-upgrade-2.0.0-2.3.4.2.php" hash="3859c1e7610e198b1b526d2ce62d3ddc"/><file name="mysql4-upgrade-2.3.4.2-2.3.4.4.php" hash="0d43090401db3b53c7bb350557edc983"/><file name="mysql4-upgrade-2.3.4.3-2.3.4.4.php" hash="0d43090401db3b53c7bb350557edc983"/><file name="mysql4-upgrade-2.4.0.3-2.4.1.0.php" hash="99fd4fec75dc5e2d052a08eaa7d92c67"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="."><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="externalsales.xml" hash="8e47661893cbd491d14332af3cb5fdd3"/></dir><dir name="template"><dir name="iparcel"><dir name="sales"><dir name="order"><dir name="shipment"><dir name="view"><file name="tracking.phtml" hash="8e7db62fb7a6afdf4ecac2046cb143bc"/></dir></dir></dir></dir><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="38b9ea2cc01467c8221ed2540a63062a"/><file name="checkitems.phtml" hash="b0ed24b77d2ccd04c0c48209bac7d2e1"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="externalshipping.xml" hash="af11233d09ca127c72a6efef215893f0"/></dir><dir name="template"><dir name="shippingip"><file name="cpf.phtml" hash="c5ce5632e329af430265d1a069f1549b"/><dir name="html"><dir name="head"><file name="iparcel.phtml" hash="2c6ebcb17c00043066afa773c97563bf"/><file name="jquery.phtml" hash="9c7eb5b39de8e0a7821607fa5985e888"/><file name="post.phtml" hash="997d566fa62b8d7a575422d3434d2eb0"/></dir></dir><dir name="post"><file name="list.phtml" hash="8807f5a2dfd7efb9d18367aaf6bcf164"/></dir><file name="post.phtml" hash="06a01a4e559474c66956c247cbd0acf3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="."><dir name="modules"><file name="Iparcel_Shipping.xml" hash="82c0c0b16f4647a662536274f17f5d18"/></dir></dir></target><target name="mage"><dir name="."><dir name="js"><dir name="iparcel"><dir name="adminhtml"><file name="label.js" hash="4078e7d784a59362c7d3b53be80507fe"/><file name="sync.js" hash="f50716af0dde3aa6ce2d030f37ab9e0b"/></dir><file name="cpf.js" hash="5cf13252eae4218a80548fa01b0f6d02"/><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/><file name="lib.js" hash="e164073ee28124072703a6fc88acd3dc"/><file name="post.js" hash="27c649cb11499bbb7139f7d157282bd6"/></dir></dir></dir></target><target name="magemedia"><dir name="."><dir name="font"><file name="code128.ttf" hash="8ffedc82f9b9a02f4016f502ab30117e"/></dir></dir></target><target name="mageskin"><dir name="."><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/iparcel/ajaxSync.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
*{margin: 0; padding: 0;}
|
2 |
+
#starting{display: block;}
|
3 |
+
#error{background-color: #c33; color: #fff;}
|
4 |
+
*[id="page:main-container"] div{background-color: #8cd9cd; margin: 5px 0; padding: 5px; font-family: sans-serif; font-size: 12px; display: none;}
|