Version Notes
Changed attribute within the shipment request
Download this release
Release Info
Developer | Karen Baker |
Extension | WebShopApps_DespatchBay |
Version | 1.0.5 |
Comparing to | |
See all releases |
Version 1.0.5
- app/code/community/Webshopapps/Adminshortcut/Helper/Data.php +35 -0
- app/code/community/Webshopapps/Adminshortcut/changelog.txt +1 -0
- app/code/community/Webshopapps/Adminshortcut/etc/adminhtml.xml +88 -0
- app/code/community/Webshopapps/Adminshortcut/etc/config.xml +44 -0
- app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/Carrier/About.php +39 -0
- app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/Carrier/Refreshcarriers.php +58 -0
- app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/Sales/Order/Shipment/Packaging.php +95 -0
- app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/System/Config/Form/Field/Heading.php +32 -0
- app/code/community/Webshopapps/Despatchbay/Helper/Data.php +90 -0
- app/code/community/Webshopapps/Despatchbay/Model/Adminhtml/System/Config/Source/Environmentscope.php +39 -0
- app/code/community/Webshopapps/Despatchbay/Model/Carrier/Convert/ShipperMapper.php +218 -0
- app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay.php +863 -0
- app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay/Source/Freemethod.php +35 -0
- app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay/Source/Labelformat.php +33 -0
- app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay/Source/Method.php +33 -0
- app/code/community/Webshopapps/Despatchbay/Model/Observer.php +132 -0
- app/code/community/Webshopapps/Despatchbay/Model/Shipping/Shipping.php +103 -0
- app/code/community/Webshopapps/Despatchbay/changelog.txt +5 -0
- app/code/community/Webshopapps/Despatchbay/controllers/AdminhtmlController.php +33 -0
- app/code/community/Webshopapps/Despatchbay/controllers/ShipmentController.php +201 -0
- app/code/community/Webshopapps/Despatchbay/etc/config.xml +127 -0
- app/code/community/Webshopapps/Despatchbay/etc/system.xml +269 -0
- app/code/community/Webshopapps/Despatchbay/etc/wsdl/Despatchbay/Shippingv11.wsdl +140 -0
- app/code/community/Webshopapps/Despatchbay/etc/wsdl/Despatchbay/Trackingv11.wsdl +63 -0
- app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/Sales/Order/Create/Shipping/Method/Form.php +86 -0
- app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/System/Config/Form/Field/Exportmatrix.php +59 -0
- app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/System/Config/Form/Field/Heading.php +50 -0
- app/code/community/Webshopapps/Wsacommon/Block/Sales/Order/Grid.php +127 -0
- app/code/community/Webshopapps/Wsacommon/Helper/.DS_Store +0 -0
- app/code/community/Webshopapps/Wsacommon/Helper/Cache.php +110 -0
- app/code/community/Webshopapps/Wsacommon/Helper/Data.php +164 -0
- app/code/community/Webshopapps/Wsacommon/Helper/Log.php +173 -0
- app/code/community/Webshopapps/Wsacommon/Helper/Shipping.php +552 -0
- app/code/community/Webshopapps/Wsacommon/Helper/Template.php +71 -0
- app/code/community/Webshopapps/Wsacommon/Model/Export/Csv.php +174 -0
- app/code/community/Webshopapps/Wsacommon/Model/Resource/Resource.php +62 -0
- app/code/community/Webshopapps/Wsacommon/Model/Sales/Quote/Address/Rate.php +57 -0
- app/code/community/Webshopapps/Wsacommon/Model/Shipping/Carrier/Baseabstract.php +249 -0
- app/code/community/Webshopapps/Wsacommon/Model/Shipping/Shipping.php +298 -0
- app/code/community/Webshopapps/Wsacommon/Model/Usa/Shipping/Carrier/Ups.php +50 -0
- app/code/community/Webshopapps/Wsacommon/changelog.txt +92 -0
- app/code/community/Webshopapps/Wsacommon/controllers/System/ConfigController.php +48 -0
- app/code/community/Webshopapps/Wsacommon/etc/config.xml +86 -0
- app/code/community/Webshopapps/Wsacommontest/Test/Helper/Totalstest.php +72 -0
- app/code/community/Webshopapps/Wsacommontest/Test/Helper/_data/fx-config.yaml +61 -0
- app/code/community/Webshopapps/Wsacommontest/etc/config.xml +15 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log.php +69 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/Grid.php +167 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/Grid/Renderer/Actions.php +81 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/View.php +51 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Code.php +49 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Notice.php +68 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Severity.php +68 -0
- app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/System/Config/Form/Fieldset/Modules/DisableLogging.php +146 -0
- app/code/community/Webshopapps/Wsalogger/Helper/Data.php +77 -0
- app/code/community/Webshopapps/Wsalogger/Helper/Log.php +147 -0
- app/code/community/Webshopapps/Wsalogger/Model/Log.php +143 -0
- app/code/community/Webshopapps/Wsalogger/Model/Mysql4/Log.php +113 -0
- app/code/community/Webshopapps/Wsalogger/Model/Mysql4/Log/Collection.php +65 -0
- app/code/community/Webshopapps/Wsalogger/Model/Observer.php +104 -0
- app/code/community/Webshopapps/Wsalogger/Model/System/Config/Source/Severities.php +63 -0
- app/code/community/Webshopapps/Wsalogger/changelog.txt +11 -0
- app/code/community/Webshopapps/Wsalogger/controllers/Adminhtml/LogController.php +244 -0
- app/code/community/Webshopapps/Wsalogger/controllers/IndexController.php +56 -0
- app/code/community/Webshopapps/Wsalogger/etc/adminhtml.xml +84 -0
- app/code/community/Webshopapps/Wsalogger/etc/config.xml +146 -0
- app/code/community/Webshopapps/Wsalogger/etc/system.xml +161 -0
- app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.0.php +50 -0
- app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.1.php +52 -0
- app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.2.php +52 -0
- app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-upgrade-1.0.0-1.0.1.php +29 -0
- app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-upgrade-1.0.1-1.0.2.php +51 -0
- app/design/adminhtml/default/default/layout/webshopapps_despatchbay.xml +37 -0
- app/design/adminhtml/default/default/layout/webshopapps_wsalogger.xml +35 -0
- app/design/adminhtml/default/default/template/webshopapps_despatchbay/sales/order/shipment/create/items.phtml +136 -0
- app/design/adminhtml/default/default/template/webshopapps_despatchbay/sales/order/shipment/view/form.phtml +115 -0
- app/design/adminhtml/default/default/template/webshopapps_despatchbay/system/config/refreshcarriers.phtml +49 -0
- app/etc/modules/Webshopapps_Despatchbay.xml +12 -0
- app/etc/modules/Webshopapps_Wsacommon.xml +9 -0
- app/etc/modules/Webshopapps_Wsalogger.xml +9 -0
- app/locale/en_US/template/email/webshopapps_log_email.html +15 -0
- lib/Shipper/Shipper.php +142 -0
- lib/ShipperHQ/CHANGELOG +2 -0
- lib/ShipperHQ/Checkout/Cart.php +160 -0
- lib/ShipperHQ/Checkout/Item.php +628 -0
- lib/ShipperHQ/Checkout/ItemAttribute.php +83 -0
- lib/ShipperHQ/README.md +4 -0
- lib/ShipperHQ/Shipping/Accessorials.php +61 -0
- lib/ShipperHQ/Shipping/Address.php +201 -0
- lib/ShipperHQ/User/Credentials.php +102 -0
- lib/ShipperHQ/User/SiteDetails.php +114 -0
- lib/ShipperHQ/WS/Client/WebServiceClient.php +41 -0
- lib/ShipperHQ/WS/Request/AbstractWebServiceRequest.php +48 -0
- lib/ShipperHQ/WS/Request/Rate/RateRequest.php +77 -0
- lib/ShipperHQ/WS/Request/UPS/registration/UPSRegistrationRequest.php +191 -0
- lib/ShipperHQ/WS/Request/WebServiceRequest.php +20 -0
- lib/ShipperHQ/WS/Response/AbstractWebServiceResponse.php +59 -0
- lib/ShipperHQ/WS/Response/ResponseSummary.php +70 -0
- lib/ShipperHQ/WS/Response/UPS/Registration/UPSRegistrationResponse.php +13 -0
- lib/ShipperHQ/WS/Response/WebServiceError.php +76 -0
- lib/ShipperHQ/WS/Response/WebServiceResponse.php +16 -0
- package.xml +18 -0
- skin/adminhtml/default/default/wsa/images/WSA_OfficialLogo_HorizontalLockup.png +0 -0
- skin/adminhtml/default/default/wsa/images/WSA_OfficialLogo_Mark.png +0 -0
- skin/adminhtml/default/default/wsa/images/WSA_avatar.png +0 -0
- skin/adminhtml/default/default/wsa/images/despatch_bay_pro_logo.png +0 -0
app/code/community/Webshopapps/Adminshortcut/Helper/Data.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Shipping data helper
|
30 |
+
*/
|
31 |
+
class Webshopapps_Adminshortcut_Helper_Data extends Mage_Core_Helper_Abstract
|
32 |
+
{
|
33 |
+
|
34 |
+
|
35 |
+
}
|
app/code/community/Webshopapps/Adminshortcut/changelog.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
1.0 - Initial release with hardcoded links
|
app/code/community/Webshopapps/Adminshortcut/etc/adminhtml.xml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Webshopapps
|
23 |
+
* @package Webshopapps_Boxmenu
|
24 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
25 |
+
* Copyright, 2013, Zowta, LLC - US license
|
26 |
+
* @license http://www.webshopapps.com/license/license.txt
|
27 |
+
* @author Karen Baker <sales@webshopapps.com>
|
28 |
+
*/
|
29 |
+
-->
|
30 |
+
<config>
|
31 |
+
<menu>
|
32 |
+
<adminshortcut>
|
33 |
+
<title>Shortcuts</title>
|
34 |
+
<sort_order>200</sort_order>
|
35 |
+
<children>
|
36 |
+
<shipping_methods translate="title" module="adminshortcut">
|
37 |
+
<title>Shipping Methods</title>
|
38 |
+
<action>adminhtml/system_config/edit/section/carriers</action>
|
39 |
+
</shipping_methods>
|
40 |
+
<shipping_settings translate="title" module="adminshortcut">
|
41 |
+
<title>Shipping Settings</title>
|
42 |
+
<action>adminhtml/system_config/edit/section/shipping</action>
|
43 |
+
</shipping_settings>
|
44 |
+
<attributes translate="title" module="adminshortcut">
|
45 |
+
<title>Attributes</title>
|
46 |
+
<action>adminhtml/catalog_product_attribute</action>
|
47 |
+
</attributes>
|
48 |
+
<logger translate="title" module="adminshortcut">
|
49 |
+
<title>WebShopApps Logger</title>
|
50 |
+
<action>adminhtml/system_config/edit/section/wsalogmenu</action>
|
51 |
+
</logger>
|
52 |
+
<dev_logger translate="title" module="adminshortcut">
|
53 |
+
<title>Developer Logging</title>
|
54 |
+
<action>adminhtml/system_config/edit/section/dev</action>
|
55 |
+
</dev_logger>
|
56 |
+
</children>
|
57 |
+
</adminshortcut>
|
58 |
+
</menu>
|
59 |
+
<acl>
|
60 |
+
<resources>
|
61 |
+
<admin>
|
62 |
+
<children>
|
63 |
+
<adminshortcut>
|
64 |
+
<title>Shortcuts</title>
|
65 |
+
<sort_order>200</sort_order>
|
66 |
+
<children>
|
67 |
+
<shipping_methods translate="title">
|
68 |
+
<title>Shipping Methods</title>
|
69 |
+
</shipping_methods>
|
70 |
+
<shipping_methods translate="title">
|
71 |
+
<title>Shipping Settings</title>
|
72 |
+
</shipping_methods>
|
73 |
+
<attributes translate="title">
|
74 |
+
<title>Attributes</title>
|
75 |
+
</attributes>
|
76 |
+
<logger translate="title">
|
77 |
+
<title>WebShopApps Logger</title>
|
78 |
+
</logger>
|
79 |
+
<dev_logger translate="title">
|
80 |
+
<title>Developer Logging</title>
|
81 |
+
</dev_logger>
|
82 |
+
</children>
|
83 |
+
</adminshortcut>
|
84 |
+
</children>
|
85 |
+
</admin>
|
86 |
+
</resources>
|
87 |
+
</acl>
|
88 |
+
</config>
|
app/code/community/Webshopapps/Adminshortcut/etc/config.xml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
@category Webshopapps
|
23 |
+
* @package Webshopapps_Wsavalidation
|
24 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
25 |
+
* Copyright, 2013, Zowta, LLC - US license
|
26 |
+
* @license http://www.webshopapps.com/license/license.txt
|
27 |
+
* @author Karen Baker <sales@webshopapps.com
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
-->
|
31 |
+
<config>
|
32 |
+
<modules>
|
33 |
+
<Webshopapps_Adminshortcut>
|
34 |
+
<version>0.0.1</version>
|
35 |
+
</Webshopapps_Adminshortcut>
|
36 |
+
</modules>
|
37 |
+
<global>
|
38 |
+
<helpers>
|
39 |
+
<adminshortcut>
|
40 |
+
<class>Webshopapps_Adminshortcut_Helper</class>
|
41 |
+
</adminshortcut>
|
42 |
+
</helpers>
|
43 |
+
</global>
|
44 |
+
</config>
|
app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/Carrier/About.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 28/04/2014
|
10 |
+
* Time 15:57
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Block_Adminhtml_Carrier_About extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Return header comment part of html for fieldset
|
20 |
+
*
|
21 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
protected function _getHeaderCommentHtml($element)
|
25 |
+
{
|
26 |
+
$beforeDiv = '<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">';
|
27 |
+
$dbHtml = '<div class= "location left"><img style="height: 36px; padding: 0px 0px;" class="logo" src="'.$this->getSkinUrl('wsa/images/despatch_bay_pro_logo.png') .'"/></div>';
|
28 |
+
$wsaHtml = '<div class= "location left"><img style="height: 36px; padding: 0px 0px;" class="logo" src="'.$this->getSkinUrl('wsa/images/WSA_OfficialLogo_HorizontalLockup.png') .'"/></div>';
|
29 |
+
$wsaText = Mage::helper('webshopapps_despatchbay')->__('This extension is provided by WebShopApps, developers of Powerful Shipping Solutions for Magento.<br />
|
30 |
+
Visit <a href="http://www.webshopapps.com" target="_blank">www.WebShopApps.com</a> to browse our catalog of extensions and learn more about us.<br />');
|
31 |
+
|
32 |
+
$afterDiv = '</div>';
|
33 |
+
$wsa = '<div class="comment">' .$wsaHtml .$beforeDiv .$wsaText .$afterDiv;
|
34 |
+
$comment = $element->getComment()
|
35 |
+
? $dbHtml .$beforeDiv .$element->getComment() .$afterDiv .'</div>'
|
36 |
+
: '</div>';
|
37 |
+
return $wsa .$comment;
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/Carrier/Refreshcarriers.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 15/04/2014
|
10 |
+
* Time 10:16
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Block_Adminhtml_Carrier_Refreshcarriers extends
|
17 |
+
Mage_Adminhtml_Block_System_Config_Form_Field
|
18 |
+
{
|
19 |
+
protected function _prepareLayout()
|
20 |
+
{
|
21 |
+
parent::_prepareLayout();
|
22 |
+
if (!$this->getTemplate()) {
|
23 |
+
$this->setTemplate('webshopapps_despatchbay/system/config/refreshcarriers.phtml');
|
24 |
+
}
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Unset some non-related element parameters
|
30 |
+
*
|
31 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
32 |
+
* @return string
|
33 |
+
*/
|
34 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
35 |
+
{
|
36 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
37 |
+
return parent::render($element);
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get the button and scripts contents
|
42 |
+
*
|
43 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
47 |
+
{
|
48 |
+
$originalData = $element->getOriginalData();
|
49 |
+
$this->addData(
|
50 |
+
array(
|
51 |
+
'button_label' => Mage::helper('customer')->__($originalData['button_label']),
|
52 |
+
'html_id' => $element->getHtmlId(),
|
53 |
+
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('webshopapps_despatchbay/adminhtml/refreshcarriers')
|
54 |
+
));
|
55 |
+
|
56 |
+
return $this->_toHtml();
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/Sales/Order/Shipment/Packaging.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 16/04/2014
|
10 |
+
* Time 15:54
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Block_Adminhtml_Sales_Order_Shipment_Packaging
|
17 |
+
extends Mage_Adminhtml_Block_Sales_Order_Shipment_Packaging
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* Override this method to allow Despatch Bay for orders that used a alternative carrier
|
21 |
+
*
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
public function getContainers()
|
25 |
+
{
|
26 |
+
if(!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Despatchbay', 'carriers/despatchbay/labels')) {
|
27 |
+
return parent::getContainers();
|
28 |
+
}
|
29 |
+
|
30 |
+
$order = $this->getShipment()->getOrder();
|
31 |
+
$storeId = $this->getShipment()->getStoreId();
|
32 |
+
$carrier = $order->getShippingCarrier();
|
33 |
+
$shippingMethodCode = trim($order->getShippingMethod(), 'despatchbay_DB_');
|
34 |
+
$arrayKeyCode = 'despatchbay#'.$shippingMethodCode;
|
35 |
+
|
36 |
+
if ($carrier) {
|
37 |
+
$params = new Varien_Object(
|
38 |
+
array(
|
39 |
+
'method' => $order->getShippingMethod(true)->getMethod(),
|
40 |
+
'postalcode_recipient' => $order->getShippingAddress()->getPostcode(),
|
41 |
+
)
|
42 |
+
);
|
43 |
+
|
44 |
+
$despatchbayCarrier = Mage::getModel('webshopapps_despatchbay/carrier_despatchbay');
|
45 |
+
$containerTypes[$despatchbayCarrier->getCarrierCode()] = $despatchbayCarrier->getContainerTypes($params);
|
46 |
+
|
47 |
+
if($carrier->getCarrierCode() != Mage::getModel('webshopapps_despatchbay/carrier_despatchbay')->getCarrierCode()) {
|
48 |
+
$containerTypes[$carrier->getCarrierCode()] = $carrier->getContainerTypes();
|
49 |
+
}
|
50 |
+
|
51 |
+
$containers = array();
|
52 |
+
|
53 |
+
foreach ($containerTypes as $carrierCode=>$containerArray) {
|
54 |
+
$carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/title', $storeId);
|
55 |
+
foreach($containerArray as $containerCode=>$containerName) {
|
56 |
+
$containers[$carrierCode.'#'.$containerCode] = $carrierTitle .' : ' .$containerName;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
//Set the first element of the array to the chosen shipping method
|
61 |
+
if(array_key_exists($arrayKeyCode,$containers)){
|
62 |
+
$containers = array($arrayKeyCode => $containers[$arrayKeyCode]) + $containers;
|
63 |
+
}
|
64 |
+
|
65 |
+
$arr = $containers;
|
66 |
+
|
67 |
+
return $arr;
|
68 |
+
}
|
69 |
+
return array();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Override this method to disable the dimensional input for Despatch Bay boxes
|
74 |
+
*
|
75 |
+
* @return array
|
76 |
+
*/
|
77 |
+
protected function _getCustomizableContainers()
|
78 |
+
{
|
79 |
+
if(!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Despatchbay', 'carriers/despatchbay/labels')) {
|
80 |
+
return parent::_getCustomizableContainers();
|
81 |
+
}
|
82 |
+
|
83 |
+
$carrier = $this->getShipment()->getOrder()->getShippingCarrier();
|
84 |
+
$types = array();
|
85 |
+
if ($carrier) {
|
86 |
+
$types = $carrier->getCustomizableContainerTypes();
|
87 |
+
}
|
88 |
+
|
89 |
+
if(count($types)) {
|
90 |
+
return $types;
|
91 |
+
} else {
|
92 |
+
return Mage::getModel('webshopapps_despatchbay/carrier_despatchbay')->getCustomizableContainerTypes();
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Block/Adminhtml/System/Config/Form/Field/Heading.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 01/05/2014
|
10 |
+
* Time 15:35
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Block_Adminhtml_System_Config_Form_Field_Heading extends Mage_Adminhtml_Block_Abstract
|
17 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* Render element html
|
21 |
+
*
|
22 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
26 |
+
{
|
27 |
+
$useContainerId = $element->getData('use_container_id');
|
28 |
+
return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
|
29 |
+
$element->getHtmlId(), $element->getLabel()
|
30 |
+
);
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Helper/Data.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebShopApps Shipping Module
|
4 |
+
*
|
5 |
+
* @category WebShopApps
|
6 |
+
* @package WebShopApps_Despatchbay
|
7 |
+
* User Joshua Stewart
|
8 |
+
* Date 15/04/2014
|
9 |
+
* Time 10:16
|
10 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
11 |
+
* Copyright, 2014, Zowta, LLC - US license
|
12 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class Webshopapps_Despatchbay_Helper_Data extends Mage_Core_Helper_Abstract
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Returns url to use - live if present, otherwise dev
|
19 |
+
* @return array
|
20 |
+
*/
|
21 |
+
private function getGatewayUrl()
|
22 |
+
{
|
23 |
+
$path = trim(Mage::getStoreConfig('carriers/despatchbay/url'));
|
24 |
+
return rtrim($path, '/') . '/';
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Retrieve url for getting allowed methods
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function getAllowedMethodGatewayUrl()
|
32 |
+
{
|
33 |
+
return $this->getGatewayUrl().'allowed_methods';
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Retrieve url for getting shipping rates
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public function getRateGatewayUrl()
|
41 |
+
{
|
42 |
+
return $this->getGatewayUrl().'rates';
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
/*
|
47 |
+
* *Retrieve url for retrieving attributes
|
48 |
+
*/
|
49 |
+
public function getCheckSynchronizedUrl()
|
50 |
+
{
|
51 |
+
return $this->getGatewayUrl().'attributes/check';
|
52 |
+
}
|
53 |
+
|
54 |
+
/*
|
55 |
+
* *Retrieve url for retrieving attributes
|
56 |
+
*/
|
57 |
+
public function getSetSynchronizedUrl()
|
58 |
+
{
|
59 |
+
return $this->getGatewayUrl().'attributes/set/updated';
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Saves the carrier title to core_config_data
|
64 |
+
* Need to do this as doesnt read from the shipping rate quote table!
|
65 |
+
* @param $carrierCode
|
66 |
+
* @param $carrierTitle
|
67 |
+
*/
|
68 |
+
public function saveCarrierTitle($carrierCode,$carrierTitle)
|
69 |
+
{
|
70 |
+
$this->saveConfig('carriers/'.$carrierCode.'/title',$carrierTitle);
|
71 |
+
}
|
72 |
+
|
73 |
+
public function saveAllMethods($methods)
|
74 |
+
{
|
75 |
+
$this->saveConfig('carriers/despatchbay/all_methods',$methods);
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Save config value to db
|
80 |
+
* @param $path
|
81 |
+
* @param $value
|
82 |
+
* @param string $scope
|
83 |
+
* @param int $scopeId
|
84 |
+
* @return $this
|
85 |
+
*/
|
86 |
+
public function saveConfig($path, $value, $scope = 'default', $scopeId = 0)
|
87 |
+
{
|
88 |
+
Mage::getConfig()->saveConfig(rtrim($path, '/'), $value, $scope, $scopeId);
|
89 |
+
}
|
90 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Adminhtml/System/Config/Source/Environmentscope.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 14/04/2014
|
10 |
+
* Time 18:06
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Model_Adminhtml_System_Config_Source_Environmentscope
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
array(
|
22 |
+
'value' => Shipper_Shipper::LIVE,
|
23 |
+
'label' => Mage::helper('webshopapps_despatchbay')->__('Live')
|
24 |
+
),
|
25 |
+
array(
|
26 |
+
'value' => Shipper_Shipper::DEV,
|
27 |
+
'label' => Mage::helper('webshopapps_despatchbay')->__('Development')
|
28 |
+
),
|
29 |
+
array(
|
30 |
+
'value' => Shipper_Shipper::TEST,
|
31 |
+
'label' => Mage::helper('webshopapps_despatchbay')->__('Test')
|
32 |
+
),
|
33 |
+
array(
|
34 |
+
'value' => Shipper_Shipper::INTEGRATION,
|
35 |
+
'label' => Mage::helper('webshopapps_despatchbay')->__('Integration')
|
36 |
+
),
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Carrier/Convert/ShipperMapper.php
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 14/04/2014
|
10 |
+
* Time 17:51
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
include_once 'ShipperHQ/User/Credentials.php';
|
17 |
+
include_once 'ShipperHQ/User/SiteDetails.php';
|
18 |
+
|
19 |
+
class Webshopapps_Despatchbay_Model_Carrier_Convert_ShipperMapper
|
20 |
+
{
|
21 |
+
protected static $ecommerceType = 'magento';
|
22 |
+
protected static $_stdAttributeNames = array(
|
23 |
+
'shipperhq_free_shipping',
|
24 |
+
'shipperhq_shipping_price',
|
25 |
+
'shipperhq_additional_price',
|
26 |
+
'shipperhq_handling_price',
|
27 |
+
'shipperhq_carrier_code',
|
28 |
+
);
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Set up values for ShipperHQ getRates()
|
32 |
+
*
|
33 |
+
* @param $magentoRequest
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public static function getShipperTranslation($magentoRequest)
|
37 |
+
{
|
38 |
+
$shipperHQRequest['credentials'] = self::getCredentials();
|
39 |
+
$shipperHQRequest['siteDetails'] = self::getSiteDetails();
|
40 |
+
$shipperHQRequest['cart'] = self::getCartDetails($magentoRequest);
|
41 |
+
$shipperHQRequest['destination'] = self::getDestination($magentoRequest);
|
42 |
+
$shipperHQRequest['origin'] = self::getOrigin($magentoRequest);
|
43 |
+
|
44 |
+
return $shipperHQRequest;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Set up values for ShipperHQ getAllowedMethods()
|
49 |
+
*
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public static function getCredentialsTranslation()
|
53 |
+
{
|
54 |
+
$shipperHQRequest['credentials'] = self::getCredentials();
|
55 |
+
$shipperHQRequest['siteDetails'] = self::getSiteDetails();
|
56 |
+
|
57 |
+
return $shipperHQRequest;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Return credentials for ShipperHQ login
|
62 |
+
*
|
63 |
+
* @return array
|
64 |
+
*/
|
65 |
+
public static function getCredentials()
|
66 |
+
{
|
67 |
+
$dbUser = Mage::getStoreConfig('carriers/despatchbay/despatch_api_user');
|
68 |
+
$dbKey = Mage::getStoreConfig('carriers/despatchbay/despatch_api_key');
|
69 |
+
$credentials = new \ShipperHQ\User\Credentials('2bc3bf8ef59577573757096baee2fc99', $dbKey, $dbUser);
|
70 |
+
|
71 |
+
return $credentials;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Format cart for from shipper for Magento
|
76 |
+
*
|
77 |
+
* @param $request
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
public static function getCartDetails($request)
|
81 |
+
{
|
82 |
+
$cart = array();
|
83 |
+
$cart['declaredValue'] = $request->getPackageValue();
|
84 |
+
$cart['freeShipping'] = (bool)$request->getFreeShipping();
|
85 |
+
$cart['items'] = self::getFormattedItems($request, $request->getAllItems());
|
86 |
+
|
87 |
+
return $cart;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Return site specific information
|
92 |
+
*
|
93 |
+
* @return array
|
94 |
+
*/
|
95 |
+
public static function getSiteDetails()
|
96 |
+
{
|
97 |
+
$siteDetails = new \ShipperHQ\User\SiteDetails('Magento ' . Mage::getEdition(), Mage::getVersion(), Mage::getBaseUrl(), Shipper_Shipper::TEST);
|
98 |
+
|
99 |
+
return $siteDetails;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get values for items
|
104 |
+
*
|
105 |
+
* @param $request
|
106 |
+
* @param $magentoItems
|
107 |
+
* @param bool $childItems
|
108 |
+
* @param null $taxPercentage
|
109 |
+
* @return array
|
110 |
+
*/
|
111 |
+
private static function getFormattedItems($request, $magentoItems, $childItems = false, $taxPercentage = null)
|
112 |
+
{
|
113 |
+
$formattedItems = array();
|
114 |
+
if (empty($magentoItems)) {
|
115 |
+
return $formattedItems;
|
116 |
+
}
|
117 |
+
foreach ($magentoItems as $magentoItem) {
|
118 |
+
if (!$childItems && $magentoItem->getParentItemId()) {
|
119 |
+
continue;
|
120 |
+
}
|
121 |
+
|
122 |
+
if (is_null($taxPercentage)) {
|
123 |
+
$calculator = Mage::helper('tax')->getCalculator();
|
124 |
+
$taxRequest = $calculator->getRateOriginRequest();
|
125 |
+
$taxRequest->setProductClassId($magentoItem->getTaxClassId());
|
126 |
+
$taxPercentage = $calculator->getRate($taxRequest);
|
127 |
+
}
|
128 |
+
|
129 |
+
$formattedItem = array(
|
130 |
+
'id' => $magentoItem->getId(),
|
131 |
+
'name' => $magentoItem->getName(),
|
132 |
+
'storePrice' => $magentoItem->getPrice(),
|
133 |
+
'weight' => $magentoItem->getWeight(),
|
134 |
+
'qty' => $magentoItem->getQty(),
|
135 |
+
'type' => $magentoItem->getProductType(),
|
136 |
+
'items' => array(),
|
137 |
+
// child items
|
138 |
+
'basePrice' => $magentoItem->getBasePrice(),
|
139 |
+
'taxInclBasePrice' => $magentoItem->getBasePriceInclTax(),
|
140 |
+
'taxInclStorePrice' => $magentoItem->getPriceInclTax(),
|
141 |
+
'rowTotal' => $magentoItem->getRowTotal(),
|
142 |
+
'baseRowTotal' => $magentoItem->getBaseRowTotal(),
|
143 |
+
'discountPercent' => $magentoItem->getDiscountPercent(),
|
144 |
+
'discountedBasePrice' => $magentoItem->getBasePrice() - $magentoItem->getBaseDiscountAmount(),
|
145 |
+
'discountedStorePrice' => $magentoItem->getPrice() - $magentoItem->getDiscountAmount(),
|
146 |
+
'discountedTaxInclBasePrice' => $magentoItem->getBasePriceInclTax() - $magentoItem->getBaseDiscountAmount(),
|
147 |
+
'discountedTaxInclStorePrice' => $magentoItem->getPriceInclTax() - $magentoItem->getDiscountAmount(),
|
148 |
+
'attributes' => array(),
|
149 |
+
'legacyAttributes' => array(),
|
150 |
+
'baseCurrency' => $request->getBaseCurrency()->getCurrencyCode(),
|
151 |
+
'packageCurrency' => $request->getPackageCurrency()->getCurrencyCode(),
|
152 |
+
'storeBaseCurrency' => Mage::app()->getBaseCurrencyCode(),
|
153 |
+
'storeCurrentCurrency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
|
154 |
+
'taxPercentage' => $taxPercentage,
|
155 |
+
'freeShipping' => $magentoItem->getFreeShipping(),
|
156 |
+
'freeMethodWeight' => $request->getFreeMethodWeight(),
|
157 |
+
'additionalAttributes' => array(),
|
158 |
+
'fixedPrice' => $magentoItem->getFixedPrice(),
|
159 |
+
'fixedWeight' => $magentoItem->getFixedWeight(),
|
160 |
+
);
|
161 |
+
|
162 |
+
if (!$childItems) {
|
163 |
+
$formattedItem['items'] = self::getFormattedItems($request, $magentoItem->getChildren(), true, $taxPercentage);
|
164 |
+
}
|
165 |
+
|
166 |
+
$formattedItems[] = $formattedItem;
|
167 |
+
}
|
168 |
+
|
169 |
+
return $formattedItems;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Get values for destination
|
174 |
+
*
|
175 |
+
* @param $request
|
176 |
+
* @return array
|
177 |
+
*/
|
178 |
+
private static function getDestination($request)
|
179 |
+
{
|
180 |
+
$destination = array(
|
181 |
+
'country' => $request->getDestCountryId(),
|
182 |
+
'region' => $request->getDestRegionCode(),
|
183 |
+
'city' => $request->getDestCity(),
|
184 |
+
'street' => $request->getDestStreet(),
|
185 |
+
'zipcode' => $request->getDestPostcode(),
|
186 |
+
'residential' => $request->getShiptoType(),
|
187 |
+
);
|
188 |
+
|
189 |
+
return $destination;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Get values for origin
|
194 |
+
*
|
195 |
+
* @param $request
|
196 |
+
* @return array
|
197 |
+
*/
|
198 |
+
private static function getOrigin($request)
|
199 |
+
{
|
200 |
+
$regionModel = Mage::getModel('directory/region')->load($request->getRegionId());
|
201 |
+
$regionCode = $regionModel->getCode();
|
202 |
+
|
203 |
+
$origin = array(
|
204 |
+
'country' => $request->getCountryId(),
|
205 |
+
'region' => $regionCode,
|
206 |
+
'city' => $request->getCity(),
|
207 |
+
'street' => $request->getStreet(),
|
208 |
+
'zipcode' => $request->getPostcode(),
|
209 |
+
);
|
210 |
+
|
211 |
+
return $origin;
|
212 |
+
}
|
213 |
+
|
214 |
+
private static function getShortDescripion($magentoItem)
|
215 |
+
{
|
216 |
+
return Mage::getModel('catalog/product')->load($magentoItem->getProduct()->getId())->getShortDescription();
|
217 |
+
}
|
218 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay.php
ADDED
@@ -0,0 +1,863 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Josh Stewart
|
9 |
+
* Date 14 April 2014
|
10 |
+
* Time 16:00
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Model_Carrier_Despatchbay
|
17 |
+
extends Webshopapps_Wsacommon_Model_Shipping_Carrier_Baseabstract
|
18 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
19 |
+
{
|
20 |
+
protected $_code = 'despatchbay';
|
21 |
+
|
22 |
+
protected $_activeFlag = 'active';
|
23 |
+
|
24 |
+
protected $modName = 'none'; //Want to use inbult Magento logging, not wsalogger
|
25 |
+
|
26 |
+
//ShipperHQ Variables
|
27 |
+
protected $_shipperWSInstance = null;
|
28 |
+
protected $_rawRatesRequest = null;
|
29 |
+
protected $_result = null;
|
30 |
+
|
31 |
+
//Label & Shipment Variables
|
32 |
+
const TRACK = 1;
|
33 |
+
const SHIPMENT = 2;
|
34 |
+
const LABEL = 3;
|
35 |
+
|
36 |
+
const TRACK_URL = 'https://api.despatchbaypro.com/soap/v11/tracking?wsdl';
|
37 |
+
const SHIPMENT_URL = 'https://api.despatchbaypro.com/soap/v11/shipping?wsdl';
|
38 |
+
const LABEL_URL = 'https://api.despatchbaypro.com/pdf/1.0.1/labels';
|
39 |
+
|
40 |
+
protected $_shipmentServiceWsdl = '';
|
41 |
+
protected $_trackServiceWsdl = '';
|
42 |
+
|
43 |
+
protected $_rawTrackingRequest = '';
|
44 |
+
|
45 |
+
protected $_helper = null;
|
46 |
+
|
47 |
+
public function __construct()
|
48 |
+
{
|
49 |
+
parent::__construct();
|
50 |
+
$wsdlBasePath = Mage::getModuleDir('etc', 'Webshopapps_Despatchbay') . DS . 'wsdl' . DS . 'Despatchbay' . DS;
|
51 |
+
|
52 |
+
$this->_shipmentServiceWsdl = $wsdlBasePath . 'Shippingv11.wsdl';
|
53 |
+
$this->_trackServiceWsdl = $wsdlBasePath . 'Trackingv11.wsdl';
|
54 |
+
$this->_helper = Mage::helper('webshopapps_despatchbay');
|
55 |
+
}
|
56 |
+
|
57 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
58 |
+
{
|
59 |
+
if (!$this->getConfigFlag($this->_activeFlag)) {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
$this->setRequest($request);
|
64 |
+
|
65 |
+
$this->_result = $this->_getQuotes();
|
66 |
+
|
67 |
+
$this->_updateFreeMethodQuote($request);
|
68 |
+
|
69 |
+
return $this->getResult();
|
70 |
+
}
|
71 |
+
|
72 |
+
public function setRequest(Mage_Shipping_Model_Rate_Request $request)
|
73 |
+
{
|
74 |
+
$this->_rawRequest = Mage::getSingleton('Webshopapps_Despatchbay_Model_Carrier_Convert_ShipperMapper')->getShipperTranslation($request);
|
75 |
+
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
+
|
79 |
+
protected function _getQuotes()
|
80 |
+
{
|
81 |
+
$resultSet = $this->_getShipperInstance()->getRates($this->_rawRequest, $this->_helper->getRateGatewayUrl());
|
82 |
+
|
83 |
+
$this->_debug($resultSet);
|
84 |
+
|
85 |
+
return $this->_parseShipperResponse($resultSet['result']);
|
86 |
+
}
|
87 |
+
|
88 |
+
protected function _parseShipperResponse($shipperResponse)
|
89 |
+
{
|
90 |
+
// If no rates are found return error message
|
91 |
+
$noRates = !isset($shipperResponse->carrierRates);
|
92 |
+
$errors = $shipperResponse->errors;
|
93 |
+
|
94 |
+
if (!is_object($shipperResponse) || $noRates || count($errors)) {
|
95 |
+
$this->_debug('Unable to parse response');
|
96 |
+
|
97 |
+
if ($noRates) {
|
98 |
+
$this->_debug('No rates/carriers have been found');
|
99 |
+
}
|
100 |
+
|
101 |
+
if (!is_null($errors)) {
|
102 |
+
$this->_debug($errors);
|
103 |
+
}
|
104 |
+
|
105 |
+
return $this->returnGeneralError();
|
106 |
+
}
|
107 |
+
|
108 |
+
if (isset($shipperResponse->carrierRates)) {
|
109 |
+
$carrierRates = $shipperResponse->carrierRates;
|
110 |
+
} else {
|
111 |
+
$carrierRates = array();
|
112 |
+
}
|
113 |
+
$result = Mage::getModel('shipping/rate_result');
|
114 |
+
|
115 |
+
// Display rates on the front end, if rates are returned.
|
116 |
+
foreach ($carrierRates as $carrierRate) {
|
117 |
+
if (isset($carrierRate->errorDetails) || !is_array($carrierRate->rates)) {
|
118 |
+
$this->appendError($result, $carrierRate->errorDetails);
|
119 |
+
continue;
|
120 |
+
}
|
121 |
+
|
122 |
+
$allowedMethods = explode(",", $this->getConfigData('allowed_methods'));
|
123 |
+
|
124 |
+
$costArr = array();
|
125 |
+
$priceArr = array();
|
126 |
+
|
127 |
+
$carrierCode = $carrierRate->carrierCode;
|
128 |
+
$carrierTitle = $carrierRate->carrierTitle;
|
129 |
+
|
130 |
+
foreach ($carrierRate->rates as $rate) {
|
131 |
+
if(in_array($rate->code,$allowedMethods)){
|
132 |
+
$priceArr[$rate->code] = array(
|
133 |
+
'price' => $rate->totalCharges,
|
134 |
+
'title' => $rate->name
|
135 |
+
);
|
136 |
+
$costArr[$rate->code] = $rate->price;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
if (empty($priceArr)) {
|
141 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
142 |
+
$error->setCarrier($carrierCode);
|
143 |
+
$error->setCarrierTitle($carrierTitle);
|
144 |
+
$errorMessage = property_exists($carrierRate, '$carrierRate') ?
|
145 |
+
$carrierRate->error_message : $this->getConfigData('specificerrmsg');
|
146 |
+
$error->setErrorMessage($errorMessage);
|
147 |
+
$result->append($error);
|
148 |
+
} else {
|
149 |
+
foreach ($priceArr as $methodCode => $rateDetails) {
|
150 |
+
$rate = Mage::getModel('shipping/rate_result_method');
|
151 |
+
$rate->setCarrier($carrierCode);
|
152 |
+
$rate->setCarrierTitle($carrierTitle);
|
153 |
+
// $methodCombineCode = $carrierCode . '_' . $methodCode;
|
154 |
+
$methodCombineCode = preg_replace('/&|;| /', "_", $methodCode);
|
155 |
+
$rawMethodCode = trim($methodCode,'DB_');
|
156 |
+
$carrierName = $this->getCarrierName($rawMethodCode);
|
157 |
+
$rate->setMethod($methodCombineCode);
|
158 |
+
$rate->setMethodTitle($carrierName.' '.$this->_helper->__($rateDetails['title']));
|
159 |
+
$rate->setCost($costArr[$methodCode]);
|
160 |
+
$rate->setPrice($this->getFinalPriceWithHandlingFee($rateDetails['price']));
|
161 |
+
$result->append($rate);
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
$this->_debug($result);
|
167 |
+
|
168 |
+
return $result;
|
169 |
+
}
|
170 |
+
|
171 |
+
protected function returnGeneralError()
|
172 |
+
{
|
173 |
+
$result = Mage::getModel('shipping/rate_result');
|
174 |
+
|
175 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
176 |
+
$error->setCarrier($this->_code);
|
177 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
178 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
179 |
+
$result->append($error);
|
180 |
+
|
181 |
+
return $result;
|
182 |
+
}
|
183 |
+
|
184 |
+
protected function appendError($result, $errorDetails)
|
185 |
+
{
|
186 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
187 |
+
$error->setCarrier($this->_code);
|
188 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
189 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
190 |
+
$result->append($error);
|
191 |
+
|
192 |
+
return $result;
|
193 |
+
}
|
194 |
+
|
195 |
+
public function getResult()
|
196 |
+
{
|
197 |
+
return $this->_result;
|
198 |
+
}
|
199 |
+
|
200 |
+
public function _getShipperInstance()
|
201 |
+
{
|
202 |
+
if (empty($this->_shipperWSInstance)) {
|
203 |
+
$this->_shipperWSInstance = new Shipper_Shipper();
|
204 |
+
}
|
205 |
+
|
206 |
+
return $this->_shipperWSInstance;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Call to ShipperHQ to get the methods available to Despatch Bay
|
211 |
+
*
|
212 |
+
* @return array
|
213 |
+
*/
|
214 |
+
public function refreshMethods()
|
215 |
+
{
|
216 |
+
$allowedMethodUrl = $this->_helper->getAllowedMethodGatewayUrl();
|
217 |
+
|
218 |
+
$shipperMapper = Mage::getSingleton('Webshopapps_Despatchbay_Model_Carrier_Convert_ShipperMapper');
|
219 |
+
$resultSet = $this->_getShipperInstance()->getAllowedMethods($shipperMapper->getCredentialsTranslation(), $allowedMethodUrl);
|
220 |
+
$this->_debug($resultSet);
|
221 |
+
|
222 |
+
$allowedMethodResponse = $resultSet['result'];
|
223 |
+
|
224 |
+
if (!is_object($allowedMethodResponse) || !isset($allowedMethodResponse->carrierMethods)) {
|
225 |
+
$this->_debug('Unable to parse response');
|
226 |
+
|
227 |
+
return array();
|
228 |
+
}
|
229 |
+
|
230 |
+
$returnedMethods = $allowedMethodResponse->carrierMethods;
|
231 |
+
|
232 |
+
$allMethods = array();
|
233 |
+
$carrierTitles = array();
|
234 |
+
foreach ($returnedMethods as $carrierMethod) {
|
235 |
+
|
236 |
+
$rateMethods = $carrierMethod->methods;
|
237 |
+
|
238 |
+
foreach ($rateMethods as $method) {
|
239 |
+
|
240 |
+
$methodCode = $method->methodCode;
|
241 |
+
$methodCode = preg_replace('/&|;| /', "_", $methodCode);
|
242 |
+
|
243 |
+
if (!array_key_exists($methodCode, $allMethods)) {
|
244 |
+
$allMethods[$methodCode] = $method->name;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
$carrierTitles[$carrierMethod->carrierCode] = $carrierMethod->title;
|
249 |
+
}
|
250 |
+
$this->_debug($allMethods);
|
251 |
+
|
252 |
+
// go set carrier titles
|
253 |
+
$this->setCarrierTitles($carrierTitles);
|
254 |
+
$encodedMethods = json_encode($allMethods);
|
255 |
+
$this->setAllMethods($encodedMethods);
|
256 |
+
|
257 |
+
return $allMethods;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Get the saved allowed methods
|
262 |
+
*
|
263 |
+
* @return array
|
264 |
+
*/
|
265 |
+
public function getAllowedMethods()
|
266 |
+
{
|
267 |
+
$allowed = explode(',', $this->getConfigData('allowed_methods'));
|
268 |
+
$arr = array();
|
269 |
+
|
270 |
+
foreach ($allowed as $k) {
|
271 |
+
$arr[$k] = $k;
|
272 |
+
}
|
273 |
+
|
274 |
+
return $arr;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Calls refreshMethods which also updates the carrier title
|
279 |
+
*
|
280 |
+
* @return bool
|
281 |
+
*/
|
282 |
+
public function refreshCarriers()
|
283 |
+
{
|
284 |
+
if (!count($this->refreshMethods())) {
|
285 |
+
return false;
|
286 |
+
} else {
|
287 |
+
return true;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Try to get previously saved shipping methods stored in all_methods global config.
|
293 |
+
* If that's empty refresh shipping methods.
|
294 |
+
*
|
295 |
+
* @return mixed Json object containing all shipping methods
|
296 |
+
*/
|
297 |
+
public function getAllMethods()
|
298 |
+
{
|
299 |
+
$allMethods = json_decode($this->getConfigData('all_methods'));
|
300 |
+
|
301 |
+
if(!count($allMethods) || empty($allMethods)){
|
302 |
+
return $this->refreshMethods();
|
303 |
+
}
|
304 |
+
|
305 |
+
return $allMethods;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Set the carrier title that is returned from shipper hq
|
310 |
+
*
|
311 |
+
* @param $carrierTitles
|
312 |
+
*/
|
313 |
+
protected function setCarrierTitles($carrierTitles)
|
314 |
+
{
|
315 |
+
foreach ($carrierTitles as $carrierCode => $carrierTitle) {
|
316 |
+
$this->_helper->saveCarrierTitle($carrierCode, $carrierTitle);
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Save all methods to global config to save a call to ShipperHQ
|
322 |
+
*
|
323 |
+
* @param $methods
|
324 |
+
*/
|
325 |
+
protected function setAllMethods($methods)
|
326 |
+
{
|
327 |
+
$this->_helper->saveAllMethods($methods);
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Check if carrier has shipping label option available
|
332 |
+
*
|
333 |
+
* @return boolean
|
334 |
+
*/
|
335 |
+
public function isShippingLabelsAvailable()
|
336 |
+
{
|
337 |
+
return true;
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Retrieve DespatchBay api access from global config
|
342 |
+
*
|
343 |
+
* @return array
|
344 |
+
*/
|
345 |
+
protected function getAccessCredentials()
|
346 |
+
{
|
347 |
+
return array(
|
348 |
+
'login' => $this->getConfigData('despatch_api_user'),
|
349 |
+
'password' => $this->getConfigData('despatch_api_key')
|
350 |
+
);
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* @param $wsdl
|
355 |
+
* @param bool $trace
|
356 |
+
* @param $type
|
357 |
+
* @return SoapClient
|
358 |
+
*/
|
359 |
+
protected function _createSoapClient($wsdl, $trace = false, $type = self::SHIPMENT)
|
360 |
+
{
|
361 |
+
$credentials = $this->getAccessCredentials();
|
362 |
+
|
363 |
+
$client = new SoapClient($wsdl, array('trace' => $trace,
|
364 |
+
'login' => $credentials['login'],
|
365 |
+
'password' => $credentials['password'],
|
366 |
+
'user_agent' => 'ShipperHQ/1.0'));
|
367 |
+
|
368 |
+
switch ($type) {
|
369 |
+
case self::TRACK:
|
370 |
+
$client->__setLocation(self::TRACK_URL);
|
371 |
+
break;
|
372 |
+
case self::SHIPMENT:
|
373 |
+
$client->__setLocation(self::SHIPMENT_URL);
|
374 |
+
break;
|
375 |
+
default:
|
376 |
+
$client->__setLocation(self::SHIPMENT_URL);
|
377 |
+
break;
|
378 |
+
}
|
379 |
+
|
380 |
+
return $client;
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Create shipment soap client
|
385 |
+
*
|
386 |
+
* @return SoapClient
|
387 |
+
*/
|
388 |
+
protected function _createShipmentSoapClient()
|
389 |
+
{
|
390 |
+
return $this->_createSoapClient($this->_shipmentServiceWsdl, $this->_debug, self::SHIPMENT);
|
391 |
+
}
|
392 |
+
|
393 |
+
protected function _createTrackingSoapClient()
|
394 |
+
{
|
395 |
+
return $this->_createSoapClient($this->_trackServiceWsdl, $this->_debug, self::TRACK);
|
396 |
+
}
|
397 |
+
|
398 |
+
protected function _setAccessRequest(&$r){
|
399 |
+
$r->setApiUser($this->getConfigData('despatch_api_user'));
|
400 |
+
$r->setApiKey($this->getConfigData('despatch_api_key'));
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Do request to shipment
|
405 |
+
*
|
406 |
+
* @param Mage_Shipping_Model_Shipment_Request $request
|
407 |
+
* @return array
|
408 |
+
*/
|
409 |
+
public function requestToShipment(Mage_Shipping_Model_Shipment_Request $request)
|
410 |
+
{
|
411 |
+
$packages = $request->getPackages();
|
412 |
+
|
413 |
+
if (!is_array($packages) || !$packages) {
|
414 |
+
Mage::throwException(Mage::helper('usa')->__('No packages for request'));
|
415 |
+
}
|
416 |
+
|
417 |
+
if ($request->getStoreId() != null) {
|
418 |
+
$this->setStore($request->getStoreId());
|
419 |
+
}
|
420 |
+
|
421 |
+
$data = array();
|
422 |
+
$result = array();
|
423 |
+
|
424 |
+
foreach ($packages as $packageId => $package) {
|
425 |
+
if($package['params']['weight'] > 30){
|
426 |
+
Mage::throwException(Mage::helper('usa')->__('Package #'.$packageId.' Exceeds 30Kg Max Weight'));
|
427 |
+
}
|
428 |
+
$request->setPackageId($packageId);
|
429 |
+
$request->setServiceId(trim($package['params']['container'], 'despatchbay#'));
|
430 |
+
$request->setPackageWeight($package['params']['weight']);
|
431 |
+
$request->setPackageValue($package['params']['customs_value']);
|
432 |
+
$request->setPackageParams(new Varien_Object($package['params']));
|
433 |
+
$request->setPackageItems($package['items']);
|
434 |
+
|
435 |
+
$result = $this->_doShipmentRequest($request);
|
436 |
+
|
437 |
+
if ($result->hasErrors()) {
|
438 |
+
$this->rollBack($data);
|
439 |
+
break;
|
440 |
+
} else {
|
441 |
+
$data[] = array(
|
442 |
+
'tracking_number' => $result->getTrackingNumber(),
|
443 |
+
'label_content' => $result->getShippingLabelContent()
|
444 |
+
);
|
445 |
+
}
|
446 |
+
|
447 |
+
if (!isset($isFirstRequest)) {
|
448 |
+
$request->setMasterTrackingId($result->getTrackingNumber());
|
449 |
+
$isFirstRequest = false;
|
450 |
+
}
|
451 |
+
}
|
452 |
+
|
453 |
+
$response = new Varien_Object(array('info' => $data));
|
454 |
+
|
455 |
+
if ($result->getErrors()) {
|
456 |
+
$response->setErrors($result->getErrors());
|
457 |
+
}
|
458 |
+
|
459 |
+
return $response;
|
460 |
+
}
|
461 |
+
|
462 |
+
public function rollBack($data)
|
463 |
+
{
|
464 |
+
return true;
|
465 |
+
}
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Do shipment request to Despatch Bay, creates a new shipment and returns shipment ID in response
|
469 |
+
*
|
470 |
+
* @param Varien_Object $request
|
471 |
+
* @return Varien_Object
|
472 |
+
*/
|
473 |
+
protected function _doShipmentRequest(Varien_Object $request)
|
474 |
+
{
|
475 |
+
$this->_prepareShipmentRequest($request);
|
476 |
+
$result = new Varien_Object();
|
477 |
+
$response = null;
|
478 |
+
|
479 |
+
try {
|
480 |
+
$client = $this->_createShipmentSoapClient();
|
481 |
+
$requestShip = $this->_formShipmentRequest($request);
|
482 |
+
$response = $client->AddDomesticShipment($requestShip);//crete shipment on DS.com
|
483 |
+
$debugData['request_sent'] = $requestShip;
|
484 |
+
$debugData['response'] = "Shipment ID: " . $response;
|
485 |
+
} catch (Exception $e) {
|
486 |
+
$debugData['result'] = array(
|
487 |
+
'error' => $e->getMessage(),
|
488 |
+
'code' => $e->getCode()
|
489 |
+
);
|
490 |
+
$result->setErrors($e->getMessage());
|
491 |
+
}
|
492 |
+
|
493 |
+
$this->_debug($debugData);
|
494 |
+
|
495 |
+
return $this->_sendShipmentAcceptRequest($response);
|
496 |
+
}
|
497 |
+
|
498 |
+
/**
|
499 |
+
* Use the shipment id to retreive the new shipment from Despatch Bay and set the label and tracking number on
|
500 |
+
* the result
|
501 |
+
*
|
502 |
+
* @param $shipmentId
|
503 |
+
* @return Varien_Object
|
504 |
+
*/
|
505 |
+
protected function _sendShipmentAcceptRequest($shipmentId)
|
506 |
+
{
|
507 |
+
$result = $this->generateLabels($shipmentId);
|
508 |
+
|
509 |
+
if($result->hasErrors()) {
|
510 |
+
return $result;
|
511 |
+
}
|
512 |
+
|
513 |
+
$shipment = new Varien_Object();
|
514 |
+
|
515 |
+
try {
|
516 |
+
$client = $this->_createShipmentSoapClient();
|
517 |
+
$shipment = $client->GetShipment($shipmentId);
|
518 |
+
$debugData['request_sent'] = $shipmentId;
|
519 |
+
$debugData['response'] = $shipment;
|
520 |
+
} catch (Exception $e) {
|
521 |
+
$debugData['result'] = array(
|
522 |
+
'error' => $e->getMessage(),
|
523 |
+
'code' => $e->getCode()
|
524 |
+
);
|
525 |
+
}
|
526 |
+
|
527 |
+
$result->setTrackingNumber($shipment->StartTrackingNumber);
|
528 |
+
|
529 |
+
$this->_debug($debugData);
|
530 |
+
|
531 |
+
return $result;
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Takes the Despatch Bay shipment ID and creates labels for it
|
536 |
+
*
|
537 |
+
* @param $shipmentId
|
538 |
+
* @return Varien_Object
|
539 |
+
*/
|
540 |
+
protected function generateLabels($shipmentId)
|
541 |
+
{
|
542 |
+
$client = new Varien_Http_Client(self::LABEL_URL);
|
543 |
+
$client->setMethod(Varien_Http_Client::POST);
|
544 |
+
$client->setConfig(array('useragent' => 'ShipperHQ/1.0'));
|
545 |
+
$accessDetails = $this->getAccessCredentials();
|
546 |
+
$client->setParameterPost('apikey', $accessDetails['password']);
|
547 |
+
$client->setParameterPost('apiuser', $accessDetails['login']);
|
548 |
+
$client->setParameterPost('format', $this->getConfigData('label_size'));
|
549 |
+
$client->setParameterPost('sid', $shipmentId);
|
550 |
+
$result = new Varien_Object();
|
551 |
+
|
552 |
+
try {
|
553 |
+
$labelResponse = $client->request();
|
554 |
+
|
555 |
+
$debugData['request'] = $client->getLastRequest();
|
556 |
+
$debugData['response'] = $client->getLastResponse();
|
557 |
+
$this->_debug($debugData);
|
558 |
+
|
559 |
+
if($labelResponse->isSuccessful()) {
|
560 |
+
$result->setShippingLabelContent($labelResponse->getBody());
|
561 |
+
} else {
|
562 |
+
$result->setErrors($labelResponse->getMessage() .' - '. $labelResponse->getBody());
|
563 |
+
}
|
564 |
+
} catch (Exception $e) {
|
565 |
+
Mage::logException($e);
|
566 |
+
}
|
567 |
+
|
568 |
+
return $result;
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Form array with appropriate structure for shipment request.
|
573 |
+
* Weight is irrelevant. Each package can weight upto 30Kg and is charged the same.
|
574 |
+
*
|
575 |
+
* @param Varien_Object $request
|
576 |
+
* @return array
|
577 |
+
*/
|
578 |
+
protected function _formShipmentRequest(Varien_Object $request)
|
579 |
+
{
|
580 |
+
$this->_request = $request;
|
581 |
+
|
582 |
+
$shipRequest = new StdClass();
|
583 |
+
|
584 |
+
$shipRequest->ServiceID = $request->getServiceId();
|
585 |
+
$shipRequest->ParcelQuantity = 1;//count($request->getPackages());
|
586 |
+
$shipRequest->OrderReference = 'Order #'.$request->getOrderShipment()->getOrder()->getIncrementId();
|
587 |
+
$shipRequest->Contents = self::createItemsArray($request->getPackageItems());
|
588 |
+
$shipRequest->RecipientName = $request->getRecipientContactPersonName();
|
589 |
+
$shipRequest->Street = $request->getRecipientAddressStreet();
|
590 |
+
$shipRequest->Locality = $request->getRecipientAddressStreet2();
|
591 |
+
$shipRequest->Town = $request->getRecipientAddressCity();
|
592 |
+
$shipRequest->County = $request->getRecipientAddressStateOrProvinceCode();
|
593 |
+
$shipRequest->Postcode = $request->getRecipientAddressPostalCode();
|
594 |
+
$shipRequest->RecipientEmail = $request->getRecipientEmail();
|
595 |
+
$shipRequest->EmailNotification = $this->getConfigFlag('shipment_email');
|
596 |
+
$shipRequest->DashboardNotification = $this->getConfigFlag('shipment_dashboard');
|
597 |
+
|
598 |
+
return $shipRequest;
|
599 |
+
}
|
600 |
+
|
601 |
+
private function createItemsArray($items)
|
602 |
+
{
|
603 |
+
$itemString = "";
|
604 |
+
|
605 |
+
foreach ($items as $item) {
|
606 |
+
$itemString .= $item['name'].',';
|
607 |
+
}
|
608 |
+
|
609 |
+
if(strlen($itemString) > 255) {
|
610 |
+
$itemString = substr($itemString, 0, 255);
|
611 |
+
}
|
612 |
+
|
613 |
+
return trim($itemString,',');
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* Prepare shipment request.
|
618 |
+
* Validate and correct request information
|
619 |
+
*
|
620 |
+
* @param Varien_Object $request
|
621 |
+
*
|
622 |
+
*/
|
623 |
+
protected function _prepareShipmentRequest(Varien_Object $request)
|
624 |
+
{
|
625 |
+
$phonePattern = '/[\s\_\-\(\)]+/';
|
626 |
+
$phoneNumber = $request->getShipperContactPhoneNumber();
|
627 |
+
$phoneNumber = preg_replace('/\D/', '', $phoneNumber);
|
628 |
+
$phoneNumber = preg_replace($phonePattern, '', $phoneNumber);
|
629 |
+
|
630 |
+
$request->setShipperContactPhoneNumber($phoneNumber);
|
631 |
+
|
632 |
+
$phoneNumber = $request->getRecipientContactPhoneNumber();
|
633 |
+
$phoneNumber = preg_replace($phonePattern, '', $phoneNumber);
|
634 |
+
|
635 |
+
$request->setRecipientContactPhoneNumber($phoneNumber);
|
636 |
+
}
|
637 |
+
|
638 |
+
public function getTracking($trackings)
|
639 |
+
{
|
640 |
+
$this->setTrackingReqeust();
|
641 |
+
|
642 |
+
if (!is_array($trackings)) {
|
643 |
+
$trackings=array($trackings);
|
644 |
+
}
|
645 |
+
|
646 |
+
foreach($trackings as $tracking){
|
647 |
+
$this->_getSoapTracking($tracking);
|
648 |
+
}
|
649 |
+
|
650 |
+
return $this->_result;
|
651 |
+
}
|
652 |
+
|
653 |
+
protected function _getSoapTracking($trackingNumber)
|
654 |
+
{
|
655 |
+
$response = array();
|
656 |
+
try {
|
657 |
+
$client = $this->_createTrackingSoapClient();
|
658 |
+
$response = $client->GetTracking($trackingNumber);
|
659 |
+
$debugData['request_sent'] = $trackingNumber;
|
660 |
+
$debugData['response'] = $response;
|
661 |
+
} catch (Exception $e) {
|
662 |
+
$debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
|
663 |
+
Mage::logException($e);
|
664 |
+
$response['error'] = $e->getMessage();
|
665 |
+
}
|
666 |
+
|
667 |
+
$this->_debug($debugData);
|
668 |
+
$this->_parseTrackingResponse($trackingNumber, $response);
|
669 |
+
}
|
670 |
+
|
671 |
+
protected function _parseTrackingResponse($trackingNumber, $response)
|
672 |
+
{
|
673 |
+
$errorTitle=null;
|
674 |
+
|
675 |
+
if (count($response)) {
|
676 |
+
if (array_key_exists('error',$response)) {
|
677 |
+
$errorTitle = $response['error'];
|
678 |
+
} else {
|
679 |
+
$resultArray = array();
|
680 |
+
$packageProgress = array();
|
681 |
+
|
682 |
+
$resultCount = 0;
|
683 |
+
|
684 |
+
foreach ($response as $responseObject) {
|
685 |
+
if($resultCount > 0) {
|
686 |
+
$tempArray = array();
|
687 |
+
$tempArray['deliverydate'] = $responseObject->Date;
|
688 |
+
if(property_exists($responseObject,'Time')){
|
689 |
+
$tempArray['deliverytime'] = $responseObject->Time;
|
690 |
+
}
|
691 |
+
$tempArray['activity'] = $responseObject->Description;
|
692 |
+
$tempArray['deliverylocation'] = $responseObject->Location;
|
693 |
+
$packageProgress[] = $tempArray;
|
694 |
+
} else {
|
695 |
+
$resultArray['status'] = $responseObject->Description;
|
696 |
+
$resultArray['deliverydate'] = $responseObject->Date;
|
697 |
+
$resultArray['deliverytime'] = $responseObject->Time;
|
698 |
+
$resultArray['deliverylocation'] = $responseObject->Location;
|
699 |
+
$resultArray['signedby'] = $responseObject->Signatory;
|
700 |
+
}
|
701 |
+
$resultCount++;
|
702 |
+
}
|
703 |
+
|
704 |
+
$resultArray['progressdetail'] = $packageProgress;
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
if (!$this->_result) {
|
709 |
+
$this->_result = Mage::getModel('shipping/tracking_result');
|
710 |
+
}
|
711 |
+
|
712 |
+
if (isset($resultArray)) {
|
713 |
+
$tracking = Mage::getModel('shipping/tracking_result_status');
|
714 |
+
$tracking->setCarrier('webshopapps_despatchbay');
|
715 |
+
$tracking->setCarrierTitle($this->getConfigData('title'));
|
716 |
+
$tracking->setTracking($trackingNumber);
|
717 |
+
$tracking->addData($resultArray);
|
718 |
+
$this->_result->append($tracking);
|
719 |
+
} else {
|
720 |
+
$error = Mage::getModel('shipping/tracking_result_error');
|
721 |
+
$error->setCarrier('webshopapps_despatchbay');
|
722 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
723 |
+
$error->setTracking($trackingNumber);
|
724 |
+
$error->setErrorMessage($errorTitle ? $errorTitle : Mage::helper('usa')->__('Unable to retrieve tracking'));
|
725 |
+
$this->_result->append($error);
|
726 |
+
}
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* Return Despatch Bay services with prices included
|
731 |
+
*
|
732 |
+
* @param Varien_Object|null $params
|
733 |
+
* @return array
|
734 |
+
*/
|
735 |
+
public function getContainerTypes(Varien_Object $params = null)
|
736 |
+
{
|
737 |
+
if(!is_null($params)) {
|
738 |
+
$postalcode = $params['postalcode_recipient'];
|
739 |
+
|
740 |
+
return $this->getDomesticServicesByPostcode($postalcode);
|
741 |
+
}
|
742 |
+
|
743 |
+
return $this->getCode('packaging');
|
744 |
+
}
|
745 |
+
|
746 |
+
public function getCustomizableContainerTypes()
|
747 |
+
{
|
748 |
+
return array('none' => 'none');
|
749 |
+
}
|
750 |
+
|
751 |
+
public function isGirthAllowed($countyDest = null)
|
752 |
+
{
|
753 |
+
return false;
|
754 |
+
}
|
755 |
+
|
756 |
+
/**
|
757 |
+
* Get all services available to given postal code with pricing
|
758 |
+
*
|
759 |
+
* @param $postcode
|
760 |
+
* @return array
|
761 |
+
*/
|
762 |
+
public function getDomesticServicesByPostcode($postcode)
|
763 |
+
{
|
764 |
+
$requestString = $postcode;
|
765 |
+
$response = $this->_getCachedQuotes($requestString);
|
766 |
+
$debugData = array('request' => $requestString);
|
767 |
+
|
768 |
+
if($response === null) {
|
769 |
+
try {
|
770 |
+
$client = $this->_createShipmentSoapClient();
|
771 |
+
$response = $client->GetDomesticServicesByPostcode($requestString);
|
772 |
+
$this->_setCachedQuotes($requestString, serialize($response));
|
773 |
+
$debugData['result'] = $response;
|
774 |
+
} catch (Exception $e) {
|
775 |
+
$debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
|
776 |
+
Mage::logException($e);
|
777 |
+
}
|
778 |
+
} else {
|
779 |
+
$response = unserialize($response);
|
780 |
+
$debugData['result'] = $response;
|
781 |
+
}
|
782 |
+
|
783 |
+
$this->_debug($debugData);
|
784 |
+
|
785 |
+
return $this->_parseDomesticServicesByPostcodeRequest($response);
|
786 |
+
}
|
787 |
+
|
788 |
+
/**
|
789 |
+
* Sort the available services into a array
|
790 |
+
* Array key is service code
|
791 |
+
*
|
792 |
+
* @param $response
|
793 |
+
* @return array
|
794 |
+
*/
|
795 |
+
protected function _parseDomesticServicesByPostcodeRequest($response)
|
796 |
+
{
|
797 |
+
$result = array();
|
798 |
+
|
799 |
+
if (count($response)) {
|
800 |
+
foreach ($response as $method) {
|
801 |
+
$price = $this->getPriceAndFormat($method->Cost);
|
802 |
+
$serviceId = $method->ServiceID;
|
803 |
+
$carrierName = $this->getCarrierName($serviceId);
|
804 |
+
$result[$serviceId] = $carrierName .' '.$method->Name .' '. $price;
|
805 |
+
}
|
806 |
+
}
|
807 |
+
|
808 |
+
return $result;
|
809 |
+
}
|
810 |
+
|
811 |
+
private function getPriceAndFormat($price)
|
812 |
+
{
|
813 |
+
$finalPrice = $this->getFinalPriceWithHandlingFee($price);
|
814 |
+
|
815 |
+
$price = Mage::helper('core')->currency($finalPrice, true, false);
|
816 |
+
|
817 |
+
return $price;
|
818 |
+
}
|
819 |
+
|
820 |
+
public function getCarrierName($serviceId)
|
821 |
+
{
|
822 |
+
switch ($serviceId){
|
823 |
+
case $serviceId == 47: return 'Despatch Bay';
|
824 |
+
case $serviceId == 48: return 'Despatch Bay';
|
825 |
+
case $serviceId <= 14: return 'Yodel';
|
826 |
+
case $serviceId <= 49: return 'ParcelForce';
|
827 |
+
case $serviceId > 50: return 'CityLink';
|
828 |
+
|
829 |
+
default: return '';
|
830 |
+
}
|
831 |
+
}
|
832 |
+
|
833 |
+
/**
|
834 |
+
* @param $type
|
835 |
+
* @param string $code
|
836 |
+
* @return bool|array
|
837 |
+
*/
|
838 |
+
public function getCode($type, $code = '')
|
839 |
+
{
|
840 |
+
$codes = array(
|
841 |
+
'packaging' => array(
|
842 |
+
'custom_package' => Mage::helper('webshopapps_despatchbay')->__('Your Packaging (Max Length 1.5m - Max Length and Girth 3m)')
|
843 |
+
),
|
844 |
+
'label_formats' => array(
|
845 |
+
'1A4' => $this->_helper->__('One Label per A4 Sheet'),
|
846 |
+
'1A6' => $this->_helper->__('A6 Format Labels'),
|
847 |
+
'2A4' => $this->_helper->__('Two Labels per A4 Sheet'),
|
848 |
+
)
|
849 |
+
);
|
850 |
+
|
851 |
+
if (!isset($codes[$type])) {
|
852 |
+
return false;
|
853 |
+
} elseif (''===$code) {
|
854 |
+
return $codes[$type];
|
855 |
+
}
|
856 |
+
|
857 |
+
if (!isset($codes[$type][$code])) {
|
858 |
+
return false;
|
859 |
+
} else {
|
860 |
+
return $codes[$type][$code];
|
861 |
+
}
|
862 |
+
}
|
863 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay/Source/Freemethod.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 01/05/2014
|
10 |
+
* Time 15:51
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Model_Carrier_Despatchbay_Source_Freemethod
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
$despatchBayModel = Mage::getSingleton('webshopapps_despatchbay/carrier_despatchbay');
|
21 |
+
|
22 |
+
$arr = array();
|
23 |
+
$methods = $despatchBayModel->getAllMethods();
|
24 |
+
|
25 |
+
if($methods){
|
26 |
+
foreach ($methods as $code=>$method) {
|
27 |
+
$arr[] = array('value'=>$code, 'label'=>$method);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
array_unshift($arr, array('value'=>'', 'label'=>Mage::helper('shipping')->__('None')));
|
32 |
+
|
33 |
+
return $arr;
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay/Source/Labelformat.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 25/04/2014
|
10 |
+
* Time 17:47
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Model_Carrier_Despatchbay_Source_Labelformat
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
$despatchBayModel = Mage::getSingleton('webshopapps_despatchbay/carrier_despatchbay');
|
21 |
+
|
22 |
+
$arr = array();
|
23 |
+
$formats = $despatchBayModel->getCode('label_formats');
|
24 |
+
|
25 |
+
if($formats){
|
26 |
+
foreach ($formats as $code=>$format) {
|
27 |
+
$arr[] = array('value'=>$code, 'label'=>$format);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return $arr;
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Carrier/Despatchbay/Source/Method.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 17/04/2014
|
10 |
+
* Time 14:14
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Model_Carrier_Despatchbay_Source_Method
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
$despatchBayModel = Mage::getSingleton('webshopapps_despatchbay/carrier_despatchbay');
|
21 |
+
|
22 |
+
$arr = array();
|
23 |
+
$methods = $despatchBayModel->getAllMethods();
|
24 |
+
|
25 |
+
if($methods){
|
26 |
+
foreach ($methods as $code=>$method) {
|
27 |
+
$arr[] = array('value'=>$code, 'label'=>$method);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return $arr;
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Observer.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 16/04/2014
|
10 |
+
* Time 12:58
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Model_Observer extends Mage_Core_Model_Abstract
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Sets the shipping method on the shipment
|
20 |
+
*
|
21 |
+
* @param $observer
|
22 |
+
* @return null
|
23 |
+
*/
|
24 |
+
public function adminhtmlControllerActionPredispatchStart()
|
25 |
+
{
|
26 |
+
if (!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Despatchbay', 'carriers/despatchbay/labels')) {
|
27 |
+
return null;
|
28 |
+
}
|
29 |
+
|
30 |
+
if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2hpcF9vbmNl', 'dHVyYm9tb2Rl', 'Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2VyaWFs')) {
|
31 |
+
Mage::helper('wsalogger/log')->postCritical('Webshopapps Despatch Bay', base64_decode('TGljZW5zZQ=='), base64_decode('U2VyaWFsIEtleSBJbnZhbGlk'));
|
32 |
+
|
33 |
+
return null;
|
34 |
+
}
|
35 |
+
|
36 |
+
$request = Mage::app()->getFrontController()->getRequest();
|
37 |
+
$params = $request->getParams();
|
38 |
+
if (strstr($request->getControllerName(), 'sales_order_shipment') && strstr($request->getActionName(), 'createLabel')) {
|
39 |
+
if(!self::isValidCountry($params)) {
|
40 |
+
return null;
|
41 |
+
}
|
42 |
+
|
43 |
+
$request = Mage::app()->getRequest();
|
44 |
+
$request->initForward()
|
45 |
+
->setControllerName('shipment')
|
46 |
+
->setModuleName('webshopapps_despatchbay')
|
47 |
+
->setActionName('createDespatchbayLabel')
|
48 |
+
->setDispatched(false);
|
49 |
+
} elseif (strstr($request->getControllerName(), 'sales_order_shipment') && strstr($request->getActionName(), 'save')) {
|
50 |
+
if(!self::isValidCountry($params)) {
|
51 |
+
return null;
|
52 |
+
}
|
53 |
+
|
54 |
+
$request = Mage::app()->getRequest();
|
55 |
+
$request->initForward()
|
56 |
+
->setControllerName('shipment')
|
57 |
+
->setModuleName('webshopapps_despatchbay')
|
58 |
+
->setActionName('save')
|
59 |
+
->setDispatched(false);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Takes request params and gets shipment country. If not UK then Despatch is not available
|
65 |
+
*
|
66 |
+
* @param $params
|
67 |
+
* @return bool
|
68 |
+
*/
|
69 |
+
private function isValidCountry($params)
|
70 |
+
{
|
71 |
+
if(!array_key_exists('shipment_id',$params)) {
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
|
75 |
+
$countryId = Mage::getModel('sales/order_shipment')->load($params['shipment_id'])->getShippingAddress()->getCountryId();
|
76 |
+
|
77 |
+
if($countryId != 'GB') {
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function coreBlockAbstractToHtmlBefore($observer)
|
85 |
+
{
|
86 |
+
if (!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Despatchbay', 'carriers/despatchbay/labels')) {
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
+
if ($observer->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_View_Form) {
|
91 |
+
if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2hpcF9vbmNl', 'dHVyYm9tb2Rl', 'Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2VyaWFs')) {
|
92 |
+
Mage::helper('wsalogger/log')->postCritical('Webshopapps Despatch Bay', base64_decode('TGljZW5zZQ=='), base64_decode('U2VyaWFsIEtleSBJbnZhbGlk'));
|
93 |
+
|
94 |
+
return null;
|
95 |
+
}
|
96 |
+
|
97 |
+
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
98 |
+
|
99 |
+
$countryId = Mage::getModel('sales/order_shipment')->load($params['shipment_id'])->getShippingAddress()->getCountryId();
|
100 |
+
|
101 |
+
if($countryId != 'GB') {
|
102 |
+
return null;
|
103 |
+
}
|
104 |
+
|
105 |
+
$observer->getBlock()->setTemplate('webshopapps_despatchbay/sales/order/shipment/view/form.phtml');
|
106 |
+
} elseif ($observer->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_Create_Items) {
|
107 |
+
if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2hpcF9vbmNl', 'dHVyYm9tb2Rl', 'Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2VyaWFs')) {
|
108 |
+
Mage::helper('wsalogger/log')->postCritical('Webshopapps Despatch Bay', base64_decode('TGljZW5zZQ=='), base64_decode('U2VyaWFsIEtleSBJbnZhbGlk'));
|
109 |
+
|
110 |
+
return null;
|
111 |
+
}
|
112 |
+
|
113 |
+
$params = Mage::app()->getFrontController()->getRequest()->getParams();
|
114 |
+
|
115 |
+
$countryId = Mage::getModel('sales/order')->load($params['order_id'])->getShippingAddress()->getCountryId();
|
116 |
+
|
117 |
+
if($countryId != 'GB') {
|
118 |
+
return null;
|
119 |
+
}
|
120 |
+
|
121 |
+
$observer->getBlock()->setTemplate('webshopapps_despatchbay/sales/order/shipment/create/items.phtml');
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
public function postError()
|
126 |
+
{
|
127 |
+
if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2hpcF9vbmNl', 'dHVyYm9tb2Rl', 'Y2FycmllcnMvZGVzcGF0Y2hiYXkvc2VyaWFs')) {
|
128 |
+
$session = Mage::getSingleton('adminhtml/session');
|
129 |
+
$session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIGtleSBpcyBub3QgdmFsaWQgZm9yIFdlYnNob3BhcHBzIERlc3BhdGNoIEJheSA=')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
app/code/community/Webshopapps/Despatchbay/Model/Shipping/Shipping.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 17/04/2014
|
10 |
+
* Time 17:07
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_Model_Shipping_Shipping extends Webshopapps_Wsacommon_Model_Shipping_Shipping
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Prepare and do request to shipment
|
20 |
+
*
|
21 |
+
* @param Mage_Sales_Model_Order_Shipment $orderShipment
|
22 |
+
* @return Varien_Object
|
23 |
+
*/
|
24 |
+
public function requestToShipment(Mage_Sales_Model_Order_Shipment $orderShipment)
|
25 |
+
{
|
26 |
+
$admin = Mage::getSingleton('admin/session')->getUser();
|
27 |
+
$order = $orderShipment->getOrder();
|
28 |
+
$address = $order->getShippingAddress();
|
29 |
+
$selectedShipMethod = $order->getShippingMethod(true);
|
30 |
+
$shipmentStoreId = $orderShipment->getStoreId();
|
31 |
+
$shipmentCarrier = Mage::getModel('webshopapps_despatchbay/carrier_despatchbay');
|
32 |
+
|
33 |
+
$shippingMethod = $this->_getShipmentCarrier($selectedShipMethod, $shipmentCarrier->getCarrierCode());
|
34 |
+
|
35 |
+
$baseCurrencyCode = Mage::app()->getStore($shipmentStoreId)->getBaseCurrencyCode();
|
36 |
+
if (!$shipmentCarrier) {
|
37 |
+
Mage::throwException('Invalid carrier: ' . $shippingMethod->getCarrierCode());
|
38 |
+
}
|
39 |
+
$shipperRegionCode = Mage::getStoreConfig(self::XML_PATH_STORE_REGION_ID, $shipmentStoreId);
|
40 |
+
if (is_numeric($shipperRegionCode)) {
|
41 |
+
$shipperRegionCode = Mage::getModel('directory/region')->load($shipperRegionCode)->getCode();
|
42 |
+
}
|
43 |
+
|
44 |
+
$recipientRegionCode = Mage::getModel('directory/region')->load($address->getRegionId())->getCode();
|
45 |
+
|
46 |
+
$originStreet1 = Mage::getStoreConfig(self::XML_PATH_STORE_ADDRESS1, $shipmentStoreId);
|
47 |
+
$originStreet2 = Mage::getStoreConfig(self::XML_PATH_STORE_ADDRESS2, $shipmentStoreId);
|
48 |
+
$storeInfo = new Varien_Object(Mage::getStoreConfig('general/store_information', $shipmentStoreId));
|
49 |
+
|
50 |
+
if (!$admin->getFirstname() || !$admin->getLastname() || !$storeInfo->getName() || !$storeInfo->getPhone() || !$originStreet1 || !Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId) || !$shipperRegionCode || !Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId) || !Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId)
|
51 |
+
) {
|
52 |
+
Mage::throwException(Mage::helper('sales')->__('Insufficient information to create shipping label(s). Please verify your Store Information and Shipping Settings.'));
|
53 |
+
}
|
54 |
+
|
55 |
+
/** @var $request Mage_Shipping_Model_Shipment_Request */
|
56 |
+
$request = Mage::getModel('shipping/shipment_request');
|
57 |
+
$request->setOrderShipment($orderShipment);
|
58 |
+
$request->setShipperContactPersonName($admin->getName());
|
59 |
+
$request->setShipperContactPersonFirstName($admin->getFirstname());
|
60 |
+
$request->setShipperContactPersonLastName($admin->getLastname());
|
61 |
+
$request->setShipperContactCompanyName($storeInfo->getName());
|
62 |
+
$request->setShipperContactPhoneNumber($storeInfo->getPhone());
|
63 |
+
$request->setShipperEmail($admin->getEmail());
|
64 |
+
$request->setShipperAddressStreet(trim($originStreet1 . ' ' . $originStreet2));
|
65 |
+
$request->setShipperAddressStreet1($originStreet1);
|
66 |
+
$request->setShipperAddressStreet2($originStreet2);
|
67 |
+
$request->setShipperAddressCity(Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId));
|
68 |
+
$request->setShipperAddressStateOrProvinceCode($shipperRegionCode);
|
69 |
+
$request->setShipperAddressPostalCode(Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId));
|
70 |
+
$request->setShipperAddressCountryCode(Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId));
|
71 |
+
$request->setRecipientContactPersonName(trim($address->getFirstname() . ' ' . $address->getLastname()));
|
72 |
+
$request->setRecipientContactPersonFirstName($address->getFirstname());
|
73 |
+
$request->setRecipientContactPersonLastName($address->getLastname());
|
74 |
+
$request->setRecipientContactCompanyName($address->getCompany());
|
75 |
+
$request->setRecipientContactPhoneNumber($address->getTelephone());
|
76 |
+
$request->setRecipientEmail($address->getEmail());
|
77 |
+
$request->setRecipientAddressStreet(trim($address->getStreet1() . ' ' . $address->getStreet2()));
|
78 |
+
$request->setRecipientAddressStreet1($address->getStreet1());
|
79 |
+
$request->setRecipientAddressStreet2($address->getStreet2());
|
80 |
+
$request->setRecipientAddressCity($address->getCity());
|
81 |
+
$request->setRecipientAddressStateOrProvinceCode($address->getRegionCode());
|
82 |
+
$request->setRecipientAddressRegionCode($recipientRegionCode);
|
83 |
+
$request->setRecipientAddressPostalCode($address->getPostcode());
|
84 |
+
$request->setRecipientAddressCountryCode($address->getCountryId());
|
85 |
+
$request->setShippingMethod($shippingMethod->getMethod());
|
86 |
+
$request->setPackageWeight($order->getWeight());
|
87 |
+
$request->setPackages($orderShipment->getPackages());
|
88 |
+
$request->setBaseCurrencyCode($baseCurrencyCode);
|
89 |
+
$request->setStoreId($shipmentStoreId);
|
90 |
+
|
91 |
+
return $shipmentCarrier->requestToShipment($request);
|
92 |
+
}
|
93 |
+
|
94 |
+
protected function _getShipmentCarrier($method, $carrierCode)
|
95 |
+
{
|
96 |
+
return new Varien_Object(
|
97 |
+
array(
|
98 |
+
'carrier_code' => $carrierCode,
|
99 |
+
'method' => $method
|
100 |
+
)
|
101 |
+
);
|
102 |
+
}
|
103 |
+
}
|
app/code/community/Webshopapps/Despatchbay/changelog.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1.0 - DespatchBay
|
2 |
+
1.0.1 - DB2 - Resolved issue with wrong method at the top of label dropdown
|
3 |
+
1.0.2 - DB3 - Removed redundant configuration options
|
4 |
+
1.0.3 - DB3 - Added formatting checks to URL
|
5 |
+
1.0.5 - DB5 - Changed attribute within the shipment request
|
app/code/community/Webshopapps/Despatchbay/controllers/AdminhtmlController.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 15/04/2014
|
10 |
+
* Time 15:24
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Despatchbay_AdminhtmlController extends Mage_Adminhtml_Controller_Action
|
17 |
+
{
|
18 |
+
public function refreshcarriersAction()
|
19 |
+
{
|
20 |
+
$carrier = Mage::getModel('webshopapps_despatchbay/carrier_despatchbay');
|
21 |
+
$refreshResult = $carrier->refreshCarriers();
|
22 |
+
$success = 0;
|
23 |
+
$message = Mage::helper('webshopapps_despatchbay')->__('There was an issue connecting to ShipperHQ');
|
24 |
+
|
25 |
+
if ($refreshResult) {
|
26 |
+
$success = 1;
|
27 |
+
$message = Mage::helper('webshopapps_despatchbay')->__('Despatch Bay has been updated via ShipperHQ');
|
28 |
+
}
|
29 |
+
|
30 |
+
$result= array('result' =>$success, 'message' =>$message);
|
31 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Webshopapps/Despatchbay/controllers/ShipmentController.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 16/04/2014
|
10 |
+
* Time 14:35
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
|
17 |
+
|
18 |
+
class Webshopapps_Despatchbay_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController
|
19 |
+
{
|
20 |
+
public function createDespatchbayLabelAction()
|
21 |
+
{
|
22 |
+
$response = new Varien_Object();
|
23 |
+
try {
|
24 |
+
$shipment = $this->_initShipment();
|
25 |
+
if ($this->_createShippingLabel($shipment)) {
|
26 |
+
$shipment->save();
|
27 |
+
$this->_getSession()->addSuccess(Mage::helper('sales')->__('The shipping label has been created.'));
|
28 |
+
$response->setOk(true);
|
29 |
+
}
|
30 |
+
} catch (Mage_Core_Exception $e) {
|
31 |
+
$response->setError(true);
|
32 |
+
$response->setMessage($e->getMessage());
|
33 |
+
} catch (Exception $e) {
|
34 |
+
Mage::logException($e);
|
35 |
+
$response->setError(true);
|
36 |
+
$response->setMessage(Mage::helper('sales')->__('An error occurred while creating shipping label.'));
|
37 |
+
}
|
38 |
+
|
39 |
+
$this->getResponse()->setBody($response->toJson());
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @return null|void
|
44 |
+
*/
|
45 |
+
public function saveAction()
|
46 |
+
{
|
47 |
+
$data = $this->getRequest()->getPost('shipment');
|
48 |
+
$isNeedCreateLabel = false;
|
49 |
+
$responseAjax = new Varien_Object();
|
50 |
+
$shipment = false;
|
51 |
+
|
52 |
+
if (!empty($data['comment_text'])) {
|
53 |
+
Mage::getSingleton('adminhtml/session')->setCommentText($data['comment_text']);
|
54 |
+
}
|
55 |
+
try {
|
56 |
+
$shipment = $this->_initShipment();
|
57 |
+
if (!$shipment) {
|
58 |
+
$this->_forward('noRoute');
|
59 |
+
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
$shipment->register();
|
64 |
+
$comment = '';
|
65 |
+
if (!empty($data['comment_text'])) {
|
66 |
+
$shipment->addComment($data['comment_text'], isset($data['comment_customer_notify']), isset($data['is_visible_on_front']));
|
67 |
+
if (isset($data['comment_customer_notify'])) {
|
68 |
+
$comment = $data['comment_text'];
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
if (!empty($data['send_email'])) {
|
73 |
+
$shipment->setEmailSent(true);
|
74 |
+
}
|
75 |
+
|
76 |
+
$shipment->getOrder()->setCustomerNoteNotify(!empty($data['send_email']));
|
77 |
+
$responseAjax = new Varien_Object();
|
78 |
+
$isNeedCreateLabel = isset($data['create_shipping_label']) && $data['create_shipping_label'];
|
79 |
+
|
80 |
+
if ($isNeedCreateLabel && $this->_createShippingLabel($shipment)) {
|
81 |
+
$responseAjax->setOk(true);
|
82 |
+
}
|
83 |
+
|
84 |
+
$this->_saveShipment($shipment);
|
85 |
+
|
86 |
+
$shipment->sendEmail(!empty($data['send_email']), $comment);
|
87 |
+
|
88 |
+
$shipmentCreatedMessage = $this->__('The shipment has been created.');
|
89 |
+
$labelCreatedMessage = $this->__('The shipping label has been created.');
|
90 |
+
|
91 |
+
$this->_getSession()->addSuccess($isNeedCreateLabel ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage : $shipmentCreatedMessage);
|
92 |
+
Mage::getSingleton('adminhtml/session')->getCommentText(true);
|
93 |
+
} catch (Mage_Core_Exception $e) {
|
94 |
+
if ($isNeedCreateLabel) {
|
95 |
+
$responseAjax->setError(true);
|
96 |
+
$responseAjax->setMessage($e->getMessage());
|
97 |
+
} else {
|
98 |
+
$this->_getSession()->addError($e->getMessage());
|
99 |
+
$this->_redirect('adminhtml/sales_order/view', array('order_id' => $this->getRequest()->getParam('order_id')));
|
100 |
+
}
|
101 |
+
} catch (Exception $e) {
|
102 |
+
Mage::logException($e);
|
103 |
+
if ($isNeedCreateLabel) {
|
104 |
+
$responseAjax->setError(true);
|
105 |
+
$responseAjax->setMessage(Mage::helper('sales')->__('An error occurred while creating shipping label.'));
|
106 |
+
} else {
|
107 |
+
$this->_getSession()->addError($this->__('Cannot save shipment.'));
|
108 |
+
$this->_redirect('adminhtml/sales_order/view', array('order_id' => $this->getRequest()->getParam('order_id')));
|
109 |
+
}
|
110 |
+
}
|
111 |
+
if ($isNeedCreateLabel) {
|
112 |
+
$this->getResponse()->setBody($responseAjax->toJson());
|
113 |
+
} else {
|
114 |
+
$this->_redirect('adminhtml/sales_order/view', array('order_id' => $shipment->getOrderId()));
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Create shipping label for specific shipment with validation.
|
120 |
+
*
|
121 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
protected function _createShippingLabel(Mage_Sales_Model_Order_Shipment $shipment)
|
125 |
+
{
|
126 |
+
if (!$shipment) {
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
|
130 |
+
$despatchbayCarrier = Mage::getModel('webshopapps_despatchbay/carrier_despatchbay');
|
131 |
+
$useDespatchbay = false;
|
132 |
+
$packages = $this->getRequest()->getParam('packages');
|
133 |
+
|
134 |
+
foreach ($packages as $key => $package) {
|
135 |
+
$containerArray = explode('#', $package['params']['container']);
|
136 |
+
if (count($containerArray) > 1) {
|
137 |
+
$newpackage = $package;
|
138 |
+
$newpackage['params']['container'] = $containerArray[1];
|
139 |
+
|
140 |
+
if ($containerArray[0] == $despatchbayCarrier->getCarrierCode()) {
|
141 |
+
$useDespatchbay = true;
|
142 |
+
}
|
143 |
+
|
144 |
+
$packages[$key] = $newpackage;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
if (!$useDespatchbay) {
|
149 |
+
return parent::_createShippingLabel($shipment);
|
150 |
+
}
|
151 |
+
|
152 |
+
$this->getRequest()->setParam('packages', $packages);
|
153 |
+
|
154 |
+
if ($useDespatchbay) {
|
155 |
+
$carrier = $despatchbayCarrier;
|
156 |
+
} else {
|
157 |
+
$carrier = $shipment->getOrder()->getShippingCarrier();
|
158 |
+
}
|
159 |
+
|
160 |
+
if (!$carrier->isShippingLabelsAvailable()) {
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
|
164 |
+
$shipment->setPackages($this->getRequest()->getParam('packages'));
|
165 |
+
$response = Mage::getModel('webshopapps_despatchbay/shipping_shipping')->requestToShipment($shipment);
|
166 |
+
|
167 |
+
if ($response->hasErrors()) {
|
168 |
+
Mage::throwException($response->getErrors());
|
169 |
+
}
|
170 |
+
|
171 |
+
if (!$response->hasInfo()) {
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
$labelsContent = array();
|
176 |
+
$trackingNumbers = array();
|
177 |
+
$info = $response->getInfo();
|
178 |
+
|
179 |
+
foreach ($info as $inf) {
|
180 |
+
if (!empty($inf['tracking_number']) && !empty($inf['label_content'])) {
|
181 |
+
$labelsContent[] = $inf['label_content'];
|
182 |
+
$trackingNumbers[] = $inf['tracking_number'];
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
$outputPdf = $this->_combineLabelsPdf($labelsContent);
|
187 |
+
$shipment->setShippingLabel($outputPdf->render());
|
188 |
+
|
189 |
+
$carrierCode = $carrier->getCarrierCode();
|
190 |
+
$carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/title', $shipment->getStoreId());
|
191 |
+
|
192 |
+
if ($trackingNumbers) {
|
193 |
+
foreach ($trackingNumbers as $trackingNumber) {
|
194 |
+
$track = Mage::getModel('sales/order_shipment_track')->setNumber($trackingNumber)->setCarrierCode($carrierCode)->setTitle($carrierTitle);
|
195 |
+
$shipment->addTrack($track);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
}
|
app/code/community/Webshopapps/Despatchbay/etc/config.xml
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Josh Stewart
|
9 |
+
* Date 13 April 2014
|
10 |
+
* Time 11:00 AM
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
-->
|
17 |
+
<config>
|
18 |
+
<modules>
|
19 |
+
<Webshopapps_Despatchbay>
|
20 |
+
<version>0.1.0</version>
|
21 |
+
<depends>
|
22 |
+
<Mage_Shipping />
|
23 |
+
</depends>
|
24 |
+
</Webshopapps_Despatchbay>
|
25 |
+
</modules>
|
26 |
+
<global>
|
27 |
+
<models>
|
28 |
+
<webshopapps_despatchbay>
|
29 |
+
<class>Webshopapps_Despatchbay_Model</class>
|
30 |
+
<resourceModel>webshopapps_despatchbay_resource</resourceModel>
|
31 |
+
</webshopapps_despatchbay>
|
32 |
+
<webshopapps_despatchbay_shipping>
|
33 |
+
<class>Webshopapps_Despatchbay_Model</class>
|
34 |
+
</webshopapps_despatchbay_shipping>
|
35 |
+
</models>
|
36 |
+
<blocks>
|
37 |
+
<webshopapps_despatchbay>
|
38 |
+
<class>Webshopapps_Despatchbay_Block</class>
|
39 |
+
</webshopapps_despatchbay>
|
40 |
+
</blocks>
|
41 |
+
<helpers>
|
42 |
+
<webshopapps_despatchbay>
|
43 |
+
<class>Webshopapps_Despatchbay_Helper</class>
|
44 |
+
</webshopapps_despatchbay>
|
45 |
+
</helpers>
|
46 |
+
<sales>
|
47 |
+
<shipping>
|
48 |
+
<carriers>
|
49 |
+
<despatchbay>
|
50 |
+
<class>Webshopapps_Despatchbay_Model_Carrier_Despatchbay</class>
|
51 |
+
</despatchbay>
|
52 |
+
</carriers>
|
53 |
+
</shipping>
|
54 |
+
</sales>
|
55 |
+
<events>
|
56 |
+
<admin_system_config_changed_section_carriers>
|
57 |
+
<observers>
|
58 |
+
<connection_observer>
|
59 |
+
<class>webshopapps_despatchbay/observer</class>
|
60 |
+
<method>postError</method>
|
61 |
+
</connection_observer>
|
62 |
+
</observers>
|
63 |
+
</admin_system_config_changed_section_carriers>
|
64 |
+
<adminhtml_controller_action_predispatch_start>
|
65 |
+
<observers>
|
66 |
+
<webshopapps_despatchbay_labelcreate>
|
67 |
+
<class>webshopapps_despatchbay/observer</class>
|
68 |
+
<method>adminhtmlControllerActionPredispatchStart</method>
|
69 |
+
</webshopapps_despatchbay_labelcreate>
|
70 |
+
</observers>
|
71 |
+
</adminhtml_controller_action_predispatch_start>
|
72 |
+
<core_block_abstract_to_html_before>
|
73 |
+
<observers>
|
74 |
+
<webshopapps_despatchbay_add_checkbox>
|
75 |
+
<class>webshopapps_despatchbay/observer</class>
|
76 |
+
<method>coreBlockAbstractToHtmlBefore</method>
|
77 |
+
</webshopapps_despatchbay_add_checkbox>
|
78 |
+
</observers>
|
79 |
+
</core_block_abstract_to_html_before>
|
80 |
+
</events>
|
81 |
+
</global>
|
82 |
+
<admin>
|
83 |
+
<routers>
|
84 |
+
<webshopapps_despatchbay>
|
85 |
+
<use>admin</use>
|
86 |
+
<args>
|
87 |
+
<module>Webshopapps_Despatchbay</module>
|
88 |
+
<frontName>webshopapps_despatchbay</frontName>
|
89 |
+
</args>
|
90 |
+
</webshopapps_despatchbay>
|
91 |
+
</routers>
|
92 |
+
</admin>
|
93 |
+
<adminhtml>
|
94 |
+
<layout>
|
95 |
+
<updates>
|
96 |
+
<webshopapps_despatchbay module="Webshopapps_Despatchbay">
|
97 |
+
<file>webshopapps_despatchbay.xml</file>
|
98 |
+
</webshopapps_despatchbay>
|
99 |
+
</updates>
|
100 |
+
</layout>
|
101 |
+
</adminhtml>
|
102 |
+
<default>
|
103 |
+
<carriers>
|
104 |
+
<despatchbay>
|
105 |
+
<active>0</active>
|
106 |
+
<title>Despatch Bay</title>
|
107 |
+
<serial backend_model="adminhtml/system_config_backend_encrypted" />
|
108 |
+
<despatch_api_user backend_model="adminhtml/system_config_backend_encrypted" />
|
109 |
+
<despatch_api_key backend_model="adminhtml/system_config_backend_encrypted" />
|
110 |
+
<ship_once>0</ship_once>
|
111 |
+
<url>https://despatchbay.shipperhq.com/despatch-bay-ws/v1/</url>
|
112 |
+
<model>webshopapps_despatchbay/carrier_despatchbay</model>
|
113 |
+
<debug>0</debug>
|
114 |
+
<label_size>1A4</label_size>
|
115 |
+
<all_methods></all_methods>
|
116 |
+
<allowed_methods>Priority 12,DB_1,DB_2,DB_3,DB_4,DB_5,DB_6,DB_7,DB_8,DB_9,DB_10,DB_11,DB_12,DB_13,DB_14,DB_15,DB_16,DB_17,DB_18,DB_19,DB_20,DB_21,DB_22,DB_23,DB_24,DB_25,DB_26,DB_27,DB_28,DB_29,DB_30,DB_31,DB_32,DB_33,DB_34,DB_35,DB_36,DB_37,DB_38,DB_39,DB_40,DB_41,DB_42,DB_43,DB_44,DB_45,DB_46,DB_47,DB_48,DB_49,DB_50,DB_51,DB_52,DB_53,DB_54,DB_55,DB_56,DB_57,DB_58,DB_59,DB_60,DB_61,DB_62,DB_63,DB_64,DB_65,DB_66,DB_67,DB_68,DB_69,DB_70,DB_71,DB_72,DB_73,DB_74,DB_75</allowed_methods>
|
117 |
+
<shipment_email>1</shipment_email>
|
118 |
+
<shipment_dashboard>1</shipment_dashboard>
|
119 |
+
<sallowspecific>0</sallowspecific>
|
120 |
+
<showmethod>0</showmethod>
|
121 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
122 |
+
<notification_severity>1</notification_severity>
|
123 |
+
<notification_msg>This store and Shipper HQ are out of synch, please Synchronize Now</notification_msg>
|
124 |
+
</despatchbay>
|
125 |
+
</carriers>
|
126 |
+
</default>
|
127 |
+
</config>
|
app/code/community/Webshopapps/Despatchbay/etc/system.xml
ADDED
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Despatchbay
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 15/04/2014
|
10 |
+
* Time 10:16
|
11 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2014, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
-->
|
17 |
+
<config>
|
18 |
+
<sections>
|
19 |
+
<carriers translate="label" module="shipping">
|
20 |
+
<groups>
|
21 |
+
<despatchbay translate="label">
|
22 |
+
<label>Despatch Bay - Powered by WebShopApps</label>
|
23 |
+
<frontend_model>webshopapps_despatchbay/adminhtml_carrier_about</frontend_model>
|
24 |
+
<sort_order>2</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 |
+
<comment>
|
29 |
+
<![CDATA[
|
30 |
+
Despatch Bay makes sending parcels quick & easy. For more information about Despatch Bay visit <a href="http://www.despatchbay.com" target="_blank">www.DespatchBay.com</a> <br />
|
31 |
+
If you have questions about the WebShopApps Despatch Bay Shipping extension visit our <a href="http://support.webshopapps.com/despatchbayshipping" target="_blank">Despatch Bay Shipping Knowledge Base</a> for documentation and examples.<br /> <br />
|
32 |
+
In order to use this extension you will need to sign up for a <a href="https://despatchbaypro.com/newaccount" target="_blank">Despatch Bay Pro account</a>.<br />
|
33 |
+
Instructions on how to register and obtain your API Access Details are available on the <a href="http://support.webshopapps.com/despatchbayshipping" target="_blank">Despatch Bay Shipping Knowledge Base</a>.
|
34 |
+
]]>
|
35 |
+
</comment>
|
36 |
+
<fields>
|
37 |
+
<active translate="label">
|
38 |
+
<label>Enabled for Shipping Rates</label>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</active>
|
46 |
+
<labels translate="label">
|
47 |
+
<label>Enabled for Shipments and Labels</label>
|
48 |
+
<frontend_type>select</frontend_type>
|
49 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
50 |
+
<sort_order>20</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</labels>
|
55 |
+
<serial>
|
56 |
+
<label>Serial Key</label>
|
57 |
+
<frontend_type>obscure</frontend_type>
|
58 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
59 |
+
<sort_order>30</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</serial>
|
64 |
+
<despatchbay_heading translate="label">
|
65 |
+
<label>Despatch Bay Configuration</label>
|
66 |
+
<frontend_model>webshopapps_despatchbay/adminhtml_system_config_form_field_heading</frontend_model>
|
67 |
+
<sort_order>40</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
</despatchbay_heading>
|
71 |
+
<title>
|
72 |
+
<label>Carrier Title</label>
|
73 |
+
<frontend_type>text</frontend_type>
|
74 |
+
<sort_order>50</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 |
+
<comment>This is updated dynamically from ShipperHQ</comment>
|
79 |
+
</title>
|
80 |
+
<despatch_api_user>
|
81 |
+
<label>Despatch Bay API User ID</label>
|
82 |
+
<frontend_type>obscure</frontend_type>
|
83 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
84 |
+
<sort_order>60</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</despatch_api_user>
|
89 |
+
<despatch_api_key>
|
90 |
+
<label>Despatch Bay API Key</label>
|
91 |
+
<frontend_type>obscure</frontend_type>
|
92 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
93 |
+
<sort_order>70</sort_order>
|
94 |
+
<show_in_default>1</show_in_default>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>1</show_in_store>
|
97 |
+
</despatch_api_key>
|
98 |
+
<allowed_methods translate="label">
|
99 |
+
<label>Allowed Methods</label>
|
100 |
+
<frontend_type>multiselect</frontend_type>
|
101 |
+
<source_model>webshopapps_despatchbay/carrier_despatchbay_source_method</source_model>
|
102 |
+
<sort_order>75</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>0</show_in_store>
|
106 |
+
<can_be_empty>1</can_be_empty>
|
107 |
+
<comment><![CDATA[Please select methods you wish to obtain rates for]]>
|
108 |
+
</comment>
|
109 |
+
</allowed_methods>
|
110 |
+
<label_size>
|
111 |
+
<label>Label Size</label>
|
112 |
+
<frontend_type>select</frontend_type>
|
113 |
+
<source_model>webshopapps_despatchbay/carrier_despatchbay_source_labelformat</source_model>
|
114 |
+
<sort_order>80</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>0</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
</label_size>
|
119 |
+
<shipment_email>
|
120 |
+
<label>Email Notificaton of Shipment to Customer</label>
|
121 |
+
<frontend_type>select</frontend_type>
|
122 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
123 |
+
<sort_order>90</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>0</show_in_website>
|
126 |
+
<show_in_store>0</show_in_store>
|
127 |
+
</shipment_email>
|
128 |
+
<shipment_dashboard>
|
129 |
+
<label>Dashboard Notificaton of Shipment to Customer</label>
|
130 |
+
<frontend_type>select</frontend_type>
|
131 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
132 |
+
<sort_order>100</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>0</show_in_website>
|
135 |
+
<show_in_store>0</show_in_store>
|
136 |
+
</shipment_dashboard>
|
137 |
+
<shipperhq_heading translate="label">
|
138 |
+
<label>ShipperHQ Configuration</label>
|
139 |
+
<frontend_model>webshopapps_despatchbay/adminhtml_system_config_form_field_heading</frontend_model>
|
140 |
+
<sort_order>110</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
</shipperhq_heading>
|
144 |
+
<url>
|
145 |
+
<label>Secure URL</label>
|
146 |
+
<frontend_type>text</frontend_type>
|
147 |
+
<sort_order>120</sort_order>
|
148 |
+
<show_in_default>1</show_in_default>
|
149 |
+
<show_in_website>1</show_in_website>
|
150 |
+
<show_in_store>1</show_in_store>
|
151 |
+
</url>
|
152 |
+
<refresh_methods translate="label">
|
153 |
+
<label>Refresh Methods</label>
|
154 |
+
<frontend_type>select</frontend_type>
|
155 |
+
<frontend_model>webshopapps_despatchbay/adminhtml_carrier_refreshcarriers</frontend_model>
|
156 |
+
<button_label>Refresh Now</button_label>
|
157 |
+
<sort_order>160</sort_order>
|
158 |
+
<show_in_default>1</show_in_default>
|
159 |
+
<show_in_website>0</show_in_website>
|
160 |
+
<show_in_store>0</show_in_store>
|
161 |
+
</refresh_methods>
|
162 |
+
<magento_heading translate="label">
|
163 |
+
<label>Standard Configuration</label>
|
164 |
+
<frontend_model>webshopapps_despatchbay/adminhtml_system_config_form_field_heading</frontend_model>
|
165 |
+
<sort_order>170</sort_order>
|
166 |
+
<show_in_default>1</show_in_default>
|
167 |
+
<show_in_website>1</show_in_website>
|
168 |
+
</magento_heading>
|
169 |
+
<free_method translate="label">
|
170 |
+
<label>Free Method</label>
|
171 |
+
<frontend_type>select</frontend_type>
|
172 |
+
<frontend_class>free-method</frontend_class>
|
173 |
+
<source_model>webshopapps_despatchbay/carrier_despatchbay_source_freemethod</source_model>
|
174 |
+
<sort_order>175</sort_order>
|
175 |
+
<show_in_default>1</show_in_default>
|
176 |
+
<show_in_website>1</show_in_website>
|
177 |
+
<show_in_store>0</show_in_store>
|
178 |
+
</free_method>
|
179 |
+
<handling_type translate="label">
|
180 |
+
<label>Calculate Handling Fee</label>
|
181 |
+
<frontend_type>select</frontend_type>
|
182 |
+
<source_model>shipping/source_handlingType</source_model>
|
183 |
+
<sort_order>180</sort_order>
|
184 |
+
<show_in_default>1</show_in_default>
|
185 |
+
<show_in_website>1</show_in_website>
|
186 |
+
<show_in_store>0</show_in_store>
|
187 |
+
</handling_type>
|
188 |
+
<handling_action translate="label">
|
189 |
+
<label>Handling Applied</label>
|
190 |
+
<frontend_type>select</frontend_type>
|
191 |
+
<source_model>shipping/source_handlingAction</source_model>
|
192 |
+
<sort_order>190</sort_order>
|
193 |
+
<show_in_default>1</show_in_default>
|
194 |
+
<show_in_website>1</show_in_website>
|
195 |
+
<show_in_store>0</show_in_store>
|
196 |
+
</handling_action>
|
197 |
+
<handling_fee translate="label">
|
198 |
+
<label>Handling Fee</label>
|
199 |
+
<frontend_type>text</frontend_type>
|
200 |
+
<validate>validate-number validate-zero-or-greater</validate>
|
201 |
+
<sort_order>200</sort_order>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>1</show_in_website>
|
204 |
+
<show_in_store>0</show_in_store>
|
205 |
+
</handling_fee>
|
206 |
+
<sallowspecific translate="label">
|
207 |
+
<label>Ship to Applicable Countries</label>
|
208 |
+
<frontend_type>select</frontend_type>
|
209 |
+
<sort_order>210</sort_order>
|
210 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
211 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
212 |
+
<show_in_default>1</show_in_default>
|
213 |
+
<show_in_website>1</show_in_website>
|
214 |
+
<show_in_store>1</show_in_store>
|
215 |
+
</sallowspecific>
|
216 |
+
<specificcountry translate="label">
|
217 |
+
<label>Ship to Specific Countries</label>
|
218 |
+
<frontend_type>multiselect</frontend_type>
|
219 |
+
<sort_order>220</sort_order>
|
220 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>1</show_in_store>
|
224 |
+
</specificcountry>
|
225 |
+
<showmethod translate="label">
|
226 |
+
<label>Show Method if Not Applicable</label>
|
227 |
+
<frontend_type>select</frontend_type>
|
228 |
+
<sort_order>230</sort_order>
|
229 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
230 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
231 |
+
<show_in_default>1</show_in_default>
|
232 |
+
<show_in_website>1</show_in_website>
|
233 |
+
<show_in_store>1</show_in_store>
|
234 |
+
</showmethod>
|
235 |
+
<specificerrmsg translate="label">
|
236 |
+
<label>Displayed Error Message</label>
|
237 |
+
<frontend_type>textarea</frontend_type>
|
238 |
+
<sort_order>240</sort_order>
|
239 |
+
<show_in_default>1</show_in_default>
|
240 |
+
<show_in_website>1</show_in_website>
|
241 |
+
<show_in_store>1</show_in_store>
|
242 |
+
<comment>
|
243 |
+
This error message will be displayed if no error message
|
244 |
+
is returned from ShipperHQ
|
245 |
+
</comment>
|
246 |
+
</specificerrmsg>
|
247 |
+
<debug translate="label">
|
248 |
+
<label>Debug</label>
|
249 |
+
<frontend_type>select</frontend_type>
|
250 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
251 |
+
<sort_order>250</sort_order>
|
252 |
+
<show_in_default>1</show_in_default>
|
253 |
+
<show_in_website>1</show_in_website>
|
254 |
+
<show_in_store>0</show_in_store>
|
255 |
+
</debug>
|
256 |
+
<sort_order translate="label">
|
257 |
+
<label>Sort Order</label>
|
258 |
+
<frontend_type>text</frontend_type>
|
259 |
+
<sort_order>260</sort_order>
|
260 |
+
<show_in_default>1</show_in_default>
|
261 |
+
<show_in_website>1</show_in_website>
|
262 |
+
<show_in_store>1</show_in_store>
|
263 |
+
</sort_order>
|
264 |
+
</fields>
|
265 |
+
</despatchbay>
|
266 |
+
</groups>
|
267 |
+
</carriers>
|
268 |
+
</sections>
|
269 |
+
</config>
|
app/code/community/Webshopapps/Despatchbay/etc/wsdl/Despatchbay/Shippingv11.wsdl
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="windows-1252"?>
|
2 |
+
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:despatchbay" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:despatchbay">
|
3 |
+
<types>
|
4 |
+
<xsd:schema targetNamespace="urn:despatchbay">
|
5 |
+
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
|
6 |
+
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
|
7 |
+
<xsd:complexType name="ServiceType">
|
8 |
+
<xsd:all>
|
9 |
+
<xsd:element name="ServiceID" type="xsd:int"/>
|
10 |
+
<xsd:element name="Name" type="xsd:string"/>
|
11 |
+
<xsd:element name="Cost" type="xsd:float"/>
|
12 |
+
</xsd:all>
|
13 |
+
</xsd:complexType>
|
14 |
+
<xsd:complexType name="ArrayOfServiceType">
|
15 |
+
<xsd:complexContent>
|
16 |
+
<xsd:restriction base="SOAP-ENC:Array">
|
17 |
+
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:ServiceType[]"/>
|
18 |
+
</xsd:restriction>
|
19 |
+
</xsd:complexContent>
|
20 |
+
</xsd:complexType>
|
21 |
+
<xsd:complexType name="ShipmentReturnType">
|
22 |
+
<xsd:all>
|
23 |
+
<xsd:element name="ShipmentID" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
24 |
+
<xsd:element name="ServiceID" type="xsd:int" minOccurs="1" maxOccurs="1"/>
|
25 |
+
<xsd:element name="CreateDate" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
26 |
+
<xsd:element name="ParcelQuantity" type="xsd:int" minOccurs="1" maxOccurs="1"/>
|
27 |
+
<xsd:element name="Printed" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
|
28 |
+
<xsd:element name="StartTrackingNumber" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
29 |
+
<xsd:element name="EndTrackingNumber" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
30 |
+
<xsd:element name="Despatched" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
|
31 |
+
<xsd:element name="DespatchDate" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
32 |
+
<xsd:element name="OrderReference" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
33 |
+
<xsd:element name="Contents" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
34 |
+
<xsd:element name="CompanyName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
35 |
+
<xsd:element name="RecipientName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
36 |
+
<xsd:element name="Street" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
37 |
+
<xsd:element name="Locality" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
38 |
+
<xsd:element name="Town" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
39 |
+
<xsd:element name="County" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
40 |
+
<xsd:element name="Country" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
41 |
+
<xsd:element name="Postcode" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
42 |
+
<xsd:element name="RecipientEmail" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
43 |
+
<xsd:element name="EmailNotification" type="xsd:int" minOccurs="1" maxOccurs="1"/>
|
44 |
+
<xsd:element name="DashboardNotification" type="xsd:int" minOccurs="1" maxOccurs="1"/>
|
45 |
+
</xsd:all>
|
46 |
+
</xsd:complexType>
|
47 |
+
<xsd:complexType name="ArrayOfShipmentReturnType">
|
48 |
+
<xsd:complexContent>
|
49 |
+
<xsd:restriction base="SOAP-ENC:Array">
|
50 |
+
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:ShipmentReturnType[]"/>
|
51 |
+
</xsd:restriction>
|
52 |
+
</xsd:complexContent>
|
53 |
+
</xsd:complexType>
|
54 |
+
<xsd:complexType name="ShipmentRequestType">
|
55 |
+
<xsd:all>
|
56 |
+
<xsd:element name="ServiceID" type="xsd:int" minOccurs="1" maxOccurs="1"/>
|
57 |
+
<xsd:element name="ParcelQuantity" type="xsd:int" minOccurs="1" maxOccurs="1"/>
|
58 |
+
<xsd:element name="OrderReference" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
59 |
+
<xsd:element name="Contents" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
60 |
+
<xsd:element name="CompanyName" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
61 |
+
<xsd:element name="RecipientName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
62 |
+
<xsd:element name="Street" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
63 |
+
<xsd:element name="Locality" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
64 |
+
<xsd:element name="Town" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
65 |
+
<xsd:element name="County" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
66 |
+
<xsd:element name="Postcode" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
67 |
+
<xsd:element name="RecipientEmail" type="xsd:string" minOccurs="0" maxOccurs="1"/>
|
68 |
+
<xsd:element name="EmailNotification" type="xsd:int" minOccurs="0" maxOccurs="1"/>
|
69 |
+
<xsd:element name="DashboardNotification" type="xsd:int" minOccurs="0" maxOccurs="1"/>
|
70 |
+
</xsd:all>
|
71 |
+
</xsd:complexType>
|
72 |
+
</xsd:schema>
|
73 |
+
</types>
|
74 |
+
<message name="GetDomesticServicesRequest">
|
75 |
+
<part name="postcode" type="xsd:string"/></message>
|
76 |
+
<message name="GetDomesticServicesResponse">
|
77 |
+
<part name="return" type="tns:ArrayOfServiceType"/></message>
|
78 |
+
<message name="GetDomesticServicesByPostcodeRequest">
|
79 |
+
<part name="postcode" type="xsd:string"/></message>
|
80 |
+
<message name="GetDomesticServicesByPostcodeResponse">
|
81 |
+
<part name="return" type="tns:ArrayOfServiceType"/></message>
|
82 |
+
<message name="GetShipmentRequest">
|
83 |
+
<part name="ShipmentID" type="xsd:string"/></message>
|
84 |
+
<message name="GetShipmentResponse">
|
85 |
+
<part name="return" type="tns:ShipmentReturnType"/></message>
|
86 |
+
<message name="AddDomesticShipmentRequest">
|
87 |
+
<part name="Shipment" type="tns:ShipmentRequestType"/></message>
|
88 |
+
<message name="AddDomesticShipmentResponse">
|
89 |
+
<part name="ShipmentID" type="xsd:string"/></message>
|
90 |
+
<portType name="ShippingServicePortType">
|
91 |
+
<operation name="GetDomesticServices">
|
92 |
+
<documentation>Returns all available courier services for your account</documentation>
|
93 |
+
<input message="tns:GetDomesticServicesRequest"/>
|
94 |
+
<output message="tns:GetDomesticServicesResponse"/>
|
95 |
+
</operation>
|
96 |
+
<operation name="GetDomesticServicesByPostcode">
|
97 |
+
<documentation>Returns the courier services available at the destination postcode</documentation>
|
98 |
+
<input message="tns:GetDomesticServicesByPostcodeRequest"/>
|
99 |
+
<output message="tns:GetDomesticServicesByPostcodeResponse"/>
|
100 |
+
</operation>
|
101 |
+
<operation name="GetShipment">
|
102 |
+
<documentation>Returns Shipment Detail</documentation>
|
103 |
+
<input message="tns:GetShipmentRequest"/>
|
104 |
+
<output message="tns:GetShipmentResponse"/>
|
105 |
+
</operation>
|
106 |
+
<operation name="AddDomesticShipment">
|
107 |
+
<documentation>Queues a new shipment</documentation>
|
108 |
+
<input message="tns:AddDomesticShipmentRequest"/>
|
109 |
+
<output message="tns:AddDomesticShipmentResponse"/>
|
110 |
+
</operation>
|
111 |
+
</portType>
|
112 |
+
<binding name="ShippingServiceBinding" type="tns:ShippingServicePortType">
|
113 |
+
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
114 |
+
<operation name="GetDomesticServices">
|
115 |
+
<soap:operation soapAction="urn:despatchbay#GetDomesticServices" style="rpc"/>
|
116 |
+
<input><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
117 |
+
<output><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
118 |
+
</operation>
|
119 |
+
<operation name="GetDomesticServicesByPostcode">
|
120 |
+
<soap:operation soapAction="urn:despatchbay#GetDomesticServicesByPostcode" style="rpc"/>
|
121 |
+
<input><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
122 |
+
<output><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
123 |
+
</operation>
|
124 |
+
<operation name="GetShipment">
|
125 |
+
<soap:operation soapAction="urn:despatchbay#GetShipment" style="rpc"/>
|
126 |
+
<input><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
127 |
+
<output><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
128 |
+
</operation>
|
129 |
+
<operation name="AddDomesticShipment">
|
130 |
+
<soap:operation soapAction="urn:despatchbay#AddDomesticShipment" style="rpc"/>
|
131 |
+
<input><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
132 |
+
<output><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
133 |
+
</operation>
|
134 |
+
</binding>
|
135 |
+
<service name="ShippingService">
|
136 |
+
<port name="ShippingServicePort" binding="tns:ShippingServiceBinding">
|
137 |
+
<soap:address location="http://api.despatchbaypro.com/api/soap/v11/shipping.php"/>
|
138 |
+
</port>
|
139 |
+
</service>
|
140 |
+
</definitions>
|
app/code/community/Webshopapps/Despatchbay/etc/wsdl/Despatchbay/Trackingv11.wsdl
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="windows-1252"?>
|
2 |
+
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:despatchbay" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:despatchbay">
|
3 |
+
<types>
|
4 |
+
<xsd:schema targetNamespace="urn:despatchbay">
|
5 |
+
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
|
6 |
+
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
|
7 |
+
<xsd:complexType name="TrackingCodeType">
|
8 |
+
<xsd:all>
|
9 |
+
<xsd:element name="Code" type="xsd:int"/>
|
10 |
+
<xsd:element name="Description" type="xsd:string"/>
|
11 |
+
</xsd:all>
|
12 |
+
</xsd:complexType>
|
13 |
+
<xsd:complexType name="ArrayOfTrackingCodeType">
|
14 |
+
<xsd:complexContent>
|
15 |
+
<xsd:restriction base="SOAP-ENC:Array">
|
16 |
+
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:TrackingCodeType[]"/>
|
17 |
+
</xsd:restriction>
|
18 |
+
</xsd:complexContent>
|
19 |
+
</xsd:complexType>
|
20 |
+
<xsd:complexType name="TrackingType">
|
21 |
+
<xsd:all>
|
22 |
+
<xsd:element name="Date" type="xsd:string"/>
|
23 |
+
<xsd:element name="Time" type="xsd:string"/>
|
24 |
+
<xsd:element name="Code" type="xsd:string"/>
|
25 |
+
<xsd:element name="Description" type="xsd:string"/>
|
26 |
+
<xsd:element name="Location" type="xsd:string"/>
|
27 |
+
<xsd:element name="Signatory" type="xsd:string"/>
|
28 |
+
</xsd:all>
|
29 |
+
</xsd:complexType>
|
30 |
+
<xsd:complexType name="ArrayOfTrackingType">
|
31 |
+
<xsd:complexContent>
|
32 |
+
<xsd:restriction base="SOAP-ENC:Array">
|
33 |
+
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:TrackingType[]"/>
|
34 |
+
</xsd:restriction>
|
35 |
+
</xsd:complexContent>
|
36 |
+
</xsd:complexType>
|
37 |
+
</xsd:schema>
|
38 |
+
</types>
|
39 |
+
<message name="GetTrackingRequest">
|
40 |
+
<part name="trackingNumber" type="xsd:string"/></message>
|
41 |
+
<message name="GetTrackingResponse">
|
42 |
+
<part name="return" type="tns:ArrayOfTrackingType"/></message>
|
43 |
+
<portType name="TrackingServicePortType">
|
44 |
+
<operation name="GetTracking">
|
45 |
+
<documentation>Returns tracking information for a tracking number</documentation>
|
46 |
+
<input message="tns:GetTrackingRequest"/>
|
47 |
+
<output message="tns:GetTrackingResponse"/>
|
48 |
+
</operation>
|
49 |
+
</portType>
|
50 |
+
<binding name="TrackingServiceBinding" type="tns:TrackingServicePortType">
|
51 |
+
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
52 |
+
<operation name="GetTracking">
|
53 |
+
<soap:operation soapAction="urn:despatchbay#GetTracking" style="rpc"/>
|
54 |
+
<input><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
55 |
+
<output><soap:body use="encoded" namespace="urn:despatchbay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
56 |
+
</operation>
|
57 |
+
</binding>
|
58 |
+
<service name="TrackingService">
|
59 |
+
<port name="TrackingServicePort" binding="tns:TrackingServiceBinding">
|
60 |
+
<soap:address location="http://api.despatchbaypro.com/api/soap/v11/tracking.php"/>
|
61 |
+
</port>
|
62 |
+
</service>
|
63 |
+
</definitions>
|
app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/Sales/Order/Create/Shipping/Method/Form.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_dropfreight
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 20/09/2013
|
10 |
+
* Time 12:47
|
11 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2013, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
|
17 |
+
class Webshopapps_Wsacommon_Block_Adminhtml_Sales_Order_Create_Shipping_Method_Form extends Mage_Adminhtml_Block_Sales_Order_Create_Shipping_Method_Form
|
18 |
+
{
|
19 |
+
public function getLiftgateRequired()
|
20 |
+
{
|
21 |
+
if(Mage::getStoreConfig('shipping/wsafreightcommon/default_liftgate',Mage::app()->getStore()) && $this->getQuote()->getLiftgateRequired() == ''){
|
22 |
+
return true;
|
23 |
+
} else {
|
24 |
+
return $this->getQuote()->getLiftgateRequired();
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getShiptoType()
|
29 |
+
{
|
30 |
+
return $this->getQuote()->getShiptoType();
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getNotifyRequired()
|
34 |
+
{
|
35 |
+
return $this->getQuote()->getNotifyRequired();
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
public function getInsideDelivery()
|
40 |
+
{
|
41 |
+
return $this->getQuote()->getInsideDelivery();
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
public function getShiptoTypeHtmlSelect($defValue=null)
|
46 |
+
{
|
47 |
+
if (is_null($defValue)) {
|
48 |
+
$defValue=$this->getShiptoType();
|
49 |
+
}
|
50 |
+
|
51 |
+
$options = Mage::helper('wsafreightcommon')->getOptions();
|
52 |
+
|
53 |
+
$html = $this->getLayout()->createBlock('core/html_select')
|
54 |
+
->setName('shipto_type')
|
55 |
+
->setTitle(Mage::helper('wsafreightcommon')->__('Address Type'))
|
56 |
+
->setId('shipto_type')
|
57 |
+
->setClass('required-entry')
|
58 |
+
->setValue($defValue)
|
59 |
+
->setOptions($options)
|
60 |
+
->getHtml();
|
61 |
+
return $html;
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
public function dontShowCommonFreight()
|
66 |
+
{
|
67 |
+
return Mage::helper('wsafreightcommon')->dontShowCommonFreight(
|
68 |
+
$this->getQuote()->getAllItems(),$this->getQuote()->getShippingAddress()->getWeight());
|
69 |
+
}
|
70 |
+
/**
|
71 |
+
* Added in for compatibility with AddressValidator
|
72 |
+
* @param null $defValue
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function getDestTypeHtmlSelect($defValue=null)
|
76 |
+
{
|
77 |
+
if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsavalidation')){
|
78 |
+
if (is_null($defValue)) {
|
79 |
+
$defValue=$this->getQuote()->getDestType();
|
80 |
+
}
|
81 |
+
|
82 |
+
return Mage::helper('wsavalidation')->getBasicDestTypeHtmlSelect($this->getLayout(),$defValue);
|
83 |
+
}
|
84 |
+
return null;
|
85 |
+
}
|
86 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/System/Config/Form/Field/Exportmatrix.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Export CSV button for shipping table rates
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Adminhtml
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Webshopapps_Wsacommon_Block_Adminhtml_System_Config_Form_Field_Exportmatrix extends Mage_Adminhtml_Block_System_Config_Form_Field
|
36 |
+
{
|
37 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
38 |
+
{
|
39 |
+
$this->setElement($element);
|
40 |
+
$buttonBlock = $this->getLayout()->createBlock('adminhtml/widget_button');
|
41 |
+
$params = array(
|
42 |
+
'carrier_code' => $this->getCarrierCode(),
|
43 |
+
'website' => $buttonBlock->getRequest()->getParam('website')
|
44 |
+
);
|
45 |
+
$url = Mage::getModel('adminhtml/url')->getUrl("*/*/exportmatrix", $params);
|
46 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
47 |
+
->setType('button')
|
48 |
+
->setClass('scalable')
|
49 |
+
->setLabel('Export CSV')
|
50 |
+
->setOnClick("setLocation('$url')")
|
51 |
+
->toHtml();
|
52 |
+
|
53 |
+
return $html;
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function getCarrierCode() {
|
57 |
+
return 'nk';
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/System/Config/Form/Field/Heading.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Renderer for sub-heading in fieldset
|
31 |
+
*
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Webshopapps_Wsacommon_Block_Adminhtml_System_Config_Form_Field_Heading
|
35 |
+
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Render element html
|
39 |
+
*
|
40 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
44 |
+
{
|
45 |
+
$useContainerId = $element->getData('use_container_id');
|
46 |
+
return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
|
47 |
+
$element->getHtmlId(), $element->getLabel()
|
48 |
+
);
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Block/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Webshopapps Module
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
|
21 |
+
*
|
22 |
+
* @category Webshopapps
|
23 |
+
* @package Webshopapps_Importshipments
|
24 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
25 |
+
* Copyright, 2013, Zowta, LLC - US license
|
26 |
+
* @license www.webshopapps.com/license/license.txt
|
27 |
+
* @author Genevieve Eddison <sales@webshopapps.com>
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
class Webshopapps_Wsacommon_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
|
31 |
+
{
|
32 |
+
protected $_importTypes = array();
|
33 |
+
|
34 |
+
protected function _prepareMassaction()
|
35 |
+
{
|
36 |
+
parent::_prepareMassaction();
|
37 |
+
|
38 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Importshipments', 'shipping/importshipments/active')) {
|
39 |
+
|
40 |
+
$this->getMassactionBlock()->addItem('importshipments', array(
|
41 |
+
'label'=> Mage::helper('sales')->__('Create import template'),
|
42 |
+
'url' => $this->getUrl('*/sales_order_export/csvtemplateexport'),
|
43 |
+
));
|
44 |
+
}
|
45 |
+
|
46 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Oneclickcomplete', 'sales/oneclickcomplete/active')) {
|
47 |
+
$this->getMassactionBlock()->addItem('oneclickcomplete', array(
|
48 |
+
'label'=> Mage::helper('sales')->__('Create Shipment and Complete Orders'),
|
49 |
+
'url' => $this->getUrl('*/sales_order_complete/pdfcomplete'),
|
50 |
+
));
|
51 |
+
}
|
52 |
+
|
53 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Ordermanager', 'order_export/export_orders/active')) {
|
54 |
+
$this->getMassactionBlock()->addItem('ordermanager', array(
|
55 |
+
'label'=> Mage::helper('sales')->__('Export orders'),
|
56 |
+
'url' => $this->getUrl('*/sales_order_export/csvexport'),
|
57 |
+
));
|
58 |
+
if (Mage::helper('wsacommon')->getNewVersion() == 11) {
|
59 |
+
$this->getMassactionBlock()->setUseSelectAll(true);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getButtonHtml($label, $onclick, $class='', $id=null)
|
66 |
+
{
|
67 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
68 |
+
->setData(array(
|
69 |
+
'label'=> $label,
|
70 |
+
'onclick'=> $onclick,
|
71 |
+
'class'=> $class,
|
72 |
+
'type'=> 'button',
|
73 |
+
'id'=> $id,
|
74 |
+
))
|
75 |
+
->toHtml();
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getImportTypes()
|
79 |
+
{
|
80 |
+
return empty($this->_importTypes) ? false : $this->_importTypes;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function addImportType($label)
|
84 |
+
{
|
85 |
+
$this->_importTypes[] = new Varien_Object(
|
86 |
+
array(
|
87 |
+
'label' => $label
|
88 |
+
)
|
89 |
+
);
|
90 |
+
return $this;
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function _prepareColumns()
|
94 |
+
{
|
95 |
+
$this->addImportType('orders');
|
96 |
+
parent::_prepareColumns();
|
97 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Ordermanager', 'order_export/export_orders/active') && Mage::helper('wsacommon')->getNewVersion() >= 8 ) {
|
98 |
+
$this->addColumn('exported', array(
|
99 |
+
'header' => Mage::helper('sales')->__('Exported'),
|
100 |
+
'index' => 'exported',
|
101 |
+
'type' => 'options',
|
102 |
+
'width' => '10px',
|
103 |
+
'options' => Mage::getSingleton('ordermanager/options_exported')->toOptionArray(),
|
104 |
+
));
|
105 |
+
|
106 |
+
}
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
protected function _prepareCollection()
|
111 |
+
{
|
112 |
+
|
113 |
+
if (Mage::helper('wsacommon')->getNewVersion() >= 8 ) {
|
114 |
+
$collectionClass =$this->_getCollectionClass();
|
115 |
+
$collection = Mage::getResourceModel($collectionClass);
|
116 |
+
//added this
|
117 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Ordermanager', 'order_export/export_orders/active')) {
|
118 |
+
$collection->join('ordermanager/exported', 'entity_id=order_id', 'exported');
|
119 |
+
}
|
120 |
+
$this->setCollection($collection);
|
121 |
+
}
|
122 |
+
|
123 |
+
return parent::_prepareCollection();
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
?>
|
app/code/community/Webshopapps/Wsacommon/Helper/.DS_Store
ADDED
Binary file
|
app/code/community/Webshopapps/Wsacommon/Helper/Cache.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebShopApps Shipping Module
|
4 |
+
*
|
5 |
+
* @category WebShopApps
|
6 |
+
* @package WebShopApps_Wsacommon
|
7 |
+
* User karen
|
8 |
+
* Date 16/11/2013
|
9 |
+
* Time 22:19
|
10 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
11 |
+
* Copyright, 2013, Zowta, LLC - US license
|
12 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
|
16 |
+
|
17 |
+
class Webshopapps_Wsacommon_Helper_Cache extends Mage_Core_Helper_Abstract
|
18 |
+
{
|
19 |
+
const CACHE_PREFIX = 'wsacommon_cache'; // May want to push this to be declared in method later on
|
20 |
+
const CACHE_TAG = Mage_Core_Model_Config::CACHE_TAG;
|
21 |
+
const CACHE_TTL = 3600;
|
22 |
+
|
23 |
+
static $_dataCache;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Data Cache Key gen for Magento cache
|
27 |
+
* @param $key
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function getDataCacheKeySha($key)
|
31 |
+
{
|
32 |
+
if (is_array($key)) {
|
33 |
+
$key = implode(',',array_keys($key));
|
34 |
+
}
|
35 |
+
return sha1($key);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* get Cached Data for Magento cache
|
40 |
+
* @param $key
|
41 |
+
* @return mixed|null|string
|
42 |
+
*/
|
43 |
+
public function getCachedDataSha($key)
|
44 |
+
{
|
45 |
+
$result = $this->getCachedData($key);
|
46 |
+
if ($result === null) {
|
47 |
+
$cachedResult = Mage::app()->loadCache(self::CACHE_PREFIX . $this->getDataCacheKey($key));
|
48 |
+
if ($cachedResult) {
|
49 |
+
$result = $cachedResult;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
return $result;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* set Cached Data for Magento cache
|
57 |
+
* @param $key
|
58 |
+
* @param $value
|
59 |
+
* @return $this
|
60 |
+
*/
|
61 |
+
public function setCachedDataSha($key, $value)
|
62 |
+
{
|
63 |
+
$this->setCachedData($key, $value);
|
64 |
+
Mage::app()->saveCache($value, self::CACHE_PREFIX . $this->getDataCacheKey($key), array(self::CACHE_TAG), self::CACHE_TTL);
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Returns cache key for some request to carrier data service
|
70 |
+
*
|
71 |
+
* @param string|array $key
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function getDataCacheKey($key)
|
75 |
+
{
|
76 |
+
if (is_array($key)) {
|
77 |
+
$key = implode(',',array_keys($key));
|
78 |
+
}
|
79 |
+
return crc32($key);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Checks whether some request to rates have already been done, so we have cache for it
|
84 |
+
* Used to reduce number of same requests done to carrier service during one session
|
85 |
+
*
|
86 |
+
* Returns cached response or null
|
87 |
+
*
|
88 |
+
* @param string|array $key
|
89 |
+
* @return null|string
|
90 |
+
*/
|
91 |
+
public function getCachedData($key)
|
92 |
+
{
|
93 |
+
$key = $this->getDataCacheKey($key);
|
94 |
+
return isset(self::$_dataCache[$key]) ? self::$_dataCache[$key] : null;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Sets received carrier data to cache
|
99 |
+
*
|
100 |
+
* @param string|array $key
|
101 |
+
* @param string $value
|
102 |
+
* @return Mage_Usa_Model_Shipping_Carrier_Abstract
|
103 |
+
*/
|
104 |
+
public function setCachedData($key, $value)
|
105 |
+
{
|
106 |
+
$key = $this->getDataCacheKey($key);
|
107 |
+
self::$_dataCache[$key] = $value;
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Helper/Data.php
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* WSA Common
|
3 |
+
*
|
4 |
+
* @category Webshopapps
|
5 |
+
* @package Webshopapps_Wsacommon
|
6 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
7 |
+
* Copyright, 2013, Zowta, LLC - US license
|
8 |
+
* @license http://www.webshopapps.com/license/license.txt - Commercial license
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Webshopapps_Wsacommon_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
/*
|
15 |
+
* * Retrieves version of Magento and assigns a corresponding enterprise version
|
16 |
+
* */
|
17 |
+
|
18 |
+
public static function getVersion() {
|
19 |
+
|
20 |
+
$version = Mage::getVersion();
|
21 |
+
if (version_compare($version, '1.6', '>=')) {
|
22 |
+
if (version_compare($version, '1.12') >= 0) $eeVersion = 1.12;
|
23 |
+
else if (version_compare($version, '1.13') >= 0) $eeVersion = 1.13;
|
24 |
+
else if (version_compare($version, '1.11') >= 0) $eeVersion = 1.11;
|
25 |
+
else if (version_compare($version, '1.10') >= 0) $eeVersion = 1.10;
|
26 |
+
else if (version_compare($version, '1.8') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 1.13; //CE 1.8, EE 1.13
|
27 |
+
else if (version_compare($version, '1.7') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 1.12; //CE 1.7, EE 1.12
|
28 |
+
else if (version_compare($version, '1.6') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 1.11; //CE 1.6, EE 1.11
|
29 |
+
else if (version_compare($version, '1.9') >= 0) $eeVersion = 1.9;
|
30 |
+
else if (version_compare($version, '1.8') >= 0) $eeVersion = 1.8;
|
31 |
+
else if (version_compare($version, '1.7') >= 0) $eeVersion = 1.7;
|
32 |
+
else if (version_compare($version, '1.6') >= 0) $eeVersion = 1.6; //EE 1.6
|
33 |
+
else $eeVersion = 1.8; // default to this if unsure, changed to assume is 1.4.1+
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
if (version_compare($version, '1.5') >= 0) $eeVersion = 1.10;
|
37 |
+
else if (version_compare($version, '1.4.2') >= 0) $eeVersion = 1.9;
|
38 |
+
else if (version_compare($version, '1.4.1') >= 0) $eeVersion = 1.8;
|
39 |
+
else if (version_compare($version, '1.4.0') >= 0) $eeVersion = 1.7;
|
40 |
+
else if (version_compare($version, '1.3.2.4') >= 0) $eeVersion = 1.6;
|
41 |
+
else $eeVersion = 1.8; // default to this if unsure, changed to assume is 1.4.1+
|
42 |
+
}
|
43 |
+
return $eeVersion;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* This method will return just the 2nd part of the version number, thus allowing greater than/less than calculations to be performed
|
48 |
+
* Please convert to this call if possible
|
49 |
+
* Enter description here ...
|
50 |
+
*/
|
51 |
+
public static function getNewVersion() {
|
52 |
+
$version = Mage::getVersion();
|
53 |
+
if (version_compare($version, '1.6', '>=')) {
|
54 |
+
if (version_compare($version, '1.12') >= 0) $eeVersion = 12;
|
55 |
+
else if (version_compare($version, '1.13') >= 0) $eeVersion = 13;
|
56 |
+
else if (version_compare($version, '1.11') >= 0) $eeVersion = 11;
|
57 |
+
else if (version_compare($version, '1.10') >= 0) $eeVersion = 10;
|
58 |
+
else if (version_compare($version, '1.8') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 13; //CE 1.8, EE 1.13
|
59 |
+
else if (version_compare($version, '1.7') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 12; //CE 1.7, EE 1.12
|
60 |
+
else if (version_compare($version, '1.6') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 11; //CE 1.6, EE 1.11
|
61 |
+
else if (version_compare($version, '1.9') >= 0) $eeVersion = 9;
|
62 |
+
else if (version_compare($version, '1.8') >= 0 ) $eeVersion = 8;
|
63 |
+
else if (version_compare($version, '1.7') >= 0) $eeVersion = 7;
|
64 |
+
else if (version_compare($version, '1.6') >= 0) $eeVersion = 6; //EE 1.6
|
65 |
+
else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
|
66 |
+
}
|
67 |
+
else {
|
68 |
+
if (version_compare($version, '1.5') >= 0) $eeVersion = 10;
|
69 |
+
else if (version_compare($version, '1.4.2') >= 0) $eeVersion = 9;
|
70 |
+
else if (version_compare($version, '1.4.1') >= 0) $eeVersion = 8;
|
71 |
+
else if (version_compare($version, '1.4.0') >= 0) $eeVersion = 7;
|
72 |
+
else if (version_compare($version, '1.3.2.4') >= 0) $eeVersion = 6;
|
73 |
+
else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
|
74 |
+
}
|
75 |
+
return $eeVersion;
|
76 |
+
}
|
77 |
+
|
78 |
+
public static function checkItems($checkKey,$compare,$compare2) {
|
79 |
+
|
80 |
+
if (Mage::getStoreConfig(base64_decode($checkKey))) {
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
|
84 |
+
$temp2 = strtolower($_SERVER[base64_decode('U0VSVkVSX05BTUU=')]);
|
85 |
+
$found=false;
|
86 |
+
|
87 |
+
if (empty($temp2) || self::checkItem($temp2,$compare,$compare2)) { $found= true; }
|
88 |
+
else if (self::checkItem(base64_decode('d2Vic2hvcGFwcHM='),$compare,$compare2)) { $found = true; }
|
89 |
+
else if (self::checkItem(substr($temp2,strpos($temp2,".")+1),$compare,$compare2)) { $found= true; }
|
90 |
+
else if (self::checkItem('www.'.$temp2,$compare,$compare2)) { return true; }
|
91 |
+
else if (self::checkItem('www'.substr($temp2,strpos($temp2,'.')),$compare,$compare2)) { $found= true; }
|
92 |
+
|
93 |
+
if ($found)
|
94 |
+
{
|
95 |
+
Mage::getConfig()->saveConfig(base64_decode($checkKey),true);
|
96 |
+
} else {
|
97 |
+
Mage::getConfig()->deleteConfig(base64_decode($compare2), 'default', 0);
|
98 |
+
}
|
99 |
+
return $found;
|
100 |
+
}
|
101 |
+
|
102 |
+
private static function checkItem($temp2,$compare,$compare2) {
|
103 |
+
if (sha1(sha1(base64_decode($compare)) . $temp2) == Mage::getStoreConfig(base64_decode($compare2))) { return true; }
|
104 |
+
else {
|
105 |
+
foreach (Mage::app()->getStores(true) as $store){
|
106 |
+
if(sha1(sha1(base64_decode($compare)) . $temp2) == Mage::getStoreConfig(base64_decode($compare2),$store)) {
|
107 |
+
return true;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
public static function isEnterpriseEdition() {
|
115 |
+
if (!Mage::getConfig()->getNode('modules/Enterprise_Cms')) {
|
116 |
+
return false;
|
117 |
+
}
|
118 |
+
return true;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Check is module exists and enabled in global config.
|
123 |
+
* This is only needed for 1.4.0.1 or less, but might aswell have in for all
|
124 |
+
* See Mage_Core_Helper_Abstract for defn
|
125 |
+
* Enter description here ...
|
126 |
+
* @param $moduleName
|
127 |
+
*/
|
128 |
+
public function isModuleEnabled($moduleName = null,$enabledLocation=null)
|
129 |
+
{
|
130 |
+
|
131 |
+
if ($moduleName === null) {
|
132 |
+
$moduleName = $this->_getModuleName();
|
133 |
+
}
|
134 |
+
|
135 |
+
if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
|
136 |
+
return false;
|
137 |
+
}
|
138 |
+
|
139 |
+
$isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active');
|
140 |
+
$test = (string)$isActive;
|
141 |
+
if (!$isActive || !in_array((string)$isActive, array('true', '1'))) {
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
|
145 |
+
if ($enabledLocation === null) {
|
146 |
+
return true;
|
147 |
+
}
|
148 |
+
|
149 |
+
if (!Mage::getStoreConfig($enabledLocation)) {
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
return true;
|
154 |
+
}
|
155 |
+
|
156 |
+
public function getNumericExtensionVersion($moduleShortName)
|
157 |
+
{
|
158 |
+
$versionArr = explode('.',Mage::getResourceSingleton('core/resource')->getDbVersion($moduleShortName.'_setup'));
|
159 |
+
|
160 |
+
return $versionArr[0]*100+$versionArr[1]*10+$versionArr[2];
|
161 |
+
}
|
162 |
+
|
163 |
+
|
164 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Helper/Log.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* WSA Common
|
3 |
+
*
|
4 |
+
* @category Webshopapps
|
5 |
+
* @package Webshopapps_Wsacommon
|
6 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
7 |
+
* Copyright, 2013, Zowta, LLC - US license
|
8 |
+
* @license http://www.webshopapps.com/license/license.txt - Commercial license
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* NOTE: This is deprecated. Please use Wsa Logger now instead.
|
13 |
+
* @author Karen Baker
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Webshopapps_Wsacommon_Helper_Log extends Mage_Core_Helper_Abstract
|
17 |
+
{
|
18 |
+
|
19 |
+
const SEVERITY_CRITICAL = 1;
|
20 |
+
const SEVERITY_MAJOR = 2;
|
21 |
+
const SEVERITY_MINOR = 3;
|
22 |
+
const SEVERITY_NOTICE = 4;
|
23 |
+
const SEVERITY_NONE = -1;
|
24 |
+
|
25 |
+
/**
|
26 |
+
*
|
27 |
+
* Post a debug message
|
28 |
+
*
|
29 |
+
* @deprecated Now part of WSALogger
|
30 |
+
*
|
31 |
+
* @param $extension
|
32 |
+
* @param string $title
|
33 |
+
* @param string $description
|
34 |
+
* @param bool $debug
|
35 |
+
* @param int $code
|
36 |
+
* @param string $url
|
37 |
+
* @internal param $severity - CRITIAL,MAJOR,MINOR,NOTICE - 1-4
|
38 |
+
*/
|
39 |
+
|
40 |
+
public static function postNotice($extension,$title,$description,$debug=true,$code=0,$url='') {
|
41 |
+
|
42 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active') || !$debug) {
|
43 |
+
return ;
|
44 |
+
}
|
45 |
+
|
46 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
47 |
+
array('severity'=>self::SEVERITY_NOTICE,
|
48 |
+
'title' => $title,
|
49 |
+
'extension' => $extension,
|
50 |
+
'description' => $description,
|
51 |
+
'code' => $code,
|
52 |
+
'url' => $url
|
53 |
+
));
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Post a minor error message
|
59 |
+
*
|
60 |
+
* @deprecated Now part of WSALogger
|
61 |
+
*
|
62 |
+
* @param $extension
|
63 |
+
* @param $title
|
64 |
+
* @param $description
|
65 |
+
* @param bool $debug
|
66 |
+
* @param int $code
|
67 |
+
* @param string $url
|
68 |
+
*/
|
69 |
+
public static function postMinor($extension,$title,$description,$debug=true,$code=0,$url='') {
|
70 |
+
|
71 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
|
72 |
+
return ;
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
77 |
+
array('severity'=>self::SEVERITY_MINOR,
|
78 |
+
'extension' => $extension,
|
79 |
+
'title' => $title,
|
80 |
+
'description' => $description,
|
81 |
+
'code' => $code,
|
82 |
+
'url' => $url
|
83 |
+
));
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Post a major error message
|
89 |
+
*
|
90 |
+
* @deprecated Now part of WSALogger
|
91 |
+
*
|
92 |
+
* @param $extension
|
93 |
+
* @param $title
|
94 |
+
* @param $description
|
95 |
+
* @param bool $debug
|
96 |
+
* @param int $code
|
97 |
+
* @param string $url
|
98 |
+
*/
|
99 |
+
public static function postMajor($extension,$title,$description,$debug=true,$code=0,$url='') {
|
100 |
+
|
101 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
|
102 |
+
return ;
|
103 |
+
}
|
104 |
+
|
105 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
106 |
+
array('severity'=>self::SEVERITY_MAJOR,
|
107 |
+
'title' => $title,
|
108 |
+
'extension' => $extension,
|
109 |
+
'description' => $description,
|
110 |
+
'code' => $code,
|
111 |
+
'url' => $url
|
112 |
+
));
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Post a critical error
|
117 |
+
*
|
118 |
+
* @deprecated Now part of WSALogger
|
119 |
+
*
|
120 |
+
* @param $extension
|
121 |
+
* @param $title
|
122 |
+
* @param $description
|
123 |
+
* @param bool $debug
|
124 |
+
* @param int $code
|
125 |
+
* @param string $url
|
126 |
+
*/
|
127 |
+
public static function postCritical($extension,$title,$description,$debug=true,$code=0,$url='') {
|
128 |
+
|
129 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
|
130 |
+
return ;
|
131 |
+
}
|
132 |
+
|
133 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
134 |
+
array('severity'=>self::SEVERITY_CRITICAL,
|
135 |
+
'title' => $title,
|
136 |
+
'extension' => $extension,
|
137 |
+
'description' => $description,
|
138 |
+
'code' => $code,
|
139 |
+
'url' => $url
|
140 |
+
));
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Get possible error states
|
146 |
+
*
|
147 |
+
* @deprecated Now part of WSALogger
|
148 |
+
*
|
149 |
+
* @param null $severity
|
150 |
+
* @return array|null
|
151 |
+
*/
|
152 |
+
public function getSeverities($severity = null)
|
153 |
+
{
|
154 |
+
$severities = array(
|
155 |
+
self::SEVERITY_CRITICAL => Mage::helper('adminnotification')->__('Critical'),
|
156 |
+
self::SEVERITY_MAJOR => Mage::helper('adminnotification')->__('Major'),
|
157 |
+
self::SEVERITY_MINOR => Mage::helper('adminnotification')->__('Minor'),
|
158 |
+
self::SEVERITY_NOTICE => Mage::helper('adminnotification')->__('Notice'),
|
159 |
+
self::SEVERITY_NONE => Mage::helper('adminnotification')->__('None'),
|
160 |
+
);
|
161 |
+
|
162 |
+
if (!is_null($severity)) {
|
163 |
+
if (isset($severities[$severity])) {
|
164 |
+
return $severities[$severity];
|
165 |
+
}
|
166 |
+
return null;
|
167 |
+
}
|
168 |
+
|
169 |
+
return $severities;
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Helper/Shipping.php
ADDED
@@ -0,0 +1,552 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* WSA Common
|
3 |
+
*
|
4 |
+
* @category Webshopapps
|
5 |
+
* @package Webshopapps_Wsacommon
|
6 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
7 |
+
* Copyright, 2013, Zowta, LLC - US license
|
8 |
+
* @license http://www.webshopapps.com/license/license.txt - Commercial license
|
9 |
+
*/
|
10 |
+
class Webshopapps_Wsacommon_Helper_Shipping extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
public static function getVirtualItemTotals($item, &$weight, &$qty, &$price, $useParent=true,$ignoreFreeItems=true, &$itemGroup=array(),
|
13 |
+
$useDiscountValue=false, $cartFreeShipping=false, $useBase=false, $useTax = false, $includeVirtual = false) {
|
14 |
+
|
15 |
+
$addressWeight=0;
|
16 |
+
$addressQty=0;
|
17 |
+
$freeMethodWeight=0;
|
18 |
+
$itemGroup[]=$item;
|
19 |
+
$applyShipping= Mage::getModel('catalog/product')->load($item->getProduct()->getId())->getApplyShipping();
|
20 |
+
$downloadShipping = Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Downloadshipping');
|
21 |
+
$hasCustomOptions = 0;
|
22 |
+
if($downloadShipping) {
|
23 |
+
$hasCustomOptions = Mage::helper('downloadshipping')->hasCustomOptions($item);
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
if(!$downloadShipping && $item->getProduct()->isVirtual() && !$includeVirtual){
|
28 |
+
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ($ignoreFreeItems && $item->getFreeShipping()) {
|
33 |
+
return false;
|
34 |
+
}
|
35 |
+
|
36 |
+
/*
|
37 |
+
* Children weight we calculate for parent
|
38 |
+
*/
|
39 |
+
if ($item->getParentItem() && ( ($item->getParentItem()->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $useParent)
|
40 |
+
|| $item->getParentItem()->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE )) {
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
|
44 |
+
if (!$useParent && $item->getHasChildren() && $item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ) {
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
49 |
+
|
50 |
+
|
51 |
+
foreach ($item->getChildren() as $child) {
|
52 |
+
$itemGroup[]=$item;
|
53 |
+
if($downloadShipping){
|
54 |
+
if ($child->getProduct()->isVirtual() && !$applyShipping || !$hasCustomOptions) {
|
55 |
+
continue;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
$addressQty += $item->getQty()*$child->getQty();
|
60 |
+
|
61 |
+
if (!$item->getProduct()->getWeightType()) {
|
62 |
+
$itemWeight = $child->getWeight();
|
63 |
+
$itemQty = $child->getTotalQty();
|
64 |
+
$rowWeight = $itemWeight*$itemQty;
|
65 |
+
if ($cartFreeShipping || $child->getFreeShipping()===true) {
|
66 |
+
$rowWeight = 0;
|
67 |
+
} elseif (is_numeric($child->getFreeShipping())) {
|
68 |
+
$freeQty = $child->getFreeShipping();
|
69 |
+
if ($itemQty>$freeQty) {
|
70 |
+
$rowWeight = $itemWeight*($itemQty-$freeQty);
|
71 |
+
} else {
|
72 |
+
$rowWeight = 0;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
$freeMethodWeight += $rowWeight;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
if ($item->getProduct()->getWeightType()) {
|
79 |
+
$itemWeight = $item->getWeight();
|
80 |
+
$rowWeight = $itemWeight*$item->getQty();
|
81 |
+
$addressWeight+= $rowWeight;
|
82 |
+
if ($cartFreeShipping || $item->getFreeShipping()===true) {
|
83 |
+
$rowWeight = 0;
|
84 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
85 |
+
$freeQty = $item->getFreeShipping();
|
86 |
+
if ($item->getQty()>$freeQty) {
|
87 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
88 |
+
} else {
|
89 |
+
$rowWeight = 0;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
$freeMethodWeight+= $rowWeight;
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
if ($downloadShipping || $includeVirtual){
|
96 |
+
|
97 |
+
if(!$item->getProduct()->isVirtual() || $item->getProduct()->isVirtual() && $applyShipping || $hasCustomOptions || $includeVirtual){
|
98 |
+
|
99 |
+
$addressQty += $item->getQty();
|
100 |
+
}
|
101 |
+
else{return false;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
$itemWeight = $item->getWeight();
|
105 |
+
$rowWeight = $itemWeight*$item->getQty();
|
106 |
+
$addressWeight+= $rowWeight;
|
107 |
+
if ($cartFreeShipping || $item->getFreeShipping()===true) {
|
108 |
+
$rowWeight = 0;
|
109 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
110 |
+
$freeQty = $item->getFreeShipping();
|
111 |
+
if ($item->getQty()>$freeQty) {
|
112 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
113 |
+
} else {
|
114 |
+
$rowWeight = 0;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
$freeMethodWeight+= $rowWeight;
|
118 |
+
}
|
119 |
+
|
120 |
+
if (!$useParent && $item->getParentItem() && $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ) {
|
121 |
+
$weight=$addressWeight*$item->getParentItem()->getQty();
|
122 |
+
$qty=$addressQty*$item->getParentItem()->getQty();
|
123 |
+
$parentProduct = $item->getParentItem()->getProduct();
|
124 |
+
!$useBase ? $finalPrice = $item->getRowTotal() : $finalPrice = $item->getBaseRowTotal();
|
125 |
+
$useTax && $useBase ? $finalPrice += $item->getBaseTaxAmount() : false;
|
126 |
+
$useTax && !$useBase ? $finalPrice += $item->getTaxAmount() : false;
|
127 |
+
|
128 |
+
if ($parentProduct->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
|
129 |
+
if ($parentProduct->hasCustomOptions()) {
|
130 |
+
$customOption = $parentProduct->getCustomOption('bundle_option_ids');
|
131 |
+
$customOption = $parentProduct->getCustomOption('bundle_selection_ids');
|
132 |
+
$selectionIds = unserialize($customOption->getValue());
|
133 |
+
$selections = $parentProduct->getTypeInstance(true)->getSelectionsByIds($selectionIds, $parentProduct);
|
134 |
+
if (method_exists($selections,'addTierPriceData')) {
|
135 |
+
$selections->addTierPriceData();
|
136 |
+
}
|
137 |
+
foreach ($selections->getItems() as $selection) {
|
138 |
+
if ($selection->getProductId()== $item->getProductId()) {
|
139 |
+
$finalPrice = $item->getParentItem()->getProduct()->getPriceModel()->getChildFinalPrice(
|
140 |
+
$parentProduct, $item->getParentItem()->getQty(),
|
141 |
+
$selection, $qty, $item->getQty());
|
142 |
+
//Price from here is always base. Convert to store to stay consistent unless flag $useBase is set.
|
143 |
+
!$useBase ? $finalPrice = Mage::helper('directory')->currencyConvert($finalPrice,
|
144 |
+
Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()) : '';
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
$price=$finalPrice;
|
150 |
+
} else {
|
151 |
+
$weight=$addressWeight;
|
152 |
+
$qty=$addressQty;
|
153 |
+
!$useBase ? $price = $item->getRowTotal() : $price = $item->getBaseRowTotal();
|
154 |
+
$useTax && !$useBase ? $price += ($item->getRowTotalInclTax() - $item->getRowTotal()) : false;
|
155 |
+
$useTax && $useBase ? $price += ($item->getBaseRowTotalInclTax() - $item->getBaseRowTotal()) : false;
|
156 |
+
}
|
157 |
+
|
158 |
+
if ($useDiscountValue){
|
159 |
+
!$useBase ? $price-=$item->getDiscountAmount() : $price-=$item->getBaseDiscountAmount();;
|
160 |
+
}
|
161 |
+
|
162 |
+
return true;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* PHP - Doesnt support function overloading. Bring on a real language!
|
167 |
+
*
|
168 |
+
* @param Mage_Sales_Model_Quote_Item $item
|
169 |
+
* @param int $weight
|
170 |
+
* @param int $qty
|
171 |
+
* @param int $price
|
172 |
+
* @param bool $useParent
|
173 |
+
* @param bool $ignoreFreeItems
|
174 |
+
* @param array $itemGroup
|
175 |
+
* @param bool $useDiscountValue
|
176 |
+
* @param bool $cartFreeShipping
|
177 |
+
* @param bool $useBase
|
178 |
+
* @param bool $useTax
|
179 |
+
* @return bool
|
180 |
+
*/
|
181 |
+
public static function getItemTotals($item, &$weight, &$qty, &$price, $useParent=true,$ignoreFreeItems=true,
|
182 |
+
&$itemGroup=array(),$useDiscountValue=false, $cartFreeShipping = false,$useBase = false, $useTax = false) {
|
183 |
+
|
184 |
+
$freeMethodWeight =0;
|
185 |
+
return self::getItemInclFreeTotals($item, $weight, $qty, $price, $freeMethodWeight, $useParent,$ignoreFreeItems,
|
186 |
+
$itemGroup,$useDiscountValue,$cartFreeShipping, $useBase, $useTax);
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Freemethod weight now returned
|
191 |
+
*
|
192 |
+
* @param Mage_Sales_Model_Quote_Item $item
|
193 |
+
* @param int $weight
|
194 |
+
* @param int $qty
|
195 |
+
* @param int $price
|
196 |
+
* @param int $freeMethodWeight
|
197 |
+
* @param bool $useParent
|
198 |
+
* @param bool $ignoreFreeItems
|
199 |
+
* @param array $itemGroup
|
200 |
+
* @param bool $useDiscountValue
|
201 |
+
* @param bool $cartFreeShipping
|
202 |
+
* @param bool $useBase
|
203 |
+
* @param bool $useTax
|
204 |
+
* @param int $basePriceInclTax
|
205 |
+
* @return bool
|
206 |
+
*/
|
207 |
+
public static function getItemInclFreeTotals($item, &$weight, &$qty, &$price, &$freeMethodWeight, $useParent=true,$ignoreFreeItems=true,
|
208 |
+
&$itemGroup=array(),$useDiscountValue=false, $cartFreeShipping = false, $useBase = false, $useTax = false, &$basePriceInclTax = 0) {
|
209 |
+
|
210 |
+
$addressWeight=0;
|
211 |
+
$addressQty=0;
|
212 |
+
$freeMethodWeight=0;
|
213 |
+
$itemGroup[]=$item;
|
214 |
+
|
215 |
+
if (!is_object($item))
|
216 |
+
{
|
217 |
+
Mage::helper('wsacommon/log')->postCritical('wsacommon','Fatal Error','Item/Product is Malformed');
|
218 |
+
return false;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Skip if this item is virtual
|
223 |
+
**/
|
224 |
+
|
225 |
+
if ($item->getProduct()->isVirtual()) {
|
226 |
+
return false;
|
227 |
+
}
|
228 |
+
|
229 |
+
if ($ignoreFreeItems && ($item->getFreeShipping() || $cartFreeShipping)) {
|
230 |
+
return false;
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Children weight we calculate for parent
|
235 |
+
*/
|
236 |
+
|
237 |
+
if ($item->getParentItem() && ( ($item->getParentItem()->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $useParent)
|
238 |
+
|| $item->getParentItem()->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE )) {
|
239 |
+
return false;
|
240 |
+
}
|
241 |
+
|
242 |
+
if (!$useParent && $item->getHasChildren() && $item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ) {
|
243 |
+
if ($item->getProduct()->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
|
244 |
+
//Add on the fixed initial parent price. Children are calculated separately.
|
245 |
+
$basePrice = $item->getProduct()->getPrice();
|
246 |
+
$storePrice = Mage::helper('directory')->currencyConvert($basePrice,
|
247 |
+
Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode());
|
248 |
+
|
249 |
+
!$useBase ? $price = $storePrice : $price = $basePrice;
|
250 |
+
|
251 |
+
$calculator = Mage::helper('tax')->getCalculator();
|
252 |
+
$taxRequest = $calculator->getRateOriginRequest();
|
253 |
+
$taxRequest->setProductClassId($item->getProduct()->getTaxClassId());
|
254 |
+
$taxPercentage = $calculator->getRate($taxRequest);
|
255 |
+
|
256 |
+
//Magento bug/feature - call to getPrice on bundle includes tax if prices entered in catalog are tax inclusive
|
257 |
+
if(!Mage::getStoreConfig('tax/calculation/price_includes_tax', Mage::app()->getStore())) {
|
258 |
+
$taxAmount = round(($taxPercentage/100) * $price, 2);
|
259 |
+
$storeTaxAmount = round(Mage::helper('directory')->currencyConvert($taxAmount,
|
260 |
+
Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()), 2);
|
261 |
+
|
262 |
+
$useTax && !$useBase ? $price += $storeTaxAmount : false;
|
263 |
+
$useTax && $useBase ? $price += $taxAmount : false;
|
264 |
+
} else {
|
265 |
+
$taxAmount = round($price / (($taxPercentage/100)+1), 2);
|
266 |
+
$storeTaxAmount = round(Mage::helper('directory')->currencyConvert($taxAmount,
|
267 |
+
Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()), 2);
|
268 |
+
|
269 |
+
!$useTax && !$useBase ? $price -= $storeTaxAmount : false;
|
270 |
+
!$useTax && $useBase ? $price -= $taxAmount : false;
|
271 |
+
}
|
272 |
+
|
273 |
+
$price = $price * $item->getQty();
|
274 |
+
|
275 |
+
if($item->getProduct()->getWeightType()){
|
276 |
+
$itemWeight = $item->getProduct()->getWeight();
|
277 |
+
$rowWeight = $itemWeight*$item->getQty();
|
278 |
+
|
279 |
+
if ($cartFreeShipping || $item->getFreeShipping()===true) {
|
280 |
+
$rowWeight = 0;
|
281 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
282 |
+
$freeQty = $item->getFreeShipping();
|
283 |
+
if ($item->getQty()>$freeQty) {
|
284 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
285 |
+
} else {
|
286 |
+
$rowWeight = 0;
|
287 |
+
}
|
288 |
+
}
|
289 |
+
$weight = $rowWeight;
|
290 |
+
$freeMethodWeight+= $rowWeight;
|
291 |
+
}
|
292 |
+
|
293 |
+
return true; //return - the weight & qty is worked out from the child items. Children may have additional fixed price to add on.
|
294 |
+
} else {
|
295 |
+
return false;
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
300 |
+
foreach ($item->getChildren() as $child) {
|
301 |
+
$itemGroup[]=$item;
|
302 |
+
if ($child->getProduct()->isVirtual()) {
|
303 |
+
continue;
|
304 |
+
}
|
305 |
+
$addressQty += $item->getQty()*$child->getQty();
|
306 |
+
|
307 |
+
if (!$item->getProduct()->getWeightType()) {
|
308 |
+
$itemWeight = $child->getWeight();
|
309 |
+
$itemQty = $child->getTotalQty();
|
310 |
+
$rowWeight = $itemWeight*$itemQty;
|
311 |
+
if ($cartFreeShipping || $child->getFreeShipping()===true) {
|
312 |
+
$rowWeight = 0;
|
313 |
+
} elseif (is_numeric($child->getFreeShipping())) {
|
314 |
+
$freeQty = $child->getFreeShipping();
|
315 |
+
if ($itemQty>$freeQty) {
|
316 |
+
$rowWeight = $itemWeight*($itemQty-$freeQty);
|
317 |
+
} else {
|
318 |
+
$rowWeight = 0;
|
319 |
+
}
|
320 |
+
}
|
321 |
+
$freeMethodWeight += $rowWeight;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
if ($item->getProduct()->getWeightType()) {
|
325 |
+
$itemWeight = $item->getWeight();
|
326 |
+
$rowWeight = $itemWeight*$item->getQty();
|
327 |
+
$addressWeight+= $rowWeight;
|
328 |
+
if ($cartFreeShipping || $item->getFreeShipping()===true) {
|
329 |
+
$rowWeight = 0;
|
330 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
331 |
+
$freeQty = $item->getFreeShipping();
|
332 |
+
if ($item->getQty()>$freeQty) {
|
333 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
334 |
+
} else {
|
335 |
+
$rowWeight = 0;
|
336 |
+
}
|
337 |
+
}
|
338 |
+
$freeMethodWeight+= $rowWeight;
|
339 |
+
}
|
340 |
+
} else {
|
341 |
+
if (!$item->getProduct()->isVirtual()) {
|
342 |
+
$addressQty += $item->getQty();
|
343 |
+
}
|
344 |
+
|
345 |
+
if($item->getParentItem() && $item->getParentItem()->getProduct()->getWeightType()){
|
346 |
+
$itemWeight = 0;
|
347 |
+
$rowWeight = 0;
|
348 |
+
$addressWeight += 0; //Added in parent logic above
|
349 |
+
} else {
|
350 |
+
$itemWeight = $item->getWeight();
|
351 |
+
$rowWeight = $itemWeight*$item->getQty();
|
352 |
+
$addressWeight+= $rowWeight;
|
353 |
+
}
|
354 |
+
if ($cartFreeShipping || $item->getFreeShipping()===true) {
|
355 |
+
$rowWeight = 0;
|
356 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
357 |
+
$freeQty = $item->getFreeShipping();
|
358 |
+
if ($item->getQty()>$freeQty) {
|
359 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
360 |
+
} else {
|
361 |
+
$rowWeight = 0;
|
362 |
+
}
|
363 |
+
}
|
364 |
+
$freeMethodWeight+= $rowWeight;
|
365 |
+
}
|
366 |
+
|
367 |
+
if (!$useParent && $item->getParentItem() && $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ) {
|
368 |
+
$weight=$addressWeight*$item->getParentItem()->getQty();
|
369 |
+
$qty=$addressQty*$item->getParentItem()->getQty();
|
370 |
+
$parentProduct = $item->getParentItem()->getProduct();
|
371 |
+
!$useBase ? $finalPrice = $item->getRowTotal() : $finalPrice = $item->getBaseRowTotal();
|
372 |
+
$useTax && $useBase ? $finalPrice += $item->getBaseTaxAmount() : false;
|
373 |
+
$useTax && !$useBase ? $finalPrice += $item->getTaxAmount() : false;
|
374 |
+
if ($parentProduct->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
|
375 |
+
if ($parentProduct->hasCustomOptions()) {
|
376 |
+
$customOption = $parentProduct->getCustomOption('bundle_option_ids');
|
377 |
+
$customOption = $parentProduct->getCustomOption('bundle_selection_ids');
|
378 |
+
$selectionIds = unserialize($customOption->getValue());
|
379 |
+
$selections = $parentProduct->getTypeInstance(true)->getSelectionsByIds($selectionIds, $parentProduct);
|
380 |
+
if (method_exists($selections,'addTierPriceData')) {
|
381 |
+
$selections->addTierPriceData();
|
382 |
+
}
|
383 |
+
foreach ($selections->getItems() as $selection) {
|
384 |
+
if ($selection->getProductId()== $item->getProductId()) {
|
385 |
+
$finalPrice = $item->getParentItem()->getProduct()->getPriceModel()->getChildFinalPrice(
|
386 |
+
$parentProduct, $item->getParentItem()->getQty(),
|
387 |
+
$selection, $qty, $item->getQty());
|
388 |
+
//Price from here is always base. Convert to store to stay consistent unless flag $useBase is set.
|
389 |
+
!$useBase ? $finalPrice = Mage::helper('directory')->currencyConvert($finalPrice,
|
390 |
+
Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()) : '';
|
391 |
+
|
392 |
+
if($useTax) {
|
393 |
+
$calculator = Mage::helper('tax')->getCalculator();
|
394 |
+
$taxRequest = $calculator->getRateOriginRequest();
|
395 |
+
$taxRequest->setProductClassId($parentProduct->getTaxClassId());
|
396 |
+
$taxPercentage = $calculator->getRate($taxRequest);
|
397 |
+
|
398 |
+
$taxAmount = round(($taxPercentage/100) * $finalPrice,2);
|
399 |
+
$storeTaxAmount = round(Mage::helper('directory')->currencyConvert($taxAmount,
|
400 |
+
Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()),2);
|
401 |
+
|
402 |
+
$finalPrice += $useBase ? $taxAmount : $storeTaxAmount;
|
403 |
+
}
|
404 |
+
}
|
405 |
+
}
|
406 |
+
}
|
407 |
+
}
|
408 |
+
$price=$finalPrice;
|
409 |
+
} else {
|
410 |
+
$weight=$addressWeight;
|
411 |
+
$qty=$addressQty;
|
412 |
+
!$useBase ? $price = $item->getRowTotal() : $price = $item->getBaseRowTotal();
|
413 |
+
$useTax && !$useBase ? $price += ($item->getRowTotalInclTax() - $item->getRowTotal()) : false;
|
414 |
+
$useTax && $useBase ? $price += ($item->getBaseRowTotalInclTax() - $item->getBaseRowTotal()) : false;
|
415 |
+
}
|
416 |
+
|
417 |
+
if ($useDiscountValue){
|
418 |
+
!$useBase ? $price-=$item->getDiscountAmount() : $price-=$item->getBaseDiscountAmount();;
|
419 |
+
}
|
420 |
+
|
421 |
+
$basePriceInclTax += $item->getBaseRowTotalInclTax(); //TODO: Need to cover all scenarios
|
422 |
+
|
423 |
+
if($item->getWeight() == null) { //DIMSHIP-129
|
424 |
+
Mage::helper('wsalogger/log')->postCritical('wsacommon','Weight Issue','Weight is Null');
|
425 |
+
return false;
|
426 |
+
}
|
427 |
+
|
428 |
+
return true;
|
429 |
+
}
|
430 |
+
|
431 |
+
|
432 |
+
|
433 |
+
public static function updateStatus($session,$numRows) {
|
434 |
+
if ($numRows<1) {
|
435 |
+
$session->addError(Mage::helper('adminhtml')->__($numRows.' rows have been imported. See <a href="http://wiki.webshopapps.com/the-faq#TOC-This-Shipping-Method-Is-Unavailable">wiki article for help</a>')) ;
|
436 |
+
} else {
|
437 |
+
$session->addSuccess(Mage::helper('adminhtml')->__($numRows.' rows have been imported.'));
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
|
442 |
+
// DO NOT USE THIS - See Helper/Data.php in Freight Common
|
443 |
+
// Has been deprecated May 2013
|
444 |
+
public static function hasFreightCarrierEnabled() {
|
445 |
+
if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Yrcfreight','carriers/yrcfreight/active') ||
|
446 |
+
Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsaupsfreight','carriers/wsaupsfreight/active') ||
|
447 |
+
Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/rlfreight/active') ||
|
448 |
+
Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/newgistics/active') ||
|
449 |
+
Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafedexfreight','carriers/wsafedexfreight/active') ) {
|
450 |
+
return true;
|
451 |
+
}
|
452 |
+
return false;
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* // DO NOT USE THIS - See Helper/Data.php in Freight Common
|
457 |
+
// Has been deprecated May 2013
|
458 |
+
* Retrieves enabled freight carriers. Currently only returns one
|
459 |
+
*/
|
460 |
+
public static function getFreightCarriers() {
|
461 |
+
if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Yrcfreight','carriers/yrcfreight/active')) {
|
462 |
+
return 'yrcfreight';
|
463 |
+
}
|
464 |
+
|
465 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsaupsfreight','carriers/wsaupsfreight/active') ) {
|
466 |
+
return 'wsaupsfreight';
|
467 |
+
}
|
468 |
+
|
469 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/rlfreight/active') ) {
|
470 |
+
return 'rlfreight';
|
471 |
+
}
|
472 |
+
|
473 |
+
if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafedexfreight','carriers/wsafedexfreight/active')){
|
474 |
+
return 'wsafedexfreight';
|
475 |
+
|
476 |
+
}
|
477 |
+
return '';
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
*
|
482 |
+
* Method to save a backup copy of the CSV file to the file system.
|
483 |
+
*
|
484 |
+
* @param String $file - CSV file to be saved.
|
485 |
+
* @param String $fileName - What to call the file including extension.
|
486 |
+
* @param string $websiteId - The website Id to be added to the file name.
|
487 |
+
* @param null $carrierCode
|
488 |
+
*/
|
489 |
+
public function saveCSV($file,$fileName,$websiteId=NULL,$carrierCode=NULL) {
|
490 |
+
|
491 |
+
$dir = Mage::getBaseDir('var').'/export/';
|
492 |
+
|
493 |
+
$fileName = 'WSA_'.$carrierCode.'_' . $fileName; // Add unique WSA marker for csv exporting.
|
494 |
+
|
495 |
+
if (strpos($fileName, '.csv')) {
|
496 |
+
$timestamp = md5(microtime());
|
497 |
+
if (!is_null($websiteId)) {
|
498 |
+
$fileName = str_replace('.csv', '', $fileName) . 'Id=' . $websiteId . '_' . $timestamp . '.csv';
|
499 |
+
} else {
|
500 |
+
$fileName = str_replace('.csv', '', $fileName) . $timestamp . '.csv';
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
try {
|
505 |
+
if(!is_dir($dir)) {
|
506 |
+
if(!mkdir($dir)){
|
507 |
+
Mage::helper('wsacommon/log')->postMajor("WSA Helper","IO Error","Error Creating Backup CSV File Directory");
|
508 |
+
}
|
509 |
+
}
|
510 |
+
if (!ctype_digit(file_put_contents($dir.$fileName, $file))) {
|
511 |
+
Mage::helper('wsacommon/log')->postMajor("WSA Helper","IO Error","Error Creating Backup CSV File");
|
512 |
+
}
|
513 |
+
} catch (Exception $e) {
|
514 |
+
Mage::helper('wsacommon/log')->postMajor("Helper","Error Saving CSV File Backup",$e->getMessage());
|
515 |
+
}
|
516 |
+
|
517 |
+
}
|
518 |
+
|
519 |
+
public static function getProduct($item,$useParent=true) {
|
520 |
+
$product = null;
|
521 |
+
|
522 |
+
if ($item->getParentItem()!=null && $useParent ) {
|
523 |
+
$product=$item->getParentItem()->getProduct();
|
524 |
+
} else if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && !$useParent ) {
|
525 |
+
if ($item->getHasChildren()) {
|
526 |
+
foreach ($item->getChildren() as $child) {
|
527 |
+
$product=Mage::getModel('catalog/product')->load($child->getProductId());
|
528 |
+
break;
|
529 |
+
}
|
530 |
+
}
|
531 |
+
} else {
|
532 |
+
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
533 |
+
}
|
534 |
+
|
535 |
+
return $product;
|
536 |
+
}
|
537 |
+
|
538 |
+
public function formatXML($xmlString) {
|
539 |
+
|
540 |
+
try {
|
541 |
+
$simpleXml = new SimpleXMLElement($xmlString);
|
542 |
+
$dom = new DOMDocument('1.0');
|
543 |
+
$dom->preserveWhiteSpace = false;
|
544 |
+
$dom->formatOutput = true;
|
545 |
+
$dom->loadXML($simpleXml->asXML());
|
546 |
+
return $dom->saveXML();
|
547 |
+
} catch (Exception $e) {
|
548 |
+
return $xmlString;
|
549 |
+
}
|
550 |
+
|
551 |
+
}
|
552 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Helper/Template.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Common
|
8 |
+
* User Joshua Stewart
|
9 |
+
* Date 20/09/2013
|
10 |
+
* Time 11:56
|
11 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2013, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
|
17 |
+
class Webshopapps_Wsacommon_Helper_Template extends Mage_Core_Helper_Abstract
|
18 |
+
{
|
19 |
+
public function adminTemplate($ref)
|
20 |
+
{
|
21 |
+
switch ($ref) {
|
22 |
+
case 'adminhtml_sales_order_create_index';
|
23 |
+
case 'adminhtml_sales_order_create_load_block_data';
|
24 |
+
case 'adminhtml_sales_order_create_load_block_shipping_method';
|
25 |
+
|
26 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafreightcommon',
|
27 |
+
'shipping/wsafreightcommon/active') &&
|
28 |
+
Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Adminshipping')) {
|
29 |
+
return 'webshopapps/wsafreightcommon/sales/order/create/shipping/method/formcombineadmin.phtml';
|
30 |
+
}
|
31 |
+
|
32 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Calendarbase',
|
33 |
+
'shipping/webshopapps_dateshiphelper/active') &&
|
34 |
+
Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Adminshipping')) {
|
35 |
+
return 'webshopapps_adminshipping/order/create/shipping/method/formcombined.phtml';
|
36 |
+
}
|
37 |
+
|
38 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafreightcommon',
|
39 |
+
'shipping/wsafreightcommon/active')) {
|
40 |
+
return 'webshopapps/wsafreightcommon/sales/order/create/shipping/method/form.phtml';
|
41 |
+
}
|
42 |
+
|
43 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Adminshipping')) {
|
44 |
+
return 'webshopapps_adminshipping/order/create/shipping/method/form.phtml';
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
break;
|
49 |
+
|
50 |
+
case 'order_tab_info': // This is no longer used, remove
|
51 |
+
if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafreightcommon','shipping/wsafreightcommon/active')
|
52 |
+
&& Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropship','carriers/dropship/active')) {
|
53 |
+
return 'webshopapps/wsafreightcommon/sales/order/view/tab/info_containercombinedrop.phtml';
|
54 |
+
}
|
55 |
+
|
56 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafreightcommon','shipping/wsafreightcommon/active')) {
|
57 |
+
return 'webshopapps/wsafreightcommon/sales/order/view/tab/info_container.phtml';
|
58 |
+
}
|
59 |
+
|
60 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropship','carriers/dropship/active')) {
|
61 |
+
return 'webshopapps/dropship/sales/order/view/tab/info_container.phtml';
|
62 |
+
}
|
63 |
+
|
64 |
+
break;
|
65 |
+
|
66 |
+
default: return '';
|
67 |
+
}
|
68 |
+
|
69 |
+
return "";
|
70 |
+
}
|
71 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Model/Export/Csv.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Webshopapps Shipping Module
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Webshopapps
|
22 |
+
* @package Webshopapps_Wsacommon
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://www.webshopapps.com/license/license.txt
|
26 |
+
* @author Karen Baker <sales@webshopapps.com>
|
27 |
+
*/
|
28 |
+
class Webshopapps_Wsacommon_Model_Export_Csv extends Mage_Core_Model_Abstract
|
29 |
+
{
|
30 |
+
const ENCLOSURE = '"';
|
31 |
+
const DELIMITER = ',';
|
32 |
+
protected $_fileDates = array();
|
33 |
+
protected $_dateFileArray = array();
|
34 |
+
protected $_theDataArray = array();
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get latest CSV file name and content from var/export
|
38 |
+
*
|
39 |
+
* @param $website Id of the current store config scope
|
40 |
+
* @return Array The name of the CSV and data of the CSV file to be returned
|
41 |
+
*/
|
42 |
+
public function createCSV($website, $carrierCode='nk')
|
43 |
+
{
|
44 |
+
if (is_dir(Mage::getBaseDir('var') . DS . 'export' . DS)) {
|
45 |
+
$directory = Mage::getBaseDir('var') . DS . 'export' . DS;
|
46 |
+
$csvFiles = glob($directory . 'WSA*.csv');
|
47 |
+
|
48 |
+
if (!$this->_findCarrierSpecificCsvFiles($directory,$website, $carrierCode)) {
|
49 |
+
if (!$this->_findOldFormatCsvFiles($csvFiles,$website)) {
|
50 |
+
|
51 |
+
} else {
|
52 |
+
$this->_findNoWebsiteCsvFiles($csvFiles);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
// If $this->_fileDates is empty return a blank CSV
|
57 |
+
if (!isset($this->_fileDates) || empty($this->_fileDates)) {
|
58 |
+
return $this->_getNoCsvFilePresentArr();
|
59 |
+
}
|
60 |
+
|
61 |
+
$this->_findMostRecentCSV();
|
62 |
+
|
63 |
+
} else {
|
64 |
+
// If var/export is not a directory return a blank CSV
|
65 |
+
return $this->_getNoCsvFilePresentArr();
|
66 |
+
}
|
67 |
+
return $this->_theDataArray;
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
protected function _findCarrierSpecificCsvFiles($directory,$website, $carrierCode) {
|
72 |
+
$carrierSpecificCsvFiles = glob($directory . 'WSA_'.$carrierCode.'_*.csv');
|
73 |
+
if (empty($carrierSpecificCsvFiles)) {
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
|
77 |
+
return $this->_findCsvFile($carrierSpecificCsvFiles,$website);
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _findOldFormatCsvFiles($csvFiles,$website) {
|
82 |
+
if (empty($csvFiles)) { // If no WSA*.csv files found, return blank CSV
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
return $this->_findCsvFile($csvFiles,$website);
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
protected function _findCsvFile($csvFiles,$website) {
|
90 |
+
|
91 |
+
$found = false;
|
92 |
+
foreach ($csvFiles as $file) {
|
93 |
+
$file = basename($file);
|
94 |
+
$posOfId = strpos($file, 'Id=');
|
95 |
+
$websiteId = substr($file, $posOfId+3, 1);
|
96 |
+
|
97 |
+
// Get files for the current website config scope
|
98 |
+
if ($website == $websiteId) {
|
99 |
+
$this->timeSortSetup($file);
|
100 |
+
$found = true;
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
return $found;
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Loops through csv files and sets up $_dateFileArray & $_theDataArray
|
111 |
+
*
|
112 |
+
* @param $csvFiles Array of csv files in var/export
|
113 |
+
*/
|
114 |
+
protected function _findNoWebsiteCsvFiles($csvFiles)
|
115 |
+
{
|
116 |
+
foreach ($csvFiles as $file) {
|
117 |
+
$file = basename($file);
|
118 |
+
$this->timeSortSetup($file);
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Get most recent csv, read data and assign to $this->$theData
|
124 |
+
*
|
125 |
+
* @param $csvFiles Array of csv files in var/export.
|
126 |
+
*/
|
127 |
+
protected function _findMostRecentCSV()
|
128 |
+
{
|
129 |
+
// Get file with the most recent timestamp
|
130 |
+
array_multisort($this->_fileDates, SORT_DESC);
|
131 |
+
$mostRecent = $this->_fileDates[0];
|
132 |
+
$mostRecentCSV = $this->_dateFileArray[$mostRecent];
|
133 |
+
$fullFileName = Mage::getBaseDir('var') . DS . 'export' . DS . $mostRecentCSV;
|
134 |
+
|
135 |
+
if (is_file($fullFileName)) {
|
136 |
+
$theData = array(
|
137 |
+
'type' => 'filename',
|
138 |
+
'value' => $fullFileName,
|
139 |
+
'rm' => false // can delete file after use
|
140 |
+
);
|
141 |
+
} else {
|
142 |
+
$theData = $this->_noCSVPresent($fullFileName);
|
143 |
+
return $theData;
|
144 |
+
}
|
145 |
+
|
146 |
+
$this->_theDataArray = array($mostRecentCSV, $theData);
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Sets up $this->_fileDates & $this->_dateFileArray to be sorted
|
151 |
+
*
|
152 |
+
* @param $csvFiles Array of csv files in var/export.
|
153 |
+
*/
|
154 |
+
protected function timeSortSetup($file)
|
155 |
+
{
|
156 |
+
$currentModified = filectime(Mage::getBaseDir('var') . DS . 'export' . DS. $file);
|
157 |
+
$this->_fileDates[] = $currentModified;
|
158 |
+
$this->_dateFileArray[$currentModified] = $file;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Assigns blank CSV file to $this->_theDataArray and posts a log
|
163 |
+
*
|
164 |
+
* @param $dir Location of var/export.
|
165 |
+
*/
|
166 |
+
protected function _getNoCsvFilePresentArr()
|
167 |
+
{
|
168 |
+
$dir = Mage::getBaseDir('var') . DS . 'export' . DS;
|
169 |
+
Mage::helper('wsacommon/log')->postMajor('WSA Helper','No file found in var/export with the name:', $dir);
|
170 |
+
return array('', 'blank');
|
171 |
+
}
|
172 |
+
|
173 |
+
}
|
174 |
+
?>
|
app/code/community/Webshopapps/Wsacommon/Model/Resource/Resource.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
/**
|
28 |
+
* Magento Webshopapps Module
|
29 |
+
*
|
30 |
+
* @category Webshopapps
|
31 |
+
* @package Webshopapps Wsacommon
|
32 |
+
* @copyright Copyright (c) 2011 Zowta Ltd (http://www.webshopapps.com)
|
33 |
+
* @license www.webshopapps.com/license/license.txt
|
34 |
+
* @author Karen Baker <sales@webshopapps.com>
|
35 |
+
*/
|
36 |
+
|
37 |
+
class Webshopapps_Wsacommon_Model_Resource_Resource extends Mage_Core_Model_Resource_Resource
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Set module version into *****DB CREATED BY TOM*****
|
41 |
+
*
|
42 |
+
* @param string $resName
|
43 |
+
* @param string $version
|
44 |
+
* @return int
|
45 |
+
*/
|
46 |
+
public function deleteDbVersion($resName, $version)
|
47 |
+
{
|
48 |
+
$dbModuleInfo = array(
|
49 |
+
'code' => $resName,
|
50 |
+
'version' => $version,
|
51 |
+
);
|
52 |
+
|
53 |
+
if ($this->getDbVersion($resName)) {
|
54 |
+
self::$_versions[$resName] = $resName;
|
55 |
+
return $this->_getWriteAdapter()->delete($this->getMainTable(),
|
56 |
+
array('code = ?' => $resName));
|
57 |
+
} else {
|
58 |
+
self::$_versions[$resName] = $version;
|
59 |
+
return $this->_getWriteAdapter()->insert($this->getMainTable(), $dbModuleInfo);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Model/Sales/Quote/Address/Rate.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebShopApps Shipping Module
|
4 |
+
*
|
5 |
+
* @category WebShopApps
|
6 |
+
* @package WebShopApps_Wsacommon
|
7 |
+
* User karen
|
8 |
+
* Date 26/08/2013
|
9 |
+
* Time 14:42
|
10 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
11 |
+
* Copyright, 2013, Zowta, LLC - US license
|
12 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
|
16 |
+
class Webshopapps_Wsacommon_Model_Sales_Quote_Address_Rate extends Mage_Sales_Model_Quote_Address_Rate
|
17 |
+
{
|
18 |
+
|
19 |
+
|
20 |
+
public function importShippingRate(Mage_Shipping_Model_Rate_Result_Abstract $rate)
|
21 |
+
{
|
22 |
+
|
23 |
+
if (!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropship','carriers/dropship/active') &&
|
24 |
+
!Mage::helper('wsacommon')->isModuleEnabled(
|
25 |
+
'Webshopapps_Wsafreightcommon','shipping/wsafreightcommon/active') ) {
|
26 |
+
return parent::importShippingRate($rate);
|
27 |
+
}
|
28 |
+
|
29 |
+
if ($rate instanceof Mage_Shipping_Model_Rate_Result_Error) {
|
30 |
+
$this
|
31 |
+
->setCode($rate->getCarrier().'_error')
|
32 |
+
->setCarrier($rate->getCarrier())
|
33 |
+
->setCarrierTitle($rate->getCarrierTitle())
|
34 |
+
->setWarehouse($rate->getWarehouse())
|
35 |
+
->setWarehouseShippingDetails($rate->getWarehouseShippingDetails())
|
36 |
+
->setErrorMessage($rate->getErrorMessage())
|
37 |
+
;
|
38 |
+
} elseif ($rate instanceof Mage_Shipping_Model_Rate_Result_Method) {
|
39 |
+
$this
|
40 |
+
->setCode($rate->getCarrier().'_'.$rate->getMethod())
|
41 |
+
->setCarrier($rate->getCarrier())
|
42 |
+
->setCarrierTitle($rate->getCarrierTitle())
|
43 |
+
->setMethod($rate->getMethod())
|
44 |
+
->setWarehouse($rate->getWarehouse())
|
45 |
+
->setWarehouseShippingDetails($rate->getWarehouseShippingDetails())
|
46 |
+
->setExpectedDelivery($rate->getExpectedDelivery())
|
47 |
+
->setDispatchDate($rate->getDispatchDate())
|
48 |
+
->setFreightQuoteId($rate->getFreightQuoteId())
|
49 |
+
->setMethodTitle($rate->getMethodTitle())
|
50 |
+
->setMethodDescription($rate->getMethodDescription())
|
51 |
+
->setOverridePriceInfo($rate->getOverridePriceInfo())
|
52 |
+
->setPrice($rate->getPrice())
|
53 |
+
;
|
54 |
+
}
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Model/Shipping/Carrier/Baseabstract.php
ADDED
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Usa
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Abstract USA shipping carrier model
|
30 |
+
*
|
31 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
32 |
+
*/
|
33 |
+
/**
|
34 |
+
* Magento Webshopapps Module
|
35 |
+
*
|
36 |
+
* @category Webshopapps
|
37 |
+
* @package Webshopapps Wsacommon
|
38 |
+
* @copyright Copyright (c) 2011 Zowta Ltd (http://www.webshopapps.com)
|
39 |
+
* @license www.webshopapps.com/license/license.txt
|
40 |
+
* @author Karen Baker <sales@webshopapps.com>
|
41 |
+
*/
|
42 |
+
|
43 |
+
abstract class Webshopapps_Wsacommon_Model_Shipping_Carrier_Baseabstract extends Mage_Shipping_Model_Carrier_Abstract
|
44 |
+
{
|
45 |
+
protected $_debug;
|
46 |
+
|
47 |
+
protected $_request = null;
|
48 |
+
|
49 |
+
protected $_result = null;
|
50 |
+
|
51 |
+
protected $_rawRequest = null;
|
52 |
+
protected $_modName = 'none';
|
53 |
+
|
54 |
+
protected $_code;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Part of carrier xml config path
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
protected $_availabilityConfigField = 'active';
|
62 |
+
|
63 |
+
protected static $_quotesCache = array();
|
64 |
+
|
65 |
+
const XML_PATH_STORE_ADDRESS1 = 'shipping/origin/street_line1';
|
66 |
+
const XML_PATH_STORE_ADDRESS2 = 'shipping/origin/street_line2';
|
67 |
+
const XML_PATH_STORE_CITY = 'shipping/origin/city';
|
68 |
+
const XML_PATH_STORE_REGION_ID = 'shipping/origin/region_id';
|
69 |
+
const XML_PATH_STORE_ZIP = 'shipping/origin/postcode';
|
70 |
+
const XML_PATH_STORE_COUNTRY_ID = 'shipping/origin/country_id';
|
71 |
+
|
72 |
+
|
73 |
+
abstract protected function _getQuotes();
|
74 |
+
abstract public function getCode($type, $code='');
|
75 |
+
|
76 |
+
public function getTrackingInfo($tracking, $postcode=null, $orderId=null)
|
77 |
+
{
|
78 |
+
$info = array();
|
79 |
+
|
80 |
+
$result = $this->getTracking($tracking);
|
81 |
+
|
82 |
+
if($result instanceof Mage_Shipping_Model_Tracking_Result){
|
83 |
+
if ($trackings = $result->getAllTrackings()) {
|
84 |
+
return $trackings[0];
|
85 |
+
}
|
86 |
+
}
|
87 |
+
elseif (is_string($result) && !empty($result)) {
|
88 |
+
return $result;
|
89 |
+
} else {
|
90 |
+
$info['title'] = $this->getConfigData('title');
|
91 |
+
$info['number'] = $tracking;
|
92 |
+
return $info;
|
93 |
+
}
|
94 |
+
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Check if carrier has shipping tracking option available
|
100 |
+
* All Mage_Usa carriers have shipping tracking option available
|
101 |
+
*
|
102 |
+
* @return boolean
|
103 |
+
*/
|
104 |
+
public function isTrackingAvailable()
|
105 |
+
{
|
106 |
+
return true;
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getResult()
|
110 |
+
{
|
111 |
+
return $this->_result;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Enter description here...
|
116 |
+
*
|
117 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
118 |
+
* @return Mage_Shipping_Model_Rate_Result
|
119 |
+
*/
|
120 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
121 |
+
{
|
122 |
+
if (!$this->getConfigFlag('active')) {
|
123 |
+
return false;
|
124 |
+
}
|
125 |
+
if ($this->_modName == 'none') {
|
126 |
+
$this->_debug = $this->getConfigData('debug');
|
127 |
+
} else {
|
128 |
+
$this->_debug = Mage::helper('wsalogger')->isDebug($this->_modName);
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
$this->setRequest($request);
|
133 |
+
|
134 |
+
$this->_result = $this->_getQuotes();
|
135 |
+
|
136 |
+
$this->_updateFreeMethodQuote($request);
|
137 |
+
|
138 |
+
return $this->getResult();
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
protected function _setFreeMethodRequest($freeMethod)
|
143 |
+
{
|
144 |
+
$this->_rawRequest->setIgnoreFreeItems(true);
|
145 |
+
}
|
146 |
+
|
147 |
+
public function getAllowedMethods()
|
148 |
+
{
|
149 |
+
return array($this->_code=>$this->getConfigData('name'));
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Returns cache key for some request to carrier quotes service
|
154 |
+
*
|
155 |
+
* @param string|array $requestParams
|
156 |
+
* @return string
|
157 |
+
*/
|
158 |
+
protected function _getQuotesCacheKey($requestParams)
|
159 |
+
{
|
160 |
+
if (is_array($requestParams)) {
|
161 |
+
$requestParams = implode(',', array_merge(
|
162 |
+
array($this->getCarrierCode()),
|
163 |
+
array_keys($requestParams),
|
164 |
+
$requestParams)
|
165 |
+
);
|
166 |
+
}
|
167 |
+
return crc32($requestParams);
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Checks whether some request to rates have already been done, so we have cache for it
|
172 |
+
* Used to reduce number of same requests done to carrier service during one session
|
173 |
+
*
|
174 |
+
* Returns cached response or null
|
175 |
+
*
|
176 |
+
* @param string|array $requestParams
|
177 |
+
* @return null|string
|
178 |
+
*/
|
179 |
+
protected function _getCachedQuotes($requestParams)
|
180 |
+
{
|
181 |
+
$key = $this->_getQuotesCacheKey($requestParams);
|
182 |
+
return isset(self::$_quotesCache[$key]) ? self::$_quotesCache[$key] : null;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Sets received carrier quotes to cache
|
187 |
+
*
|
188 |
+
* @param string|array $requestParams
|
189 |
+
* @param string $response
|
190 |
+
* @return Mage_Usa_Model_Shipping_Carrier_Abstract
|
191 |
+
*/
|
192 |
+
protected function _setCachedQuotes($requestParams, $response)
|
193 |
+
{
|
194 |
+
$key = $this->_getQuotesCacheKey($requestParams);
|
195 |
+
self::$_quotesCache[$key] = $response;
|
196 |
+
return $this;
|
197 |
+
}
|
198 |
+
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Get carrier by its code
|
202 |
+
*
|
203 |
+
* @param string $carrierCode
|
204 |
+
* @param null|int $storeId
|
205 |
+
* @return bool|Mage_Core_Model_Abstract
|
206 |
+
*/
|
207 |
+
public function getCarrierByCode($carrierCode, $storeId = null)
|
208 |
+
{
|
209 |
+
if (!Mage::getStoreConfigFlag('carriers/'.$carrierCode.'/'.$this->_availabilityConfigField, $storeId)) {
|
210 |
+
return false;
|
211 |
+
}
|
212 |
+
$className = Mage::getStoreConfig('carriers/'.$carrierCode.'/model', $storeId);
|
213 |
+
if (!$className) {
|
214 |
+
return false;
|
215 |
+
}
|
216 |
+
$obj = Mage::getModel($className);
|
217 |
+
if ($storeId) {
|
218 |
+
$obj->setStore($storeId);
|
219 |
+
}
|
220 |
+
return $obj;
|
221 |
+
}
|
222 |
+
|
223 |
+
|
224 |
+
protected function _getCart()
|
225 |
+
{
|
226 |
+
return Mage::getSingleton('checkout/cart');
|
227 |
+
}
|
228 |
+
|
229 |
+
protected function _getQuote()
|
230 |
+
{
|
231 |
+
if (Mage::registry('rule_data')) {
|
232 |
+
return $this->_getAdminQuote();
|
233 |
+
|
234 |
+
}
|
235 |
+
return $this->_getCart()->getQuote();
|
236 |
+
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
protected function _getAdminSession()
|
241 |
+
{
|
242 |
+
return Mage::getSingleton('adminhtml/session_quote');
|
243 |
+
}
|
244 |
+
|
245 |
+
protected function _getAdminQuote()
|
246 |
+
{
|
247 |
+
return $this->_getAdminSession()->getQuote();
|
248 |
+
}
|
249 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Model/Shipping/Shipping.php
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
/**
|
28 |
+
* Magento Webshopapps Module
|
29 |
+
*
|
30 |
+
* @category Webshopapps
|
31 |
+
* @package Webshopapps Wsacommon
|
32 |
+
* @copyright Copyright (c) 2011 Zowta Ltd (http://www.webshopapps.com)
|
33 |
+
* @license www.webshopapps.com/license/license.txt
|
34 |
+
* @author Karen Baker <sales@webshopapps.com>
|
35 |
+
*/
|
36 |
+
|
37 |
+
class Webshopapps_Wsacommon_Model_Shipping_Shipping extends Mage_Shipping_Model_Shipping
|
38 |
+
{
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Prefix of model events
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected static $_eventPrefix = 'webshopapps_shipping_shipping';
|
47 |
+
|
48 |
+
public $request;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Name of event object
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
protected static $_eventObject = 'shipping';
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Retrieve all methods for supplied shipping data
|
59 |
+
*
|
60 |
+
* @todo make it ordered
|
61 |
+
* @param Mage_Shipping_Model_Shipping_Method_Request $data
|
62 |
+
* @return Mage_Shipping_Model_Shipping
|
63 |
+
*/
|
64 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
65 |
+
{
|
66 |
+
Mage::dispatchEvent(self::$_eventPrefix . '_collectRates_before', array(self::$_eventObject => $this,
|
67 |
+
'request' =>$request));
|
68 |
+
|
69 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropcommon','carriers/dropship/active')) {
|
70 |
+
if (!Mage::registry('dropcommon_shipmodel')) {
|
71 |
+
$model = Mage::getModel('dropcommon/shipping_shipping');
|
72 |
+
Mage::register('dropcommon_shipmodel', $model);
|
73 |
+
}
|
74 |
+
Mage::registry('dropcommon_shipmodel')->resetResult();
|
75 |
+
return Mage::registry('dropcommon_shipmodel')->collectRates($request);
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropship','carriers/dropship/active')) {
|
81 |
+
if (!Mage::registry('dropship_shipmodel')) {
|
82 |
+
$model = Mage::getModel('dropship/shipping_shipping');
|
83 |
+
Mage::register('dropship_shipmodel', $model);
|
84 |
+
}
|
85 |
+
Mage::registry('dropship_shipmodel')->resetResult();
|
86 |
+
return Mage::registry('dropship_shipmodel')->collectRates($request);
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rgshipping','shipping/rgshipping/active')) {
|
91 |
+
if (!Mage::registry('rgshipping_shipmodel')) {
|
92 |
+
$model = Mage::getModel('rgshipping/shipping_shipping');
|
93 |
+
Mage::register('rgshipping_shipmodel', $model);
|
94 |
+
}
|
95 |
+
Mage::registry('rgshipping_shipmodel')->resetResult();
|
96 |
+
return Mage::registry('rgshipping_shipmodel')->collectRates($request);
|
97 |
+
}
|
98 |
+
|
99 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipmanager','carriers/shipmanager/active')) {
|
100 |
+
if (!Mage::registry('shipmanager_shipmodel')) {
|
101 |
+
$model = Mage::getModel('shipmanager/shipping_shipping');
|
102 |
+
Mage::register('shipmanager_shipmodel', $model);
|
103 |
+
}
|
104 |
+
Mage::registry('shipmanager_shipmodel')->resetResult();
|
105 |
+
return Mage::registry('shipmanager_shipmodel')->collectRates($request);
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shippingoverride2','shipping/shippingoverride2/active')) {
|
110 |
+
if (!Mage::registry('override2_shipmodel')) {
|
111 |
+
$model = Mage::getModel('shippingoverride2/shipping_shipping');
|
112 |
+
Mage::register('override2_shipmodel', $model);
|
113 |
+
}
|
114 |
+
Mage::registry('override2_shipmodel')->resetResult();
|
115 |
+
return Mage::registry('override2_shipmodel')->collectRates($request);
|
116 |
+
}
|
117 |
+
|
118 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Freightrate','carriers/freightrate/active')) {
|
119 |
+
if (!Mage::registry('freightrate_shipmodel')) {
|
120 |
+
$model = Mage::getModel('freightrate/shipping_shipping');
|
121 |
+
Mage::register('freightrate_shipmodel', $model);
|
122 |
+
}
|
123 |
+
Mage::registry('freightrate_shipmodel')->resetResult();
|
124 |
+
return Mage::registry('freightrate_shipmodel')->collectRates($request);
|
125 |
+
}
|
126 |
+
|
127 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafreightcommon','shipping/wsafreightcommon/active')) {
|
128 |
+
if (!Mage::registry('wsafreightcommon_shipmodel')) {
|
129 |
+
$model = Mage::getModel('wsafreightcommon/shipping_shipping');
|
130 |
+
Mage::register('wsafreightcommon_shipmodel', $model);
|
131 |
+
}
|
132 |
+
Mage::registry('wsafreightcommon_shipmodel')->resetResult();
|
133 |
+
return Mage::registry('wsafreightcommon_shipmodel')->collectRates($request);
|
134 |
+
}
|
135 |
+
|
136 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Estesfreight','carriers/estesfreight/active')) {
|
137 |
+
if (!Mage::registry('estes_shipmodel')) {
|
138 |
+
$model = Mage::getModel('estesfreight/shipping_shipping');
|
139 |
+
Mage::register('estes_shipmodel', $model);
|
140 |
+
}
|
141 |
+
Mage::registry('estes_shipmodel')->resetResult();
|
142 |
+
return Mage::registry('estes_shipmodel')->collectRates($request);
|
143 |
+
}
|
144 |
+
|
145 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Conwayfreight','carriers/conwayfreight/active')) {
|
146 |
+
if (!Mage::registry('conway_shipmodel')) {
|
147 |
+
$model = Mage::getModel('conwayfreight/shipping_shipping');
|
148 |
+
Mage::register('conway_shipmodel', $model);
|
149 |
+
}
|
150 |
+
Mage::registry('conway_shipmodel')->resetResult();
|
151 |
+
return Mage::registry('conway_shipmodel')->collectRates($request);
|
152 |
+
}
|
153 |
+
|
154 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafedexfreight','carriers/wsafedexfreight/active')) {
|
155 |
+
if (!Mage::registry('wsafedexfreight_shipmodel')) {
|
156 |
+
$model = Mage::getModel('wsafedexfreight/shipping_shipping');
|
157 |
+
Mage::register('wsafedexfreight_shipmodel', $model);
|
158 |
+
}
|
159 |
+
Mage::registry('wsafedexfreight_shipmodel')->resetResult();
|
160 |
+
return Mage::registry('wsafedexfreight_shipmodel')->collectRates($request);
|
161 |
+
}
|
162 |
+
|
163 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Usslogistics','carriers/usslogistics/active')) {
|
164 |
+
if (!Mage::registry('usslogistics_shipmodel')) {
|
165 |
+
$model = Mage::getModel('usslogistics/shipping_shipping');
|
166 |
+
Mage::register('usslogistics_shipmodel', $model);
|
167 |
+
}
|
168 |
+
Mage::registry('usslogistics_shipmodel')->resetResult();
|
169 |
+
return Mage::registry('usslogistics_shipmodel')->collectRates($request);
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Abffreight','carriers/abffreight/active')) {
|
174 |
+
if (!Mage::registry('abffreight_shipmodel')) {
|
175 |
+
$model = Mage::getModel('abffreight/shipping_shipping');
|
176 |
+
Mage::register('abffreight_shipmodel', $model);
|
177 |
+
}
|
178 |
+
Mage::registry('abffreight_shipmodel')->resetResult();
|
179 |
+
return Mage::registry('abffreight_shipmodel')->collectRates($request);
|
180 |
+
}
|
181 |
+
|
182 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsaupsfreight','carriers/wsaupsfreight/active')) {
|
183 |
+
if (!Mage::registry('wsaupfreight_shipmodel')) {
|
184 |
+
$model = Mage::getModel('wsaupsfreight/shipping_shipping');
|
185 |
+
Mage::register('wsaupfreight_shipmodel', $model);
|
186 |
+
}
|
187 |
+
Mage::registry('wsaupfreight_shipmodel')->resetResult();
|
188 |
+
return Mage::registry('wsaupfreight_shipmodel')->collectRates($request);
|
189 |
+
}
|
190 |
+
|
191 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Yrcfreight','carriers/yrcfreight/active')) {
|
192 |
+
if (!Mage::registry('yrc_shipmodel')) {
|
193 |
+
$model = Mage::getModel('yrcfreight/shipping_shipping');
|
194 |
+
Mage::register('yrc_shipmodel', $model);
|
195 |
+
}
|
196 |
+
Mage::registry('yrc_shipmodel')->resetResult();
|
197 |
+
return Mage::registry('yrc_shipmodel')->collectRates($request);
|
198 |
+
}
|
199 |
+
|
200 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/rlfreight/active')) {
|
201 |
+
if (!Mage::registry('rlfreight_shipmodel')) {
|
202 |
+
$model = Mage::getModel('rlfreight/shipping_shipping');
|
203 |
+
Mage::register('rlfreight_shipmodel', $model);
|
204 |
+
}
|
205 |
+
Mage::registry('rlfreight_shipmodel')->resetResult();
|
206 |
+
return Mage::registry('rlfreight_shipmodel')->collectRates($request);
|
207 |
+
}
|
208 |
+
|
209 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingproduct','shipping/handlingproduct/active')) {
|
210 |
+
if (!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipusa','shipping/shipusa/active')) {
|
211 |
+
if (Mage::registry('handlingproduct_shipmodel')) {
|
212 |
+
Mage::registry('handlingproduct_shipmodel')->resetResult();
|
213 |
+
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
// This method of handling rewrites is now deprecated in favour of using event logic for handling matrix
|
218 |
+
// Only remains in case Handling Matrix code has not been updated
|
219 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingmatrix','shipping/handlingmatrix/active') &&
|
220 |
+
Mage::helper('wsacommon')->getNumericExtensionVersion('handlingmatrix')<100) {
|
221 |
+
if (Mage::registry('handlingmatrix_shipmodel')) {
|
222 |
+
Mage::registry('handlingmatrix_shipmodel')->resetResult();
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Insurance','shipping/insurance/active')) {
|
227 |
+
if (Mage::registry('insurance_shipmodel')) {
|
228 |
+
Mage::registry('insurance_shipmodel')->resetResult();
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
parent::collectRates($request);
|
233 |
+
|
234 |
+
Mage::dispatchEvent(self::$_eventPrefix . '_collectRates_after', array(self::$_eventObject => $this,
|
235 |
+
'request' => $request));
|
236 |
+
|
237 |
+
return $this;
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Overrides this method in core, and decides which extension to call
|
243 |
+
* Uses a hierarchy to decide on best extension
|
244 |
+
* @see app/code/core/Mage/Shipping/Model/Mage_Shipping_Model_Shipping::collectCarrierRates()
|
245 |
+
*/
|
246 |
+
public function collectCarrierRates($carrierCode, $request)
|
247 |
+
{
|
248 |
+
|
249 |
+
// check to see if handling Product enabled
|
250 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingproduct','shipping/handlingproduct/active')) {
|
251 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipusa','shipping/shipusa/active')) {
|
252 |
+
return parent::collectCarrierRates($carrierCode,$request);
|
253 |
+
|
254 |
+
} else {
|
255 |
+
if (!Mage::registry('handlingproduct_shipmodel')) {
|
256 |
+
$model = Mage::getModel('handlingproduct/shipping_shipping');
|
257 |
+
Mage::register('handlingproduct_shipmodel', $model);
|
258 |
+
}
|
259 |
+
$model = Mage::registry('handlingproduct_shipmodel') ;
|
260 |
+
$model->collectCarrierRates($carrierCode, $request);
|
261 |
+
$this->_result=$model->getResult();
|
262 |
+
return $model;
|
263 |
+
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
// This method of handling rewrites is now deprecated in favour of using event logic for handling matrix
|
268 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingmatrix','shipping/handlingmatrix/active') &&
|
269 |
+
Mage::helper('wsacommon')->getNumericExtensionVersion('handlingmatrix')<100) {
|
270 |
+
if (!Mage::registry('handlingmatrix_shipmodel')) {
|
271 |
+
$model = Mage::getModel('handlingmatrix/shipping_shipping');
|
272 |
+
Mage::register('handlingmatrix_shipmodel', $model);
|
273 |
+
}
|
274 |
+
$model = Mage::registry('handlingmatrix_shipmodel');
|
275 |
+
$model->collectCarrierRates($carrierCode, $request);
|
276 |
+
$this->_result=$model->getResult();
|
277 |
+
return $model;
|
278 |
+
}
|
279 |
+
|
280 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Insurance','shipping/insurance/active')) {
|
281 |
+
if (!Mage::registry('insurance_shipmodel')) {
|
282 |
+
$model = Mage::getModel('insurance/shipping_shipping');
|
283 |
+
Mage::register('insurance_shipmodel', $model);
|
284 |
+
}
|
285 |
+
$model = Mage::registry('insurance_shipmodel');
|
286 |
+
$model->collectCarrierRates($carrierCode, $request);
|
287 |
+
$this->_result=$model->getResult();
|
288 |
+
return $model;
|
289 |
+
}
|
290 |
+
|
291 |
+
|
292 |
+
// default
|
293 |
+
return parent::collectCarrierRates($carrierCode,$request);
|
294 |
+
|
295 |
+
}
|
296 |
+
|
297 |
+
|
298 |
+
}
|
app/code/community/Webshopapps/Wsacommon/Model/Usa/Shipping/Carrier/Ups.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebShopApps Shipping Module
|
4 |
+
*
|
5 |
+
* @category WebShopApps
|
6 |
+
* @package WebShopApps_Exampleextension
|
7 |
+
* User karen
|
8 |
+
* Date 03/07/2013
|
9 |
+
* Time 00:30
|
10 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
11 |
+
* Copyright, 2013, Zowta, LLC - US license
|
12 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
|
16 |
+
class Webshopapps_Wsacommon_Model_Usa_Shipping_Carrier_Ups extends Mage_Usa_Model_Shipping_Carrier_Ups {
|
17 |
+
|
18 |
+
|
19 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
20 |
+
{
|
21 |
+
// Dimensional Shipping takes precendence over UpsCalendar
|
22 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipusa','shipping/shipusa/active')) {
|
23 |
+
if (!Mage::registry('shipusa_upsmodel')) {
|
24 |
+
$model = Mage::getModel('shipusa/shipping_carrier_ups');
|
25 |
+
Mage::register('shipusa_upsmodel', $model);
|
26 |
+
}
|
27 |
+
return Mage::registry('shipusa_upsmodel')->collectRates($request);
|
28 |
+
}
|
29 |
+
|
30 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Upscalendar','shipping/webshopapps_dateshiphelper/active')) {
|
31 |
+
if (!Mage::registry('upscalendar_upsmodel')) {
|
32 |
+
$model = Mage::getModel('upscalendar/usa_shipping_carrier_ups');
|
33 |
+
Mage::register('upscalendar_upsmodel', $model);
|
34 |
+
}
|
35 |
+
return Mage::registry('upscalendar_upsmodel')->collectRates($request);
|
36 |
+
}
|
37 |
+
|
38 |
+
if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_UPSDateShipping','shipping/webshopapps_dateshiphelper/active')) {
|
39 |
+
if (!Mage::registry('upsdateshipping_upsmodel')) {
|
40 |
+
$model = Mage::getModel('webshopapps_upsdateshipping/usa_shipping_carrier_ups');
|
41 |
+
Mage::register('upsdateshipping_upsmodel', $model);
|
42 |
+
}
|
43 |
+
return Mage::registry('upsdateshipping_upsmodel')->collectRates($request);
|
44 |
+
}
|
45 |
+
|
46 |
+
// default
|
47 |
+
return parent::collectRates($request);
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
app/code/community/Webshopapps/Wsacommon/changelog.txt
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
0.14 - Added check to see if extension active in admin panel config
|
2 |
+
0.15 - UPS Freight extension compatible release
|
3 |
+
0.16 - updated for shipping override to support multiple freight carriers
|
4 |
+
0.17 - Added support for Shipping Insurance to work with Shipping Override
|
5 |
+
0.18 - Added support for Dropship with Override
|
6 |
+
0.19 - Added fix so that ProductMatrix can work with Downloadable shipping
|
7 |
+
0.20 - Added fix to pickup on custom options set for Downloadable shipping
|
8 |
+
0.21 - Split Shipping Abstract.php into 2 classes to allow support for non-freight extensions.
|
9 |
+
Removed references to virtual products in getItemTotals to ensure no adverse effects.
|
10 |
+
0.22 - Split getItemTotals into 2 methods for virtual items and physical items
|
11 |
+
0.23 - Added ABF Support. Changed getAllowedMethod call for Freight extns
|
12 |
+
0.24 - Added a method to save a CSV file to the file system for backup purposes.
|
13 |
+
0.25 - Now resets results in Shipping.php for multi-cart checkout
|
14 |
+
0.26 - Added check to ensure item is an object.
|
15 |
+
1.0 - Removed logger components
|
16 |
+
1.1 - Added in 1.6 support
|
17 |
+
1.2 - Resolved issue producing 'Mage_Wsacommon\log_Helper_Data' not found error
|
18 |
+
1.3 - Added support for freight rate
|
19 |
+
1.4 - Re-released without logger using new ant build.xml
|
20 |
+
1.5 - Fixed issued with getVersion call on certain PHP versions
|
21 |
+
1.6 - Wasn't using the ceil weight value in getLineItems. Only affects freight extensions.
|
22 |
+
1.7 - Made weight check in freight more robust
|
23 |
+
1.8 - Reworked getAllowedMethods call to allow multiple results to be returned
|
24 |
+
1.9 - Was calling downloadable shipping even if it wasn't installed. Caused issues with virtual products
|
25 |
+
2.0 - Changed to work with version 2.0 of logger
|
26 |
+
2.1 - Added support for multiple extensions using Sales Order Grid menu
|
27 |
+
2.2 - Added support for pricing calculations of fixed priced bundled products
|
28 |
+
2.3 - Added support for Handling Matrix with Shipping Override
|
29 |
+
2.4 - Added support for EE1.11
|
30 |
+
2.5 - Added support for Free shipping on cart to affect getItemTotals
|
31 |
+
2.6 - Amended controller action of import shipments template
|
32 |
+
2.7 - Added back Select All option for Order Export
|
33 |
+
2.8 - Resolved Downloadable shipping extension issue which was causing problems when a shippable virtual product is in cart with a non shippable virtual product.
|
34 |
+
3.0 - Fixed isModuleEnabled() calls when using multiple extensions so can disable each at store level with no impact
|
35 |
+
3.1 - Moved to community
|
36 |
+
3.2 - Moved back to local - too hard to support when local is overriding
|
37 |
+
3.3 - Added in shipmanager extn
|
38 |
+
3.4 - Added Select All option for Order Export version check
|
39 |
+
3.5 - Added ability to return the base currency totals from the getItem family of methods.
|
40 |
+
3.6 - Added support for 1.6.2 around Shipping.php
|
41 |
+
3.7 - Fixed typo in handling matrix and shipping insurance reset Result
|
42 |
+
3.8 - Added try catch around code that may fail when run from cron.
|
43 |
+
3.9 - Added deleteDbVersion() function to be used by the setResource script.
|
44 |
+
3.10 - Added Fedex freight support
|
45 |
+
3.11 - Changed tracking for custom shipping methods so will return title/number when entered
|
46 |
+
3.12 - Support for tax inclusive prices in getItemTotals and getVirtualItemsTotals
|
47 |
+
3.13 - Defined store address location constants to resolve backward compatibilty issues with some extensions
|
48 |
+
3.14 - Changed bundled check logic as was causing an issue in multi-address checkout
|
49 |
+
3.15 - Added support for Estes
|
50 |
+
3.16 - Added support for EE1.12,CE1.7
|
51 |
+
3.17 - Added support for wsafreightcommon
|
52 |
+
3.18 - Changed order of calling extensions when shippingoverride and freight rate installed.
|
53 |
+
3.19 - Added support for exported column in orders grid
|
54 |
+
3.20 - Fixed issue with getting tax amounts on multi shipping checkout.
|
55 |
+
3.21 - Added exported column in Orders grid
|
56 |
+
3.22 - Moved freight common to shipping settings.
|
57 |
+
3.23 - Improved handling of virtual items.
|
58 |
+
3.24 - Further improved virtual item handling to correctly pickup the quantity
|
59 |
+
3.25 - Update Orders Grid for CE1.4.0 as doesn't support Exported column
|
60 |
+
3.26 - Resolved issue with price retrieval in multi address checkout
|
61 |
+
3.27 - Updated to work with freight common freight class
|
62 |
+
3.28 - Skipped. Not released
|
63 |
+
3.29 - Freight common updates
|
64 |
+
4.0 - Add in getProduct capability. Deprecated Abstract.php
|
65 |
+
4.1 - Put back in zipcode logic to deprecated Abstract.php so that doesnt cause issues with people running old extns
|
66 |
+
4.2 - Added workaround for EE1.9 which doesnt support addTierPriceData() method for bundled virtual products
|
67 |
+
4.3 - Added Header block
|
68 |
+
5.0 - Moved to community
|
69 |
+
5.1 - Added CSV export functionality
|
70 |
+
5.2 - Improved serial key checking
|
71 |
+
5.3 - Now adds WSA to make files saved in var/export unique. Will help avoid conflicts with other extensions that save to var/export.
|
72 |
+
5.4 - Added fixed weight for bundle product support & CSV export now works specific to the extension
|
73 |
+
5.5 - CSV export changes
|
74 |
+
5.6 - Improved csv export functionality to be unique
|
75 |
+
5.7 - SO-6 Added support in hasFreightCarrierEnabled call for fedex
|
76 |
+
5.8 - HOC1 Refactor code around how Freight carriers work
|
77 |
+
5.9 - Added carrier code to csv export file name so works with multiple WSA extensions installed
|
78 |
+
5.10 - Added observer logic to shipping area to enable extensions to work better together
|
79 |
+
5.11 - COMMON-29 fixed price bundle issue
|
80 |
+
5.12 - HFM-5 Changed HandlingMatrix to use event based logic
|
81 |
+
5.13 - COMMON-30 Refactored csv export logic to not read content
|
82 |
+
5.14 - AS1-Added compatibility for AdminShipping and Freight Extensions
|
83 |
+
5.15 - COMMON-31 Added support for CE1.8
|
84 |
+
5.16 - PICKUP-1 Moved methods into baseabstract from abstract in freight common so can be used in StorePickup
|
85 |
+
|
86 |
+
5.17 - SHIPMAN-7 Updated to implement DropCommon
|
87 |
+
5.18 - PICKUP-38 added request to predispatch event to limit carriers for storepickup
|
88 |
+
5.19 - AS-3 Admin Based shipping now working with Custom Calendar
|
89 |
+
5.20 - COMMON-34 Removed rewrite that was causing issues
|
90 |
+
5.21 - COMMON-34 Removed rewrite that was causing issues
|
91 |
+
5.22 - DIMSHIP-129 Null weight workaround
|
92 |
+
5.23 - DIMSHIP-135 - Added compatibility with UPS Date Shipping
|
app/code/community/Webshopapps/Wsacommon/controllers/System/ConfigController.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Webshopapps Shipping Module
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Webshopapps
|
22 |
+
* @package Webshopapps_Wsacommon
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://www.webshopapps.com/license/license.txt
|
26 |
+
* @author Karen Baker <sales@webshopapps.com>
|
27 |
+
*/
|
28 |
+
|
29 |
+
class Webshopapps_Wsacommon_System_ConfigController extends Mage_Adminhtml_Controller_Action
|
30 |
+
{
|
31 |
+
|
32 |
+
|
33 |
+
/*
|
34 |
+
* Export shipping table rates in csv format
|
35 |
+
*
|
36 |
+
*/
|
37 |
+
public function exportmatrixAction()
|
38 |
+
{
|
39 |
+
$website = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getId();
|
40 |
+
$carrierCode = $this->getRequest()->getParam('carrier_code');
|
41 |
+
$fileInfo = Mage::getModel('wsacommon/export_csv')->createCSV($website,$carrierCode);
|
42 |
+
if (!strpos($fileInfo[0], '.csv')) {
|
43 |
+
$fileInfo[0] = 'blank.csv';
|
44 |
+
}
|
45 |
+
$this->_prepareDownloadResponse($fileInfo[0], $fileInfo[1]);
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
app/code/community/Webshopapps/Wsacommon/etc/config.xml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Checkout
|
24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*
|
27 |
+
* @category Webshopapps
|
28 |
+
* @package Webshopapps_Wsacommon
|
29 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
30 |
+
* Copyright, 2013, Zowta, LLC - US license
|
31 |
+
* @license http://www.webshopapps.com/license/license.txt - Commercial license
|
32 |
+
* @author Karen Baker <sales@webshopapps.com>
|
33 |
+
*/
|
34 |
+
-->
|
35 |
+
<config>
|
36 |
+
<modules>
|
37 |
+
<Webshopapps_Wsacommon>
|
38 |
+
<version>1.0.0</version>
|
39 |
+
</Webshopapps_Wsacommon>
|
40 |
+
</modules>
|
41 |
+
<global>
|
42 |
+
<blocks>
|
43 |
+
<wsacommon>
|
44 |
+
<class>Webshopapps_Wsacommon_Block</class>
|
45 |
+
</wsacommon>
|
46 |
+
<wsacommon_adminhtml>
|
47 |
+
<class>Webshopapps_Wsacommon_Block_Adminhtml</class>
|
48 |
+
</wsacommon_adminhtml>
|
49 |
+
</blocks>
|
50 |
+
<models>
|
51 |
+
<wsacommon>
|
52 |
+
<class>Webshopapps_Wsacommon_Model</class>
|
53 |
+
<resourceModel>wsacommon_resource</resourceModel>
|
54 |
+
</wsacommon>
|
55 |
+
<wsacommon_resource>
|
56 |
+
<class>Webshopapps_Wsacommon_Model_Resource</class>
|
57 |
+
</wsacommon_resource>
|
58 |
+
</models>
|
59 |
+
<helpers>
|
60 |
+
<wsacommon>
|
61 |
+
<class>Webshopapps_Wsacommon_Helper</class>
|
62 |
+
</wsacommon>
|
63 |
+
</helpers>
|
64 |
+
<resources>
|
65 |
+
<wsacommon_setup>
|
66 |
+
<setup>
|
67 |
+
<module>Webshopapps_Wsacommon</module>
|
68 |
+
</setup>
|
69 |
+
<connection>
|
70 |
+
<use>core_setup</use>
|
71 |
+
</connection>
|
72 |
+
</wsacommon_setup>
|
73 |
+
</resources>
|
74 |
+
</global>
|
75 |
+
<admin>
|
76 |
+
<routers>
|
77 |
+
<adminhtml>
|
78 |
+
<args>
|
79 |
+
<modules>
|
80 |
+
<Webshopapps_Wsacommon before="Mage_Adminhtml">Webshopapps_Wsacommon</Webshopapps_Wsacommon>
|
81 |
+
</modules>
|
82 |
+
</args>
|
83 |
+
</adminhtml>
|
84 |
+
</routers>
|
85 |
+
</admin>
|
86 |
+
</config>
|
app/code/community/Webshopapps/Wsacommontest/Test/Helper/Totalstest.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by JetBrains PhpStorm.
|
4 |
+
* User: karen
|
5 |
+
* Date: 14/02/2013
|
6 |
+
* Time: 22:16
|
7 |
+
* To change this template use File | Settings | File Templates.
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Webshopapps_Wsacommontest_Test_Helper_Totalstest extends EcomDev_PHPUnit_Test_Case {
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Helper instance for test
|
15 |
+
*
|
16 |
+
* @var Webshopapps_Wsacommon_Helper_Totals
|
17 |
+
*/
|
18 |
+
protected $_helper = null;
|
19 |
+
|
20 |
+
|
21 |
+
protected $_quote = null;
|
22 |
+
|
23 |
+
protected $_quoteItem = null;
|
24 |
+
|
25 |
+
protected function setUp() {
|
26 |
+
|
27 |
+
|
28 |
+
$customer = $this->getModelMockBuilder('customer/session')
|
29 |
+
->disableOriginalConstructor()
|
30 |
+
->setMethods(null)
|
31 |
+
->getMock();
|
32 |
+
|
33 |
+
// All calls to Mage::getSingleton for customer/session will now return the mock object
|
34 |
+
// Instead of the real one!
|
35 |
+
$this->replaceByMock('singleton','customer/session',$customer);
|
36 |
+
|
37 |
+
$this->_quote = Mage::getModel('sales/quote')->load(1);
|
38 |
+
|
39 |
+
// mock this model, and this method within the model
|
40 |
+
$this->_quoteItem = $this->getModelMock('sales/quote_item',array('getQuote'));
|
41 |
+
|
42 |
+
// when method getQuote is called then return $this->_quote
|
43 |
+
$this->_quoteItem->expects($this->any())
|
44 |
+
->method('getQuote')
|
45 |
+
->will($this->returnValue($this->_quote));
|
46 |
+
|
47 |
+
$this->replaceByMock('singleton','sales/quote_item',$this->_quoteItem);
|
48 |
+
|
49 |
+
$this->app()->getRequest()->setBaseUrl('http://www.localhost.com');
|
50 |
+
$_SESSION = array();
|
51 |
+
|
52 |
+
$this->_helper = Mage::helper('wsacommon/totals');
|
53 |
+
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @loadFixture config
|
59 |
+
*/
|
60 |
+
public function testSimpleTotals() {
|
61 |
+
|
62 |
+
$item1 = $this->_quoteItem->load(1);
|
63 |
+
|
64 |
+
|
65 |
+
$totals = $this->_helper->getTotals($item1);
|
66 |
+
|
67 |
+
$this->assertEquals($totals->getData('weight'),1);
|
68 |
+
$this->assertEquals($totals->getData('price'),2);
|
69 |
+
$this->assertEquals($totals->getData('qty'),3);
|
70 |
+
|
71 |
+
}
|
72 |
+
}
|
app/code/community/Webshopapps/Wsacommontest/Test/Helper/_data/fx-config.yaml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
eav:
|
2 |
+
catalog_product:
|
3 |
+
- entity_id: 37
|
4 |
+
sku: SINGLE_MAXQTY_4_NODIMS_5LB
|
5 |
+
type_id: simple
|
6 |
+
name: SINGLE_MAXQTY_4_NODIMS_5LB
|
7 |
+
description: SINGLE_MAXQTY_4_NODIMS_5LB
|
8 |
+
short_description: SINGLE_MAXQTY_4_NODIMS_5LB
|
9 |
+
url_key: SINGLE_MAXQTY_4_NODIMS_5LB
|
10 |
+
price: 12.00
|
11 |
+
category_ids:
|
12 |
+
- 2 # Default Category
|
13 |
+
weight: 5
|
14 |
+
stock:
|
15 |
+
qty: 100.00
|
16 |
+
is_in_stock: 1
|
17 |
+
website_ids:
|
18 |
+
- base
|
19 |
+
tax_class_id: 2 # Taxable Goods
|
20 |
+
status: 1 # Enabled
|
21 |
+
visibility: 4 # Visible in Catalog & Search
|
22 |
+
- entity_id: 18 # 'SEP_5LB_NO_DIM'
|
23 |
+
type_id: simple
|
24 |
+
sku: SEP_5LB_NO_DIM
|
25 |
+
name: SEP_5LB_NO_DIM
|
26 |
+
short_description: SEP_5LB_NO_DIM
|
27 |
+
description: SEP_5LB_NO_DIM
|
28 |
+
url_key: SEP_5LB_NO_DIM
|
29 |
+
stock:
|
30 |
+
qty: 100.00
|
31 |
+
is_in_stock: 1
|
32 |
+
website_ids:
|
33 |
+
- base
|
34 |
+
category_ids:
|
35 |
+
- 2 # Default Category
|
36 |
+
price: 12.99
|
37 |
+
weight: 5
|
38 |
+
tax_class_id: 2 # Taxable Goods
|
39 |
+
status: 1 # Enabled
|
40 |
+
visibility: 4 # Visible in Catalog & Search
|
41 |
+
ship_separately: 1
|
42 |
+
tables:
|
43 |
+
sales/quote:
|
44 |
+
- entity_id: 1
|
45 |
+
store_id: 1
|
46 |
+
sales/quote_address:
|
47 |
+
- address_id: 1
|
48 |
+
quote_id: 1
|
49 |
+
firstname: John
|
50 |
+
lastname: Doe
|
51 |
+
street: 1 Street, apt 1
|
52 |
+
city: Somewhere
|
53 |
+
sales/quote_item:
|
54 |
+
- item_id: 1 # using standard mechanism provided by Ivan
|
55 |
+
quote_id: 1
|
56 |
+
product_id: 37 # SINGLE_MAXQTY_4_NODIMS_5LB
|
57 |
+
qty: 2
|
58 |
+
- item_id: 18
|
59 |
+
quote_id: 1
|
60 |
+
product_id: 18 # SEP_5LB_NO_DIM
|
61 |
+
qty: 2
|
app/code/community/Webshopapps/Wsacommontest/etc/config.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Webshopapps_Wsacommontest>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Webshopapps_Wsacommontest>
|
7 |
+
</modules>
|
8 |
+
<phpunit>
|
9 |
+
<suite>
|
10 |
+
<modules>
|
11 |
+
<Webshopapps_Wsacommontest />
|
12 |
+
</modules>
|
13 |
+
</suite>
|
14 |
+
</phpunit>
|
15 |
+
</config>
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* WebShopApps
|
29 |
+
*
|
30 |
+
* NOTICE OF LICENSE
|
31 |
+
*
|
32 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
33 |
+
* that is bundled with this package in the file LICENSE.txt.
|
34 |
+
* It is also available through the world-wide-web at this URL:
|
35 |
+
* http://opensource.org/licenses/osl-3.0.php
|
36 |
+
* If you did not receive a copy of the license and are unable to
|
37 |
+
* obtain it through the world-wide-web, please send an email
|
38 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
39 |
+
*
|
40 |
+
* DISCLAIMER
|
41 |
+
*
|
42 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
43 |
+
* versions in the future. If you wish to customize Magento for your
|
44 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
45 |
+
*
|
46 |
+
* @category WebShopApps
|
47 |
+
* @package WebShopApps WsaLogger
|
48 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
49 |
+
* Copyright, 2013, Zowta, LLC - US license
|
50 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
51 |
+
*/
|
52 |
+
|
53 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_Log extends Mage_Adminhtml_Block_Widget_Grid_Container
|
54 |
+
{
|
55 |
+
public function _construct()
|
56 |
+
{
|
57 |
+
$this->_controller = 'log';
|
58 |
+
$this->_blockGroup = 'wsalogger_adminhtml';
|
59 |
+
$this->_headerText = Mage::helper('wsalogger')->__('WebShopApps Log');
|
60 |
+
parent::_construct();
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function _prepareLayout()
|
64 |
+
{
|
65 |
+
$this->_removeButton('add');
|
66 |
+
|
67 |
+
return parent::_prepareLayout();
|
68 |
+
}
|
69 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/Grid.php
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* WebShopApps
|
30 |
+
*
|
31 |
+
* NOTICE OF LICENSE
|
32 |
+
*
|
33 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
34 |
+
* that is bundled with this package in the file LICENSE.txt.
|
35 |
+
* It is also available through the world-wide-web at this URL:
|
36 |
+
* http://opensource.org/licenses/osl-3.0.php
|
37 |
+
* If you did not receive a copy of the license and are unable to
|
38 |
+
* obtain it through the world-wide-web, please send an email
|
39 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
40 |
+
*
|
41 |
+
* DISCLAIMER
|
42 |
+
*
|
43 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
44 |
+
* versions in the future. If you wish to customize Magento for your
|
45 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
46 |
+
*
|
47 |
+
* @category WebShopApps
|
48 |
+
* @package WebShopApps WsaLogger
|
49 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
50 |
+
* Copyright, 2013, Zowta, LLC - US license
|
51 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
52 |
+
*/
|
53 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
54 |
+
{
|
55 |
+
protected function _construct()
|
56 |
+
{
|
57 |
+
$this->setSaveParametersInSession(true);
|
58 |
+
$this->setId('logGrid');
|
59 |
+
$this->setIdFieldName('notification_id');
|
60 |
+
$this->setDefaultSort('date_added', 'desc');
|
61 |
+
$this->setFilterVisibility(false);
|
62 |
+
}
|
63 |
+
|
64 |
+
protected function _prepareCollection()
|
65 |
+
{
|
66 |
+
$collection = Mage::getModel('wsalogger/log')
|
67 |
+
->getCollection()
|
68 |
+
->addRemoveFilter();
|
69 |
+
$this->setCollection($collection);
|
70 |
+
return parent::_prepareCollection();
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
protected function _prepareColumns()
|
75 |
+
{
|
76 |
+
$this->setTemplate('webshopapps_wsalogger/grid.phtml');
|
77 |
+
|
78 |
+
$this->addColumn('code', array(
|
79 |
+
'header' => Mage::helper('adminnotification')->__('Code'),
|
80 |
+
'width' => '30px',
|
81 |
+
'index' => 'code',
|
82 |
+
// 'renderer' => 'wsalogger_adminhtml/notification_grid_renderer_notice',
|
83 |
+
));
|
84 |
+
|
85 |
+
$this->addColumn('severity', array(
|
86 |
+
'header' => Mage::helper('adminnotification')->__('Severity'),
|
87 |
+
'width' => '60px',
|
88 |
+
'index' => 'severity',
|
89 |
+
'renderer' => 'wsalogger_adminhtml/notification_grid_renderer_severity',
|
90 |
+
));
|
91 |
+
|
92 |
+
$this->addColumn('date_added', array(
|
93 |
+
'header' => Mage::helper('adminnotification')->__('Date Added'),
|
94 |
+
'index' => 'date_added',
|
95 |
+
'width' => '150px',
|
96 |
+
'type' => 'datetime'
|
97 |
+
));
|
98 |
+
|
99 |
+
$this->addColumn('extension', array(
|
100 |
+
'header' => Mage::helper('adminnotification')->__('Extension'),
|
101 |
+
'index' => 'extension',
|
102 |
+
'width' => '80px',
|
103 |
+
));
|
104 |
+
|
105 |
+
$this->addColumn('title', array(
|
106 |
+
'header' => Mage::helper('adminnotification')->__('Message'),
|
107 |
+
'index' => 'title',
|
108 |
+
'renderer' => 'wsalogger_adminhtml/notification_grid_renderer_notice',
|
109 |
+
));
|
110 |
+
|
111 |
+
$this->addColumn('actions', array(
|
112 |
+
'header' => Mage::helper('adminnotification')->__('Actions'),
|
113 |
+
'width' => '100px',
|
114 |
+
'sortable' => false,
|
115 |
+
'renderer' => 'wsalogger_adminhtml/log_grid_renderer_actions',
|
116 |
+
));
|
117 |
+
|
118 |
+
return parent::_prepareColumns();
|
119 |
+
}
|
120 |
+
|
121 |
+
|
122 |
+
protected function _prepareMassaction()
|
123 |
+
{
|
124 |
+
$this->setMassactionIdField('notification_id');
|
125 |
+
$this->getMassactionBlock()->setFormFieldName('notification');
|
126 |
+
|
127 |
+
$this->getMassactionBlock()->addItem('mark_as_read', array(
|
128 |
+
'label' => Mage::helper('adminnotification')->__('Mark as Read'),
|
129 |
+
'url' => $this->getUrl('*/*/massMarkAsRead', array('_current'=>true)),
|
130 |
+
));
|
131 |
+
|
132 |
+
$this->getMassactionBlock()->addItem('remove', array(
|
133 |
+
'label' => Mage::helper('adminnotification')->__('Remove from View'),
|
134 |
+
'url' => $this->getUrl('*/*/massRemove'),
|
135 |
+
'confirm' => Mage::helper('adminnotification')->__('Are you sure?')
|
136 |
+
));
|
137 |
+
$this->getMassactionBlock()->addItem('delete_table', array(
|
138 |
+
'label' => Mage::helper('adminnotification')->__('Destroy all Stored Logs'),
|
139 |
+
'url' => $this->getUrl('*/*/massDestroy'),
|
140 |
+
'confirm' => Mage::helper('adminnotification')->__('Are you sure?')
|
141 |
+
));
|
142 |
+
|
143 |
+
// $this->getColumn('massaction')->setWidth('30px');
|
144 |
+
|
145 |
+
return $this;
|
146 |
+
}
|
147 |
+
|
148 |
+
public function getRowClass(Varien_Object $row) {
|
149 |
+
return $row->getIsRead() ? 'read' : 'unread';
|
150 |
+
}
|
151 |
+
|
152 |
+
public function getRowClickCallback()
|
153 |
+
{
|
154 |
+
return false;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Row click url
|
159 |
+
*
|
160 |
+
* @return string
|
161 |
+
*/
|
162 |
+
public function getRowUrl($row)
|
163 |
+
{
|
164 |
+
return $this->getUrl('*/*/view', array('notification_id' => $row->getId()));
|
165 |
+
}
|
166 |
+
|
167 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/Grid/Renderer/Actions.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* WebShopApps
|
30 |
+
*
|
31 |
+
* NOTICE OF LICENSE
|
32 |
+
*
|
33 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
34 |
+
* that is bundled with this package in the file LICENSE.txt.
|
35 |
+
* It is also available through the world-wide-web at this URL:
|
36 |
+
* http://opensource.org/licenses/osl-3.0.php
|
37 |
+
* If you did not receive a copy of the license and are unable to
|
38 |
+
* obtain it through the world-wide-web, please send an email
|
39 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
40 |
+
*
|
41 |
+
* DISCLAIMER
|
42 |
+
*
|
43 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
44 |
+
* versions in the future. If you wish to customize Magento for your
|
45 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
46 |
+
*
|
47 |
+
* @category WebShopApps
|
48 |
+
* @package WebShopApps WsaLogger
|
49 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
50 |
+
* Copyright, 2013, Zowta, LLC - US license
|
51 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
52 |
+
*/
|
53 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_Log_Grid_Renderer_Actions
|
54 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
55 |
+
{
|
56 |
+
/**
|
57 |
+
* Renders grid column
|
58 |
+
*
|
59 |
+
* @param Varien_Object $row
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function render(Varien_Object $row)
|
63 |
+
{
|
64 |
+
if (!$row->getIsRead()) {
|
65 |
+
return sprintf('<a href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>',
|
66 |
+
$this->getUrl('*/*/markAsRead/', array('_current'=>true, 'id' => $row->getId())),
|
67 |
+
Mage::helper('adminnotification')->__('Mark as Read'),
|
68 |
+
$this->getUrl('*/*/remove/', array('_current'=>true, 'id' => $row->getId())),
|
69 |
+
Mage::helper('adminnotification')->__('Are you sure?'),
|
70 |
+
Mage::helper('adminnotification')->__('Remove')
|
71 |
+
);
|
72 |
+
}
|
73 |
+
else {
|
74 |
+
return sprintf('<a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>',
|
75 |
+
$this->getUrl('*/*/remove/', array('_current'=>true, 'id' => $row->getId())),
|
76 |
+
Mage::helper('adminnotification')->__('Are you sure?'),
|
77 |
+
Mage::helper('adminnotification')->__('Remove')
|
78 |
+
);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/View.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category WebShopApps
|
23 |
+
* @package WebShopApps WsaLogger
|
24 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
25 |
+
* Copyright, 2013, Zowta, LLC - US license
|
26 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
27 |
+
*/
|
28 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_Log_View extends Mage_Catalog_Block_Product_Abstract {
|
29 |
+
|
30 |
+
public function _construct() {
|
31 |
+
parent::_construct();
|
32 |
+
$this->setTemplate('webshopapps_wsalogger/view.phtml');
|
33 |
+
$this->setNotificationId($this->getRequest()->getParam('notification_id', false));
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
public function getMessageData() {
|
38 |
+
if( $this->getNotificationId()) {
|
39 |
+
return Mage::getModel('wsalogger/log')
|
40 |
+
->load($this->getNotificationId());
|
41 |
+
} else {
|
42 |
+
throw new Exception("No Notification Id given");
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getBackUrl() {
|
47 |
+
return Mage::helper('adminhtml')->getUrl('*/adminhtml_log');
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Code.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Adminhtml AdminNotification Severity Renderer
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Adminhtml
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_Notification_Grid_Renderer_Code
|
36 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Renders grid column
|
40 |
+
*
|
41 |
+
* @param Varien_Object $row
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function render(Varien_Object $row)
|
45 |
+
{
|
46 |
+
$url = $row->getUrl();
|
47 |
+
return sprintf('<a target="_blank" href="'.$url.'">'.$row->getData($this->getColumn()->getIndex()).'</a>');
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* WebShopApps
|
29 |
+
*
|
30 |
+
* NOTICE OF LICENSE
|
31 |
+
*
|
32 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
33 |
+
* that is bundled with this package in the file LICENSE.txt.
|
34 |
+
* It is also available through the world-wide-web at this URL:
|
35 |
+
* http://opensource.org/licenses/osl-3.0.php
|
36 |
+
* If you did not receive a copy of the license and are unable to
|
37 |
+
* obtain it through the world-wide-web, please send an email
|
38 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
39 |
+
*
|
40 |
+
* DISCLAIMER
|
41 |
+
*
|
42 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
43 |
+
* versions in the future. If you wish to customize Magento for your
|
44 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
45 |
+
*
|
46 |
+
* @category WebShopApps
|
47 |
+
* @package WebShopApps WsaLogger
|
48 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
49 |
+
* Copyright, 2013, Zowta, LLC - US license
|
50 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
51 |
+
*/
|
52 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_Notification_Grid_Renderer_Notice
|
53 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
54 |
+
{
|
55 |
+
/**
|
56 |
+
* Renders grid column
|
57 |
+
*
|
58 |
+
* @param Varien_Object $row
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function render(Varien_Object $row)
|
62 |
+
{
|
63 |
+
$dots = '';
|
64 |
+
if(strlen($row->getDescription())>512) { $dots = ' . . . '; }
|
65 |
+
return '<span class="grid-row-title">' . $row->getTitle() . '</span>'
|
66 |
+
. ($row->getDescription() ? '<br />' . substr($row->getDescription(), 0, 512) . $dots : '');
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Severity.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Adminhtml AdminNotification Severity Renderer
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Adminhtml
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_Notification_Grid_Renderer_Severity
|
36 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Renders grid column
|
40 |
+
*
|
41 |
+
* @param Varien_Object $row
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function render(Varien_Object $row)
|
45 |
+
{
|
46 |
+
$notice = Mage::getSingleton('wsalogger/log');
|
47 |
+
|
48 |
+
switch ($row->getData($this->getColumn()->getIndex())) {
|
49 |
+
case Mage_AdminNotification_Model_Inbox::SEVERITY_CRITICAL:
|
50 |
+
$class = 'critical';
|
51 |
+
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_CRITICAL);
|
52 |
+
break;
|
53 |
+
case Mage_AdminNotification_Model_Inbox::SEVERITY_MAJOR:
|
54 |
+
$class = 'major';
|
55 |
+
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_MAJOR);
|
56 |
+
break;
|
57 |
+
case Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR:
|
58 |
+
$class = 'minor';
|
59 |
+
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR);
|
60 |
+
break;
|
61 |
+
case Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE:
|
62 |
+
$class = 'notice';
|
63 |
+
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE);
|
64 |
+
break;
|
65 |
+
}
|
66 |
+
return '<span class="grid-severity-' . $class . '"><span>' . $value . '</span></span>';
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/System/Config/Form/Fieldset/Modules/DisableLogging.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
/**
|
27 |
+
* WebShopApps
|
28 |
+
*
|
29 |
+
* NOTICE OF LICENSE
|
30 |
+
*
|
31 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
32 |
+
* that is bundled with this package in the file LICENSE.txt.
|
33 |
+
* It is also available through the world-wide-web at this URL:
|
34 |
+
* http://opensource.org/licenses/osl-3.0.php
|
35 |
+
* If you did not receive a copy of the license and are unable to
|
36 |
+
* obtain it through the world-wide-web, please send an email
|
37 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
38 |
+
*
|
39 |
+
* DISCLAIMER
|
40 |
+
*
|
41 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
42 |
+
* versions in the future. If you wish to customize Magento for your
|
43 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
44 |
+
*
|
45 |
+
* @category WebShopApps
|
46 |
+
* @package WebShopApps WsaLogger
|
47 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
48 |
+
* Copyright, 2013, Zowta, LLC - US license
|
49 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
50 |
+
**/
|
51 |
+
|
52 |
+
|
53 |
+
class Webshopapps_Wsalogger_Adminhtml_Block_System_Config_Form_Fieldset_Modules_DisableLogging
|
54 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
55 |
+
{
|
56 |
+
|
57 |
+
|
58 |
+
protected $_dummyElement;
|
59 |
+
protected $_fieldRenderer;
|
60 |
+
protected $_values;
|
61 |
+
|
62 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
63 |
+
{
|
64 |
+
$html = $this->_getHeaderHtml($element);
|
65 |
+
|
66 |
+
// $html.= $this->getUrl('*/system_wsalogger');
|
67 |
+
|
68 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
69 |
+
$wsaApproved = array('webshopapps','shipperhq');
|
70 |
+
|
71 |
+
sort($modules);
|
72 |
+
|
73 |
+
foreach ($modules as $moduleName) {
|
74 |
+
if ($moduleName==='Mage_Adminhtml' ||$moduleName==='Webshopapps_Wsacommon' || $moduleName==='Webshopapps_Wsalogger'
|
75 |
+
|| stripos($moduleName,'Mage_') !== false) {
|
76 |
+
continue;
|
77 |
+
}
|
78 |
+
|
79 |
+
$providerArray = explode('_',$moduleName);
|
80 |
+
$provider = strtolower($providerArray[0]);
|
81 |
+
|
82 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/view_all_extns') && !in_array($provider, $wsaApproved)){
|
83 |
+
continue;
|
84 |
+
}
|
85 |
+
$html.= $this->_getFieldHtml($element, $moduleName);
|
86 |
+
}
|
87 |
+
$html .= $this->_getFooterHtml($element);
|
88 |
+
|
89 |
+
return $html;
|
90 |
+
}
|
91 |
+
|
92 |
+
protected function _getDummyElement()
|
93 |
+
{
|
94 |
+
if (empty($this->_dummyElement)) {
|
95 |
+
$this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
|
96 |
+
}
|
97 |
+
return $this->_dummyElement;
|
98 |
+
}
|
99 |
+
|
100 |
+
protected function _getFieldRenderer()
|
101 |
+
{
|
102 |
+
if (empty($this->_fieldRenderer)) {
|
103 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
104 |
+
}
|
105 |
+
return $this->_fieldRenderer;
|
106 |
+
}
|
107 |
+
|
108 |
+
protected function _getValues()
|
109 |
+
{
|
110 |
+
if (empty($this->_values)) {
|
111 |
+
$this->_values = array(
|
112 |
+
array('label'=>Mage::helper('adminhtml')->__('Logging Disabled'), 'value'=>0),
|
113 |
+
array('label'=>Mage::helper('adminhtml')->__('Logging Enabled'), 'value'=>1),
|
114 |
+
);
|
115 |
+
}
|
116 |
+
return $this->_values;
|
117 |
+
}
|
118 |
+
|
119 |
+
protected function _getFieldHtml($fieldset, $moduleName)
|
120 |
+
{
|
121 |
+
$configData = $this->getConfigData();
|
122 |
+
$path = 'wsalogmenu/modules_disable_logger/'.$moduleName; //TODO: move as property of form
|
123 |
+
if (isset($configData[$path])) {
|
124 |
+
$data = $configData[$path];
|
125 |
+
$inherit = false;
|
126 |
+
} else {
|
127 |
+
$data = 0;
|
128 |
+
$inherit = true;
|
129 |
+
}
|
130 |
+
|
131 |
+
$e = $this->_getDummyElement();
|
132 |
+
|
133 |
+
$field = $fieldset->addField($moduleName, 'select',
|
134 |
+
array(
|
135 |
+
'name' => 'groups[modules_disable_logger][fields]['.$moduleName.'][value]',
|
136 |
+
'label' => $moduleName,
|
137 |
+
'value' => $data,
|
138 |
+
'values' => $this->_getValues(),
|
139 |
+
'inherit' => $inherit,
|
140 |
+
'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
|
141 |
+
'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
|
142 |
+
))->setRenderer($this->_getFieldRenderer());
|
143 |
+
|
144 |
+
return $field->toHtml();
|
145 |
+
}
|
146 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Helper/Data.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebShopApps
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category WebShopApps
|
22 |
+
* @package WebShopApps WsaLogger
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
class Webshopapps_Wsalogger_Helper_Data extends Mage_Core_Helper_Abstract
|
28 |
+
{
|
29 |
+
|
30 |
+
/**
|
31 |
+
* This method will return just the 2nd part of the version number, thus allowing greater than/less than calculations to be performed
|
32 |
+
* Please convert to this call if possible
|
33 |
+
* Enter description here ...
|
34 |
+
*/
|
35 |
+
public static function getNewVersion() {
|
36 |
+
$version = Mage::getVersion();
|
37 |
+
if (version_compare($version, '1.6', '>=')) {
|
38 |
+
if (version_compare($version, '1.12') >= 0) $eeVersion = 12;
|
39 |
+
else if (version_compare($version, '1.13') >= 0) $eeVersion = 13;
|
40 |
+
else if (version_compare($version, '1.11') >= 0) $eeVersion = 11;
|
41 |
+
else if (version_compare($version, '1.10') >= 0) $eeVersion = 10;
|
42 |
+
else if (version_compare($version, '1.8') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 13; //CE 1.8, EE 1.13
|
43 |
+
else if (version_compare($version, '1.7') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 12; //CE 1.7, EE 1.12
|
44 |
+
else if (version_compare($version, '1.6') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 11; //CE 1.6, EE 1.11
|
45 |
+
else if (version_compare($version, '1.9') >= 0) $eeVersion = 9;
|
46 |
+
else if (version_compare($version, '1.8') >= 0) $eeVersion = 8;
|
47 |
+
else if (version_compare($version, '1.7') >= 0) $eeVersion = 7;
|
48 |
+
else if (version_compare($version, '1.6') >= 0) $eeVersion = 6; //EE 1.6
|
49 |
+
else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
|
50 |
+
}
|
51 |
+
else {
|
52 |
+
if (version_compare($version, '1.5') >= 0) $eeVersion = 10;
|
53 |
+
else if (version_compare($version, '1.4.2') >= 0) $eeVersion = 9;
|
54 |
+
else if (version_compare($version, '1.4.1') >= 0) $eeVersion = 8;
|
55 |
+
else if (version_compare($version, '1.4.0') >= 0) $eeVersion = 7;
|
56 |
+
else if (version_compare($version, '1.3.2.4') >= 0) $eeVersion = 6;
|
57 |
+
else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
|
58 |
+
}
|
59 |
+
return $eeVersion;
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
public static function isEnterpriseEdition() {
|
64 |
+
if (!Mage::getConfig()->getNode('modules/Enterprise_Cms')) {
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
return true;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function isDebug($moduleName) {
|
71 |
+
|
72 |
+
$path = 'wsalogmenu/modules_disable_logger/'.$moduleName;
|
73 |
+
return Mage::getStoreConfig($path) ? true : false;
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Helper/Log.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebShopApps
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category WebShopApps
|
22 |
+
* @package WebShopApps WsaLogger
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
class Webshopapps_Wsalogger_Helper_Log extends Mage_Core_Helper_Abstract
|
29 |
+
{
|
30 |
+
|
31 |
+
const SEVERITY_CRITICAL = 1;
|
32 |
+
const SEVERITY_MAJOR = 2;
|
33 |
+
const SEVERITY_MINOR = 3;
|
34 |
+
const SEVERITY_NOTICE = 4;
|
35 |
+
const SEVERITY_NONE = -1;
|
36 |
+
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param string $extension
|
40 |
+
* @param string $title
|
41 |
+
* @param string $description
|
42 |
+
* @param bool $debug
|
43 |
+
* @param int $code
|
44 |
+
* @param string $url
|
45 |
+
*/
|
46 |
+
public static function postDebug($extension,$title,$description,$debug=true,$code=0,$url='') {
|
47 |
+
|
48 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active') || !$debug) {
|
49 |
+
return ;
|
50 |
+
}
|
51 |
+
|
52 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
53 |
+
array('severity'=>self::SEVERITY_NOTICE,
|
54 |
+
'title' => $title,
|
55 |
+
'extension' => $extension,
|
56 |
+
'description' => $description,
|
57 |
+
'code' => $code,
|
58 |
+
'url' => $url
|
59 |
+
));
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param string $extension
|
64 |
+
* @param string $title
|
65 |
+
* @param string $description
|
66 |
+
* @param bool $debug
|
67 |
+
* @param int $code
|
68 |
+
* @param string $url
|
69 |
+
*/
|
70 |
+
public static function postInfo($extension,$title,$description,$debug=true,$code=0,$url='') {
|
71 |
+
|
72 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
|
73 |
+
return ;
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
78 |
+
array('severity'=>self::SEVERITY_MINOR,
|
79 |
+
'extension' => $extension,
|
80 |
+
'title' => $title,
|
81 |
+
'description' => $description,
|
82 |
+
'code' => $code,
|
83 |
+
'url' => $url
|
84 |
+
));
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @param string $extension
|
89 |
+
* @param string $title
|
90 |
+
* @param string $description
|
91 |
+
* @param bool $debug
|
92 |
+
* @param int $code
|
93 |
+
* @param string $url
|
94 |
+
*/
|
95 |
+
public static function postWarning($extension,$title,$description,$debug=true,$code=0,$url='') {
|
96 |
+
|
97 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
|
98 |
+
return ;
|
99 |
+
}
|
100 |
+
|
101 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
102 |
+
array('severity'=>self::SEVERITY_MAJOR,
|
103 |
+
'title' => $title,
|
104 |
+
'extension' => $extension,
|
105 |
+
'description' => $description,
|
106 |
+
'code' => $code,
|
107 |
+
'url' => $url
|
108 |
+
));
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @param string $extension
|
113 |
+
* @param string $title
|
114 |
+
* @param string $description
|
115 |
+
* @param bool $debug
|
116 |
+
* @param int $code
|
117 |
+
* @param string $url
|
118 |
+
*/
|
119 |
+
public static function postCritical($extension,$title,$description,$debug=true,$code=0,$url='') {
|
120 |
+
|
121 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
|
122 |
+
return ;
|
123 |
+
}
|
124 |
+
|
125 |
+
Mage::dispatchEvent('wsalogger_log_mesasge',
|
126 |
+
array('severity'=>self::SEVERITY_CRITICAL,
|
127 |
+
'title' => $title,
|
128 |
+
'extension' => $extension,
|
129 |
+
'description' => $description,
|
130 |
+
'code' => $code,
|
131 |
+
'url' => $url
|
132 |
+
));
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @param string $severity
|
137 |
+
* @return array|string
|
138 |
+
*/
|
139 |
+
public function getSeverities($severity = null)
|
140 |
+
{
|
141 |
+
|
142 |
+
return Mage::getSingleton('wsalogger/log')->getSeverities($severity);
|
143 |
+
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Model/Log.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_AdminNotification
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* WebShopApps
|
30 |
+
*
|
31 |
+
* NOTICE OF LICENSE
|
32 |
+
*
|
33 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
34 |
+
* that is bundled with this package in the file LICENSE.txt.
|
35 |
+
* It is also available through the world-wide-web at this URL:
|
36 |
+
* http://opensource.org/licenses/osl-3.0.php
|
37 |
+
* If you did not receive a copy of the license and are unable to
|
38 |
+
* obtain it through the world-wide-web, please send an email
|
39 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
40 |
+
*
|
41 |
+
* DISCLAIMER
|
42 |
+
*
|
43 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
44 |
+
* versions in the future. If you wish to customize Magento for your
|
45 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
46 |
+
*
|
47 |
+
* @category WebShopApps
|
48 |
+
* @package WebShopApps WsaLogger
|
49 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
50 |
+
* Copyright, 2013, Zowta, LLC - US license
|
51 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
52 |
+
*/
|
53 |
+
class Webshopapps_Wsalogger_Model_Log extends Mage_Core_Model_Abstract
|
54 |
+
{
|
55 |
+
const SEVERITY_CRITICAL = 1;
|
56 |
+
const SEVERITY_MAJOR = 2;
|
57 |
+
const SEVERITY_MINOR = 3;
|
58 |
+
const SEVERITY_NOTICE = 4;
|
59 |
+
const SEVERITY_NONE = -1;
|
60 |
+
|
61 |
+
protected function _construct()
|
62 |
+
{
|
63 |
+
$this->_init('wsalogger/log');
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Retrieve Severity collection array
|
68 |
+
*
|
69 |
+
* @return array|string
|
70 |
+
*/
|
71 |
+
public function getSeverities($severity = null)
|
72 |
+
{
|
73 |
+
$severities = array(
|
74 |
+
self::SEVERITY_CRITICAL => Mage::helper('adminnotification')->__('critical'),
|
75 |
+
self::SEVERITY_MAJOR => Mage::helper('adminnotification')->__('warning'),
|
76 |
+
self::SEVERITY_MINOR => Mage::helper('adminnotification')->__('info'),
|
77 |
+
self::SEVERITY_NOTICE => Mage::helper('adminnotification')->__('debug'),
|
78 |
+
self::SEVERITY_NONE => Mage::helper('adminnotification')->__('DISABLED')
|
79 |
+
);
|
80 |
+
|
81 |
+
if (!is_null($severity)) {
|
82 |
+
if (isset($severities[$severity])) {
|
83 |
+
return $severities[$severity];
|
84 |
+
}
|
85 |
+
return null;
|
86 |
+
}
|
87 |
+
|
88 |
+
return $severities;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Retrieve Latest Notice
|
93 |
+
*
|
94 |
+
* @return Mage_AdminNotification_Model_Inbox
|
95 |
+
*/
|
96 |
+
public function loadLatestNotice()
|
97 |
+
{
|
98 |
+
$this->setData(array());
|
99 |
+
$this->getResource()->loadLatestNotice($this);
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Retrieve notice statuses
|
105 |
+
*
|
106 |
+
* @return array
|
107 |
+
*/
|
108 |
+
public function getNoticeStatus()
|
109 |
+
{
|
110 |
+
return $this->getResource()->getNoticeStatus($this);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Parse and save new data
|
115 |
+
*
|
116 |
+
* @param array $data
|
117 |
+
* @return Mage_AdminNotification_Model_Inbox
|
118 |
+
*/
|
119 |
+
public function parse($severity,$extension,$title,$description,$code=0,$url='')
|
120 |
+
{
|
121 |
+
if (is_array($description) || is_object($description)) {
|
122 |
+
$description = print_r($description, true);
|
123 |
+
}
|
124 |
+
|
125 |
+
$feedData[] = array(
|
126 |
+
'severity' => $severity,
|
127 |
+
'date_added' => gmdate('Y-m-d H:i:s'),
|
128 |
+
'extension' => $extension,
|
129 |
+
'title' => $title,
|
130 |
+
'description' => $description,
|
131 |
+
'code' => $code,
|
132 |
+
'url' => $url
|
133 |
+
);
|
134 |
+
|
135 |
+
|
136 |
+
return $this->getResource()->parse($this, $feedData);
|
137 |
+
}
|
138 |
+
|
139 |
+
public function truncate()
|
140 |
+
{
|
141 |
+
return $this->getResource()->truncate();
|
142 |
+
}
|
143 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Model/Mysql4/Log.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_AdminNotification
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* WebShopApps
|
30 |
+
*
|
31 |
+
* NOTICE OF LICENSE
|
32 |
+
*
|
33 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
34 |
+
* that is bundled with this package in the file LICENSE.txt.
|
35 |
+
* It is also available through the world-wide-web at this URL:
|
36 |
+
* http://opensource.org/licenses/osl-3.0.php
|
37 |
+
* If you did not receive a copy of the license and are unable to
|
38 |
+
* obtain it through the world-wide-web, please send an email
|
39 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
40 |
+
*
|
41 |
+
* DISCLAIMER
|
42 |
+
*
|
43 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
44 |
+
* versions in the future. If you wish to customize Magento for your
|
45 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
46 |
+
*
|
47 |
+
* @category WebShopApps
|
48 |
+
* @package WebShopApps WsaLogger
|
49 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
50 |
+
* Copyright, 2013, Zowta, LLC - US license
|
51 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
52 |
+
*/
|
53 |
+
class Webshopapps_Wsalogger_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
|
54 |
+
{
|
55 |
+
protected function _construct()
|
56 |
+
{
|
57 |
+
$this->_init('wsalogger/log', 'notification_id');
|
58 |
+
}
|
59 |
+
|
60 |
+
public function loadLatestNotice(Webshopapps_Wsalogger_Model_Log $object)
|
61 |
+
{
|
62 |
+
$select = $this->_getReadAdapter()->select()
|
63 |
+
->from($this->getMainTable())
|
64 |
+
->order($this->getIdFieldName() . ' desc')
|
65 |
+
->where('is_read <> 1')
|
66 |
+
->where('is_remove <> 1')
|
67 |
+
->limit(1);
|
68 |
+
$data = $this->_getReadAdapter()->fetchRow($select);
|
69 |
+
|
70 |
+
if ($data) {
|
71 |
+
$object->setData($data);
|
72 |
+
}
|
73 |
+
|
74 |
+
$this->_afterLoad($object);
|
75 |
+
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getNoticeStatus(Webshopapps_Wsalogger_Model_Log $object)
|
80 |
+
{
|
81 |
+
$select = $this->_getReadAdapter()->select()
|
82 |
+
->from($this->getMainTable(), array(
|
83 |
+
'severity' => 'severity',
|
84 |
+
'count_notice' => 'COUNT(' . $this->getIdFieldName() . ')'))
|
85 |
+
->group('severity')
|
86 |
+
->where('is_remove=?', 0)
|
87 |
+
->where('is_read=?', 0);
|
88 |
+
$return = array();
|
89 |
+
$rowSet = $this->_getReadAdapter()->fetchAll($select);
|
90 |
+
foreach ($rowSet as $row) {
|
91 |
+
$return[$row['severity']] = $row['count_notice'];
|
92 |
+
}
|
93 |
+
return $return;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function parse(Webshopapps_Wsalogger_Model_Log $object, array $data)
|
97 |
+
{
|
98 |
+
$write = $this->_getWriteAdapter();
|
99 |
+
foreach ($data as $item) {
|
100 |
+
$write->insert($this->getMainTable(), $item);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
public function truncate()
|
105 |
+
{
|
106 |
+
try {
|
107 |
+
$this->_getWriteAdapter()->truncate($this->getMainTable());
|
108 |
+
}catch(Exception $e){
|
109 |
+
Mage::logException("WebShopApps Logger Exception");
|
110 |
+
Mage::logException($e);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Model/Mysql4/Log/Collection.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_AdminNotification
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* WebShopApps
|
29 |
+
*
|
30 |
+
* NOTICE OF LICENSE
|
31 |
+
*
|
32 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
33 |
+
* that is bundled with this package in the file LICENSE.txt.
|
34 |
+
* It is also available through the world-wide-web at this URL:
|
35 |
+
* http://opensource.org/licenses/osl-3.0.php
|
36 |
+
* If you did not receive a copy of the license and are unable to
|
37 |
+
* obtain it through the world-wide-web, please send an email
|
38 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
39 |
+
*
|
40 |
+
* DISCLAIMER
|
41 |
+
*
|
42 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
43 |
+
* versions in the future. If you wish to customize Magento for your
|
44 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
45 |
+
*
|
46 |
+
* @category WebShopApps
|
47 |
+
* @package WebShopApps WsaLogger
|
48 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
49 |
+
* Copyright, 2013, Zowta, LLC - US license
|
50 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
51 |
+
*/
|
52 |
+
class Webshopapps_Wsalogger_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
53 |
+
{
|
54 |
+
protected function _construct()
|
55 |
+
{
|
56 |
+
$this->_init('wsalogger/log');
|
57 |
+
}
|
58 |
+
|
59 |
+
public function addRemoveFilter()
|
60 |
+
{
|
61 |
+
$this->getSelect()
|
62 |
+
->where('is_remove=?', 0);
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Model/Observer.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category WebShopApps
|
23 |
+
* @package WebShopApps WsaLogger
|
24 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
25 |
+
* Copyright, 2013, Zowta, LLC - US license
|
26 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
27 |
+
*/
|
28 |
+
|
29 |
+
class Webshopapps_Wsalogger_Model_Observer extends Mage_Core_Model_Abstract
|
30 |
+
{
|
31 |
+
|
32 |
+
/**
|
33 |
+
* event wsalogger_log_mesasge
|
34 |
+
*/
|
35 |
+
public function logMessage($observer){
|
36 |
+
|
37 |
+
if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
|
38 |
+
return ;
|
39 |
+
}
|
40 |
+
|
41 |
+
$adminLevel = Mage::getStoreConfig('wsalogmenu/wsalog/admin_level');
|
42 |
+
$systemLogLevel = Mage::getStoreConfig('wsalogmenu/wsalog/system_level');
|
43 |
+
$emailLevel = Mage::getStoreConfig('wsalogmenu/wsalog/email_level');
|
44 |
+
|
45 |
+
$code = $observer->getEvent()->getCode();
|
46 |
+
$url = $observer->getEvent()->getUrl();
|
47 |
+
$severity = $observer->getEvent()->getSeverity();
|
48 |
+
$title = $observer->getEvent()->getTitle();
|
49 |
+
$extension = $observer->getEvent()->getExtension();
|
50 |
+
$description = $observer->getEvent()->getDescription();
|
51 |
+
|
52 |
+
if ($adminLevel>0 && $adminLevel>=$severity) {
|
53 |
+
Mage::getModel('wsalogger/log')->parse($severity,$extension,$title,$description,$code,$url);
|
54 |
+
}
|
55 |
+
|
56 |
+
if ($systemLogLevel>0 && $systemLogLevel>=$severity) {
|
57 |
+
Mage::log(Mage::helper('wsalogger/log')->getSeverities($severity).' '.$code.' '.$url.' - '.$extension.' - '.$title);
|
58 |
+
if (!is_null($description) && $description!='') {
|
59 |
+
Mage::log($description);
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
if ($emailLevel>0 && $emailLevel>=$severity) {
|
65 |
+
/* * Loads the html file named 'custom_email_template1.html' from
|
66 |
+
* app/locale/en_US/template/email/activecodeline_custom_email1.html */
|
67 |
+
$emailTemplate = Mage::getModel('core/email_template')
|
68 |
+
->loadDefault('log_email_template');
|
69 |
+
|
70 |
+
$senderName = Mage::getStoreConfig('wsalogmenu/wsalog/sender_email_name');
|
71 |
+
$senderEmail = Mage::getStoreConfig('wsalogmenu/wsalog/sender_email');
|
72 |
+
$subject = Mage::getStoreConfig('wsalogmenu/wsalog/email_subject');
|
73 |
+
|
74 |
+
if(!empty($senderEmail) && !empty($senderName) && !empty($subject)) {
|
75 |
+
|
76 |
+
$emailTemplate->setSenderName($senderName);
|
77 |
+
$emailTemplate->setSenderEmail($senderEmail);
|
78 |
+
$emailTemplate->setTemplateSubject($subject);
|
79 |
+
|
80 |
+
if (is_array($description) || is_object($description)) {
|
81 |
+
$description = print_r($description, true);
|
82 |
+
}
|
83 |
+
$description = htmlentities($description);
|
84 |
+
|
85 |
+
//Create an array of variables to assign to template
|
86 |
+
//TODO add severity
|
87 |
+
$emailTemplateVariables = array();
|
88 |
+
$emailTemplateVariables['title'] = $title;
|
89 |
+
$emailTemplateVariables['severity'] = $severity;
|
90 |
+
$emailTemplateVariables['extension'] = $extension;
|
91 |
+
$emailTemplateVariables['description'] = $description;
|
92 |
+
$emailTemplateVariables['code'] = $code;
|
93 |
+
$emailTemplateVariables['url'] = $url;
|
94 |
+
|
95 |
+
$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
96 |
+
/* * Or you can send the email directly, * note getProcessedTemplate is called inside send() */
|
97 |
+
|
98 |
+
$emailTemplate->send(Mage::getStoreConfig('wsalogmenu/wsalog/contact_email'),'', $emailTemplateVariables);
|
99 |
+
} else {
|
100 |
+
Mage::log("WebShopApps Logger - Email Log Can Not Be Sent. Email Address/Subject/Name Not Entered in Config");
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
app/code/community/Webshopapps/Wsalogger/Model/System/Config/Source/Severities.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Usa
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
/**
|
27 |
+
* WebShopApps
|
28 |
+
*
|
29 |
+
* NOTICE OF LICENSE
|
30 |
+
*
|
31 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
32 |
+
* that is bundled with this package in the file LICENSE.txt.
|
33 |
+
* It is also available through the world-wide-web at this URL:
|
34 |
+
* http://opensource.org/licenses/osl-3.0.php
|
35 |
+
* If you did not receive a copy of the license and are unable to
|
36 |
+
* obtain it through the world-wide-web, please send an email
|
37 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
38 |
+
*
|
39 |
+
* DISCLAIMER
|
40 |
+
*
|
41 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
42 |
+
* versions in the future. If you wish to customize Magento for your
|
43 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
44 |
+
*
|
45 |
+
* @category WebShopApps
|
46 |
+
* @package WebShopApps WsaLogger
|
47 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
48 |
+
* Copyright, 2013, Zowta, LLC - US license
|
49 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
50 |
+
*/
|
51 |
+
|
52 |
+
class Webshopapps_Wsalogger_Model_System_Config_Source_Severities
|
53 |
+
{
|
54 |
+
public function toOptionArray()
|
55 |
+
{
|
56 |
+
$arr = array();
|
57 |
+
foreach (Mage::helper('wsalogger/log')->getSeverities() as $k=>$v) {
|
58 |
+
$arr[] = array('value'=>$k, 'label'=>$v);
|
59 |
+
}
|
60 |
+
return $arr;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
app/code/community/Webshopapps/Wsalogger/changelog.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1.0 - Initial Release
|
2 |
+
1.1 - Rezip manually
|
3 |
+
1.2 - Re-released without common using new ant build.xml
|
4 |
+
1.3 - Added db logic to recreate the wsalogger table
|
5 |
+
1.4 - Removed upgrade sql script just to simplify this call
|
6 |
+
2.0 - Moved logger to under System->Configuration. Added in support to enable/disable logging at this level rather than on each extension.
|
7 |
+
2.1 - Added notice to logger page in admin warning to disable after use.
|
8 |
+
2.2 - Added support for EE1.11
|
9 |
+
2.3 - Added support for EE1.12,CE1.7
|
10 |
+
2.4 - COMMON-31 Added support for CE1.8
|
11 |
+
2.5 - COMMON-35 Fixed issue with emails not containing the error details
|
app/code/community/Webshopapps/Wsalogger/controllers/Adminhtml/LogController.php
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
/**
|
27 |
+
* WebShopApps
|
28 |
+
*
|
29 |
+
* NOTICE OF LICENSE
|
30 |
+
*
|
31 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
32 |
+
* that is bundled with this package in the file LICENSE.txt.
|
33 |
+
* It is also available through the world-wide-web at this URL:
|
34 |
+
* http://opensource.org/licenses/osl-3.0.php
|
35 |
+
* If you did not receive a copy of the license and are unable to
|
36 |
+
* obtain it through the world-wide-web, please send an email
|
37 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
38 |
+
*
|
39 |
+
* DISCLAIMER
|
40 |
+
*
|
41 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
42 |
+
* versions in the future. If you wish to customize Magento for your
|
43 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
44 |
+
*
|
45 |
+
* @category WebShopApps
|
46 |
+
* @package WebShopApps WsaLogger
|
47 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
48 |
+
* Copyright, 2013, Zowta, LLC - US license
|
49 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
50 |
+
*/
|
51 |
+
class Webshopapps_Wsalogger_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
|
52 |
+
{
|
53 |
+
|
54 |
+
protected function _initAction() {
|
55 |
+
$this->_title($this->__('System'))->_title($this->__('WebShopApps Logs'));
|
56 |
+
|
57 |
+
$this->loadLayout()
|
58 |
+
->_setActiveMenu('system/log')
|
59 |
+
->_addBreadcrumb(Mage::helper('wsalogger')->__('WebShopApps Log'), Mage::helper('wsalogger')->__('WebShopApps Log'));
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
public function indexAction()
|
65 |
+
{
|
66 |
+
$this->_initAction()
|
67 |
+
->renderLayout();
|
68 |
+
}
|
69 |
+
|
70 |
+
public function markAsReadAction()
|
71 |
+
{
|
72 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
73 |
+
$session = Mage::getSingleton('adminhtml/session');
|
74 |
+
$model = Mage::getModel('wsalogger/log')
|
75 |
+
->load($id);
|
76 |
+
|
77 |
+
if (!$model->getId()) {
|
78 |
+
$session->addError(Mage::helper('adminnotification')->__('Unable to proceed. Please, try again.'));
|
79 |
+
$this->_redirect('*/*/');
|
80 |
+
return ;
|
81 |
+
}
|
82 |
+
|
83 |
+
try {
|
84 |
+
$model->setIsRead(1)
|
85 |
+
->save();
|
86 |
+
$session->addSuccess(Mage::helper('adminnotification')->__('The message has been marked as read.'));
|
87 |
+
}
|
88 |
+
catch (Mage_Core_Exception $e) {
|
89 |
+
$session->addError($e->getMessage());
|
90 |
+
}
|
91 |
+
catch (Exception $e) {
|
92 |
+
$session->addException($e, Mage::helper('adminnotification')->__('An error occurred while marking notification as read.'));
|
93 |
+
}
|
94 |
+
|
95 |
+
$this->_redirectReferer();
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
$this->_redirect('*/*/');
|
99 |
+
}
|
100 |
+
|
101 |
+
public function massMarkAsReadAction()
|
102 |
+
{
|
103 |
+
$session = Mage::getSingleton('adminhtml/session');
|
104 |
+
$ids = $this->getRequest()->getParam('notification');
|
105 |
+
if (!is_array($ids)) {
|
106 |
+
$session->addError(Mage::helper('adminnotification')->__('Please select messages.'));
|
107 |
+
}
|
108 |
+
else {
|
109 |
+
try {
|
110 |
+
foreach ($ids as $id) {
|
111 |
+
$model = Mage::getModel('wsalogger/log')
|
112 |
+
->load($id);
|
113 |
+
if ($model->getId()) {
|
114 |
+
$model->setIsRead(1)
|
115 |
+
->save();
|
116 |
+
}
|
117 |
+
}
|
118 |
+
$this->_getSession()->addSuccess(
|
119 |
+
Mage::helper('adminnotification')->__('Total of %d record(s) have been marked as read.', count($ids))
|
120 |
+
);
|
121 |
+
} catch (Mage_Core_Exception $e) {
|
122 |
+
$session->addError($e->getMessage());
|
123 |
+
}
|
124 |
+
catch (Exception $e) {
|
125 |
+
$session->addException($e, Mage::helper('adminnotification')->__('An error occurred while marking the messages as read.'));
|
126 |
+
}
|
127 |
+
}
|
128 |
+
$this->_redirect('*/*/');
|
129 |
+
}
|
130 |
+
|
131 |
+
public function viewAction() {
|
132 |
+
|
133 |
+
$this->_initAction()
|
134 |
+
->_addContent($this->getLayout()->createBlock('wsalogger_adminhtml/log_view'))
|
135 |
+
->renderLayout();
|
136 |
+
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
public function removeAction()
|
142 |
+
{
|
143 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
144 |
+
$session = Mage::getSingleton('adminhtml/session');
|
145 |
+
$model = Mage::getModel('wsalogger/log')
|
146 |
+
->load($id);
|
147 |
+
|
148 |
+
if (!$model->getId()) {
|
149 |
+
$this->_redirect('*/*/');
|
150 |
+
return ;
|
151 |
+
}
|
152 |
+
|
153 |
+
try {
|
154 |
+
$model->setIsRemove(1)
|
155 |
+
->save();
|
156 |
+
$session->addSuccess(Mage::helper('adminnotification')->__('The message has been removed.'));
|
157 |
+
}
|
158 |
+
catch (Mage_Core_Exception $e) {
|
159 |
+
$session->addError($e->getMessage());
|
160 |
+
}
|
161 |
+
catch (Exception $e) {
|
162 |
+
$session->addException($e, Mage::helper('adminnotification')->__('An error occurred while removing the message.'));
|
163 |
+
}
|
164 |
+
|
165 |
+
$this->_redirectReferer();
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
$this->_redirect('*/*/');
|
169 |
+
}
|
170 |
+
|
171 |
+
public function massRemoveAction()
|
172 |
+
{
|
173 |
+
$session = Mage::getSingleton('adminhtml/session');
|
174 |
+
$ids = $this->getRequest()->getParam('notification');
|
175 |
+
if (!is_array($ids)) {
|
176 |
+
$session->addError(Mage::helper('adminnotification')->__('Please select messages.'));
|
177 |
+
}
|
178 |
+
else {
|
179 |
+
try {
|
180 |
+
foreach ($ids as $id) {
|
181 |
+
$model = Mage::getModel('wsalogger/log')
|
182 |
+
->load($id);
|
183 |
+
if ($model->getId()) {
|
184 |
+
$model->setIsRemove(1)
|
185 |
+
->save();
|
186 |
+
}
|
187 |
+
}
|
188 |
+
$this->_getSession()->addSuccess(
|
189 |
+
Mage::helper('adminnotification')->__('Total of %d record(s) have been removed.', count($ids))
|
190 |
+
);
|
191 |
+
} catch (Mage_Core_Exception $e) {
|
192 |
+
$session->addError($e->getMessage());
|
193 |
+
}
|
194 |
+
catch (Exception $e) {
|
195 |
+
$session->addException($e, Mage::helper('adminnotification')->__('An error occurred while removing messages.'));
|
196 |
+
}
|
197 |
+
}
|
198 |
+
$this->_redirectReferer();
|
199 |
+
}
|
200 |
+
|
201 |
+
public function massDestroyAction()
|
202 |
+
{
|
203 |
+
$session = Mage::getSingleton('adminhtml/session');
|
204 |
+
|
205 |
+
try {
|
206 |
+
$model = Mage::getModel('wsalogger/log')->truncate();
|
207 |
+
$this->_getSession()->addSuccess(
|
208 |
+
Mage::helper('adminnotification')->__('All logs have been removed.')
|
209 |
+
);
|
210 |
+
} catch (Mage_Core_Exception $e) {
|
211 |
+
$session->addError($e->getMessage());
|
212 |
+
}
|
213 |
+
catch (Exception $e) {
|
214 |
+
$session->addException($e, Mage::helper('adminnotification')->__('An error occurred while destroying messages.'));
|
215 |
+
}
|
216 |
+
$this->_redirectReferer();
|
217 |
+
}
|
218 |
+
|
219 |
+
|
220 |
+
protected function _isAllowed()
|
221 |
+
{
|
222 |
+
switch ($this->getRequest()->getActionName()) {
|
223 |
+
case 'markAsRead':
|
224 |
+
$acl = 'system/adminnotification/mark_as_read';
|
225 |
+
break;
|
226 |
+
|
227 |
+
case 'massMarkAsRead':
|
228 |
+
$acl = 'system/adminnotification/mark_as_read';
|
229 |
+
break;
|
230 |
+
|
231 |
+
case 'remove':
|
232 |
+
$acl = 'system/adminnotification/remove';
|
233 |
+
break;
|
234 |
+
|
235 |
+
case 'massRemove':
|
236 |
+
$acl = 'system/adminnotification/remove';
|
237 |
+
break;
|
238 |
+
|
239 |
+
default:
|
240 |
+
$acl = 'system/adminnotification/show_list';
|
241 |
+
}
|
242 |
+
return Mage::getSingleton('admin/session')->isAllowed($acl);
|
243 |
+
}
|
244 |
+
}
|
app/code/community/Webshopapps/Wsalogger/controllers/IndexController.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* WebShopApps
|
29 |
+
*
|
30 |
+
* NOTICE OF LICENSE
|
31 |
+
*
|
32 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
33 |
+
* that is bundled with this package in the file LICENSE.txt.
|
34 |
+
* It is also available through the world-wide-web at this URL:
|
35 |
+
* http://opensource.org/licenses/osl-3.0.php
|
36 |
+
* If you did not receive a copy of the license and are unable to
|
37 |
+
* obtain it through the world-wide-web, please send an email
|
38 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
39 |
+
*
|
40 |
+
* DISCLAIMER
|
41 |
+
*
|
42 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
43 |
+
* versions in the future. If you wish to customize Magento for your
|
44 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
45 |
+
*
|
46 |
+
* @category WebShopApps
|
47 |
+
* @package WebShopApps WsaLogger
|
48 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
49 |
+
* Copyright, 2013, Zowta, LLC - US license
|
50 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
51 |
+
*/
|
52 |
+
class Webshopapps_Wsalogger_IndexController extends Mage_Adminhtml_Controller_Action
|
53 |
+
{
|
54 |
+
|
55 |
+
|
56 |
+
}
|
app/code/community/Webshopapps/Wsalogger/etc/adminhtml.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_AdminNotification
|
24 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<!-- **
|
29 |
+
* WebShopApps
|
30 |
+
*
|
31 |
+
* NOTICE OF LICENSE
|
32 |
+
*
|
33 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
34 |
+
* that is bundled with this package in the file LICENSE.txt.
|
35 |
+
* It is also available through the world-wide-web at this URL:
|
36 |
+
* http://opensource.org/licenses/osl-3.0.php
|
37 |
+
* If you did not receive a copy of the license and are unable to
|
38 |
+
* obtain it through the world-wide-web, please send an email
|
39 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
40 |
+
*
|
41 |
+
* DISCLAIMER
|
42 |
+
*
|
43 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
44 |
+
* versions in the future. If you wish to customize Magento for your
|
45 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
46 |
+
*
|
47 |
+
* @category WebShopApps
|
48 |
+
* @package WebShopApps WsaLogger
|
49 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
50 |
+
* Copyright, 2013, Zowta, LLC - US license
|
51 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
52 |
+
-->
|
53 |
+
<config>
|
54 |
+
<acl>
|
55 |
+
<resources>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<system>
|
59 |
+
<children>
|
60 |
+
<config>
|
61 |
+
<children>
|
62 |
+
<wsalogmenu translate="title" module="log">
|
63 |
+
<title>WebShopApps Logger</title>
|
64 |
+
</wsalogmenu>
|
65 |
+
</children>
|
66 |
+
</config>
|
67 |
+
</children>
|
68 |
+
</system>
|
69 |
+
</children>
|
70 |
+
</admin>
|
71 |
+
</resources>
|
72 |
+
</acl>
|
73 |
+
<menu>
|
74 |
+
<system>
|
75 |
+
<children>
|
76 |
+
<log translate="title" module="log">
|
77 |
+
<title>WebShopApps View Logs</title>
|
78 |
+
<action>wsalogger/adminhtml_log</action>
|
79 |
+
<sort_order>15</sort_order>
|
80 |
+
</log>
|
81 |
+
</children>
|
82 |
+
</system>
|
83 |
+
</menu>
|
84 |
+
</config>
|
app/code/community/Webshopapps/Wsalogger/etc/config.xml
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!-- **
|
3 |
+
* WebShopApps
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category WebShopApps
|
22 |
+
* @package WebShopApps WsaLogger
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
-->
|
27 |
+
<config>
|
28 |
+
<modules>
|
29 |
+
<Webshopapps_Wsalogger>
|
30 |
+
<version>1.0.2</version>
|
31 |
+
</Webshopapps_Wsalogger>
|
32 |
+
</modules>
|
33 |
+
<global>
|
34 |
+
<blocks>
|
35 |
+
<wsalogger>
|
36 |
+
<class>Webshopapps_Wsalogger_Block</class>
|
37 |
+
</wsalogger>
|
38 |
+
<wsalogger_adminhtml>
|
39 |
+
<class>Webshopapps_Wsalogger_Adminhtml_Block</class>
|
40 |
+
</wsalogger_adminhtml>
|
41 |
+
</blocks>
|
42 |
+
<models>
|
43 |
+
<wsalogger>
|
44 |
+
<class>Webshopapps_Wsalogger_Model</class>
|
45 |
+
<resourceModel>wsalogger_mysql4</resourceModel>
|
46 |
+
</wsalogger>
|
47 |
+
<wsalogger_mysql4>
|
48 |
+
<class>Webshopapps_Wsalogger_Model_Mysql4</class>
|
49 |
+
<entities>
|
50 |
+
<log>
|
51 |
+
<table>wsalogger_log</table>
|
52 |
+
</log>
|
53 |
+
</entities>
|
54 |
+
</wsalogger_mysql4>
|
55 |
+
</models>
|
56 |
+
<helpers>
|
57 |
+
<wsalogger>
|
58 |
+
<class>Webshopapps_Wsalogger_Helper</class>
|
59 |
+
</wsalogger>
|
60 |
+
</helpers>
|
61 |
+
<resources>
|
62 |
+
<wsalogger_setup>
|
63 |
+
<setup>
|
64 |
+
<module>Webshopapps_Wsalogger</module>
|
65 |
+
</setup>
|
66 |
+
<connection>
|
67 |
+
<use>core_setup</use>
|
68 |
+
</connection>
|
69 |
+
</wsalogger_setup>
|
70 |
+
</resources>
|
71 |
+
<events>
|
72 |
+
<wsalogger_log_mesasge>
|
73 |
+
<observers>
|
74 |
+
<wsalogger_observer>
|
75 |
+
<type>singleton</type>
|
76 |
+
<class>wsalogger/observer</class>
|
77 |
+
<method>logMessage</method>
|
78 |
+
</wsalogger_observer>
|
79 |
+
</observers>
|
80 |
+
</wsalogger_log_mesasge>
|
81 |
+
</events>
|
82 |
+
<template>
|
83 |
+
<email>
|
84 |
+
<log_email_template module="wsalogger">
|
85 |
+
<label>Webshopapps Log Email Module</label>
|
86 |
+
<file>webshopapps_log_email.html</file>
|
87 |
+
<type>html</type>
|
88 |
+
</log_email_template>
|
89 |
+
</email>
|
90 |
+
</template>
|
91 |
+
</global>
|
92 |
+
<admin>
|
93 |
+
<routers>
|
94 |
+
<wsalogger>
|
95 |
+
<use>admin</use>
|
96 |
+
<args>
|
97 |
+
<module>Webshopapps_Wsalogger</module>
|
98 |
+
<frontName>wsalogger</frontName>
|
99 |
+
</args>
|
100 |
+
</wsalogger>
|
101 |
+
</routers>
|
102 |
+
</admin>
|
103 |
+
<adminhtml>
|
104 |
+
<translate>
|
105 |
+
<modules>
|
106 |
+
<Webshopapps_Wsalogger>
|
107 |
+
<files>
|
108 |
+
<default>Webshopapps_Wsalogger</default>
|
109 |
+
</files>
|
110 |
+
</Webshopapps_Wsalogger>
|
111 |
+
</modules>
|
112 |
+
</translate>
|
113 |
+
<layout>
|
114 |
+
<updates>
|
115 |
+
<wsalogger>
|
116 |
+
<file>webshopapps_wsalogger.xml</file>
|
117 |
+
</wsalogger>
|
118 |
+
</updates>
|
119 |
+
</layout>
|
120 |
+
</adminhtml>
|
121 |
+
<crontab>
|
122 |
+
<jobs>
|
123 |
+
<Webshopapps_Wsalogger>
|
124 |
+
<schedule>
|
125 |
+
<cron_expr>0 0 1,10,20 * *</cron_expr>
|
126 |
+
</schedule>
|
127 |
+
<run>
|
128 |
+
<model>wsalogger/log::truncate</model>
|
129 |
+
</run>
|
130 |
+
</Webshopapps_Wsalogger>
|
131 |
+
</jobs>
|
132 |
+
</crontab>
|
133 |
+
<default>
|
134 |
+
<wsalogmenu>
|
135 |
+
<wsalog>
|
136 |
+
<enabled>0</enabled>
|
137 |
+
<admin_level>-1</admin_level>
|
138 |
+
<system_level>-1</system_level>
|
139 |
+
<email_level>-1</email_level>
|
140 |
+
<empty_system_log>0</empty_system_log>
|
141 |
+
<view_all_extns>0</view_all_extns>
|
142 |
+
</wsalog>
|
143 |
+
</wsalogmenu>
|
144 |
+
</default>
|
145 |
+
|
146 |
+
</config>
|
app/code/community/Webshopapps/Wsalogger/etc/system.xml
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!-- **
|
3 |
+
* WebShopApps
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category WebShopApps
|
22 |
+
* @package WebShopApps WsaLogger
|
23 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
24 |
+
* Copyright, 2013, Zowta, LLC - US license
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
-->
|
27 |
+
<config>
|
28 |
+
<sections>
|
29 |
+
<wsalogmenu translate="label">
|
30 |
+
<label>WebShopApps Logger</label>
|
31 |
+
<tab>advanced</tab>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<sort_order>999</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
<groups>
|
38 |
+
<wsalog translate="label">
|
39 |
+
<label>Logger Configuration</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>0</show_in_website>
|
44 |
+
<show_in_store>0</show_in_store>
|
45 |
+
<comment>
|
46 |
+
<![CDATA[
|
47 |
+
<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
|
48 |
+
<h3>Please ensure that you disable this logger after use</h3>
|
49 |
+
<br/>With this logger you can see diagnostic information on WebShopApps extensions.
|
50 |
+
<br/><br/>Further info on the <a href="http://wiki.webshopapps.com/webshopapps-logger">WebShopApps Wiki</a>.
|
51 |
+
</div>
|
52 |
+
]]>
|
53 |
+
</comment>
|
54 |
+
<fields>
|
55 |
+
<active translate="label">
|
56 |
+
<label>Enabled</label>
|
57 |
+
<frontend_type>select</frontend_type>
|
58 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
59 |
+
<sort_order>5</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</active>
|
64 |
+
<admin_level translate="label">
|
65 |
+
<label>Minimum Log Level - Admin Panel</label>
|
66 |
+
<frontend_type>select</frontend_type>
|
67 |
+
<sort_order>10</sort_order>
|
68 |
+
<source_model>wsalogger/system_config_source_severities
|
69 |
+
</source_model>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
<comment>Switch on to see logs in admin under System->WebShopApps View Logs. Recommend use 'info' or above</comment>
|
74 |
+
</admin_level>
|
75 |
+
<system_level translate="label">
|
76 |
+
<label>Minimum Log Level - System Log</label>
|
77 |
+
<frontend_type>select</frontend_type>
|
78 |
+
<source_model>wsalogger/system_config_source_severities</source_model>
|
79 |
+
<sort_order>15</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
<comment>Switch on to see logs in /var/log/system.log. For expert uses</comment>
|
84 |
+
</system_level>
|
85 |
+
<email_level translate="label">
|
86 |
+
<label>Minimum Log Level - Email</label>
|
87 |
+
<frontend_type>select</frontend_type>
|
88 |
+
<sort_order>20</sort_order>
|
89 |
+
<source_model>wsalogger/system_config_source_severities
|
90 |
+
</source_model>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
<comment>Will email recipient when logs of this level raised</comment>
|
95 |
+
</email_level>
|
96 |
+
<contact_email translate="label">
|
97 |
+
<label>Logging Email Address</label>
|
98 |
+
<frontend_type>text</frontend_type>
|
99 |
+
<sort_order>30</sort_order>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>0</show_in_website>
|
102 |
+
<show_in_store>0</show_in_store>
|
103 |
+
</contact_email>
|
104 |
+
<sender_email translate="label">
|
105 |
+
<label>Sender Email</label>
|
106 |
+
<frontend_type>text</frontend_type>
|
107 |
+
<sort_order>40</sort_order>
|
108 |
+
<show_in_default>1</show_in_default>
|
109 |
+
<show_in_website>0</show_in_website>
|
110 |
+
<show_in_store>0</show_in_store>
|
111 |
+
</sender_email>
|
112 |
+
<sender_email_name translate="label">
|
113 |
+
<label>Sender Email Name</label>
|
114 |
+
<frontend_type>text</frontend_type>
|
115 |
+
<sort_order>50</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>0</show_in_website>
|
118 |
+
<show_in_store>0</show_in_store>
|
119 |
+
</sender_email_name>
|
120 |
+
<email_subject translate="label">
|
121 |
+
<label>Email Subject</label>
|
122 |
+
<frontend_type>text</frontend_type>
|
123 |
+
<sort_order>60</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>0</show_in_website>
|
126 |
+
<show_in_store>0</show_in_store>
|
127 |
+
</email_subject>
|
128 |
+
<!-- <empty_system_log translate="label">
|
129 |
+
<label>Empty System Log</label>
|
130 |
+
<frontend_type>select</frontend_type>
|
131 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
132 |
+
<sort_order>50</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>0</show_in_website>
|
135 |
+
<show_in_store>0</show_in_store>
|
136 |
+
</empty_system_log> -->
|
137 |
+
<view_all_extns translate="label">
|
138 |
+
<label>View all Extensions</label>
|
139 |
+
<frontend_type>select</frontend_type>
|
140 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
141 |
+
<sort_order>200</sort_order>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<show_in_website>0</show_in_website>
|
144 |
+
<show_in_store>0</show_in_store>
|
145 |
+
<comment>Use Logger in non-WebShopApps extensions (if supported)</comment>
|
146 |
+
</view_all_extns>
|
147 |
+
</fields>
|
148 |
+
</wsalog>
|
149 |
+
<wsamodulelog>
|
150 |
+
<label>Extension(s) to log output from</label>
|
151 |
+
<frontend_type>text</frontend_type>
|
152 |
+
<frontend_model>wsalogger_adminhtml/system_config_form_fieldset_modules_disableLogging</frontend_model>
|
153 |
+
<sort_order>20</sort_order>
|
154 |
+
<show_in_default>1</show_in_default>
|
155 |
+
<show_in_website>1</show_in_website>
|
156 |
+
<show_in_store>1</show_in_store>
|
157 |
+
</wsamodulelog>
|
158 |
+
</groups>
|
159 |
+
</wsalogmenu>
|
160 |
+
</sections>
|
161 |
+
</config>
|
app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category WebShopApps
|
23 |
+
* @package WebShopApps WsaLogger
|
24 |
+
* @copyright Copyright (c) 2011 Zowta Ltd (http://www.webshopapps.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
$installer = $this;
|
29 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
30 |
+
|
31 |
+
$installer->startSetup();
|
32 |
+
$installer->run("
|
33 |
+
DROP TABLE IF EXISTS `{$installer->getTable('wsacommon_log')}`;
|
34 |
+
CREATE TABLE IF NOT EXISTS `{$installer->getTable('wsalogger_log')}` (
|
35 |
+
`notification_id` int(10) unsigned NOT NULL auto_increment,
|
36 |
+
`severity` tinyint(3) unsigned NOT NULL default '0',
|
37 |
+
`date_added` datetime NOT NULL,
|
38 |
+
`extension` varchar(255) NOT NULL,
|
39 |
+
`title` varchar(255) NOT NULL,
|
40 |
+
`description` text,
|
41 |
+
`url` varchar(255),
|
42 |
+
`is_read` tinyint(1) unsigned NOT NULL default '0',
|
43 |
+
`is_remove` tinyint(1) unsigned NOT NULL default '0',
|
44 |
+
PRIMARY KEY (`notification_id`),
|
45 |
+
KEY `IDX_SEVERITY` (`severity`),
|
46 |
+
KEY `IDX_IS_READ` (`is_read`),
|
47 |
+
KEY `IDX_IS_REMOVE` (`is_remove`)
|
48 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
49 |
+
");
|
50 |
+
$installer->endSetup();
|
app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.1.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category WebShopApps
|
23 |
+
* @package WebShopApps WsaLogger
|
24 |
+
* @copyright Copyright (c) 2011 Zowta Ltd (http://www.webshopapps.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
$installer = $this;
|
29 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
30 |
+
|
31 |
+
$installer->startSetup();
|
32 |
+
$installer->run("
|
33 |
+
DROP TABLE IF EXISTS `{$installer->getTable('wsacommon_log')}`;
|
34 |
+
DROP TABLE IF EXISTS `{$installer->getTable('wsalogger_log')}`;
|
35 |
+
CREATE TABLE IF NOT EXISTS `{$installer->getTable('wsalogger_log')}` (
|
36 |
+
`notification_id` int(10) unsigned NOT NULL auto_increment,
|
37 |
+
`severity` tinyint(3) unsigned NOT NULL default '0',
|
38 |
+
`date_added` datetime NOT NULL,
|
39 |
+
`extension` varchar(255) NOT NULL,
|
40 |
+
`title` varchar(255) NOT NULL,
|
41 |
+
`description` text,
|
42 |
+
`code` varchar(255),
|
43 |
+
`url` varchar(255),
|
44 |
+
`is_read` tinyint(1) unsigned NOT NULL default '0',
|
45 |
+
`is_remove` tinyint(1) unsigned NOT NULL default '0',
|
46 |
+
PRIMARY KEY (`notification_id`),
|
47 |
+
KEY `IDX_SEVERITY` (`severity`),
|
48 |
+
KEY `IDX_IS_READ` (`is_read`),
|
49 |
+
KEY `IDX_IS_REMOVE` (`is_remove`)
|
50 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
51 |
+
");
|
52 |
+
$installer->endSetup();
|
app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.2.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category WebShopApps
|
23 |
+
* @package WebShopApps WsaLogger
|
24 |
+
* @copyright Copyright (c) 2011 Zowta Ltd (http://www.webshopapps.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
$installer = $this;
|
29 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
30 |
+
|
31 |
+
$installer->startSetup();
|
32 |
+
$installer->run("
|
33 |
+
DROP TABLE IF EXISTS `{$installer->getTable('wsacommon_log')}`;
|
34 |
+
DROP TABLE IF EXISTS `{$installer->getTable('wsalogger_log')}`;
|
35 |
+
CREATE TABLE IF NOT EXISTS `{$installer->getTable('wsalogger_log')}` (
|
36 |
+
`notification_id` int(10) unsigned NOT NULL auto_increment,
|
37 |
+
`severity` tinyint(3) unsigned NOT NULL default '0',
|
38 |
+
`date_added` datetime NOT NULL,
|
39 |
+
`extension` varchar(255) NOT NULL,
|
40 |
+
`title` varchar(255) NOT NULL,
|
41 |
+
`description` text,
|
42 |
+
`code` varchar(255),
|
43 |
+
`url` varchar(255),
|
44 |
+
`is_read` tinyint(1) unsigned NOT NULL default '0',
|
45 |
+
`is_remove` tinyint(1) unsigned NOT NULL default '0',
|
46 |
+
PRIMARY KEY (`notification_id`),
|
47 |
+
KEY `IDX_SEVERITY` (`severity`),
|
48 |
+
KEY `IDX_IS_READ` (`is_read`),
|
49 |
+
KEY `IDX_IS_REMOVE` (`is_remove`)
|
50 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
51 |
+
");
|
52 |
+
$installer->endSetup();
|
app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-upgrade-1.0.0-1.0.1.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
DROP TABLE IF EXISTS `{$installer->getTable('wsalogger_log')}`;
|
10 |
+
CREATE TABLE IF NOT EXISTS `{$installer->getTable('wsalogger_log')}` (
|
11 |
+
`notification_id` int(10) unsigned NOT NULL auto_increment,
|
12 |
+
`severity` tinyint(3) unsigned NOT NULL default '0',
|
13 |
+
`date_added` datetime NOT NULL,
|
14 |
+
`extension` varchar(255) NOT NULL,
|
15 |
+
`title` varchar(255) NOT NULL,
|
16 |
+
`description` text,
|
17 |
+
`code` varchar(255),
|
18 |
+
`url` varchar(255),
|
19 |
+
`is_read` tinyint(1) unsigned NOT NULL default '0',
|
20 |
+
`is_remove` tinyint(1) unsigned NOT NULL default '0',
|
21 |
+
PRIMARY KEY (`notification_id`),
|
22 |
+
KEY `IDX_SEVERITY` (`severity`),
|
23 |
+
KEY `IDX_IS_READ` (`is_read`),
|
24 |
+
KEY `IDX_IS_REMOVE` (`is_remove`)
|
25 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
26 |
+
|
27 |
+
");
|
28 |
+
|
29 |
+
$installer->endSetup();
|
app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-upgrade-1.0.1-1.0.2.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WebShopApps
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category WebShopApps
|
23 |
+
* @package WebShopApps WsaLogger
|
24 |
+
* @copyright Copyright (c) 2011 Zowta Ltd (http://www.webshopapps.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
$installer = $this;
|
29 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
30 |
+
|
31 |
+
$installer->startSetup();
|
32 |
+
$installer->run("
|
33 |
+
DROP TABLE IF EXISTS `{$installer->getTable('wsalogger_log')}`;
|
34 |
+
CREATE TABLE IF NOT EXISTS `{$installer->getTable('wsalogger_log')}` (
|
35 |
+
`notification_id` int(10) unsigned NOT NULL auto_increment,
|
36 |
+
`severity` tinyint(3) unsigned NOT NULL default '0',
|
37 |
+
`date_added` datetime NOT NULL,
|
38 |
+
`extension` varchar(255) NOT NULL,
|
39 |
+
`title` varchar(255) NOT NULL,
|
40 |
+
`description` text,
|
41 |
+
`code` varchar(255),
|
42 |
+
`url` varchar(255),
|
43 |
+
`is_read` tinyint(1) unsigned NOT NULL default '0',
|
44 |
+
`is_remove` tinyint(1) unsigned NOT NULL default '0',
|
45 |
+
PRIMARY KEY (`notification_id`),
|
46 |
+
KEY `IDX_SEVERITY` (`severity`),
|
47 |
+
KEY `IDX_IS_READ` (`is_read`),
|
48 |
+
KEY `IDX_IS_REMOVE` (`is_remove`)
|
49 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
50 |
+
");
|
51 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/webshopapps_despatchbay.xml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* WebShopApps Shipping Module
|
5 |
+
*
|
6 |
+
* @category WebShopApps
|
7 |
+
* @package WebShopApps_Endicia
|
8 |
+
* User Genevieve Eddison
|
9 |
+
* Date 13 November 2013
|
10 |
+
* Time 11:00 AM
|
11 |
+
* @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
|
12 |
+
* Copyright, 2013, Zowta, LLC - US license
|
13 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
-->
|
17 |
+
|
18 |
+
<layout version="0.1.0">
|
19 |
+
<adminhtml_sales_order_shipment_view>
|
20 |
+
<reference name="form">
|
21 |
+
<action method="unsetChild">
|
22 |
+
<name>shipment_packaging</name>
|
23 |
+
</action>
|
24 |
+
<block type="webshopapps_despatchbay/adminhtml_sales_order_shipment_packaging" name="shipment_packaging"
|
25 |
+
template="sales/order/shipment/packaging/popup.phtml"/>
|
26 |
+
</reference>
|
27 |
+
</adminhtml_sales_order_shipment_view>
|
28 |
+
<adminhtml_sales_order_shipment_new>
|
29 |
+
<reference name="form">
|
30 |
+
<action method="unsetChild">
|
31 |
+
<name>shipment_packaging</name>
|
32 |
+
</action>
|
33 |
+
<block type="webshopapps_despatchbay/adminhtml_sales_order_shipment_packaging" name="shipment_packaging"
|
34 |
+
template="sales/order/shipment/packaging/popup.phtml"/>
|
35 |
+
</reference>
|
36 |
+
</adminhtml_sales_order_shipment_new>
|
37 |
+
</layout>
|
app/design/adminhtml/default/default/layout/webshopapps_wsalogger.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category design
|
23 |
+
* @package default_default
|
24 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
|
29 |
+
<layout>
|
30 |
+
<wsalogger_adminhtml_log_index>
|
31 |
+
<reference name="content">
|
32 |
+
<block type="wsalogger_adminhtml/log" name="log" />
|
33 |
+
</reference>
|
34 |
+
</wsalogger_adminhtml_log_index>
|
35 |
+
</layout>
|
app/design/adminhtml/default/default/template/webshopapps_despatchbay/sales/order/shipment/create/items.phtml
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="grid np">
|
28 |
+
<div class="hor-scroll">
|
29 |
+
<table cellspacing="0" class="data order-tables">
|
30 |
+
<col />
|
31 |
+
<col width="1" />
|
32 |
+
<col width="1" />
|
33 |
+
<?php if (!$this->canShipPartiallyItem()): ?>
|
34 |
+
<col width="20" />
|
35 |
+
<?php endif; ?>
|
36 |
+
<thead>
|
37 |
+
<tr class="headings">
|
38 |
+
<th><?php echo $this->helper('sales')->__('Product') ?></th>
|
39 |
+
<th class="a-center"><?php echo $this->helper('sales')->__('Qty') ?></th>
|
40 |
+
<th<?php if ($this->isShipmentRegular()): ?> class="last"<?php endif; ?>><span class="nobr"><?php echo $this->helper('sales')->__('Qty to Ship') ?></span></th>
|
41 |
+
|
42 |
+
<?php if (!$this->canShipPartiallyItem()): ?>
|
43 |
+
<th class="a-center last"><span class="nobr"><?php echo $this->helper('sales')->__('Ship') ?></span></th>
|
44 |
+
<?php endif; ?>
|
45 |
+
|
46 |
+
</tr>
|
47 |
+
</thead>
|
48 |
+
<?php $_items = $this->getShipment()->getAllItems() ?>
|
49 |
+
<?php $_i=0;foreach ($_items as $_item): if ($_item->getOrderItem()->getIsVirtual() || $_item->getOrderItem()->getParentItem()): continue; endif; $_i++ ?>
|
50 |
+
<tbody class="<?php echo $_i%2?'odd':'even' ?>">
|
51 |
+
<?php echo $this->getItemHtml($_item) ?>
|
52 |
+
<?php echo $this->getItemExtraInfoHtml($_item->getOrderItem()) ?>
|
53 |
+
</tbody>
|
54 |
+
<?php endforeach; ?>
|
55 |
+
</table>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
<br />
|
59 |
+
<div class="box-left entry-edit">
|
60 |
+
<div class="entry-edit-head"><h4><?php echo $this->__('Shipment Comments') ?></h4></div>
|
61 |
+
<fieldset>
|
62 |
+
<div id="order-history_form">
|
63 |
+
<span class="field-row">
|
64 |
+
<label class="normal" for="shipment_comment_text"><?php echo Mage::helper('sales')->__('Shipment Comments') ?></label>
|
65 |
+
<textarea id="shipment_comment_text" name="shipment[comment_text]" rows="3" cols="5" style="height:6em; width:99%;"><?php echo $this->getShipment()->getCommentText(); ?></textarea>
|
66 |
+
</span>
|
67 |
+
<div class="clear"></div>
|
68 |
+
</div>
|
69 |
+
</fieldset>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<div class="box-right entry-edit">
|
73 |
+
<div class="order-totals">
|
74 |
+
<div class="order-totals-bottom">
|
75 |
+
<!--?php if ($this->canCreateShippingLabel(): ?-->
|
76 |
+
<p>
|
77 |
+
<label class="normal" for="create_shipping_label"><?php echo Mage::helper('sales')->__('Create Shipping Label') ?></label>
|
78 |
+
<input id="create_shipping_label" name="shipment[create_shipping_label]" value="1" type="checkbox" onclick="toggleCreateLabelCheckbox();" />
|
79 |
+
</p>
|
80 |
+
<!--?php endif ?-->
|
81 |
+
<p>
|
82 |
+
<label class="normal" for="notify_customer"><?php echo Mage::helper('sales')->__('Append Comments') ?></label>
|
83 |
+
<input id="notify_customer" name="shipment[comment_customer_notify]" value="1" type="checkbox" />
|
84 |
+
</p>
|
85 |
+
<?php if ($this->canSendShipmentEmail()): ?>
|
86 |
+
<p>
|
87 |
+
<label class="normal" for="send_email"><?php echo Mage::helper('sales')->__('Email Copy of Shipment') ?></label>
|
88 |
+
<input id="send_email" name="shipment[send_email]" value="1" type="checkbox" />
|
89 |
+
</p>
|
90 |
+
<?php endif; ?>
|
91 |
+
<div class="a-right">
|
92 |
+
<?php echo $this->getChildHtml('submit_button') ?>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
<div class="clear"></div>
|
98 |
+
<script type="text/javascript">
|
99 |
+
//<![CDATA[
|
100 |
+
var sendEmailCheckbox = $('send_email');
|
101 |
+
if (sendEmailCheckbox) {
|
102 |
+
var notifyCustomerCheckbox = $('notify_customer');
|
103 |
+
var shipmentCommentText = $('shipment_comment_text');
|
104 |
+
Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
|
105 |
+
bindSendEmail();
|
106 |
+
}
|
107 |
+
function bindSendEmail()
|
108 |
+
{
|
109 |
+
if (sendEmailCheckbox.checked == true) {
|
110 |
+
notifyCustomerCheckbox.disabled = false;
|
111 |
+
//shipmentCommentText.disabled = false;
|
112 |
+
}
|
113 |
+
else {
|
114 |
+
notifyCustomerCheckbox.disabled = true;
|
115 |
+
//shipmentCommentText.disabled = true;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
function toggleCreateLabelCheckbox(){
|
119 |
+
var checkbox = $('create_shipping_label');
|
120 |
+
var submitButton = checkbox.up('.order-totals').select('.submit-button span')[0];
|
121 |
+
if (checkbox.checked) {
|
122 |
+
submitButton.innerText += '...';
|
123 |
+
} else {
|
124 |
+
submitButton.innerText = submitButton.innerText.replace(/\.\.\.$/, '');
|
125 |
+
}
|
126 |
+
}
|
127 |
+
function submitShipment(btn){
|
128 |
+
var checkbox = $(btn).up('.order-totals').select('#create_shipping_label')[0];
|
129 |
+
if (checkbox && checkbox.checked) {
|
130 |
+
packaging.showWindow();
|
131 |
+
} else if(editForm.submit()) {
|
132 |
+
disableElements('submit-button');
|
133 |
+
}
|
134 |
+
}
|
135 |
+
//]]>
|
136 |
+
</script>
|
app/design/adminhtml/default/default/template/webshopapps_despatchbay/sales/order/shipment/view/form.phtml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_order = $this->getShipment()->getOrder() ?>
|
28 |
+
<?php echo $this->getChildHtml('order_info') ?>
|
29 |
+
|
30 |
+
<div class="box-left">
|
31 |
+
<!--Billing Address-->
|
32 |
+
<div class="entry-edit">
|
33 |
+
<div class="entry-edit-head">
|
34 |
+
<h4 class="icon-head head-payment-method"><?php echo $this->helper('sales')->__('Payment Information') ?></h4>
|
35 |
+
</div>
|
36 |
+
<fieldset>
|
37 |
+
<div><?php echo $this->getChildHtml('order_payment') ?></div>
|
38 |
+
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
|
39 |
+
</fieldset>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
<div class="box-right">
|
43 |
+
<!--Shipping Address-->
|
44 |
+
<div class="entry-edit">
|
45 |
+
<div class="entry-edit-head">
|
46 |
+
<h4 class="icon-head head-shipping-method"><?php echo $this->helper('sales')->__('Shipping and Tracking Information') ?></h4>
|
47 |
+
</div>
|
48 |
+
<fieldset>
|
49 |
+
<div>
|
50 |
+
<?php if($this->getShipment()->getTracksCollection()->count()): ?>
|
51 |
+
<a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($this->getShipment()) ?>','trackshipment','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track this shipment') ?>"><?php echo $this->__('Track this shipment') ?></a>
|
52 |
+
<br/>
|
53 |
+
<?php endif; ?>
|
54 |
+
<strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
|
55 |
+
<?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
|
56 |
+
|
57 |
+
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
58 |
+
<?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
|
59 |
+
<?php else: ?>
|
60 |
+
<?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
|
61 |
+
<?php endif; ?>
|
62 |
+
<?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
|
63 |
+
|
64 |
+
<?php echo $_excl; ?>
|
65 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
66 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
67 |
+
<?php endif; ?>
|
68 |
+
</div>
|
69 |
+
<div style="text-align: center; margin: 10px 0;">
|
70 |
+
<?php echo $this->getCreateLabelButton()?>
|
71 |
+
<?php if ($this->getShipment()->getShippingLabel()): ?>
|
72 |
+
<?php echo $this->getPrintLabelButton() ?>
|
73 |
+
<?php endif ?>
|
74 |
+
<?php if ($this->getShipment()->getPackages()): ?>
|
75 |
+
<?php echo $this->getShowPackagesButton() ?>
|
76 |
+
<?php endif ?>
|
77 |
+
</div>
|
78 |
+
<div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
|
79 |
+
</fieldset>
|
80 |
+
<?php echo $this->getChildHtml('shipment_packaging') ?>
|
81 |
+
<script type="text/javascript">
|
82 |
+
//<![CDATA[
|
83 |
+
document.observe("dom:loaded", function() {
|
84 |
+
setTimeout(function(){
|
85 |
+
packaging.setConfirmPackagingCallback(function(){
|
86 |
+
packaging.sendCreateLabelRequest();
|
87 |
+
});
|
88 |
+
packaging.setLabelCreatedCallback(function(response){
|
89 |
+
setLocation("<?php echo $this->getUrl(
|
90 |
+
'*/sales_order_shipment/view',
|
91 |
+
array('shipment_id' => $this->getShipment()->getId())
|
92 |
+
); ?>");
|
93 |
+
});
|
94 |
+
}, 500);
|
95 |
+
});
|
96 |
+
//]]>
|
97 |
+
</script>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
<div class="clear"></div>
|
101 |
+
|
102 |
+
<div class="entry-edit">
|
103 |
+
<div class="entry-edit-head">
|
104 |
+
<h4 class="icon-head head-products"><?php echo $this->helper('sales')->__('Items Shipped') ?></h4>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<?php echo $this->getChildHtml('shipment_items') ?>
|
109 |
+
<?php echo $this->getChildHtml('shipment_packed') ?>
|
110 |
+
|
111 |
+
<div class="box-left entry-edit">
|
112 |
+
<div class="entry-edit-head"><h4><?php echo $this->__('Shipment History') ?></h4></div>
|
113 |
+
<fieldset><?php echo $this->getChildHtml('order_comments') ?></fieldset>
|
114 |
+
</div>
|
115 |
+
<div class="clear"></div>
|
app/design/adminhtml/default/default/template/webshopapps_despatchbay/system/config/refreshcarriers.phtml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebShopApps Shipping Module
|
4 |
+
*
|
5 |
+
* @category WebShopApps
|
6 |
+
* @package WebShopApps_Despatchbay
|
7 |
+
* User Joshua Stewart
|
8 |
+
* Date 15/04/2014
|
9 |
+
* Time 10:16
|
10 |
+
* @copyright Copyright (c) 2014 Zowta Ltd (http://www.WebShopApps.com)
|
11 |
+
* Copyright, 2014, Zowta, LLC - US license
|
12 |
+
* @license http://www.WebShopApps.com/license/license.txt - Commercial license
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
?>
|
16 |
+
<?php
|
17 |
+
/**
|
18 |
+
* @see Shipperhq_Shipper_Block_Adminhtml_Carrier_Allowedmethods.php
|
19 |
+
*/
|
20 |
+
?>
|
21 |
+
|
22 |
+
<script type="text/javascript">
|
23 |
+
//<![CDATA[
|
24 |
+
function getAllowedMethods() {
|
25 |
+
var elem = $('<?php echo $this->getHtmlId() ?>');
|
26 |
+
|
27 |
+
new Ajax.Request('<?php echo $this->getAjaxUrl() ?>', {
|
28 |
+
onSuccess: function(response) {
|
29 |
+
|
30 |
+
try {
|
31 |
+
response = response.responseText.evalJSON();
|
32 |
+
result = response.message;
|
33 |
+
if (response.result == 1) {
|
34 |
+
elem.removeClassName('fail').addClassName('success')
|
35 |
+
} else {
|
36 |
+
elem.removeClassName('success').addClassName('fail')
|
37 |
+
}
|
38 |
+
} catch (e) {
|
39 |
+
elem.removeClassName('success').addClassName('fail')
|
40 |
+
}
|
41 |
+
$('allowedmethods_result').update(result);
|
42 |
+
}
|
43 |
+
});
|
44 |
+
}
|
45 |
+
//]]>
|
46 |
+
</script>
|
47 |
+
<button onclick="javascript:getAllowedMethods(); return false;" class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>">
|
48 |
+
<span id="allowedmethods_result"><?php echo $this->escapeHtml($this->getButtonLabel()) ?></span>
|
49 |
+
</button>
|
app/etc/modules/Webshopapps_Despatchbay.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Webshopapps_Despatchbay>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Shipping/>
|
9 |
+
</depends>
|
10 |
+
</Webshopapps_Despatchbay>
|
11 |
+
</modules>
|
12 |
+
</config>
|
app/etc/modules/Webshopapps_Wsacommon.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Webshopapps_Wsacommon>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Webshopapps_Wsacommon>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Webshopapps_Wsalogger.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Webshopapps_Wsalogger>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Webshopapps_Wsalogger>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/webshopapps_log_email.html
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
|
3 |
+
Extension: {{var extension}}
|
4 |
+
<br/>
|
5 |
+
Severity: {{var severity}}
|
6 |
+
<br/>
|
7 |
+
Title: {{var title}}
|
8 |
+
<br/>
|
9 |
+
Description:
|
10 |
+
<br/>
|
11 |
+
{{var description}}
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
</div>
|
lib/Shipper/Shipper.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
/**
|
31 |
+
* ShipperHQ Library Class
|
32 |
+
*
|
33 |
+
* @category ShipperHQ
|
34 |
+
* @package Shipperhq_Shipper
|
35 |
+
*
|
36 |
+
*/
|
37 |
+
|
38 |
+
class Shipper_Shipper
|
39 |
+
{
|
40 |
+
|
41 |
+
const LIVE = 'LIVE';
|
42 |
+
const DEV = 'DEV';
|
43 |
+
const TEST = 'TEST';
|
44 |
+
const INTEGRATION = 'INTEGRATION';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieve allowed methods from all the carriers
|
48 |
+
*
|
49 |
+
* @param $request
|
50 |
+
* @param string $gatewayUrl Gateway to call
|
51 |
+
* @return array List of allowed methods
|
52 |
+
*/
|
53 |
+
public function getAllowedMethods($request, $gatewayUrl)
|
54 |
+
{
|
55 |
+
return $this->submitRequest($request, $gatewayUrl);
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Shipper library entry point
|
61 |
+
*
|
62 |
+
* @param $request
|
63 |
+
* @param $gatewayUrl
|
64 |
+
* @return array Contains response and logging of what happened
|
65 |
+
*/
|
66 |
+
public function getRates($request,$gatewayUrl)
|
67 |
+
{
|
68 |
+
return $this->submitRequest($request, $gatewayUrl);
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Retreive latest attribute values
|
73 |
+
*
|
74 |
+
* @param string $request Formatted request according to ShipperHQ API
|
75 |
+
* @param $gatewayUrl
|
76 |
+
* @return array Contains response and logging of what happened
|
77 |
+
*/
|
78 |
+
public function getLatestAttributes($request,$gatewayUrl)
|
79 |
+
{
|
80 |
+
return $this->submitRequest($request, $gatewayUrl);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Retreive last time attributes were synchronized
|
85 |
+
*
|
86 |
+
* @param string $request Formatted request according to ShipperHQ API
|
87 |
+
* @param $gatewayUrl
|
88 |
+
* @return array Contains response and logging of what happened
|
89 |
+
*/
|
90 |
+
public function checkSynchronized($request,$gatewayUrl)
|
91 |
+
{
|
92 |
+
return $this->submitRequest($request, $gatewayUrl);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Set Synchronized status
|
97 |
+
*
|
98 |
+
* @param string $request Formatted request according to ShipperHQ API
|
99 |
+
* @param $gatewayUrl
|
100 |
+
* @return array Contains response and logging of what happened
|
101 |
+
*/
|
102 |
+
public function setSynchronized($request,$gatewayUrl)
|
103 |
+
{
|
104 |
+
return $this->submitRequest($request, $gatewayUrl);
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Submit request to ShipperHQ
|
109 |
+
*
|
110 |
+
* @param $request
|
111 |
+
* @param $gatewayUrl
|
112 |
+
* @return array Contains response and logging of what happened
|
113 |
+
*/
|
114 |
+
public function submitRequest($request,$gatewayUrl)
|
115 |
+
{
|
116 |
+
|
117 |
+
$jsonRequest = json_encode($request);
|
118 |
+
$debugData['json_request'] = $jsonRequest;
|
119 |
+
$debugData['url'] = $gatewayUrl;
|
120 |
+
$response = '';
|
121 |
+
|
122 |
+
try {
|
123 |
+
$client = new Zend_Http_Client();
|
124 |
+
$client->setUri($gatewayUrl);
|
125 |
+
$client->setConfig(array('maxredirects'=>0, 'timeout'=>30));
|
126 |
+
$client->setRawData($jsonRequest,'application/json');
|
127 |
+
$response = $client->request(Zend_Http_Client::POST);
|
128 |
+
$responseBody = $response->getBody();
|
129 |
+
|
130 |
+
$debugData['response'] = $responseBody;
|
131 |
+
$responseBody = json_decode($responseBody, false);
|
132 |
+
}
|
133 |
+
catch (Exception $e) {
|
134 |
+
$debugData['error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
|
135 |
+
$responseBody = '';
|
136 |
+
}
|
137 |
+
|
138 |
+
$result = array('result' => $responseBody, 'debug' => $debugData);
|
139 |
+
|
140 |
+
return $result;
|
141 |
+
}
|
142 |
+
}
|
lib/ShipperHQ/CHANGELOG
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
v0.2.0 :: 20140302
|
2 |
+
- - Updates to webservice request credentials. IP Address no londer sent from client.
|
lib/ShipperHQ/Checkout/Cart.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
namespace ShipperHQ\Checkout;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class Cart
|
34 |
+
*
|
35 |
+
* @package ShipperHQ\Checkout
|
36 |
+
*/
|
37 |
+
class Cart {
|
38 |
+
|
39 |
+
public $weight;
|
40 |
+
public $price;
|
41 |
+
public $qty;
|
42 |
+
public $declaredValue;
|
43 |
+
public $freeShipping;
|
44 |
+
public $items;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param float $declaredValue
|
48 |
+
* @param boolean $freeShipping
|
49 |
+
* @param array $items
|
50 |
+
* @param float $price
|
51 |
+
* @param int $qty
|
52 |
+
* @param float $weight
|
53 |
+
*/
|
54 |
+
function __construct($declaredValue = 0.0, $freeShipping = false, $items = array(),
|
55 |
+
$price = 0.0, $qty = 0, $weight = 0.0)
|
56 |
+
{
|
57 |
+
$this->declaredValue = $declaredValue;
|
58 |
+
$this->freeShipping = $freeShipping;
|
59 |
+
$this->items = $items;
|
60 |
+
$this->price = $price;
|
61 |
+
$this->qty = $qty;
|
62 |
+
$this->weight = $weight;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @param float $declaredValue
|
67 |
+
*/
|
68 |
+
public function setDeclaredValue(\float $declaredValue)
|
69 |
+
{
|
70 |
+
$this->declaredValue = $declaredValue;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @return float
|
75 |
+
*/
|
76 |
+
public function getDeclaredValue()
|
77 |
+
{
|
78 |
+
return $this->declaredValue;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @param boolean $freeShipping
|
83 |
+
*/
|
84 |
+
public function setFreeShipping(\boolean $freeShipping)
|
85 |
+
{
|
86 |
+
$this->freeShipping = $freeShipping;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @return boolean
|
91 |
+
*/
|
92 |
+
public function getFreeShipping()
|
93 |
+
{
|
94 |
+
return $this->freeShipping;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @param array $items
|
99 |
+
*/
|
100 |
+
public function setItems(array $items)
|
101 |
+
{
|
102 |
+
$this->items = $items;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @return array
|
107 |
+
*/
|
108 |
+
public function getItems()
|
109 |
+
{
|
110 |
+
return $this->items;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @param float $price
|
115 |
+
*/
|
116 |
+
public function setPrice(\float $price)
|
117 |
+
{
|
118 |
+
$this->price = $price;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @return float
|
123 |
+
*/
|
124 |
+
public function getPrice()
|
125 |
+
{
|
126 |
+
return $this->price;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @param int $qty
|
131 |
+
*/
|
132 |
+
public function setQty(\integer $qty)
|
133 |
+
{
|
134 |
+
$this->qty = $qty;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* @return int
|
139 |
+
*/
|
140 |
+
public function getQty()
|
141 |
+
{
|
142 |
+
return $this->qty;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* @param float $weight
|
147 |
+
*/
|
148 |
+
public function setWeight(\float $weight)
|
149 |
+
{
|
150 |
+
$this->weight = $weight;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* @return float
|
155 |
+
*/
|
156 |
+
public function getWeight()
|
157 |
+
{
|
158 |
+
return $this->weight;
|
159 |
+
}
|
160 |
+
}
|
lib/ShipperHQ/Checkout/Item.php
ADDED
@@ -0,0 +1,628 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
|
31 |
+
namespace ShipperHQ\Checkout;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Class Item
|
35 |
+
*
|
36 |
+
* @package ShipperHQ\Checkout
|
37 |
+
*/
|
38 |
+
class Item
|
39 |
+
{
|
40 |
+
|
41 |
+
public $id;
|
42 |
+
public $name;
|
43 |
+
public $weight;
|
44 |
+
public $qty;
|
45 |
+
public $attributes;
|
46 |
+
public $basePrice;
|
47 |
+
public $storePrice;
|
48 |
+
public $taxInclStorePrice;
|
49 |
+
public $taxInclBasePrice;
|
50 |
+
public $discountedStorePrice;
|
51 |
+
public $discountedBasePrice;
|
52 |
+
public $discountedTaxInclStorePrice;
|
53 |
+
public $discountedTaxInclBasePrice;
|
54 |
+
public $rowTotal;
|
55 |
+
public $baseRowTotal;
|
56 |
+
public $baseCurrency;
|
57 |
+
public $packageCurrency;
|
58 |
+
public $storeBaseCurrency;
|
59 |
+
public $storeCurrentCurrency;
|
60 |
+
public $taxPercentage;
|
61 |
+
public $discountPercent;
|
62 |
+
public $discountAmount;
|
63 |
+
public $freeShipping;
|
64 |
+
public $freeMethodWeight;
|
65 |
+
public $additionalAttributes;
|
66 |
+
public $legacyAttributes;
|
67 |
+
public $items;
|
68 |
+
public $type;
|
69 |
+
public $fixedPrice;
|
70 |
+
public $fixedWeight;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @param array $items
|
74 |
+
* @param int $qty
|
75 |
+
* @param float $weight
|
76 |
+
* @param int $rowTotal
|
77 |
+
* @param float $basePrice
|
78 |
+
* @param float $baseRowTotal
|
79 |
+
* @param float $discountAmount
|
80 |
+
* @param float $discountPercent
|
81 |
+
* @param float $discountedBasePrice
|
82 |
+
* @param float $discountedStorePrice
|
83 |
+
* @param float $discountedTaxInclBasePrice
|
84 |
+
* @param float $discountedTaxInclStorePrice
|
85 |
+
* @param bool $fixedPrice
|
86 |
+
* @param float $fixedWeight
|
87 |
+
* @param float $freeMethodWeight
|
88 |
+
* @param bool $freeShipping
|
89 |
+
* @param int $id
|
90 |
+
* @param string $name
|
91 |
+
* @param string $packageCurrency
|
92 |
+
* @param string $baseCurrency
|
93 |
+
* @param string $storeBaseCurrency
|
94 |
+
* @param string $storeCurrentCurrency
|
95 |
+
* @param float $storePrice
|
96 |
+
* @param float $taxInclBasePrice
|
97 |
+
* @param float $taxInclStorePrice
|
98 |
+
* @param float $taxPercentage
|
99 |
+
* @param string $type
|
100 |
+
* @param array $attributes
|
101 |
+
* @param array $legacyAttributes
|
102 |
+
* @param array $additionalAttributes
|
103 |
+
*/
|
104 |
+
function __construct($items = array(), $qty = 0, $weight = 0.0, $rowTotal = 0,
|
105 |
+
$basePrice = 0.0, $baseRowTotal = 0.0, $discountAmount = 0.0,
|
106 |
+
$discountPercent = 0.0, $discountedBasePrice = 0.0,
|
107 |
+
$discountedStorePrice = 0.0, $discountedTaxInclBasePrice = 0.0,
|
108 |
+
$discountedTaxInclStorePrice = 0.0, $fixedPrice = false, $fixedWeight = 0.0,
|
109 |
+
$freeMethodWeight = 0.0, $freeShipping = false, $id = 0,
|
110 |
+
$name = "", $packageCurrency = "",$baseCurrency = "",
|
111 |
+
$storeBaseCurrency = "", $storeCurrentCurrency = "", $storePrice = 0.0, $taxInclBasePrice = 0.0,
|
112 |
+
$taxInclStorePrice = 0.0, $taxPercentage = 0.0, $type = "",
|
113 |
+
$attributes = array(), $legacyAttributes = array(), $additionalAttributes = array())
|
114 |
+
{
|
115 |
+
$this->additionalAttributes = $additionalAttributes;
|
116 |
+
$this->attributes = $attributes;
|
117 |
+
$this->baseCurrency = $baseCurrency;
|
118 |
+
$this->basePrice = $basePrice;
|
119 |
+
$this->baseRowTotal = $baseRowTotal;
|
120 |
+
$this->discountAmount = $discountAmount;
|
121 |
+
$this->discountPercent = $discountPercent;
|
122 |
+
$this->discountedBasePrice = $discountedBasePrice;
|
123 |
+
$this->discountedStorePrice = $discountedStorePrice;
|
124 |
+
$this->discountedTaxInclBasePrice = $discountedTaxInclBasePrice;
|
125 |
+
$this->discountedTaxInclStorePrice = $discountedTaxInclStorePrice;
|
126 |
+
$this->fixedPrice = $fixedPrice;
|
127 |
+
$this->fixedWeight = $fixedWeight;
|
128 |
+
$this->freeMethodWeight = $freeMethodWeight;
|
129 |
+
$this->freeShipping = $freeShipping;
|
130 |
+
$this->id = $id;
|
131 |
+
$this->items = $items;
|
132 |
+
$this->legacyAttributes = $legacyAttributes;
|
133 |
+
$this->name = $name;
|
134 |
+
$this->packageCurrency = $packageCurrency;
|
135 |
+
$this->qty = $qty;
|
136 |
+
$this->rowTotal = $rowTotal;
|
137 |
+
$this->storeBaseCurrency = $storeBaseCurrency;
|
138 |
+
$this->storeCurrentCurrency = $storeCurrentCurrency;
|
139 |
+
$this->storePrice = $storePrice;
|
140 |
+
$this->taxInclBasePrice = $taxInclBasePrice;
|
141 |
+
$this->taxInclStorePrice = $taxInclStorePrice;
|
142 |
+
$this->taxPercentage = $taxPercentage;
|
143 |
+
$this->type = $type;
|
144 |
+
$this->weight = $weight;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @param array $additionalAttributes
|
149 |
+
*/
|
150 |
+
public function setAdditionalAttributes($additionalAttributes)
|
151 |
+
{
|
152 |
+
$this->additionalAttributes = $additionalAttributes;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @return array
|
157 |
+
*/
|
158 |
+
public function getAdditionalAttributes()
|
159 |
+
{
|
160 |
+
return $this->additionalAttributes;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* @param array $attributes
|
165 |
+
*/
|
166 |
+
public function setAttributes($attributes)
|
167 |
+
{
|
168 |
+
$this->attributes = $attributes;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @return array
|
173 |
+
*/
|
174 |
+
public function getAttributes()
|
175 |
+
{
|
176 |
+
return $this->attributes;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* @param mixed $baseCurrency
|
181 |
+
*/
|
182 |
+
public function setBaseCurrency($baseCurrency)
|
183 |
+
{
|
184 |
+
$this->baseCurrency = $baseCurrency;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* @return mixed
|
189 |
+
*/
|
190 |
+
public function getBaseCurrency()
|
191 |
+
{
|
192 |
+
return $this->baseCurrency;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @param float $basePrice
|
197 |
+
*/
|
198 |
+
public function setBasePrice($basePrice)
|
199 |
+
{
|
200 |
+
$this->basePrice = $basePrice;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* @return float
|
205 |
+
*/
|
206 |
+
public function getBasePrice()
|
207 |
+
{
|
208 |
+
return $this->basePrice;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @param float $baseRowTotal
|
213 |
+
*/
|
214 |
+
public function setBaseRowTotal($baseRowTotal)
|
215 |
+
{
|
216 |
+
$this->baseRowTotal = $baseRowTotal;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* @return float
|
221 |
+
*/
|
222 |
+
public function getBaseRowTotal()
|
223 |
+
{
|
224 |
+
return $this->baseRowTotal;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* @param float $discountAmount
|
229 |
+
*/
|
230 |
+
public function setDiscountAmount($discountAmount)
|
231 |
+
{
|
232 |
+
$this->discountAmount = $discountAmount;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* @return float
|
237 |
+
*/
|
238 |
+
public function getDiscountAmount()
|
239 |
+
{
|
240 |
+
return $this->discountAmount;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* @param float $discountPercent
|
245 |
+
*/
|
246 |
+
public function setDiscountPercent($discountPercent)
|
247 |
+
{
|
248 |
+
$this->discountPercent = $discountPercent;
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* @return float
|
253 |
+
*/
|
254 |
+
public function getDiscountPercent()
|
255 |
+
{
|
256 |
+
return $this->discountPercent;
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* @param float $discountedBasePrice
|
261 |
+
*/
|
262 |
+
public function setDiscountedBasePrice($discountedBasePrice)
|
263 |
+
{
|
264 |
+
$this->discountedBasePrice = $discountedBasePrice;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* @return float
|
269 |
+
*/
|
270 |
+
public function getDiscountedBasePrice()
|
271 |
+
{
|
272 |
+
return $this->discountedBasePrice;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* @param float $discountedStorePrice
|
277 |
+
*/
|
278 |
+
public function setDiscountedStorePrice($discountedStorePrice)
|
279 |
+
{
|
280 |
+
$this->discountedStorePrice = $discountedStorePrice;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* @return float
|
285 |
+
*/
|
286 |
+
public function getDiscountedStorePrice()
|
287 |
+
{
|
288 |
+
return $this->discountedStorePrice;
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* @param float $discountedTaxInclBasePrice
|
293 |
+
*/
|
294 |
+
public function setDiscountedTaxInclBasePrice($discountedTaxInclBasePrice)
|
295 |
+
{
|
296 |
+
$this->discountedTaxInclBasePrice = $discountedTaxInclBasePrice;
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* @return float
|
301 |
+
*/
|
302 |
+
public function getDiscountedTaxInclBasePrice()
|
303 |
+
{
|
304 |
+
return $this->discountedTaxInclBasePrice;
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* @param float $discountedTaxInclStorePrice
|
309 |
+
*/
|
310 |
+
public function setDiscountedTaxInclStorePrice($discountedTaxInclStorePrice)
|
311 |
+
{
|
312 |
+
$this->discountedTaxInclStorePrice = $discountedTaxInclStorePrice;
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* @return float
|
317 |
+
*/
|
318 |
+
public function getDiscountedTaxInclStorePrice()
|
319 |
+
{
|
320 |
+
return $this->discountedTaxInclStorePrice;
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* @param boolean $fixedPrice
|
325 |
+
*/
|
326 |
+
public function setFixedPrice($fixedPrice)
|
327 |
+
{
|
328 |
+
$this->fixedPrice = $fixedPrice;
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* @return boolean
|
333 |
+
*/
|
334 |
+
public function getFixedPrice()
|
335 |
+
{
|
336 |
+
return $this->fixedPrice;
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* @param boolean $fixedWeight
|
341 |
+
*/
|
342 |
+
public function setFixedWeight($fixedWeight)
|
343 |
+
{
|
344 |
+
$this->fixedWeight = $fixedWeight;
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* @return boolean
|
349 |
+
*/
|
350 |
+
public function getFixedWeight()
|
351 |
+
{
|
352 |
+
return $this->fixedWeight;
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* @param float $freeMethodWeight
|
357 |
+
*/
|
358 |
+
public function setFreeMethodWeight($freeMethodWeight)
|
359 |
+
{
|
360 |
+
$this->freeMethodWeight = $freeMethodWeight;
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* @return float
|
365 |
+
*/
|
366 |
+
public function getFreeMethodWeight()
|
367 |
+
{
|
368 |
+
return $this->freeMethodWeight;
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* @param boolean $freeShipping
|
373 |
+
*/
|
374 |
+
public function setFreeShipping($freeShipping)
|
375 |
+
{
|
376 |
+
$this->freeShipping = $freeShipping;
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* @return boolean
|
381 |
+
*/
|
382 |
+
public function getFreeShipping()
|
383 |
+
{
|
384 |
+
return $this->freeShipping;
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* @param int $id
|
389 |
+
*/
|
390 |
+
public function setId($id)
|
391 |
+
{
|
392 |
+
$this->id = $id;
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* @return int
|
397 |
+
*/
|
398 |
+
public function getId()
|
399 |
+
{
|
400 |
+
return $this->id;
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* @param array $items
|
405 |
+
*/
|
406 |
+
public function setItems($items)
|
407 |
+
{
|
408 |
+
$this->items = $items;
|
409 |
+
}
|
410 |
+
|
411 |
+
/**
|
412 |
+
* @return array
|
413 |
+
*/
|
414 |
+
public function getItems()
|
415 |
+
{
|
416 |
+
return $this->items;
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* @param array $legacyAttributes
|
421 |
+
*/
|
422 |
+
public function setLegacyAttributes($legacyAttributes)
|
423 |
+
{
|
424 |
+
$this->legacyAttributes = $legacyAttributes;
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* @return array
|
429 |
+
*/
|
430 |
+
public function getLegacyAttributes()
|
431 |
+
{
|
432 |
+
return $this->legacyAttributes;
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* @param mixed $name
|
437 |
+
*/
|
438 |
+
public function setName($name)
|
439 |
+
{
|
440 |
+
$this->name = $name;
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* @return mixed
|
445 |
+
*/
|
446 |
+
public function getName()
|
447 |
+
{
|
448 |
+
return $this->name;
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* @param mixed $packageCurrency
|
453 |
+
*/
|
454 |
+
public function setPackageCurrency($packageCurrency)
|
455 |
+
{
|
456 |
+
$this->packageCurrency = $packageCurrency;
|
457 |
+
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* @return mixed
|
461 |
+
*/
|
462 |
+
public function getPackageCurrency()
|
463 |
+
{
|
464 |
+
return $this->packageCurrency;
|
465 |
+
}
|
466 |
+
|
467 |
+
/**
|
468 |
+
* @param int $qty
|
469 |
+
*/
|
470 |
+
public function setQty($qty)
|
471 |
+
{
|
472 |
+
$this->qty = $qty;
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* @return int
|
477 |
+
*/
|
478 |
+
public function getQty()
|
479 |
+
{
|
480 |
+
return $this->qty;
|
481 |
+
}
|
482 |
+
|
483 |
+
/**
|
484 |
+
* @param int $rowTotal
|
485 |
+
*/
|
486 |
+
public function setRowTotal($rowTotal)
|
487 |
+
{
|
488 |
+
$this->rowTotal = $rowTotal;
|
489 |
+
}
|
490 |
+
|
491 |
+
/**
|
492 |
+
* @return int
|
493 |
+
*/
|
494 |
+
public function getRowTotal()
|
495 |
+
{
|
496 |
+
return $this->rowTotal;
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* @param mixed $storeBaseCurrency
|
501 |
+
*/
|
502 |
+
public function setStoreBaseCurrency($storeBaseCurrency)
|
503 |
+
{
|
504 |
+
$this->storeBaseCurrency = $storeBaseCurrency;
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* @return mixed
|
509 |
+
*/
|
510 |
+
public function getStoreBaseCurrency()
|
511 |
+
{
|
512 |
+
return $this->storeBaseCurrency;
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* @param mixed $storeCurrentCurrency
|
517 |
+
*/
|
518 |
+
public function setStoreCurrentCurrency($storeCurrentCurrency)
|
519 |
+
{
|
520 |
+
$this->storeCurrentCurrency = $storeCurrentCurrency;
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* @return mixed
|
525 |
+
*/
|
526 |
+
public function getStoreCurrentCurrency()
|
527 |
+
{
|
528 |
+
return $this->storeCurrentCurrency;
|
529 |
+
}
|
530 |
+
|
531 |
+
/**
|
532 |
+
* @param float $storePrice
|
533 |
+
*/
|
534 |
+
public function setStorePrice($storePrice)
|
535 |
+
{
|
536 |
+
$this->storePrice = $storePrice;
|
537 |
+
}
|
538 |
+
|
539 |
+
/**
|
540 |
+
* @return float
|
541 |
+
*/
|
542 |
+
public function getStorePrice()
|
543 |
+
{
|
544 |
+
return $this->storePrice;
|
545 |
+
}
|
546 |
+
|
547 |
+
/**
|
548 |
+
* @param float $taxInclBasePrice
|
549 |
+
*/
|
550 |
+
public function setTaxInclBasePrice($taxInclBasePrice)
|
551 |
+
{
|
552 |
+
$this->taxInclBasePrice = $taxInclBasePrice;
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
* @return float
|
557 |
+
*/
|
558 |
+
public function getTaxInclBasePrice()
|
559 |
+
{
|
560 |
+
return $this->taxInclBasePrice;
|
561 |
+
}
|
562 |
+
|
563 |
+
/**
|
564 |
+
* @param float $taxInclStorePrice
|
565 |
+
*/
|
566 |
+
public function setTaxInclStorePrice($taxInclStorePrice)
|
567 |
+
{
|
568 |
+
$this->taxInclStorePrice = $taxInclStorePrice;
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* @return float
|
573 |
+
*/
|
574 |
+
public function getTaxInclStorePrice()
|
575 |
+
{
|
576 |
+
return $this->taxInclStorePrice;
|
577 |
+
}
|
578 |
+
|
579 |
+
/**
|
580 |
+
* @param float $taxPercentage
|
581 |
+
*/
|
582 |
+
public function setTaxPercentage($taxPercentage)
|
583 |
+
{
|
584 |
+
$this->taxPercentage = $taxPercentage;
|
585 |
+
}
|
586 |
+
|
587 |
+
/**
|
588 |
+
* @return float
|
589 |
+
*/
|
590 |
+
public function getTaxPercentage()
|
591 |
+
{
|
592 |
+
return $this->taxPercentage;
|
593 |
+
}
|
594 |
+
|
595 |
+
/**
|
596 |
+
* @param mixed $type
|
597 |
+
*/
|
598 |
+
public function setType($type)
|
599 |
+
{
|
600 |
+
$this->type = $type;
|
601 |
+
}
|
602 |
+
|
603 |
+
/**
|
604 |
+
* @return mixed
|
605 |
+
*/
|
606 |
+
public function getType()
|
607 |
+
{
|
608 |
+
return $this->type;
|
609 |
+
}
|
610 |
+
|
611 |
+
/**
|
612 |
+
* @param float $weight
|
613 |
+
*/
|
614 |
+
public function setWeight($weight)
|
615 |
+
{
|
616 |
+
$this->weight = $weight;
|
617 |
+
}
|
618 |
+
|
619 |
+
/**
|
620 |
+
* @return float
|
621 |
+
*/
|
622 |
+
public function getWeight()
|
623 |
+
{
|
624 |
+
return $this->weight;
|
625 |
+
}
|
626 |
+
|
627 |
+
|
628 |
+
}
|
lib/ShipperHQ/Checkout/ItemAttribute.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
namespace ShipperHQ\Checkout;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class ItemAttribute
|
34 |
+
*
|
35 |
+
* @package ShipperHQ\Checkout
|
36 |
+
*/
|
37 |
+
class ItemAttribute {
|
38 |
+
|
39 |
+
public $name;
|
40 |
+
public $value;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param string $name
|
44 |
+
* @param string $value
|
45 |
+
*/
|
46 |
+
function __construct($name = "", $value = "")
|
47 |
+
{
|
48 |
+
$this->name = $name;
|
49 |
+
$this->value = $value;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @param string $name
|
54 |
+
*/
|
55 |
+
public function setName($name)
|
56 |
+
{
|
57 |
+
$this->name = $name;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getName()
|
64 |
+
{
|
65 |
+
return $this->name;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @param string $value
|
70 |
+
*/
|
71 |
+
public function setValue($value)
|
72 |
+
{
|
73 |
+
$this->value = $value;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function getValue()
|
80 |
+
{
|
81 |
+
return $this->value;
|
82 |
+
}
|
83 |
+
}
|
lib/ShipperHQ/README.md
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
ShipperHQClientLib
|
2 |
+
==================
|
3 |
+
|
4 |
+
This repository contains all the libraries shared across different e-commerce platform implementations of ShipperHQ. This repository should be used as git submodule in any ShipperHQ implementation.
|
lib/ShipperHQ/Shipping/Accessorials.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
namespace ShipperHQ\Shipping;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class Accessorials
|
34 |
+
*
|
35 |
+
* @package ShipperHQ\Shipping
|
36 |
+
*/
|
37 |
+
class Accessorials {
|
38 |
+
|
39 |
+
public $liftgateRequired;
|
40 |
+
|
41 |
+
function __construct($liftgateRequired = null)
|
42 |
+
{
|
43 |
+
$this->liftgateRequired = $liftgateRequired;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param mixed $liftgateRequired
|
48 |
+
*/
|
49 |
+
public function setLiftgateRequired($liftgateRequired)
|
50 |
+
{
|
51 |
+
$this->liftgateRequired = $liftgateRequired;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return mixed
|
56 |
+
*/
|
57 |
+
public function getLiftgateRequired()
|
58 |
+
{
|
59 |
+
return $this->liftgateRequired;
|
60 |
+
}
|
61 |
+
}
|
lib/ShipperHQ/Shipping/Address.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
namespace ShipperHQ\Shipping;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class Address
|
34 |
+
*
|
35 |
+
* @package ShipperHQ\Shipping
|
36 |
+
*/
|
37 |
+
class Address
|
38 |
+
{
|
39 |
+
|
40 |
+
public $country;
|
41 |
+
public $region;
|
42 |
+
public $city;
|
43 |
+
public $street;
|
44 |
+
public $street2;
|
45 |
+
public $zipcode;
|
46 |
+
public $residential;
|
47 |
+
public $accessorials;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param Accessorials $accessorials
|
51 |
+
* @param null $city
|
52 |
+
* @param null $country
|
53 |
+
* @param null $region
|
54 |
+
* @param null $residential
|
55 |
+
* @param null $street
|
56 |
+
* @param null $street2
|
57 |
+
* @param null $zipcode
|
58 |
+
*/
|
59 |
+
function __construct(\ShipperHQ\Shipping\Accessorials $accessorials = null, $city = null, $country = null, $region = null,
|
60 |
+
$residential = null, $street = null, $street2 = null, $zipcode = null)
|
61 |
+
{
|
62 |
+
$this->accessorials = $accessorials;
|
63 |
+
$this->city = $city;
|
64 |
+
$this->country = $country;
|
65 |
+
$this->region = $region;
|
66 |
+
$this->residential = $residential;
|
67 |
+
$this->street = $street;
|
68 |
+
$this->street2 = $street2;
|
69 |
+
$this->zipcode = $zipcode;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @param mixed zipcode
|
74 |
+
*/
|
75 |
+
public function setZipcode($zipcode)
|
76 |
+
{
|
77 |
+
$this->zipcode = $zipcode;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @return mixed
|
82 |
+
*/
|
83 |
+
public function getZipcode()
|
84 |
+
{
|
85 |
+
return $this->zipcode;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param Accessorials $accessorials
|
90 |
+
*/
|
91 |
+
public function setAccessorials(\ShipperHQ\Shipping\Accessorials $accessorials)
|
92 |
+
{
|
93 |
+
$this->accessorials = $accessorials;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @return Accessorials
|
98 |
+
*/
|
99 |
+
public function getAccessorials()
|
100 |
+
{
|
101 |
+
return $this->accessorials;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @param mixed $city
|
106 |
+
*/
|
107 |
+
public function setCity($city)
|
108 |
+
{
|
109 |
+
$this->city = $city;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @return mixed
|
114 |
+
*/
|
115 |
+
public function getCity()
|
116 |
+
{
|
117 |
+
return $this->city;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @param mixed $country
|
122 |
+
*/
|
123 |
+
public function setCountry($country)
|
124 |
+
{
|
125 |
+
$this->country = $country;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @return mixed
|
130 |
+
*/
|
131 |
+
public function getCountry()
|
132 |
+
{
|
133 |
+
return $this->country;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @param mixed $region
|
138 |
+
*/
|
139 |
+
public function setRegion($region)
|
140 |
+
{
|
141 |
+
$this->region = $region;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @return mixed
|
146 |
+
*/
|
147 |
+
public function getRegion()
|
148 |
+
{
|
149 |
+
return $this->region;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @param mixed $residential
|
154 |
+
*/
|
155 |
+
public function setResidential($residential)
|
156 |
+
{
|
157 |
+
$this->residential = $residential;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @return mixed
|
162 |
+
*/
|
163 |
+
public function getResidential()
|
164 |
+
{
|
165 |
+
return $this->residential;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @param mixed $street
|
170 |
+
*/
|
171 |
+
public function setStreet($street)
|
172 |
+
{
|
173 |
+
$this->street = $street;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @return mixed
|
178 |
+
*/
|
179 |
+
public function getStreet()
|
180 |
+
{
|
181 |
+
return $this->street;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @param mixed $street2
|
186 |
+
*/
|
187 |
+
public function setStreet2($street2)
|
188 |
+
{
|
189 |
+
$this->street2 = $street2;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @return mixed
|
194 |
+
*/
|
195 |
+
public function getStreet2()
|
196 |
+
{
|
197 |
+
return $this->street2;
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
}
|
lib/ShipperHQ/User/Credentials.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
namespace ShipperHQ\User;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class Credentials
|
34 |
+
*
|
35 |
+
* @package ShipperHQ\User
|
36 |
+
*/
|
37 |
+
class Credentials
|
38 |
+
{
|
39 |
+
public $userId;
|
40 |
+
public $password;
|
41 |
+
public $apiKey;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @param null $apiKey
|
45 |
+
* @param null $password
|
46 |
+
* @param null $userId
|
47 |
+
*/
|
48 |
+
function __construct($apiKey = null, $password = null, $userId = null)
|
49 |
+
{
|
50 |
+
$this->apiKey = $apiKey;
|
51 |
+
$this->password = $password;
|
52 |
+
$this->userId = $userId;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @param mixed $apiKey
|
57 |
+
*/
|
58 |
+
public function setApiKey($apiKey)
|
59 |
+
{
|
60 |
+
$this->apiKey = $apiKey;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @return mixed
|
65 |
+
*/
|
66 |
+
public function getApiKey()
|
67 |
+
{
|
68 |
+
return $this->apiKey;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @param mixed $password
|
73 |
+
*/
|
74 |
+
public function setPassword($password)
|
75 |
+
{
|
76 |
+
$this->password = $password;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @return mixed
|
81 |
+
*/
|
82 |
+
public function getPassword()
|
83 |
+
{
|
84 |
+
return $this->password;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @param mixed $userId
|
89 |
+
*/
|
90 |
+
public function setUserId($userId)
|
91 |
+
{
|
92 |
+
$this->userId = $userId;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @return mixed
|
97 |
+
*/
|
98 |
+
public function getUserId()
|
99 |
+
{
|
100 |
+
return $this->userId;
|
101 |
+
}
|
102 |
+
}
|
lib/ShipperHQ/User/SiteDetails.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Webshopapps Shipping Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Shipper HQ Shipping
|
23 |
+
*
|
24 |
+
* @category ShipperHQ
|
25 |
+
* @package ShipperHQ_Shipping_Carrier
|
26 |
+
* @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author ShipperHQ Team sales@shipperhq.com
|
29 |
+
*/
|
30 |
+
namespace ShipperHQ\User;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class SiteDetails
|
34 |
+
*
|
35 |
+
* @package ShipperHQ\User
|
36 |
+
*/
|
37 |
+
class SiteDetails
|
38 |
+
{
|
39 |
+
public $ecommerceCart;
|
40 |
+
public $ecommerceVersion;
|
41 |
+
public $websiteUrl;
|
42 |
+
public $environmentScope;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param null $ecommerceCart
|
46 |
+
* @param null $ecommerceVersion
|
47 |
+
* @param null $websiteUrl
|
48 |
+
*/
|
49 |
+
function __construct($ecommerceCart = null, $ecommerceVersion = null, $websiteUrl = null, $environmentScope = null)
|
50 |
+
{
|
51 |
+
$this->ecommerceCart = $ecommerceCart;
|
52 |
+
$this->ecommerceVersion = $ecommerceVersion;
|
53 |
+
$this->websiteUrl = $websiteUrl;
|
54 |
+
$this->environmentScope = $environmentScope;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param mixed $ecommerceCart
|
59 |
+
*/
|
60 |
+
public function setEcommerceCart($ecommerceCart)
|
61 |
+
{
|
62 |
+
$this->ecommerceCart = $ecommerceCart;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @return mixed
|
67 |
+
*/
|
68 |
+
public function getEcommerceCart()
|
69 |
+
{
|
70 |
+
return $this->ecommerceCart;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @param mixed $ecommerceVersion
|
75 |
+
*/
|
76 |
+
public function setEcommerceVersion($ecommerceVersion)
|
77 |
+
{
|
78 |
+
$this->ecommerceVersion = $ecommerceVersion;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @return mixed
|
83 |
+
*/
|
84 |
+
public function getEcommerceVersion()
|
85 |
+
{
|
86 |
+
return $this->ecommerceVersion;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param mixed $websiteUrl
|
91 |
+
*/
|
92 |
+
public function setWebsiteUrl($websiteUrl)
|
93 |
+
{
|
94 |
+
$this->websiteUrl = $websiteUrl;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @return mixed
|
99 |
+
*/
|
100 |
+
public function getWebsiteUrl()
|
101 |
+
{
|
102 |
+
return $this->websiteUrl;
|
103 |
+
}
|
104 |
+
|
105 |
+
public function setEnvironmentScope($environmentScope)
|
106 |
+
{
|
107 |
+
$this->environmentScope = $environmentScope;
|
108 |
+
}
|
109 |
+
|
110 |
+
public function getEnvironmentScope()
|
111 |
+
{
|
112 |
+
return $this->environmentScope;
|
113 |
+
}
|
114 |
+
}
|
lib/ShipperHQ/WS/Client/WebServiceClient.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Client;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class WebServiceClient
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Client
|
9 |
+
*/
|
10 |
+
class WebServiceClient {
|
11 |
+
|
12 |
+
private $shipperHQWebServiceHost = "http://www.localhost.com:8080/shipperhq-ws";
|
13 |
+
private $shipperHQWebServiceVersion = 1;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param \ShipperHQ\WS\Request\WebServiceRequest $requestObj
|
17 |
+
* @param $webServicePath
|
18 |
+
* @return mixed|null
|
19 |
+
*/
|
20 |
+
public function sendAndReceive(\ShipperHQ\WS\Request\WebServiceRequest $requestObj, $webServicePath) {
|
21 |
+
|
22 |
+
$webServiceURL = $this->shipperHQWebServiceHost . "/v" . $this->shipperHQWebServiceVersion .
|
23 |
+
"/" . $webServicePath;
|
24 |
+
|
25 |
+
try {
|
26 |
+
|
27 |
+
$client = new \Zend_Http_Client();
|
28 |
+
$client->setUri($webServiceURL);
|
29 |
+
$client->setConfig(array('maxredirects'=>0, 'timeout'=>30));
|
30 |
+
$client->setRawData(json_encode($requestObj), 'application/json');
|
31 |
+
$response = $client->request(\Zend_Http_Client::POST);
|
32 |
+
$responseBody = $response->getBody();
|
33 |
+
|
34 |
+
return json_decode($responseBody, false);
|
35 |
+
}
|
36 |
+
catch (\Exception $e) {
|
37 |
+
$debugData['error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
|
38 |
+
}
|
39 |
+
return null;
|
40 |
+
}
|
41 |
+
}
|
lib/ShipperHQ/WS/Request/AbstractWebServiceRequest.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Request;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class AbstractWebServiceRequest
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Request
|
9 |
+
*/
|
10 |
+
abstract class AbstractWebServiceRequest implements \ShipperHQ\WS\Request\WebServiceRequest
|
11 |
+
{
|
12 |
+
|
13 |
+
public $credentials;
|
14 |
+
public $siteDetails;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return mixed
|
18 |
+
*/
|
19 |
+
function getCredentials()
|
20 |
+
{
|
21 |
+
return $this->credentials;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param \ShipperHQ\User\Credentials $credentials
|
26 |
+
*/
|
27 |
+
function setCredentials(\ShipperHQ\User\Credentials $credentials)
|
28 |
+
{
|
29 |
+
$this->credentials = $credentials;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @return mixed
|
34 |
+
*/
|
35 |
+
function getSiteDetails()
|
36 |
+
{
|
37 |
+
return $this->siteDetails;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @param \ShipperHQ\User\SiteDetails $siteDetails
|
42 |
+
*/
|
43 |
+
function setSiteDetails(\ShipperHQ\User\SiteDetails $siteDetails)
|
44 |
+
{
|
45 |
+
$this->siteDetails = $siteDetails;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
lib/ShipperHQ/WS/Request/Rate/RateRequest.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Request\Rate;
|
4 |
+
use ShipperHQ\Shipping\Address;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class RateRequest
|
8 |
+
*
|
9 |
+
* @package ShipperHQ\WS\Request\Rate
|
10 |
+
*/
|
11 |
+
class RateRequest extends \ShipperHQ\WS\Request\AbstractWebServiceRequest implements \ShipperHQ\WS\Request\WebServiceRequest
|
12 |
+
{
|
13 |
+
|
14 |
+
public $cart;
|
15 |
+
public $origin;
|
16 |
+
public $destination;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @param null $cart
|
20 |
+
* @param Address $destination
|
21 |
+
* @param Address $origin
|
22 |
+
*/
|
23 |
+
function __construct($cart = null, \ShipperHQ\Shipping\Address $destination = null, \ShipperHQ\Shipping\Address $origin = null)
|
24 |
+
{
|
25 |
+
$this->cart = $cart;
|
26 |
+
$this->destination = $destination;
|
27 |
+
$this->origin = $origin;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @param mixed $cart
|
32 |
+
*/
|
33 |
+
public function setCart($cart)
|
34 |
+
{
|
35 |
+
$this->cart = $cart;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @return mixed
|
40 |
+
*/
|
41 |
+
public function getCart()
|
42 |
+
{
|
43 |
+
return $this->cart;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param Address $destination
|
48 |
+
*/
|
49 |
+
public function setDestination(\ShipperHQ\Shipping\Address $destination)
|
50 |
+
{
|
51 |
+
$this->destination = $destination;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return Address
|
56 |
+
*/
|
57 |
+
public function getDestination()
|
58 |
+
{
|
59 |
+
return $this->destination;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param Address $origin
|
64 |
+
*/
|
65 |
+
public function setOrigin(\ShipperHQ\Shipping\Address $origin)
|
66 |
+
{
|
67 |
+
$this->origin = $origin;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @return Address
|
72 |
+
*/
|
73 |
+
public function getOrigin()
|
74 |
+
{
|
75 |
+
return $this->origin;
|
76 |
+
}
|
77 |
+
}
|
lib/ShipperHQ/WS/Request/UPS/registration/UPSRegistrationRequest.php
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Request\UPS\Registration;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class UPSRegistrationRequest
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Request\UPS\Registration
|
9 |
+
*/
|
10 |
+
class UPSRegistrationRequest extends \ShipperHQ\WS\Request\AbstractWebServiceRequest implements \ShipperHQ\WS\Request\WebServiceRequest
|
11 |
+
{
|
12 |
+
public $proposedUserName;
|
13 |
+
public $proposedPassWord;
|
14 |
+
public $companyName;
|
15 |
+
public $customerName;
|
16 |
+
public $title;
|
17 |
+
public $address;
|
18 |
+
public $phoneNumber;
|
19 |
+
public $phoneExt;
|
20 |
+
public $email;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param \ShipperHQ\Shipping\Address $address
|
24 |
+
* @param null $companyName
|
25 |
+
* @param null $customerName
|
26 |
+
* @param null $email
|
27 |
+
* @param null $phoneExt
|
28 |
+
* @param null $phoneNumber
|
29 |
+
* @param null $proposedPassWord
|
30 |
+
* @param null $proposedUserName
|
31 |
+
* @param null $title
|
32 |
+
*/
|
33 |
+
function __construct(\ShipperHQ\Shipping\Address $address = null, $companyName = null, $customerName = null, $email = null,
|
34 |
+
$phoneExt = null, $phoneNumber = null, $proposedPassWord = null, $proposedUserName = null,
|
35 |
+
$title = null)
|
36 |
+
{
|
37 |
+
$this->address = $address;
|
38 |
+
$this->companyName = $companyName;
|
39 |
+
$this->customerName = $customerName;
|
40 |
+
$this->email = $email;
|
41 |
+
$this->phoneExt = $phoneExt;
|
42 |
+
$this->phoneNumber = $phoneNumber;
|
43 |
+
$this->proposedPassWord = $proposedPassWord;
|
44 |
+
$this->proposedUserName = $proposedUserName;
|
45 |
+
$this->title = $title;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param \ShipperHQ\Shipping\Address $address
|
50 |
+
*/
|
51 |
+
public function setAddress(\ShipperHQ\Shipping\Address $address)
|
52 |
+
{
|
53 |
+
$this->address = $address;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @return Address
|
58 |
+
*/
|
59 |
+
public function getAddress()
|
60 |
+
{
|
61 |
+
return $this->address;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @param mixed $companyName
|
66 |
+
*/
|
67 |
+
public function setCompanyName($companyName)
|
68 |
+
{
|
69 |
+
$this->companyName = $companyName;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function getCompanyName()
|
76 |
+
{
|
77 |
+
return $this->companyName;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @param mixed $customerName
|
82 |
+
*/
|
83 |
+
public function setCustomerName($customerName)
|
84 |
+
{
|
85 |
+
$this->customerName = $customerName;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @return mixed
|
90 |
+
*/
|
91 |
+
public function getCustomerName()
|
92 |
+
{
|
93 |
+
return $this->customerName;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @param mixed $email
|
98 |
+
*/
|
99 |
+
public function setEmail($email)
|
100 |
+
{
|
101 |
+
$this->email = $email;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @return mixed
|
106 |
+
*/
|
107 |
+
public function getEmail()
|
108 |
+
{
|
109 |
+
return $this->email;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @param mixed $phoneExt
|
114 |
+
*/
|
115 |
+
public function setPhoneExt($phoneExt)
|
116 |
+
{
|
117 |
+
$this->phoneExt = $phoneExt;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @return mixed
|
122 |
+
*/
|
123 |
+
public function getPhoneExt()
|
124 |
+
{
|
125 |
+
return $this->phoneExt;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @param mixed $phoneNumber
|
130 |
+
*/
|
131 |
+
public function setPhoneNumber($phoneNumber)
|
132 |
+
{
|
133 |
+
$this->phoneNumber = $phoneNumber;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @return mixed
|
138 |
+
*/
|
139 |
+
public function getPhoneNumber()
|
140 |
+
{
|
141 |
+
return $this->phoneNumber;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @param mixed $proposedPassWord
|
146 |
+
*/
|
147 |
+
public function setProposedPassWord($proposedPassWord)
|
148 |
+
{
|
149 |
+
$this->proposedPassWord = $proposedPassWord;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @return mixed
|
154 |
+
*/
|
155 |
+
public function getProposedPassWord()
|
156 |
+
{
|
157 |
+
return $this->proposedPassWord;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @param mixed $proposedUserName
|
162 |
+
*/
|
163 |
+
public function setProposedUserName($proposedUserName)
|
164 |
+
{
|
165 |
+
$this->proposedUserName = $proposedUserName;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @return mixed
|
170 |
+
*/
|
171 |
+
public function getProposedUserName()
|
172 |
+
{
|
173 |
+
return $this->proposedUserName;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param mixed $title
|
178 |
+
*/
|
179 |
+
public function setTitle($title)
|
180 |
+
{
|
181 |
+
$this->title = $title;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @return mixed
|
186 |
+
*/
|
187 |
+
public function getTitle()
|
188 |
+
{
|
189 |
+
return $this->title;
|
190 |
+
}
|
191 |
+
}
|
lib/ShipperHQ/WS/Request/WebServiceRequest.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Request;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Interface WebServiceRequest
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Request
|
9 |
+
*/
|
10 |
+
interface WebServiceRequest
|
11 |
+
{
|
12 |
+
|
13 |
+
function getCredentials();
|
14 |
+
|
15 |
+
function setCredentials(\ShipperHQ\User\Credentials $credentials);
|
16 |
+
|
17 |
+
function getSiteDetails();
|
18 |
+
|
19 |
+
function setSiteDetails(\ShipperHQ\User\SiteDetails $siteDetails);
|
20 |
+
}
|
lib/ShipperHQ/WS/Response/AbstractWebServiceResponse.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Response;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class AbstractWebServiceResponse
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Response
|
9 |
+
*/
|
10 |
+
abstract class AbstractWebServiceResponse implements \ShipperHQ\WS\Response\WebServiceResponse
|
11 |
+
{
|
12 |
+
public $errors = array();
|
13 |
+
public $responseSummary;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param ResponseSummary $responseSummary
|
17 |
+
* @param array $errors
|
18 |
+
*/
|
19 |
+
function __construct(\ShipperHQ\WS\Response\ResponseSummary $responseSummary = null, array $errors = array())
|
20 |
+
{
|
21 |
+
$this->responseSummary = $responseSummary;
|
22 |
+
$this->errors = $errors;
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @param array $errors
|
27 |
+
*/
|
28 |
+
public function setErrors(array $errors)
|
29 |
+
{
|
30 |
+
$this->errors = $errors;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @return array
|
35 |
+
*/
|
36 |
+
public function getErrors()
|
37 |
+
{
|
38 |
+
return $this->errors;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param \ShipperHQ\WS\Response\ResponseSummary $responseSummary
|
43 |
+
*/
|
44 |
+
public function setResponseSummary(\ShipperHQ\WS\Response\ResponseSummary $responseSummary)
|
45 |
+
{
|
46 |
+
$this->responseSummary = $responseSummary;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @return \ShipperHQ\WS\Response\ResponseSummary
|
51 |
+
*/
|
52 |
+
public function getResponseSummary()
|
53 |
+
{
|
54 |
+
return $this->responseSummary;
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
}
|
59 |
+
|
lib/ShipperHQ/WS/Response/ResponseSummary.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Response;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class ResponseSummary
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Response
|
9 |
+
*/
|
10 |
+
class ResponseSummary {
|
11 |
+
|
12 |
+
public $date;
|
13 |
+
public $version;
|
14 |
+
public $status;
|
15 |
+
|
16 |
+
function __construct($date = 0, $status = -1, $version = "")
|
17 |
+
{
|
18 |
+
$this->date = $date;
|
19 |
+
$this->status = $status;
|
20 |
+
$this->version = $version;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param int $date
|
25 |
+
*/
|
26 |
+
public function setDate($date)
|
27 |
+
{
|
28 |
+
$this->date = $date;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @return int
|
33 |
+
*/
|
34 |
+
public function getDate()
|
35 |
+
{
|
36 |
+
return $this->date;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @param mixed $status
|
41 |
+
*/
|
42 |
+
public function setStatus($status)
|
43 |
+
{
|
44 |
+
$this->status = $status;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return mixed
|
49 |
+
*/
|
50 |
+
public function getStatus()
|
51 |
+
{
|
52 |
+
return $this->status;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @param string $version
|
57 |
+
*/
|
58 |
+
public function setVersion($version)
|
59 |
+
{
|
60 |
+
$this->version = $version;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function getVersion()
|
67 |
+
{
|
68 |
+
return $this->version;
|
69 |
+
}
|
70 |
+
}
|
lib/ShipperHQ/WS/Response/UPS/Registration/UPSRegistrationResponse.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Response\UPS\Registration;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class UPSRegistrationResponse
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Response\UPS\Registration
|
9 |
+
*/
|
10 |
+
class UPSRegistrationResponse extends \ShipperHQ\WS\Response\AbstractWebServiceResponse implements \ShipperHQ\WS\Response\WebServiceResponse
|
11 |
+
{
|
12 |
+
|
13 |
+
}
|
lib/ShipperHQ/WS/Response/WebServiceError.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Response;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class WebServiceError
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Response
|
9 |
+
*/
|
10 |
+
class WebServiceError {
|
11 |
+
|
12 |
+
public $errorCode;
|
13 |
+
public $description;
|
14 |
+
public $errorMessage;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @param $description
|
18 |
+
* @param $errorCode
|
19 |
+
* @param $errorMessage
|
20 |
+
*/
|
21 |
+
function __construct($description = "", $errorCode = -1, $errorMessage = "")
|
22 |
+
{
|
23 |
+
$this->description = $description;
|
24 |
+
$this->errorCode = $errorCode;
|
25 |
+
$this->errorMessage = $errorMessage;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @param string $description
|
30 |
+
*/
|
31 |
+
public function setDescription($description)
|
32 |
+
{
|
33 |
+
$this->description = $description;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getDescription()
|
40 |
+
{
|
41 |
+
return $this->description;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param int $errorCode
|
46 |
+
*/
|
47 |
+
public function setErrorCode($errorCode)
|
48 |
+
{
|
49 |
+
$this->errorCode = $errorCode;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return int
|
54 |
+
*/
|
55 |
+
public function getErrorCode()
|
56 |
+
{
|
57 |
+
return $this->errorCode;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @param string $errorMessage
|
62 |
+
*/
|
63 |
+
public function setErrorMessage($errorMessage)
|
64 |
+
{
|
65 |
+
$this->errorMessage = $errorMessage;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
+
public function getErrorMessage()
|
72 |
+
{
|
73 |
+
return $this->errorMessage;
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
lib/ShipperHQ/WS/Response/WebServiceResponse.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ShipperHQ\WS\Response;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Interface WebServiceResponse
|
7 |
+
*
|
8 |
+
* @package ShipperHQ\WS\Response
|
9 |
+
*/
|
10 |
+
interface WebServiceResponse
|
11 |
+
{
|
12 |
+
function getErrors();
|
13 |
+
function setErrors(array $errors);
|
14 |
+
function getResponseSummary();
|
15 |
+
function setResponseSummary(\ShipperHQ\WS\Response\ResponseSummary $responseSummary);
|
16 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>WebShopApps_DespatchBay</name>
|
4 |
+
<version>1.0.5</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Despatch Bay</summary>
|
10 |
+
<description>Despatch Bay</description>
|
11 |
+
<notes>Changed attribute within the shipment request</notes>
|
12 |
+
<authors><author><name>Karen Baker</name><user>birches</user><email>sales@webshopapps.com</email></author></authors>
|
13 |
+
<date>2014-06-06</date>
|
14 |
+
<time>15:29:18</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Webshopapps"><dir name="Adminshortcut"><dir name="Helper"><file name="Data.php" hash="e0b3d57fb624622b400e601f2229e991"/></dir><file name="changelog.txt" hash="0716b4fd8f070dd826fa9ccd4577bc2c"/><dir name="etc"><file name="adminhtml.xml" hash="80b231894e0108aa914715da3b42bf5e"/><file name="config.xml" hash="4222cc2209d41b89d24f47f7b7342bb7"/></dir></dir><dir name="Despatchbay"><dir name="Block"><dir name="Adminhtml"><dir name="Carrier"><file name="About.php" hash="fa4de4e2d61e3e68f85029218228e0fe"/><file name="Refreshcarriers.php" hash="8719139e606e3163dc065159d0f1663b"/></dir><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="Packaging.php" hash="90855a67545a3f2378199f79c4dfebfe"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Heading.php" hash="cf47a7b6eebfa2011efe7be8c23ad280"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8ad75441960e5f40793a282ac93e11bf"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Environmentscope.php" hash="fb74b99ed7c7932ea70b294681f806a3"/></dir></dir></dir></dir><dir name="Carrier"><dir name="Convert"><file name="ShipperMapper.php" hash="7377bbe9d9dc4904246ff060e9913f56"/></dir><dir name="Despatchbay"><dir name="Source"><file name="Freemethod.php" hash="4e7105523c4b1bef440036e797b64550"/><file name="Labelformat.php" hash="c683abd1db829a8644855f34761080bb"/><file name="Method.php" hash="0fb56fccdae99f363ee53ab6dac5ae94"/></dir></dir><file name="Despatchbay.php" hash="ebe7373d221e07372efadfbf565d6653"/></dir><file name="Observer.php" hash="83d64297e766be4da664a095354ec47c"/><dir name="Shipping"><file name="Shipping.php" hash="d716a5b608d78aeea54f3a7b268fbd95"/></dir></dir><file name="changelog.txt" hash="a96928ac95d7966698f2aa564d71f33e"/><dir name="controllers"><file name="AdminhtmlController.php" hash="52e3260ba96c016097f13765b5048c8b"/><file name="ShipmentController.php" hash="9e4b7f8577e94cf960794598b336d8c4"/></dir><dir name="etc"><file name="config.xml" hash="b1b43d8505e9416287ea113ace792840"/><file name="system.xml" hash="07458b49e119a9916219dac2220001b5"/><dir name="wsdl"><dir name="Despatchbay"><file name="Shippingv11.wsdl" hash="607755a90ab25f2e7c9cd9f69eb5260c"/><file name="Trackingv11.wsdl" hash="2756fff255c83d6ba5c778acd528cf84"/></dir></dir></dir></dir><dir name="Wsacommon"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Shipping"><dir name="Method"><file name="Form.php" hash="40505c7931deadf58f30d540cbc144e3"/></dir></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Exportmatrix.php" hash="0213f43ba8166f501a70189824a32b02"/><file name="Heading.php" hash="03c7875a2ba8f92e54c407986f99bea1"/></dir></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="0505d90899d5d7b77a26aed481ca6e2f"/></dir></dir></dir><dir name="Helper"><file name="Cache.php" hash="a37af743f62c6a064f6cc4ed894f3db5"/><file name="Data.php" hash="397f5aeded3380843f0dce0215ae5fc9"/><file name="Log.php" hash="013f24cf7782dcaf80baaa3903ce516a"/><file name="Shipping.php" hash="467837b4fd2fb6cd62b7ae71ac736fe3"/><file name="Template.php" hash="48b90324df7ad81412bbb664da3256af"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><dir name="Export"><file name="Csv.php" hash="76a8101bd4e25204d57b632209269a1f"/></dir><dir name="Resource"><file name="Resource.php" hash="cfa41489dc5b8d5f29e92c87361a40df"/></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><file name="Rate.php" hash="33c825070b0731e1cc28ee370dd0b935"/></dir></dir></dir><dir name="Shipping"><dir name="Carrier"><file name="Baseabstract.php" hash="910f46519f559863d3b0c770831581be"/></dir><file name="Shipping.php" hash="f88fd8c1dd6f095327dfb510f321e971"/></dir><dir name="Usa"><dir name="Shipping"><dir name="Carrier"><file name="Ups.php" hash="039a1e1c8f56adc26f8a9befcdcbbcac"/></dir></dir></dir></dir><file name="changelog.txt" hash="375940561deda39e2904f38459375743"/><dir name="controllers"><dir name="System"><file name="ConfigController.php" hash="4f59fd0565f628d65a1b950cc6a77a91"/></dir></dir><dir name="etc"><file name="config.xml" hash="b0ebcdc9848a796ee8d096e0757bc185"/></dir></dir><dir name="Wsacommontest"><dir name="Test"><dir name="Helper"><file name="Totalstest.php" hash="8752ca8f378367cfdbea14a9bd6eba88"/><dir name="_data"><file name="fx-config.yaml" hash="a617b8be7d84b7bf19894d79b4e19736"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="982a9f2016ef5a4915183cac50c0e214"/></dir></dir><dir name="Wsalogger"><dir name="Adminhtml"><dir name="Block"><dir name="Log"><dir name="Grid"><dir name="Renderer"><file name="Actions.php" hash="473872b8e0c6b55242a47ff77bd2248d"/></dir></dir><file name="Grid.php" hash="c69c4d94766ae37a2d9a51743c40ade3"/><file name="View.php" hash="6386e92422079e1d19468b517aab6bb0"/></dir><file name="Log.php" hash="ef60b3552a6426f96af636ebd188df88"/><dir name="Notification"><dir name="Grid"><dir name="Renderer"><file name="Code.php" hash="3b0dd6a7d11fe0520b36bb92e699ebbc"/><file name="Notice.php" hash="6b95f97727f126b5a674a6cb22176978"/><file name="Severity.php" hash="7f9b5985ce5b60c57a841192e3f29a4e"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Modules"><file name="DisableLogging.php" hash="7aae4ca58f704045267c9b556c2be3e6"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f0c259638d2b85ac741716d06fab8667"/><file name="Log.php" hash="1d702e10c39f773adaa973d1181ae024"/></dir><dir name="Model"><file name="Log.php" hash="ab6a7a9431aaf7d0cc90c46c5b494818"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="f86775cc279d3e2a84006309a991e197"/></dir><file name="Log.php" hash="d3bc2f0d28ae634a7aa7bc622fc5c7fa"/></dir><file name="Observer.php" hash="58c79f3b39fa2a6f14d9fc074be02a75"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Severities.php" hash="b0f96c4ebe133ae8dbdd762a5947ff6f"/></dir></dir></dir></dir><file name="changelog.txt" hash="888b81137767d7b5eb88e6135c5afe2b"/><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="e14df6f7aec6bee299bd432d10768f11"/></dir><file name="IndexController.php" hash="adac20244d34c93051807b65ca015f9d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e919b14b61a64c22988add37cda619b5"/><file name="config.xml" hash="8327c4fedf7fea04c7477daaa0ad822e"/><file name="system.xml" hash="eab192c58f70a062a16582d2164aa4d5"/></dir><dir name="sql"><dir name="wsalogger_setup"><file name="mysql4-install-1.0.0.php" hash="32db82e8865ef799c4d4d64e7b4042e4"/><file name="mysql4-install-1.0.1.php" hash="386616525a4b4be6b2d94955e4f2ec81"/><file name="mysql4-install-1.0.2.php" hash="386616525a4b4be6b2d94955e4f2ec81"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="c0c3b4fd38f3ab92eab2b6fd0b556701"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="9f0c4f258368c9130e41f5731f27ed5b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="webshopapps_despatchbay.xml" hash="3e1f624636f0aef8605bd972356965c5"/><file name="webshopapps_wsalogger.xml" hash="804b47419205e7a73b02ca72cdbd3213"/></dir><dir name="template"><dir name="webshopapps_despatchbay"><dir name="sales"><dir name="order"><dir name="shipment"><dir name="create"><file name="items.phtml" hash="dd135466a4ecd2f628fbad5c5862067d"/></dir><dir name="view"><file name="form.phtml" hash="0ec410b9fe1fd7d0728ba2db2626cc2c"/></dir></dir></dir></dir><dir name="system"><dir name="config"><file name="refreshcarriers.phtml" hash="e39466ffa93db4ce843291bca777b1bf"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Webshopapps_Despatchbay.xml" hash="bf00af8411624b67a750fa28a22b78b1"/><file name="Webshopapps_Wsacommon.xml" hash="384a3ae94b83d7bccb3c96e0bb2d270f"/><file name="Webshopapps_Wsalogger.xml" hash="199d449ef7cf012fcfc32357de430cfd"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="webshopapps_log_email.html" hash="c85b0d27c9ecdb9c227d99cd0aaa86fb"/></dir></dir></dir></target><target name="magelib"><dir name="Shipper"><file name="Shipper.php" hash="e84f50429b11e45169bc127f8426cbfb"/></dir><dir name="ShipperHQ"><file name="CHANGELOG" hash="0987223093a0f7203a5b184953061048"/><dir name="Checkout"><file name="Cart.php" hash="3040b909017ca7728bc813791073dc66"/><file name="Item.php" hash="4e8bbe466245b2a5b6daad6bae04593d"/><file name="ItemAttribute.php" hash="ceae511d7d1d62b2821cdf5052c55109"/></dir><file name="README.md" hash="ab78ea558cbb91bf90797d8e3ba9173c"/><dir name="Shipping"><file name="Accessorials.php" hash="bf013050c4b2cca36de920511f47ecc8"/><file name="Address.php" hash="71d0341c999527e8044c09f9d73b2794"/></dir><dir name="User"><file name="Credentials.php" hash="170da58af0339680197de0ff272735e7"/><file name="SiteDetails.php" hash="041a03300c8b72ce1be5dad2021e61df"/></dir><dir name="WS"><dir name="Client"><file name="WebServiceClient.php" hash="089c3f282484f063b08f19ac94cf990d"/></dir><dir name="Request"><file name="AbstractWebServiceRequest.php" hash="91a5d5fc494a369df2d1311d342211d9"/><dir name="Rate"><file name="RateRequest.php" hash="abe02f60a330ce1f846d7b6ce9864108"/></dir><dir name="UPS"><dir name="registration"><file name="UPSRegistrationRequest.php" hash="d470c6a7cbc94e21e41ab88dbc3558d6"/></dir></dir><file name="WebServiceRequest.php" hash="e342ae20cee6a2799adfcdfa36688e2c"/></dir><dir name="Response"><file name="AbstractWebServiceResponse.php" hash="fcfccb9715bb10174f6d6fd41daf0aa4"/><file name="ResponseSummary.php" hash="98af5f450f8700308b3384fda2c7db21"/><dir name="UPS"><dir name="Registration"><file name="UPSRegistrationResponse.php" hash="7776f2a4adb472ace875a8c470a6b06a"/></dir></dir><file name="WebServiceError.php" hash="ed4e0051391c6e9cb047236273c4e048"/><file name="WebServiceResponse.php" hash="6a69713d0843cfc8dfb166b20d2d8a9f"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="wsa"><dir name="images"><file name="WSA_OfficialLogo_HorizontalLockup.png" hash="7af26aa8530ea6d99cfd7d45fbf2ec65"/><file name="WSA_OfficialLogo_Mark.png" hash="0415b6800a188d995df38bd29132ea9f"/><file name="WSA_avatar.png" hash="195395ab4de01812b90b696b6bd7466c"/><file name="despatch_bay_pro_logo.png" hash="89d7ceb06df5d7f5b17716552078e5ee"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/wsa/images/WSA_OfficialLogo_HorizontalLockup.png
ADDED
Binary file
|
skin/adminhtml/default/default/wsa/images/WSA_OfficialLogo_Mark.png
ADDED
Binary file
|
skin/adminhtml/default/default/wsa/images/WSA_avatar.png
ADDED
Binary file
|
skin/adminhtml/default/default/wsa/images/despatch_bay_pro_logo.png
ADDED
Binary file
|