WebShopApps_Cerasis - Version 1.4.1

Version Notes

Abstracted methods in preparation for book shipment and tracking logic

Download this release

Release Info

Developer Karen Baker
Extension WebShopApps_Cerasis
Version 1.4.1
Comparing to
See all releases


Version 1.4.1

Files changed (93) hide show
  1. app/code/community/Webshopapps/Cerasisfreight/Helper/Data.php +84 -0
  2. app/code/community/Webshopapps/Cerasisfreight/LICENSE.pdf +0 -0
  3. app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight.php +527 -0
  4. app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight/Source/Billingtype.php +21 -0
  5. app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight/Source/Freemethod.php +47 -0
  6. app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight/Source/Method.php +46 -0
  7. app/code/community/Webshopapps/Cerasisfreight/changelog.txt +2 -0
  8. app/code/community/Webshopapps/Cerasisfreight/etc/config.xml +116 -0
  9. app/code/community/Webshopapps/Cerasisfreight/etc/system.xml +281 -0
  10. app/code/community/Webshopapps/Cerasisfreight/sql/cerasisfreight_setup/mysql4-install-0.0.1.php +9 -0
  11. app/code/community/Webshopapps/Cerasisfreight/versions_supported.txt +1 -0
  12. app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/System/Config/Form/Field/Exportmatrix.php +59 -0
  13. app/code/community/Webshopapps/Wsacommon/Block/Adminhtml/System/Config/Form/Field/Heading.php +50 -0
  14. app/code/community/Webshopapps/Wsacommon/Block/Sales/Order/Grid.php +127 -0
  15. app/code/community/Webshopapps/Wsacommon/Helper/.DS_Store +0 -0
  16. app/code/community/Webshopapps/Wsacommon/Helper/Data.php +156 -0
  17. app/code/community/Webshopapps/Wsacommon/Helper/Log.php +123 -0
  18. app/code/community/Webshopapps/Wsacommon/Helper/Shipping.php +525 -0
  19. app/code/community/Webshopapps/Wsacommon/Model/Export/Csv.php +172 -0
  20. app/code/community/Webshopapps/Wsacommon/Model/Resource/Resource.php +62 -0
  21. app/code/community/Webshopapps/Wsacommon/Model/Shipping/Carrier/Abstract.php +152 -0
  22. app/code/community/Webshopapps/Wsacommon/Model/Shipping/Carrier/Baseabstract.php +191 -0
  23. app/code/community/Webshopapps/Wsacommon/Model/Shipping/Shipping.php +258 -0
  24. app/code/community/Webshopapps/Wsacommon/changelog.txt +78 -0
  25. app/code/community/Webshopapps/Wsacommon/controllers/System/ConfigController.php +48 -0
  26. app/code/community/Webshopapps/Wsacommon/etc/config.xml +86 -0
  27. app/code/community/Webshopapps/Wsafreightcommon/Block/Adminhtml/Sales/Order/View/Freightinfo.php +97 -0
  28. app/code/community/Webshopapps/Wsafreightcommon/Block/Checkout/Cart/Shipping.php +143 -0
  29. app/code/community/Webshopapps/Wsafreightcommon/Block/Onepage.php +67 -0
  30. app/code/community/Webshopapps/Wsafreightcommon/Block/Onepage/Progress.php +60 -0
  31. app/code/community/Webshopapps/Wsafreightcommon/Block/Onepage/Shippingextra.php +93 -0
  32. app/code/community/Webshopapps/Wsafreightcommon/Helper/Data.php +481 -0
  33. app/code/community/Webshopapps/Wsafreightcommon/LICENSE.pdf +0 -0
  34. app/code/community/Webshopapps/Wsafreightcommon/Model/Carrier/Abstract.php +372 -0
  35. app/code/community/Webshopapps/Wsafreightcommon/Model/Carrier/Freefreight.php +93 -0
  36. app/code/community/Webshopapps/Wsafreightcommon/Model/Observer.php +214 -0
  37. app/code/community/Webshopapps/Wsafreightcommon/Model/Quote/Address/Rate.php +62 -0
  38. app/code/community/Webshopapps/Wsafreightcommon/Model/Quote/Address/Total/Shipping.php +62 -0
  39. app/code/community/Webshopapps/Wsafreightcommon/Model/Shipping/Shipping.php +93 -0
  40. app/code/community/Webshopapps/Wsafreightcommon/Model/Source/Carriers.php +59 -0
  41. app/code/community/Webshopapps/Wsafreightcommon/Model/Type/Onepage.php +115 -0
  42. app/code/community/Webshopapps/Wsafreightcommon/changelog.txt +41 -0
  43. app/code/community/Webshopapps/Wsafreightcommon/controllers/Checkout/OnepageController.php +161 -0
  44. app/code/community/Webshopapps/Wsafreightcommon/etc/config.xml +247 -0
  45. app/code/community/Webshopapps/Wsafreightcommon/etc/system.xml +403 -0
  46. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.1.php +126 -0
  47. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.3.php +140 -0
  48. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.4.php +150 -0
  49. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.5.php +150 -0
  50. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.6.php +150 -0
  51. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.1-0.0.2.php +35 -0
  52. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.2-0.0.3.php +67 -0
  53. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.3-0.0.4.php +58 -0
  54. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.4-0.0.5.php +48 -0
  55. app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.5-0.0.6.php +40 -0
  56. app/code/community/Webshopapps/Wsafreightcommon/versions_supported.txt +1 -0
  57. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log.php +69 -0
  58. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/Grid.php +167 -0
  59. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/Grid/Renderer/Actions.php +81 -0
  60. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Log/View.php +51 -0
  61. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Code.php +49 -0
  62. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Notice.php +68 -0
  63. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/Notification/Grid/Renderer/Severity.php +68 -0
  64. app/code/community/Webshopapps/Wsalogger/Adminhtml/Block/System/Config/Form/Fieldset/Modules/DisableLogging.php +141 -0
  65. app/code/community/Webshopapps/Wsalogger/Helper/Data.php +76 -0
  66. app/code/community/Webshopapps/Wsalogger/Helper/Log.php +122 -0
  67. app/code/community/Webshopapps/Wsalogger/Model/Log.php +143 -0
  68. app/code/community/Webshopapps/Wsalogger/Model/Mysql4/Log.php +113 -0
  69. app/code/community/Webshopapps/Wsalogger/Model/Mysql4/Log/Collection.php +65 -0
  70. app/code/community/Webshopapps/Wsalogger/Model/Observer.php +97 -0
  71. app/code/community/Webshopapps/Wsalogger/Model/System/Config/Source/Severities.php +63 -0
  72. app/code/community/Webshopapps/Wsalogger/changelog.txt +9 -0
  73. app/code/community/Webshopapps/Wsalogger/controllers/Adminhtml/LogController.php +244 -0
  74. app/code/community/Webshopapps/Wsalogger/controllers/IndexController.php +56 -0
  75. app/code/community/Webshopapps/Wsalogger/etc/adminhtml.xml +84 -0
  76. app/code/community/Webshopapps/Wsalogger/etc/config.xml +146 -0
  77. app/code/community/Webshopapps/Wsalogger/etc/system.xml +161 -0
  78. app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.0.php +50 -0
  79. app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.1.php +52 -0
  80. app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-install-1.0.2.php +52 -0
  81. app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-upgrade-1.0.0-1.0.1.php +29 -0
  82. app/code/community/Webshopapps/Wsalogger/sql/wsalogger_setup/mysql4-upgrade-1.0.1-1.0.2.php +51 -0
  83. app/design/adminhtml/default/default/layout/webshopapps_wsafreightcommon.xml +49 -0
  84. app/design/adminhtml/default/default/layout/webshopapps_wsalogger.xml +35 -0
  85. app/design/frontend/base/default/layout/webshopapps_wsafreightcommon.xml +15 -0
  86. app/design/frontend/base/default/template/webshopapps/wsafreightcommon/checkout/cart/shipping.phtml +170 -0
  87. app/design/frontend/base/default/template/webshopapps/wsafreightcommon/onepage/shippingextra.phtml +152 -0
  88. app/etc/modules/Webshopapps_Cerasisfreight.xml +9 -0
  89. app/etc/modules/Webshopapps_Wsacommon.xml +9 -0
  90. app/etc/modules/Webshopapps_Wsafreightcommon.xml +14 -0
  91. app/etc/modules/Webshopapps_Wsalogger.xml +9 -0
  92. app/locale/en_US/template/email/webshopapps_log_email.html +15 -0
  93. package.xml +18 -0
app/code/community/Webshopapps/Cerasisfreight/Helper/Data.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Catalog
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Catalog data helper
29
+ *
30
+ * @author Magento Core Team <core@magentocommerce.com>
31
+ */
32
+ class Webshopapps_Cerasisfreight_Helper_Data extends Mage_Core_Helper_Abstract
33
+ {
34
+
35
+ private function getWeight($items) {
36
+ $addressWeight=0;
37
+ foreach ($items as $item) {
38
+ /**
39
+ * Skip if this item is virtual
40
+ */
41
+
42
+ if ($item->getProduct()->isVirtual()) {
43
+ continue;
44
+ }
45
+ /**
46
+ * Children weight we calculate for parent
47
+ */
48
+ if ($item->getParentItem()) {
49
+ continue;
50
+ }
51
+
52
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
53
+ foreach ($item->getChildren() as $child) {
54
+ if ($child->getProduct()->isVirtual()) {
55
+ continue;
56
+ }
57
+
58
+ if (!$item->getProduct()->getWeightType()) {
59
+ $itemWeight = $child->getWeight();
60
+ $itemQty = $item->getQty()*$child->getQty();
61
+ $rowWeight = $itemWeight*$itemQty;
62
+ $addressWeight += $rowWeight;
63
+
64
+ }
65
+ }
66
+ if ($item->getProduct()->getWeightType()) {
67
+ $itemWeight = $item->getWeight();
68
+ $rowWeight = $itemWeight*$item->getQty();
69
+ $addressWeight+= $rowWeight;
70
+
71
+ }
72
+ }
73
+ else {
74
+
75
+ $itemWeight = $item->getWeight();
76
+ $rowWeight = $itemWeight*$item->getQty();
77
+ $addressWeight+= $rowWeight;
78
+
79
+ }
80
+ }
81
+ return $addressWeight;
82
+ }
83
+
84
+ }
app/code/community/Webshopapps/Cerasisfreight/LICENSE.pdf ADDED
Binary file
app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight.php ADDED
@@ -0,0 +1,527 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Cerasisfreight Freight Shipping
3
+ *
4
+ * @category Webshopapps
5
+ * @package Webshopapps_Cerasisfreight
6
+ * @copyright Copyright (c) 2012 Zowta Ltd (http://www.webshopapps.com)
7
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
8
+ */
9
+
10
+
11
+ class Webshopapps_Cerasisfreight_Model_Carrier_Cerasisfreight
12
+ extends Webshopapps_Wsafreightcommon_Model_Carrier_Abstract
13
+ implements Mage_Shipping_Model_Carrier_Interface
14
+ {
15
+
16
+ protected $_code = 'cerasisfreight';
17
+
18
+ protected $_modName = 'Webshopapps_Cerasisfreight';
19
+
20
+ protected $_prodRateQuoteServiceWsdl = 'http://cerasis.ltlship.net/webservices/soap/freight/v3/rating.asmx?WSDL';
21
+ protected $_devRateQuoteServiceWsdl = 'http://dev.ltlship.net/webservices/soap/freight/v3/rating.asmx?WSDL';
22
+
23
+ const DEV_RATE_URL = 'http://dev.ltlship.net/webservices/soap/freight/v3/rating.asmx';
24
+ const DEV_SHIP_URL = 'http://dev.ltlship.net/webservices/soap/freight/v3/shipping.asmx';
25
+ const DEV_TRACK_URL = 'http://dev.ltlship.net/webservices/soap/freight/v3/requestinformation.asmx';
26
+
27
+ const PROD_RATE_URL = 'http://cerasis.ltlship.net/webservices/soap/freight/v3/rating.asmx';
28
+ const PROD_SHIP_URL = 'http://cerasis.ltlship.net/webservices/soap/freight/v3/shipping.asmx';
29
+ const PROD_TRACK_URL = 'http://cerasis.ltlship.net/webservices/soap/freight/v3/requestinformation.asmx';
30
+
31
+ const SHIP = 1;
32
+ const TRACK = 2;
33
+ const RATE = 3;
34
+
35
+ public function setRequest(Mage_Shipping_Model_Rate_Request $request)
36
+ {
37
+ $r = $this->setBaseRequest($request);
38
+
39
+ $this->setAccessRequest($r);
40
+
41
+ $this->_rawRequest = $r;
42
+
43
+ return $this;
44
+ }
45
+
46
+ private function setAccessRequest(&$r){
47
+ $r->setShipperID($this->getConfigData('shipper_id'));
48
+ $r->setUsername($this->getConfigData('user_name'));
49
+ $r->setPassword($this->getConfigData('password'));
50
+ $r->setAccessKey($this->getConfigData('access_key'));
51
+ $r->setBillingType($this->getConfigData('billing_type'));
52
+ }
53
+
54
+ protected function _formRateRequest()
55
+ {
56
+ $r = $this->_rawRequest;
57
+
58
+ $accSettings=$r->getAccessories();
59
+
60
+ $ratesOuterRequest = new stdClass();
61
+
62
+ $ratesOuterRequest->AccessRequest = array(
63
+ 'ShipperID' => $r->getShipperID(),
64
+ 'Username' => $r->getUsername(),
65
+ 'Password' => $r->getPassword(),
66
+ 'AccessKey' => $r->getAccessKey(),
67
+
68
+ );
69
+ $ratesOuterRequest->Version = '1';
70
+
71
+ $ratesInnerRequest = new stdClass();
72
+ $ratesInnerRequest->Direction = 'Outbound';
73
+ $ratesInnerRequest->BillingType = $r->getBillingType();
74
+ $ratesInnerRequest->Carrier = 'Rateshop';
75
+ $ratesInnerRequest->ShipDate = $currentDate = date("c",strtotime(date('Ymd',time()) . ' +1 day'));
76
+ $ratesInnerRequest->CODShipment = false;
77
+ $ratesInnerRequest->CODShipmentCharge = 0;
78
+ $ratesInnerRequest->CODAmount = 0;
79
+ $ratesInnerRequest->TotalPallets = 0;
80
+
81
+ $destResidential = false;
82
+ $origResidential = false;
83
+
84
+ foreach($accSettings as $setting){
85
+ switch($setting){
86
+ case 'RES':
87
+ $destResidential = true;
88
+ break;
89
+ case 'RES_ORIGIN':
90
+ $origResidential = true;
91
+ break;
92
+ }
93
+ }
94
+
95
+ $ratesInnerRequest->Origin = array (
96
+ 'State' => $r->getOrigRegionCode(),
97
+ 'PostalCode' => $r->getOrigPostal(),
98
+ 'Country' => $r->getOrigCountry(),
99
+ 'ResidentialDelivery' => $origResidential,
100
+ 'AddrType' => 1, // ignore, internal
101
+ );
102
+ $ratesInnerRequest->Destination = array (
103
+ 'State' => $r->getDestRegionCode(),
104
+ 'PostalCode' => $r->getDestPostal(),
105
+ 'Country' => $r->getDestCountry(),
106
+ 'ResidentialDelivery' => $destResidential,
107
+ 'AddrType' => 1, // ignore, internal
108
+ );
109
+
110
+
111
+ $ratesInnerRequest->Details = $this->_getLineItems();
112
+ $ratesInnerRequest->Accessorials = $this->_getAccessories($r);
113
+ $ratesOuterRequest->Request = $ratesInnerRequest;
114
+
115
+ $ratesRequest['RateRequest'] = $ratesOuterRequest;
116
+
117
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvY2VyYXNpc2ZyZWlnaHQvc2hpcF9vbmNl',
118
+ 'Z3JpenpseWJlYXI=','Y2FycmllcnMvY2VyYXNpc2ZyZWlnaHQvc2VyaWFs')) {
119
+ return;
120
+ }
121
+
122
+
123
+ if ($this->_debug) {
124
+ Mage::helper('wsacommon/log')->postNotice('cerasisfreight','Request',$ratesRequest);
125
+ }
126
+
127
+ return $ratesRequest;
128
+ }
129
+
130
+ protected function _getQuotes()
131
+ {
132
+ $ratesRequest = $this->_formRateRequest();
133
+ $requestString = serialize($ratesRequest);
134
+ $response = $this->_getCachedQuotes($requestString);
135
+ $debugData = array('request' => $ratesRequest);
136
+ if ($response === null) {
137
+ try {
138
+ $client = $this->_createRateSoapClient();
139
+ $response = $client->RateShipment($ratesRequest);
140
+ $this->_setCachedQuotes($requestString, serialize($response));
141
+ $debugData['result'] = $response;
142
+ } catch (Exception $e) {
143
+ $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
144
+ Mage::logException($e);
145
+ }
146
+ } else {
147
+ $response = unserialize($response);
148
+ $debugData['result'] = $response;
149
+ }
150
+ if($this->_debug)
151
+ {
152
+ //Mage::helper('wsalogger/log')->postInfo('cerasisfreight','Request XML',$client->__getLastRequest());
153
+ Mage::helper('wsalogger/log')->postInfo('cerasisfreight','Response',$debugData);
154
+ }
155
+ return $this->_parseRateResponse($ratesRequest,$response);
156
+ }
157
+
158
+ public function isCityRequired()
159
+ {
160
+ return true;
161
+ }
162
+
163
+ protected function _parseRateResponse($ratesRequest,$response)
164
+ {
165
+
166
+ $costArr = array();
167
+ $priceArr = array();
168
+ $quoteId=''; // quote id not available
169
+
170
+ if (is_object($response)) {
171
+ $resp = $response->RateResponse;
172
+ if (isset($resp) && is_object($resp->Error) &&
173
+ is_object($resp->Carriers) && isset($resp->Carriers->Carrier)) {
174
+
175
+ $allowedMethods = explode(",", $this->getConfigData('allowed_methods'));
176
+
177
+ $carrierArr = $resp->Carriers->Carrier;
178
+
179
+ if (is_array($carrierArr)) {
180
+ foreach ($carrierArr as $carrier) {
181
+
182
+ $serviceName = (string)$carrier->CarrierSCAC;
183
+
184
+ if (in_array($serviceName, $allowedMethods)) {
185
+
186
+ $amount = (string)$carrier->ShipmentRate;
187
+ $costArr[$serviceName] = $amount;
188
+ $priceArr[$serviceName] = $this->getMethodPrice($amount, $serviceName);
189
+ }
190
+ }
191
+ asort($priceArr);
192
+ } else {
193
+ $carrier = $resp->Carriers->Carrier;
194
+ $serviceName = (string)$carrier->CarrierSCAC;
195
+
196
+ if (in_array($serviceName, $allowedMethods)) {
197
+
198
+ $amount = (string)$carrier->ShipmentRate;
199
+ $costArr[$serviceName] = $amount;
200
+ $priceArr[$serviceName] = $this->getMethodPrice($amount, $serviceName);
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ if ($this->getConfigFlag('show_cheapest')) {
207
+ $priceArr = $this->_getCheapest($priceArr);
208
+ }
209
+
210
+ return $this->getResultSet($priceArr,$ratesRequest,$response,'');
211
+
212
+ }
213
+
214
+ protected function _getCheapest($priceArr) {
215
+
216
+ if (count($priceArr)<1) {return $priceArr;}
217
+
218
+ $cheapest = -1;
219
+ foreach ($priceArr as $serviceName=>$possRate) {
220
+ if ($cheapest==-1 || $possRate<$cheapest) {
221
+ $cheapestService = $serviceName;
222
+ $cheapest = $possRate;
223
+ }
224
+ }
225
+
226
+ $newPriceArr[$cheapestService]= $priceArr[$cheapestService];
227
+
228
+ return $newPriceArr;
229
+
230
+ }
231
+
232
+
233
+
234
+ public function getCode($type, $code='')
235
+ {
236
+ $codes = array(
237
+ 'billing_type' =>array(
238
+ 'Prepaid' => Mage::helper('shipping')->__('Prepaid'),
239
+ 'PPA' => Mage::helper('shipping')->__('Prepaid & Add'),
240
+
241
+ ),
242
+ 'method'=>array(
243
+ 'PYLE'=> Mage::helper('shipping')->__('A. Duie Pyle, Inc.'),
244
+ 'AACT'=> Mage::helper('shipping')->__('AAA Cooper Transportation'),
245
+ 'AGCE'=> Mage::helper('shipping')->__('ACI Motor Freight'),
246
+ 'ASAP'=> Mage::helper('shipping')->__('ASAP Delivery'),
247
+ 'AXRN'=> Mage::helper('shipping')->__('Atchesons Express, Inc.'),
248
+ 'AVRT'=> Mage::helper('shipping')->__('Averitt Express, Inc.'),
249
+ 'BEAV'=> Mage::helper('shipping')->__('Beaver Express'),
250
+ 'BLLF'=> Mage::helper('shipping')->__('Bullet Freight Systems'),
251
+ 'BEXT'=> Mage::helper('shipping')->__('Bullocks Express Transportation'),
252
+ 'CAPC'=> Mage::helper('shipping')->__('Capital Couriers, Inc.'),
253
+ 'CTSQ'=> Mage::helper('shipping')->__('Cargo Transportation Services, Inc.'),
254
+ 'CGOR'=> Mage::helper('shipping')->__('Cargo Transporters'),
255
+ 'CDNK'=> Mage::helper('shipping')->__('Celadon'),
256
+ 'CENF'=> Mage::helper('shipping')->__('Central Freight Lines, Inc.'),
257
+ 'CTII'=> Mage::helper('shipping')->__('Central Transport International. Inc.'),
258
+ 'CHEE'=> Mage::helper('shipping')->__('Cheetah'),
259
+ 'CSKL'=> Mage::helper('shipping')->__('Chris Truck Line'),
260
+ 'COAS'=> Mage::helper('shipping')->__('Coast to Coast Transportation'),
261
+ 'CMMS'=> Mage::helper('shipping')->__('Command Transportation LLC'),
262
+ 'CNWY'=> Mage::helper('shipping')->__('Con-Way Freight'),
263
+ 'CTDS'=> Mage::helper('shipping')->__('Crosstown Delivery Service'),
264
+ 'DYLT'=> Mage::helper('shipping')->__('Daylight Transport'),
265
+ 'DAFG'=> Mage::helper('shipping')->__('Dayton Freight Lines'),
266
+ 'DPHE'=> Mage::helper('shipping')->__('Dependable Highway Express'),
267
+ 'DHL'=> Mage::helper('shipping')->__('DHL'),
268
+ 'DHRN'=> Mage::helper('shipping')->__('Dohrn Transfer Company'),
269
+ 'DOUG'=> Mage::helper('shipping')->__('Douglas & Sons'),
270
+ 'DTSB'=> Mage::helper('shipping')->__('DTS'),
271
+ 'ENCO'=> Mage::helper('shipping')->__('Encore'),
272
+ 'EXLA'=> Mage::helper('shipping')->__('Estes Express Lines'),
273
+ 'FXNL'=> Mage::helper('shipping')->__('FedExFreightEconomy'),
274
+ 'ARFW'=> Mage::helper('shipping')->__('FedExFreightPriority'),
275
+ 'FINE'=> Mage::helper('shipping')->__('Fineline Express'),
276
+ 'FCAB'=> Mage::helper('shipping')->__('Freight Cab'),
277
+ 'HMES'=> Mage::helper('shipping')->__('Holland'),
278
+ 'HOLL'=> Mage::helper('shipping')->__('Holland Logistics'),
279
+ 'HTMS'=> Mage::helper('shipping')->__('Holland Transportation Management Services'),
280
+ 'HOTA'=> Mage::helper('shipping')->__('Hot Services, Inc.'),
281
+ 'HUSR'=> Mage::helper('shipping')->__('Houser Transport, Inc.'),
282
+ 'HVHT'=> Mage::helper('shipping')->__('HVH Transportation, Inc.'),
283
+ 'JKTI'=> Mage::helper('shipping')->__('JK Transport'),
284
+ 'KEXP'=> Mage::helper('shipping')->__('Kings Express'),
285
+ 'LMTS'=> Mage::helper('shipping')->__('L&M Transportation'),
286
+ 'LKVL'=> Mage::helper('shipping')->__('Lakeville Motor Express'),
287
+ 'LAXV'=> Mage::helper('shipping')->__('Land Air Express of New England'),
288
+ 'LETL'=> Mage::helper('shipping')->__('Lewis Transportation Systems, Inc.'),
289
+ 'MVTL'=> Mage::helper('shipping')->__('Mark VII Truckload'),
290
+ 'MERC'=> Mage::helper('shipping')->__('Mercer'),
291
+ 'MSXN'=> Mage::helper('shipping')->__('Mid-States Express'),
292
+ 'MIDW'=> Mage::helper('shipping')->__('Midwest Motor Express'),
293
+ 'MLXP'=> Mage::helper('shipping')->__('Milan Express'),
294
+ 'MTRG'=> Mage::helper('shipping')->__('Motor Cargo'),
295
+ 'MQDS'=> Mage::helper('shipping')->__('M-Quick Delivery Service'),
296
+ 'NMTF'=> Mage::helper('shipping')->__('N&M Transfer Co., Inc.'),
297
+ 'NEBT'=> Mage::helper('shipping')->__('Nebraska Transport Company'),
298
+ 'NEMF'=> Mage::helper('shipping')->__('New England Motor Freight'),
299
+ 'NPME'=> Mage::helper('shipping')->__('New Penn Motor Express'),
300
+ 'OAKH'=> Mage::helper('shipping')->__('Oak Harbor Freight Lines'),
301
+ 'ODFL'=> Mage::helper('shipping')->__('Old Dominion Freight Line, Inc.'),
302
+ 'PMLI'=> Mage::helper('shipping')->__('Pace Motor Lines'),
303
+ 'PATT'=> Mage::helper('shipping')->__('Patterson Motor Freight'),
304
+ 'PITD'=> Mage::helper('shipping')->__('Pitt Ohio Express'),
305
+ 'PRIC'=> Mage::helper('shipping')->__('Price Truck Line, Inc.'),
306
+ 'RLCA'=> Mage::helper('shipping')->__('R&L Carriers'),
307
+ 'RETL'=> Mage::helper('shipping')->__('Reddaway'),
308
+ 'RDFS'=> Mage::helper('shipping')->__('Roadrunner Transportation Services'),
309
+ 'RRVT'=> Mage::helper('shipping')->__('Root River Valley Transfer, Inc.'),
310
+ 'MLLR'=> Mage::helper('shipping')->__('Roy Miller Transportation'),
311
+ 'RPMI'=> Mage::helper('shipping')->__('RPM Transportation, Inc.'),
312
+ 'SAIA'=> Mage::helper('shipping')->__('Saia, Inc.'),
313
+ 'SEFL'=> Mage::helper('shipping')->__('Southeastern Freight Lines'),
314
+ 'SMTL'=> Mage::helper('shipping')->__('Southwestern Motor Transport'),
315
+ 'STDF'=> Mage::helper('shipping')->__('Standard Forwarding'),
316
+ 'TBST'=> Mage::helper('shipping')->__('TBS Trucking'),
317
+ 'TYAR'=> Mage::helper('shipping')->__('Three Way Transfer of Arkansas'),
318
+ 'TQL5'=> Mage::helper('shipping')->__('Total Quality Logistics, LLC'),
319
+ 'TSDL'=> Mage::helper('shipping')->__('Transdel'),
320
+ 'TSXW'=> Mage::helper('shipping')->__('Tri-State Express'),
321
+ 'USRD'=> Mage::helper('shipping')->__('U.S. Road Freight Express'),
322
+ 'UPGF'=> Mage::helper('shipping')->__('UPS Freight'),
323
+ 'UPPN'=> Mage::helper('shipping')->__('US Special Delivery'),
324
+ 'USFB'=> Mage::helper('shipping')->__('USF Bestway'),
325
+ 'CEXP'=> Mage::helper('shipping')->__('Velocity Express'),
326
+ 'VIKN'=> Mage::helper('shipping')->__('Viking Freight Lines'),
327
+ 'VITR'=> Mage::helper('shipping')->__('Vitran'),
328
+ 'WARD'=> Mage::helper('shipping')->__('Ward Trucking'),
329
+ 'WERN'=> Mage::helper('shipping')->__('Werner'),
330
+ 'WTVA'=> Mage::helper('shipping')->__('Wilson Trucking'),
331
+ 'WWMF'=> Mage::helper('shipping')->__('Wiseway Transportation Services'),
332
+ 'XGSI'=> Mage::helper('shipping')->__('Xpress Global Systems'),
333
+ 'YFEE'=> Mage::helper('shipping')->__('Yellow Transportation Exact Express'),
334
+ 'RDWY'=> Mage::helper('shipping')->__('YRC Freight'),
335
+ 'YFSY'=> Mage::helper('shipping')->__('YRC, Inc.')
336
+ ),
337
+ );
338
+
339
+ if (!isset($codes[$type])) {
340
+ return false;
341
+ } elseif (''===$code) {
342
+ return $codes[$type];
343
+ }
344
+
345
+ if (!isset($codes[$type][$code])) {
346
+ return false;
347
+ } else {
348
+ return $codes[$type][$code];
349
+ }
350
+ }
351
+
352
+ /**
353
+ * Get selected Accessorials and add to request
354
+ */
355
+ protected function _getAccessories($r) {
356
+
357
+
358
+ if (!Mage::helper('wsafreightcommon')->getUseLiveAccessories()) {
359
+ return;
360
+ }
361
+ $accessorials = new StdClass;
362
+ $accInners = array();
363
+
364
+ $accSettings=$r->getAccessories();
365
+ foreach ($accSettings as $acc) { // Add accessorials to the XML Request
366
+ switch ($acc) {
367
+ case 'RES':
368
+ $accInners[] = array('AccessorialName' => 'Residential/NonCommercial Delivery');
369
+ break;
370
+ case 'LIFT_ORIGIN':
371
+ $accInners[] = array('AccessorialName' => 'Lift Gate at Origin');
372
+ break;
373
+ case 'LIFT':
374
+ $accInners[] = array('AccessorialName' => 'Lift Gate at Destination');
375
+ break;
376
+ case 'INSIDE':
377
+ $accInners[] = array('AccessorialName' => 'Inside Delivery');
378
+ break;
379
+ case 'NOTIFY':
380
+ $accInners[] = array('AccessorialName' => 'Notification');
381
+ break;
382
+
383
+ }
384
+ }
385
+
386
+ if (empty($accInners)) {
387
+ return;
388
+ }
389
+
390
+ foreach($accInners as $accessorial){
391
+ $accessorials->Accessorial[] = $accessorial;
392
+ }
393
+
394
+ return $accessorials;
395
+ }
396
+
397
+
398
+
399
+ protected function _getLineItems() {
400
+ $r = $this->_rawRequest;
401
+ $details = new StdClass;
402
+
403
+ foreach ($this->getLineItems($r->getIgnoreFreeItems()) as $class =>$weight){
404
+ $detail = array (
405
+ 'Class' => $class,
406
+ 'Quantity' => '1',
407
+ 'Weight' => $weight,
408
+ 'Hazmat' => false,
409
+ );
410
+ $details->Detail[] = $detail;
411
+ }
412
+
413
+ return $details;
414
+ }
415
+
416
+
417
+ private function _array_to_objecttree($array) {
418
+ if (is_numeric(key($array))) {
419
+ foreach ($array as $key => $value) {
420
+ $array[$key] = $this->_array_to_objecttree($value);
421
+ }
422
+ return $array;
423
+ }
424
+ $Object = new stdClass;
425
+ foreach ($array as $key => $value) {
426
+ if (is_array($value)) {
427
+ $Object->$key = $this->_array_to_objecttree($value);
428
+ } else {
429
+ $Object->$key = $value;
430
+ }
431
+ }
432
+ return $Object;
433
+ }
434
+
435
+ /**
436
+ * Create rate soap client
437
+ *
438
+ * @return SoapClient
439
+ */
440
+ protected function _createRateSoapClient()
441
+ {
442
+ if($this->getConfigFlag('sandbox_mode')){
443
+ return $this->_createSoapClient($this->_devRateQuoteServiceWsdl,$this->_debug);
444
+ }
445
+ else{
446
+ return $this->_createSoapClient($this->_prodRateQuoteServiceWsdl,$this->_debug);
447
+ }
448
+
449
+ }
450
+
451
+ protected function _createSoapClient($wsdl, $trace = false, $type=self::RATE)
452
+ {
453
+ $client = new SoapClient($wsdl, array('trace' => $trace));
454
+
455
+ switch($type){
456
+ case self::RATE:
457
+ $client->__setLocation($this->getConfigFlag('sandbox_mode')
458
+ ? self::DEV_RATE_URL
459
+ : self::PROD_RATE_URL
460
+ ); break;
461
+ case self::TRACK:
462
+ $client->__setLocation($this->getConfigFlag('sandbox_mode')
463
+ ? self::DEV_TRACK_URL
464
+ : self::PROD_TRACK_URL
465
+ ); break;
466
+ case self::SHIP:
467
+ $client->__setLocation($this->getConfigFlag('sandbox_mode')
468
+ ? self::DEV_SHIP_URL
469
+ : self::PROD_SHIP_URL
470
+ ); break;
471
+ default:
472
+ $client->__setLocation($this->getConfigFlag('sandbox_mode')
473
+ ? self::DEV_RATE_URL
474
+ : self::PROD_RATE_URL
475
+ ); break;
476
+ }
477
+
478
+ return $client;
479
+ }
480
+
481
+ /**
482
+ * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response
483
+ *
484
+ * @param Varien_Object $request
485
+ * @return Varien_Object
486
+ */
487
+ /*
488
+ protected function _doShipmentRequest(Varien_Object $request){
489
+ $this->_prepareShipmentRequest($request);
490
+ $result = new Varien_Object();
491
+ $client = $this->_createSoapClient($this->_prodRateQuoteServiceWsdl,$this->_debug, self::SHIP);
492
+ $requestClient = $this->_formShipmentRequest($request);
493
+ $response = $client->processShipment($requestClient);
494
+
495
+ if ($response) {
496
+ $shippingLabelContent = $response->getLabelInfo;
497
+ $trackingNumber = $response->getTrackingNumber;
498
+ $result->setShippingLabelContent($shippingLabelContent);
499
+ $result->setTrackingNumber($trackingNumber);
500
+ $debugData = array('request' => $client->__getLastRequest(), 'result' => $client->__getLastResponse());
501
+ $this->_debug($debugData);
502
+ } else {
503
+ $debugData = array(
504
+ 'request' => $client->__getLastRequest(),
505
+ 'result' => array(
506
+ 'error' => '',
507
+ 'code' => '',
508
+ 'xml' => $client->__getLastResponse()
509
+ )
510
+ );
511
+ if (is_array($response->Notifications)) {
512
+ foreach ($response->Notifications as $notification) {
513
+ $debugData['result']['code'] .= $notification->Code . '; ';
514
+ $debugData['result']['error'] .= $notification->Message . '; ';
515
+ }
516
+ } else {
517
+ $debugData['result']['code'] = $response->Notifications->Code . ' ';
518
+ $debugData['result']['error'] = $response->Notifications->Message . ' ';
519
+ }
520
+ $this->_debug($debugData);
521
+ $result->setErrors($debugData['result']['error']);
522
+ }
523
+ $result->setGatewayResponse($client->__getLastResponse());
524
+
525
+ return $result;
526
+ }*/
527
+ }
app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight/Source/Billingtype.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Cerasisfreight Shipping
3
+ *
4
+ * @category Webshopapps
5
+ * @package Webshopapps_Cerasisfreight
6
+ * @copyright Copyright (c) 2012 Zowta Ltd (http://www.webshopapps.com)
7
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
8
+ */
9
+
10
+ class Webshopapps_Cerasisfreight_Model_Carrier_Cerasisfreight_Source_Billingtype {
11
+
12
+ public function toOptionArray()
13
+ {
14
+ $cerasisfreight = Mage::getSingleton('cerasisfreight/carrier_cerasisfreight');
15
+ $arr = array();
16
+ foreach ($cerasisfreight->getCode('billing_type') as $k=>$v) {
17
+ $arr[] = array('value'=>$k, 'label'=>Mage::helper('usa')->__($v));
18
+ }
19
+ return $arr;
20
+ }
21
+ }
app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight/Source/Freemethod.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /* Webshopapps Cerasisfreight
27
+ *
28
+ * @category Webshopapps
29
+ * @package Webshopapps_Cerasisfreight
30
+ * @copyright Copyright (c) 2012 Zowta Ltd (http://www.webshopapps.com)
31
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
32
+ */
33
+
34
+ class Webshopapps_Cerasisfreight_Model_Carrier_Cerasisfreight_Source_Freemethod
35
+ {
36
+ public function toOptionArray()
37
+ {
38
+ $cerasisfreight = Mage::getSingleton('cerasisfreight/carrier_cerasisfreight');
39
+ $arr = array();
40
+ foreach ($cerasisfreight->getCode('method') as $k=>$v) {
41
+ $arr[] = array('value'=>$k, 'label'=>$v);
42
+ }
43
+ array_unshift($arr, array('value'=>'', 'label'=>Mage::helper('shipping')->__('None')));
44
+
45
+ return $arr;
46
+ }
47
+ }
app/code/community/Webshopapps/Cerasisfreight/Model/Carrier/Cerasisfreight/Source/Method.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /* Webshopapps Cerasisfreight
27
+ *
28
+ * @category Webshopapps
29
+ * @package Webshopapps_Cerasisfreight
30
+ * @copyright Copyright (c) 2012 Zowta Ltd (http://www.webshopapps.com)
31
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
32
+ */
33
+
34
+ class Webshopapps_Cerasisfreight_Model_Carrier_Cerasisfreight_Source_Method
35
+ {
36
+ public function toOptionArray()
37
+ {
38
+ $cerasisfreight = Mage::getSingleton('cerasisfreight/carrier_cerasisfreight');
39
+
40
+ $arr = array();
41
+ foreach ($cerasisfreight->getCode('method') as $k=>$v) {
42
+ $arr[] = array('value'=>$k, 'label'=>$v);
43
+ }
44
+ return $arr;
45
+ }
46
+ }
app/code/community/Webshopapps/Cerasisfreight/changelog.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ 1.0 - Initial Release
2
+ 1.1 - Updated API Key
app/code/community/Webshopapps/Cerasisfreight/etc/config.xml ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Cerasisfreight Shipping
23
+ *
24
+ * @category Webshopapps
25
+ * @package Webshopapps_Cerasisfreight
26
+ * @copyright Copyright (c) 2010 Zowta Ltd (http://www.webshopapps.com)
27
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
28
+ *
29
+ -->
30
+ <config>
31
+ <modules>
32
+ <Webshopapps_Cerasisfreight>
33
+ <version>0.0.1</version>
34
+ <depends>
35
+ <Mage_Shipping />
36
+ <Webshopapps_Wsafreightcommon />
37
+ </depends>
38
+ </Webshopapps_Cerasisfreight>
39
+ </modules>
40
+ <global>
41
+ <models>
42
+ <cerasisfreight>
43
+ <class>Webshopapps_Cerasisfreight_Model</class>
44
+ </cerasisfreight>
45
+ <cerasisfreight_shipping>
46
+ <class>Webshopapps_Cerasisfreight_Model</class>
47
+ </cerasisfreight_shipping>
48
+ </models>
49
+ <resources>
50
+ <cerasisfreight_setup>
51
+ <setup>
52
+ <module>Webshopapps_Cerasisfreight</module>
53
+ <class>Mage_Eav_Model_Entity_Setup</class>
54
+ </setup>
55
+ <connection>
56
+ <use>core_setup</use>
57
+ </connection>
58
+ </cerasisfreight_setup>
59
+ </resources>
60
+ <sales>
61
+ <shipping>
62
+ <carriers>
63
+ <cerasisfreight>
64
+ <class>Webshopapps_Cerasisfreight_Model_Carrier_Cerasisfreight</class>
65
+ </cerasisfreight>
66
+ </carriers>
67
+ </shipping>
68
+ </sales>
69
+ <helpers>
70
+ <cerasisfreight>
71
+ <class>Webshopapps_Cerasisfreight_Helper</class>
72
+ </cerasisfreight>
73
+ </helpers>
74
+ </global>
75
+ <frontend>
76
+ <translate>
77
+ <modules>
78
+ <Webshopapps_Cerasisfreight>
79
+ <files>
80
+ <default>Webshopapps_Cerasisfreight.csv</default>
81
+ </files>
82
+ </Webshopapps_Cerasisfreight>
83
+ </modules>
84
+ </translate>
85
+ </frontend>
86
+ <adminhtml>
87
+ <translate>
88
+ <modules>
89
+ <Webshopapps_Cerasisfreight>
90
+ <files>
91
+ <default>Webshopapps_Cerasisfreight.csv</default>
92
+ </files>
93
+ </Webshopapps_Cerasisfreight>
94
+ </modules>
95
+ </translate>
96
+ </adminhtml>
97
+ <default>
98
+ <carriers>
99
+ <cerasisfreight>
100
+ <password backend_model="adminhtml/system_config_backend_encrypted"/>
101
+ <access_key backend_model="adminhtml/system_config_backend_encrypted"/>
102
+ <active>0</active>
103
+ <serial backend_model="adminhtml/system_config_backend_encrypted" />
104
+ <sallowspecific>0</sallowspecific>
105
+ <model>cerasisfreight_shipping/carrier_cerasisfreight</model>
106
+ <title>Cerasisfreight</title>
107
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
108
+ <allowed_methods>PYLE,AACT,AGCE,ASAP,AXRN,AVRT,BEAV,BLLF,BEXT,CAPC,CTSQ,CGOR,CDNK,CENF,CTII,CHEE,CSKL,COAS,CMMS,CNWY,CTDS,DYLT,DAFG,DPHE,DHL,DHRN,DOUG,DTSB,ENCO,EXLA,FXNL,ARFW,FINE,FCAB,HMES,HOLL,HTMS,HOTA,HUSR,HVHT,JKTI,KEXP,LMTS,LKVL,LAXV,LETL,MVTL,MERC,MSXN,MIDW,MLXP,MTRG,MQDS,NMTF,NEBT,NEMF,NPME,OAKH,ODFL,PMLI,PATT,PITD,PRIC,RLCA,RETL,RDFS,RRVT,MLLR,RPMI,SAIA,SEFL,SMTL,STDF,TBST,TYAR,TQL5,TSDL,TSXW,USRD,UPGF,UPPN,USFB,CEXP,VIKN,VITR,WARD,WERN,WTVA,WWMF,XGSI,YFEE,RDWY,YFSY</allowed_methods>
109
+ <ship_once>0</ship_once>
110
+ <sandbox_mode>1</sandbox_mode>
111
+ <mode_xml>0</mode_xml>
112
+ <show_cheapest>0</show_cheapest>
113
+ </cerasisfreight>
114
+ </carriers>
115
+ </default>
116
+ </config>
app/code/community/Webshopapps/Cerasisfreight/etc/system.xml ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * ProductMatrix
23
+ *
24
+ * @category Webshopapps
25
+ * @package Webshopapps Cerasisfreight
26
+ * @copyright Copyright (c) 2012 Zowta Ltd (http://www.webshopapps.com)
27
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
28
+ */
29
+ -->
30
+ <config>
31
+ <sections>
32
+ <carriers translate="label" module="shipping">
33
+ <label>Shipping Methods</label>
34
+ <tab>sales</tab>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>320</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>0</show_in_store>
40
+ <groups>
41
+ <cerasisfreight translate="label">
42
+ <label>Webshopapps Cerasis Freight Shipping</label>
43
+ <comment><![CDATA[
44
+ <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
45
+ This module was developed by <a href="http://www.webshopapps.com" target="_blank">WebShopApps.com</a> - <b>Magento Shipping Extension Specialists</b>.
46
+ <br> <b>To register for our extension please visit: <a href="http://www.webshopapps.com/us/cerasis_registration/"> Cerasis Freight Account</b></a>
47
+ <br/> For docs & examples refer to the WebShopApps <a href="https://webshopapps.bloomfire.com/series/2353-cerasis-freight">support docs</a>.
48
+ <br>Please also ensure you have configured the extension under Shipping Settings.
49
+ </div>
50
+ ]]>
51
+ </comment>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>2</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ <fields>
58
+ <active translate="label">
59
+ <label>Enabled</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>10</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </active>
67
+ <credentials_heading translate="label">
68
+ <label>Credentials</label>
69
+ <frontend_model>wsacommon_adminhtml/system_config_form_field_heading
70
+ </frontend_model>
71
+ <sort_order>20</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ </credentials_heading>
75
+ <serial translate="label">
76
+ <label>Serial Key</label>
77
+ <frontend_type>obscure</frontend_type>
78
+ <backend_model>adminhtml/system_config_backend_encrypted
79
+ </backend_model>
80
+ <sort_order>30</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </serial>
85
+ <title translate="label">
86
+ <label>Title</label>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>40</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </title>
93
+ <shipper_id translate="label">
94
+ <label>Shipper ID</label>
95
+ <frontend_type>text</frontend_type>
96
+ <sort_order>50</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>0</show_in_store>
100
+ </shipper_id>
101
+ <user_name translate="label">
102
+ <label>User Name</label>
103
+ <frontend_type>text</frontend_type>
104
+ <sort_order>60</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>0</show_in_store>
108
+ </user_name>
109
+ <password translate="label">
110
+ <label>Password</label>
111
+ <frontend_type>obscure</frontend_type>
112
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
113
+ <sort_order>70</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>0</show_in_store>
117
+ </password>
118
+ <access_key translate="label">
119
+ <label>Access Key</label>
120
+ <frontend_type>obscure</frontend_type>
121
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
122
+ <sort_order>80</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>0</show_in_store>
126
+ </access_key>
127
+ <sandbox_mode translate="label">
128
+ <label>Sandbox Mode</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>85</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>0</show_in_store>
135
+ </sandbox_mode>
136
+ <mode_xml translate="label comment">
137
+ <label>SSL Mode</label>
138
+ <comment>Enables/Disables SSL verification of Magento server by Cerasis.</comment>
139
+ <frontend_type>select</frontend_type>
140
+ <source_model>usa/shipping_carrier_ups_source_mode</source_model>
141
+ <sort_order>86</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>0</show_in_store>
145
+ </mode_xml>
146
+ <freight_heading translate="label">
147
+ <label>Freight Settings</label>
148
+ <frontend_model>wsacommon_adminhtml/system_config_form_field_heading
149
+ </frontend_model>
150
+ <sort_order>90</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ </freight_heading>
154
+ <billing_type translate="label">
155
+ <label>Billing Type</label>
156
+ <frontend_type>select</frontend_type>
157
+ <source_model>cerasisfreight/carrier_cerasisfreight_source_billingtype</source_model>
158
+ <sort_order>95</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </billing_type>
163
+ <allowed_methods translate="label">
164
+ <label>Allowed Methods</label>
165
+ <frontend_type>multiselect</frontend_type>
166
+ <source_model>cerasisfreight/carrier_cerasisfreight_source_method
167
+ </source_model>
168
+ <sort_order>100</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>0</show_in_store>
172
+ <can_be_empty>1</can_be_empty>
173
+ <comment><![CDATA[Please select carrier you wish to obtain rates for]]>
174
+ </comment>
175
+ </allowed_methods>
176
+ <max_cost translate="label">
177
+ <label>Maximum shipping cost</label>
178
+ <frontend_type>text</frontend_type>
179
+ <sort_order>120</sort_order>
180
+ <show_in_default>1</show_in_default>
181
+ <show_in_website>1</show_in_website>
182
+ <show_in_store>1</show_in_store>
183
+ </max_cost>
184
+ <show_cheapest translate="label">
185
+ <label>Show Cheapest Rate Only</label>
186
+ <frontend_type>select</frontend_type>
187
+ <source_model>adminhtml/system_config_source_yesno</source_model>
188
+ <sort_order>130</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>0</show_in_store>
192
+ </show_cheapest>
193
+ <standard_heading translate="label">
194
+ <label>Standard Shipping</label>
195
+ <frontend_model>wsacommon_adminhtml/system_config_form_field_heading
196
+ </frontend_model>
197
+ <sort_order>200</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ </standard_heading>
201
+ <free_method translate="label">
202
+ <label>Free Method</label>
203
+ <frontend_type>select</frontend_type>
204
+ <frontend_class>free-method</frontend_class>
205
+ <source_model>cerasisfreight/carrier_cerasisfreight_source_freemethod
206
+ </source_model>
207
+ <sort_order>210</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>0</show_in_store>
211
+ </free_method>
212
+ <handling_type translate="label">
213
+ <label>Calculate handling fee</label>
214
+ <frontend_type>select</frontend_type>
215
+ <source_model>shipping/source_handlingType</source_model>
216
+ <sort_order>310</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <show_in_store>0</show_in_store>
220
+ </handling_type>
221
+ <handling_fee translate="label">
222
+ <label>Handling fee</label>
223
+ <frontend_type>text</frontend_type>
224
+ <sort_order>320</sort_order>
225
+ <show_in_default>1</show_in_default>
226
+ <show_in_website>1</show_in_website>
227
+ <show_in_store>1</show_in_store>
228
+ </handling_fee>
229
+ <sort_order translate="label">
230
+ <label>Sort order</label>
231
+ <frontend_type>text</frontend_type>
232
+ <sort_order>330</sort_order>
233
+ <show_in_default>1</show_in_default>
234
+ <show_in_website>1</show_in_website>
235
+ <show_in_store>1</show_in_store>
236
+ </sort_order>
237
+ <sallowspecific translate="label">
238
+ <label>Ship to applicable countries</label>
239
+ <frontend_type>select</frontend_type>
240
+ <sort_order>340</sort_order>
241
+ <frontend_class>shipping-applicable-country</frontend_class>
242
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries
243
+ </source_model>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ </sallowspecific>
248
+ <specificcountry translate="label">
249
+ <label>Ship to specific countries</label>
250
+ <frontend_type>multiselect</frontend_type>
251
+ <sort_order>350</sort_order>
252
+ <source_model>adminhtml/system_config_source_country
253
+ </source_model>
254
+ <show_in_default>1</show_in_default>
255
+ <show_in_website>1</show_in_website>
256
+ <show_in_store>1</show_in_store>
257
+ </specificcountry>
258
+ <showmethod translate="label">
259
+ <label>Show method if not applicable</label>
260
+ <frontend_type>select</frontend_type>
261
+ <sort_order>360</sort_order>
262
+ <frontend_class>shipping-skip-hide</frontend_class>
263
+ <source_model>adminhtml/system_config_source_yesno</source_model>
264
+ <show_in_default>1</show_in_default>
265
+ <show_in_website>1</show_in_website>
266
+ <show_in_store>1</show_in_store>
267
+ </showmethod>
268
+ <specificerrmsg translate="label">
269
+ <label>Displayed error message</label>
270
+ <frontend_type>textarea</frontend_type>
271
+ <sort_order>370</sort_order>
272
+ <show_in_default>1</show_in_default>
273
+ <show_in_website>1</show_in_website>
274
+ <show_in_store>1</show_in_store>
275
+ </specificerrmsg>
276
+ </fields>
277
+ </cerasisfreight>
278
+ </groups>
279
+ </carriers>
280
+ </sections>
281
+ </config>
app/code/community/Webshopapps/Cerasisfreight/sql/cerasisfreight_setup/mysql4-install-0.0.1.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("");
8
+
9
+ $installer->endSetup();
app/code/community/Webshopapps/Cerasisfreight/versions_supported.txt ADDED
@@ -0,0 +1 @@
 
1
+ 1.4+
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/Data.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.7') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 1.12; //CE 1.6, EE unknown at present
27
+ else if (version_compare($version, '1.6') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 1.11; //CE 1.6, EE unknown at present
28
+ else if (version_compare($version, '1.9') >= 0) $eeVersion = 1.9;
29
+ else if (version_compare($version, '1.8') >= 0) $eeVersion = 1.8;
30
+ else if (version_compare($version, '1.7') >= 0) $eeVersion = 1.7;
31
+ else if (version_compare($version, '1.6') >= 0) $eeVersion = 1.6; //EE 1.6
32
+ else $eeVersion = 1.8; // default to this if unsure, changed to assume is 1.4.1+
33
+ }
34
+ else {
35
+ if (version_compare($version, '1.5') >= 0) $eeVersion = 1.10;
36
+ else if (version_compare($version, '1.4.2') >= 0) $eeVersion = 1.9;
37
+ else if (version_compare($version, '1.4.1') >= 0) $eeVersion = 1.8;
38
+ else if (version_compare($version, '1.4.0') >= 0) $eeVersion = 1.7;
39
+ else if (version_compare($version, '1.3.2.4') >= 0) $eeVersion = 1.6;
40
+ else $eeVersion = 1.8; // default to this if unsure, changed to assume is 1.4.1+
41
+ }
42
+ return $eeVersion;
43
+ }
44
+
45
+ /**
46
+ * This method will return just the 2nd part of the version number, thus allowing greater than/less than calculations to be performed
47
+ * Please convert to this call if possible
48
+ * Enter description here ...
49
+ */
50
+ public static function getNewVersion() {
51
+ $version = Mage::getVersion();
52
+ if (version_compare($version, '1.6', '>=')) {
53
+ if (version_compare($version, '1.12') >= 0) $eeVersion = 12;
54
+ else if (version_compare($version, '1.13') >= 0) $eeVersion = 13;
55
+ else if (version_compare($version, '1.11') >= 0) $eeVersion = 11;
56
+ else if (version_compare($version, '1.10') >= 0) $eeVersion = 10;
57
+ else if (version_compare($version, '1.7') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 12; //CE 1.7, EE unknown at present
58
+ else if (version_compare($version, '1.6') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 11; //CE 1.6, EE unknown at present
59
+ else if (version_compare($version, '1.9') >= 0) $eeVersion = 9;
60
+ else if (version_compare($version, '1.8') >= 0) $eeVersion = 8;
61
+ else if (version_compare($version, '1.7') >= 0) $eeVersion = 7;
62
+ else if (version_compare($version, '1.6') >= 0) $eeVersion = 6; //EE 1.6
63
+ else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
64
+ }
65
+ else {
66
+ if (version_compare($version, '1.5') >= 0) $eeVersion = 10;
67
+ else if (version_compare($version, '1.4.2') >= 0) $eeVersion = 9;
68
+ else if (version_compare($version, '1.4.1') >= 0) $eeVersion = 8;
69
+ else if (version_compare($version, '1.4.0') >= 0) $eeVersion = 7;
70
+ else if (version_compare($version, '1.3.2.4') >= 0) $eeVersion = 6;
71
+ else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
72
+ }
73
+ return $eeVersion;
74
+ }
75
+
76
+ public static function checkItems($checkKey,$compare,$compare2) {
77
+
78
+ if (Mage::getStoreConfig(base64_decode($checkKey))) {
79
+ return true;
80
+ }
81
+
82
+ $temp2 = strtolower($_SERVER[base64_decode('U0VSVkVSX05BTUU=')]);
83
+ $found=false;
84
+
85
+ if (empty($temp2) || self::checkItem($temp2,$compare,$compare2)) { $found= true; }
86
+ else if (self::checkItem(base64_decode('d2Vic2hvcGFwcHM='),$compare,$compare2)) { $found = true; }
87
+ else if (self::checkItem(substr($temp2,strpos($temp2,".")+1),$compare,$compare2)) { $found= true; }
88
+ else if (self::checkItem('www.'.$temp2,$compare,$compare2)) { return true; }
89
+ else if (self::checkItem('www'.substr($temp2,strpos($temp2,'.')),$compare,$compare2)) { $found= true; }
90
+
91
+ if ($found)
92
+ {
93
+ Mage::getConfig()->saveConfig(base64_decode($checkKey),true);
94
+ } else {
95
+ Mage::getConfig()->deleteConfig(base64_decode($compare2), 'default', 0);
96
+ }
97
+ return $found;
98
+ }
99
+
100
+ private static function checkItem($temp2,$compare,$compare2) {
101
+ if (sha1(sha1(base64_decode($compare)) . $temp2) == Mage::getStoreConfig(base64_decode($compare2))) { return true; }
102
+ else {
103
+ foreach (Mage::app()->getStores(true) as $store){
104
+ if(sha1(sha1(base64_decode($compare)) . $temp2) == Mage::getStoreConfig(base64_decode($compare2),$store)) {
105
+ return true;
106
+ }
107
+ }
108
+ }
109
+ return false;
110
+ }
111
+
112
+ public static function isEnterpriseEdition() {
113
+ if (!Mage::getConfig()->getNode('modules/Enterprise_Cms')) {
114
+ return false;
115
+ }
116
+ return true;
117
+ }
118
+
119
+ /**
120
+ * Check is module exists and enabled in global config.
121
+ * This is only needed for 1.4.0.1 or less, but might aswell have in for all
122
+ * See Mage_Core_Helper_Abstract for defn
123
+ * Enter description here ...
124
+ * @param $moduleName
125
+ */
126
+ public function isModuleEnabled($moduleName = null,$enabledLocation=null)
127
+ {
128
+
129
+ if ($moduleName === null) {
130
+ $moduleName = $this->_getModuleName();
131
+ }
132
+
133
+ if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
134
+ return false;
135
+ }
136
+
137
+ $isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active');
138
+ $test = (string)$isActive;
139
+ if (!$isActive || !in_array((string)$isActive, array('true', '1'))) {
140
+ return false;
141
+ }
142
+
143
+ if ($enabledLocation === null) {
144
+ return true;
145
+ }
146
+
147
+ if (!Mage::getStoreConfig($enabledLocation)) {
148
+ return false;
149
+ }
150
+
151
+ return true;
152
+ }
153
+
154
+
155
+
156
+ }
app/code/community/Webshopapps/Wsacommon/Helper/Log.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Enter description here ...
28
+ * @param unknown_type $severity - CRITIAL,MAJOR,MINOR,NOTICE - 1-4
29
+ * @param unknown_type $title
30
+ * @param unknown_type $description
31
+ * @param unknown_type $url
32
+ */
33
+
34
+ public static function postNotice($extension,$title,$description,$debug=true,$code=0,$url='') {
35
+
36
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/active') || !$debug) {
37
+ return ;
38
+ }
39
+
40
+ Mage::dispatchEvent('wsalogger_log_mesasge',
41
+ array('severity'=>self::SEVERITY_NOTICE,
42
+ 'title' => $title,
43
+ 'extension' => $extension,
44
+ 'description' => $description,
45
+ 'code' => $code,
46
+ 'url' => $url
47
+ ));
48
+ }
49
+
50
+
51
+ public static function postMinor($extension,$title,$description,$debug=true,$code=0,$url='') {
52
+
53
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
54
+ return ;
55
+ }
56
+
57
+
58
+ Mage::dispatchEvent('wsalogger_log_mesasge',
59
+ array('severity'=>self::SEVERITY_MINOR,
60
+ 'extension' => $extension,
61
+ 'title' => $title,
62
+ 'description' => $description,
63
+ 'code' => $code,
64
+ 'url' => $url
65
+ ));
66
+ }
67
+
68
+
69
+ public static function postMajor($extension,$title,$description,$debug=true,$code=0,$url='') {
70
+
71
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
72
+ return ;
73
+ }
74
+
75
+ Mage::dispatchEvent('wsalogger_log_mesasge',
76
+ array('severity'=>self::SEVERITY_MAJOR,
77
+ 'title' => $title,
78
+ 'extension' => $extension,
79
+ 'description' => $description,
80
+ 'code' => $code,
81
+ 'url' => $url
82
+ ));
83
+ }
84
+
85
+ public static function postCritical($extension,$title,$description,$debug=true,$code=0,$url='') {
86
+
87
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
88
+ return ;
89
+ }
90
+
91
+ Mage::dispatchEvent('wsalogger_log_mesasge',
92
+ array('severity'=>self::SEVERITY_CRITICAL,
93
+ 'title' => $title,
94
+ 'extension' => $extension,
95
+ 'description' => $description,
96
+ 'code' => $code,
97
+ 'url' => $url
98
+ ));
99
+ }
100
+
101
+
102
+ public function getSeverities($severity = null)
103
+ {
104
+ $severities = array(
105
+ self::SEVERITY_CRITICAL => Mage::helper('adminnotification')->__('Critical'),
106
+ self::SEVERITY_MAJOR => Mage::helper('adminnotification')->__('Major'),
107
+ self::SEVERITY_MINOR => Mage::helper('adminnotification')->__('Minor'),
108
+ self::SEVERITY_NOTICE => Mage::helper('adminnotification')->__('Notice'),
109
+ self::SEVERITY_NONE => Mage::helper('adminnotification')->__('None'),
110
+ );
111
+
112
+ if (!is_null($severity)) {
113
+ if (isset($severities[$severity])) {
114
+ return $severities[$severity];
115
+ }
116
+ return null;
117
+ }
118
+
119
+ return $severities;
120
+ }
121
+
122
+
123
+ }
app/code/community/Webshopapps/Wsacommon/Helper/Shipping.php ADDED
@@ -0,0 +1,525 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Enter description here ...
168
+ * @param unknown_type $item
169
+ * @param unknown_type $weight
170
+ * @param unknown_type $qty
171
+ * @param unknown_type $price
172
+ * @param unknown_type $useParent
173
+ * @param unknown_type $ignoreFreeItems
174
+ * @param unknown_type $itemGroup
175
+ * @param unknown_type $useDiscountValue
176
+ */
177
+ public static function getItemTotals($item, &$weight, &$qty, &$price, $useParent=true,$ignoreFreeItems=true,
178
+ &$itemGroup=array(),$useDiscountValue=false, $cartFreeShipping = false,$useBase = false, $useTax = false) {
179
+
180
+ $freeMethodWeight =0;
181
+ return self::getItemInclFreeTotals($item, $weight, $qty, $price, $freeMethodWeight, $useParent,$ignoreFreeItems,
182
+ $itemGroup,$useDiscountValue,$cartFreeShipping, $useBase, $useTax);
183
+ }
184
+
185
+ /**
186
+ * Freemethod weight now returned
187
+ * Enter description here ...
188
+ * @param unknown_type $item
189
+ * @param unknown_type $weight
190
+ * @param unknown_type $qty
191
+ * @param unknown_type $price
192
+ * @param unknown_type $freeMethodWeight
193
+ * @param unknown_type $useParent
194
+ * @param unknown_type $ignoreFreeItems
195
+ * @param unknown_type $itemGroup
196
+ * @param unknown_type $useDiscountValue
197
+ */
198
+ public static function getItemInclFreeTotals($item, &$weight, &$qty, &$price, &$freeMethodWeight, $useParent=true,$ignoreFreeItems=true,
199
+ &$itemGroup=array(),$useDiscountValue=false, $cartFreeShipping = false, $useBase = false, $useTax = false, &$basePriceInclTax = 0) {
200
+
201
+ $addressWeight=0;
202
+ $addressQty=0;
203
+ $freeMethodWeight=0;
204
+ $itemGroup[]=$item;
205
+
206
+ if (!is_object($item))
207
+ {
208
+ Mage::helper('wsacommon/log')->postCritical('wsacommon','Fatal Error','Item/Product is Malformed');
209
+ return false;
210
+ }
211
+
212
+ /**
213
+ * Skip if this item is virtual
214
+ **/
215
+
216
+ if ($item->getProduct()->isVirtual()) {
217
+ return false;
218
+ }
219
+
220
+ if ($ignoreFreeItems && ($item->getFreeShipping() || $cartFreeShipping)) {
221
+ return false;
222
+ }
223
+
224
+ /**
225
+ * Children weight we calculate for parent
226
+ */
227
+
228
+ if ($item->getParentItem() && ( ($item->getParentItem()->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $useParent)
229
+ || $item->getParentItem()->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE )) {
230
+ return false;
231
+ }
232
+
233
+ if (!$useParent && $item->getHasChildren() && $item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ) {
234
+ if ($item->getProduct()->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
235
+ //Add on the fixed initial parent price. Children are calculated separately.
236
+ $basePrice = $item->getProduct()->getPrice();
237
+ $storePrice = Mage::helper('directory')->currencyConvert($basePrice,
238
+ Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode());
239
+
240
+ !$useBase ? $price = $storePrice : $price = $basePrice;
241
+
242
+ $calculator = Mage::helper('tax')->getCalculator();
243
+ $taxRequest = $calculator->getRateOriginRequest();
244
+ $taxRequest->setProductClassId($item->getProduct()->getTaxClassId());
245
+ $taxPercentage = $calculator->getRate($taxRequest);
246
+
247
+ $taxAmount = round(($taxPercentage/100) * $price, 2);
248
+ $storeTaxAmount = round(Mage::helper('directory')->currencyConvert($taxAmount,
249
+ Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()), 2);
250
+
251
+ $useTax && !$useBase ? $price += $storeTaxAmount : false;
252
+ $useTax && $useBase ? $price += $taxAmount : false;
253
+
254
+ if($item->getProduct()->getWeightType()){
255
+ $itemWeight = $item->getProduct()->getWeight();
256
+ $rowWeight = $itemWeight*$item->getQty();
257
+
258
+ if ($cartFreeShipping || $item->getFreeShipping()===true) {
259
+ $rowWeight = 0;
260
+ } elseif (is_numeric($item->getFreeShipping())) {
261
+ $freeQty = $item->getFreeShipping();
262
+ if ($item->getQty()>$freeQty) {
263
+ $rowWeight = $itemWeight*($item->getQty()-$freeQty);
264
+ } else {
265
+ $rowWeight = 0;
266
+ }
267
+ }
268
+ $weight = $rowWeight;
269
+ $freeMethodWeight+= $rowWeight;
270
+ }
271
+
272
+ return true; //return - the weight & qty is worked out from the child items. Children may have additional fixed price to add on.
273
+ } else {
274
+ return false;
275
+ }
276
+ }
277
+
278
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
279
+ foreach ($item->getChildren() as $child) {
280
+ $itemGroup[]=$item;
281
+ if ($child->getProduct()->isVirtual()) {
282
+ continue;
283
+ }
284
+ $addressQty += $item->getQty()*$child->getQty();
285
+
286
+ if (!$item->getProduct()->getWeightType()) {
287
+ $itemWeight = $child->getWeight();
288
+ $itemQty = $child->getTotalQty();
289
+ $rowWeight = $itemWeight*$itemQty;
290
+ if ($cartFreeShipping || $child->getFreeShipping()===true) {
291
+ $rowWeight = 0;
292
+ } elseif (is_numeric($child->getFreeShipping())) {
293
+ $freeQty = $child->getFreeShipping();
294
+ if ($itemQty>$freeQty) {
295
+ $rowWeight = $itemWeight*($itemQty-$freeQty);
296
+ } else {
297
+ $rowWeight = 0;
298
+ }
299
+ }
300
+ $freeMethodWeight += $rowWeight;
301
+ }
302
+ }
303
+ if ($item->getProduct()->getWeightType()) {
304
+ $itemWeight = $item->getWeight();
305
+ $rowWeight = $itemWeight*$item->getQty();
306
+ $addressWeight+= $rowWeight;
307
+ if ($cartFreeShipping || $item->getFreeShipping()===true) {
308
+ $rowWeight = 0;
309
+ } elseif (is_numeric($item->getFreeShipping())) {
310
+ $freeQty = $item->getFreeShipping();
311
+ if ($item->getQty()>$freeQty) {
312
+ $rowWeight = $itemWeight*($item->getQty()-$freeQty);
313
+ } else {
314
+ $rowWeight = 0;
315
+ }
316
+ }
317
+ $freeMethodWeight+= $rowWeight;
318
+ }
319
+ } else {
320
+ if (!$item->getProduct()->isVirtual()) {
321
+ $addressQty += $item->getQty();
322
+ }
323
+
324
+ if($item->getParentItem() && $item->getParentItem()->getProduct()->getWeightType()){
325
+ $itemWeight = 0;
326
+ $rowWeight = 0;
327
+ $addressWeight += 0; //Added in parent logic above
328
+ } else {
329
+ $itemWeight = $item->getWeight();
330
+ $rowWeight = $itemWeight*$item->getQty();
331
+ $addressWeight+= $rowWeight;
332
+ }
333
+ if ($cartFreeShipping || $item->getFreeShipping()===true) {
334
+ $rowWeight = 0;
335
+ } elseif (is_numeric($item->getFreeShipping())) {
336
+ $freeQty = $item->getFreeShipping();
337
+ if ($item->getQty()>$freeQty) {
338
+ $rowWeight = $itemWeight*($item->getQty()-$freeQty);
339
+ } else {
340
+ $rowWeight = 0;
341
+ }
342
+ }
343
+ $freeMethodWeight+= $rowWeight;
344
+ }
345
+
346
+ if (!$useParent && $item->getParentItem() && $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ) {
347
+ $weight=$addressWeight*$item->getParentItem()->getQty();
348
+ $qty=$addressQty*$item->getParentItem()->getQty();
349
+ $parentProduct = $item->getParentItem()->getProduct();
350
+ !$useBase ? $finalPrice = $item->getRowTotal() : $finalPrice = $item->getBaseRowTotal();
351
+ $useTax && $useBase ? $finalPrice += $item->getBaseTaxAmount() : false;
352
+ $useTax && !$useBase ? $finalPrice += $item->getTaxAmount() : false;
353
+ if ($parentProduct->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
354
+ if ($parentProduct->hasCustomOptions()) {
355
+ $customOption = $parentProduct->getCustomOption('bundle_option_ids');
356
+ $customOption = $parentProduct->getCustomOption('bundle_selection_ids');
357
+ $selectionIds = unserialize($customOption->getValue());
358
+ $selections = $parentProduct->getTypeInstance(true)->getSelectionsByIds($selectionIds, $parentProduct);
359
+ if (method_exists($selections,'addTierPriceData')) {
360
+ $selections->addTierPriceData();
361
+ }
362
+ foreach ($selections->getItems() as $selection) {
363
+ if ($selection->getProductId()== $item->getProductId()) {
364
+ $finalPrice = $item->getParentItem()->getProduct()->getPriceModel()->getChildFinalPrice(
365
+ $parentProduct, $item->getParentItem()->getQty(),
366
+ $selection, $qty, $item->getQty());
367
+ //Price from here is always base. Convert to store to stay consistent unless flag $useBase is set.
368
+ !$useBase ? $finalPrice = Mage::helper('directory')->currencyConvert($finalPrice,
369
+ Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()) : '';
370
+
371
+ if($useTax) {
372
+ $calculator = Mage::helper('tax')->getCalculator();
373
+ $taxRequest = $calculator->getRateOriginRequest();
374
+ $taxRequest->setProductClassId($parentProduct->getTaxClassId());
375
+ $taxPercentage = $calculator->getRate($taxRequest);
376
+
377
+ $taxAmount = round(($taxPercentage/100) * $finalPrice,2);
378
+ $storeTaxAmount = round(Mage::helper('directory')->currencyConvert($taxAmount,
379
+ Mage::app()->getStore()->getBaseCurrencyCode(), Mage::app()->getStore()->getCurrentCurrencyCode()),2);
380
+
381
+ $finalPrice += $useBase ? $taxAmount : $storeTaxAmount;
382
+ }
383
+ }
384
+ }
385
+ }
386
+ }
387
+ $price=$finalPrice;
388
+ } else {
389
+ $weight=$addressWeight;
390
+ $qty=$addressQty;
391
+ !$useBase ? $price = $item->getRowTotal() : $price = $item->getBaseRowTotal();
392
+ $useTax && !$useBase ? $price += ($item->getRowTotalInclTax() - $item->getRowTotal()) : false;
393
+ $useTax && $useBase ? $price += ($item->getBaseRowTotalInclTax() - $item->getBaseRowTotal()) : false;
394
+ }
395
+
396
+ if ($useDiscountValue){
397
+ !$useBase ? $price-=$item->getDiscountAmount() : $price-=$item->getBaseDiscountAmount();;
398
+ }
399
+
400
+ $basePriceInclTax += $item->getBaseRowTotalInclTax(); //TODO: Need to cover all scenarios
401
+
402
+ return true;
403
+ }
404
+
405
+
406
+
407
+ public static function updateStatus($session,$numRows) {
408
+ if ($numRows<1) {
409
+ $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>')) ;
410
+ } else {
411
+ $session->addSuccess(Mage::helper('adminhtml')->__($numRows.' rows have been imported.'));
412
+ }
413
+ }
414
+
415
+
416
+ // DO NOT USE THIS - See Helper/Data.php in Freight Common
417
+ // Has been deprecated May 2013
418
+ public static function hasFreightCarrierEnabled() {
419
+ if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Yrcfreight','carriers/yrcfreight/active') ||
420
+ Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsaupsfreight','carriers/wsaupsfreight/active') ||
421
+ Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/rlfreight/active') ||
422
+ Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/newgistics/active') ||
423
+ Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafedexfreight','carriers/wsafedexfreight/active') ) {
424
+ return true;
425
+ }
426
+ return false;
427
+ }
428
+
429
+ /**
430
+ * // DO NOT USE THIS - See Helper/Data.php in Freight Common
431
+ // Has been deprecated May 2013
432
+ * Retrieves enabled freight carriers. Currently only returns one
433
+ */
434
+ public static function getFreightCarriers() {
435
+ if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Yrcfreight','carriers/yrcfreight/active')) {
436
+ return 'yrcfreight';
437
+ }
438
+
439
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsaupsfreight','carriers/wsaupsfreight/active') ) {
440
+ return 'wsaupsfreight';
441
+ }
442
+
443
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/rlfreight/active') ) {
444
+ return 'rlfreight';
445
+ }
446
+
447
+ if(Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafedexfreight','carriers/wsafedexfreight/active')){
448
+ return 'wsafedexfreight';
449
+
450
+ }
451
+ return '';
452
+ }
453
+
454
+ /**
455
+ *
456
+ * Method to save a backup copy of the CSV file to the file system.
457
+ * @param String $file - CSV file to be saved.
458
+ * @param String $fileName - What to call the file including extension.
459
+ * @param string $websiteId - The website Id to be added to the file name.
460
+ */
461
+ public function saveCSV($file,$fileName,$websiteId=NULL,$carrierCode=NULL) {
462
+
463
+ $dir = Mage::getBaseDir('var').'/export/';
464
+
465
+ $fileName = 'WSA_'.$carrierCode.'_' . $fileName; // Add unique WSA marker for csv exporting.
466
+
467
+ if (strpos($fileName, '.csv')) {
468
+ $timestamp = md5(microtime());
469
+ if (!is_null($websiteId)) {
470
+ $fileName = str_replace('.csv', '', $fileName) . 'Id=' . $websiteId . '_' . $timestamp . '.csv';
471
+ } else {
472
+ $fileName = str_replace('.csv', '', $fileName) . $timestamp . '.csv';
473
+ }
474
+ }
475
+
476
+ try {
477
+ if(!is_dir($dir)) {
478
+ if(!mkdir($dir)){
479
+ Mage::helper('wsacommon/log')->postMajor("WSA Helper","IO Error","Error Creating Backup CSV File Directory");
480
+ }
481
+ }
482
+ if (!ctype_digit(file_put_contents($dir.$fileName, $file))) {
483
+ Mage::helper('wsacommon/log')->postMajor("WSA Helper","IO Error","Error Creating Backup CSV File");
484
+ }
485
+ } catch (Exception $e) {
486
+ Mage::helper('wsacommon/log')->postMajor("Helper","Error Saving CSV File Backup",$e->getMessage());
487
+ }
488
+
489
+ }
490
+
491
+ public static function getProduct($item,$useParent=true) {
492
+ $product = null;
493
+
494
+ if ($item->getParentItem()!=null && $useParent ) {
495
+ $product=$item->getParentItem()->getProduct();
496
+ } else if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && !$useParent ) {
497
+ if ($item->getHasChildren()) {
498
+ foreach ($item->getChildren() as $child) {
499
+ $product=Mage::getModel('catalog/product')->load($child->getProductId());
500
+ break;
501
+ }
502
+ }
503
+ } else {
504
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
505
+ }
506
+
507
+ return $product;
508
+ }
509
+
510
+ public function formatXML($xmlString) {
511
+
512
+ try {
513
+ $simpleXml = new SimpleXMLElement($xmlString);
514
+ $dom = new DOMDocument('1.0');
515
+ $dom->preserveWhiteSpace = false;
516
+ $dom->formatOutput = true;
517
+ $dom->loadXML($simpleXml->asXML());
518
+ return $dom->saveXML();
519
+ } catch (Exception $e) {
520
+ return $xmlString;
521
+ }
522
+
523
+ }
524
+
525
+ }
app/code/community/Webshopapps/Wsacommon/Model/Export/Csv.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $dir = Mage::getBaseDir('var') . DS . 'export' . DS . $mostRecentCSV;
134
+
135
+ if (is_file($dir)) {
136
+ $fp = fopen($dir, 'r');
137
+ $theData = fread($fp, filesize($dir));
138
+ fclose($fp);
139
+ } else {
140
+ $theData = $this->_noCSVPresent($dir);
141
+ return $theData;
142
+ }
143
+
144
+ $this->_theDataArray = array($mostRecentCSV, $theData);
145
+ }
146
+
147
+ /**
148
+ * Sets up $this->_fileDates & $this->_dateFileArray to be sorted
149
+ *
150
+ * @param $csvFiles Array of csv files in var/export.
151
+ */
152
+ protected function timeSortSetup($file)
153
+ {
154
+ $currentModified = filectime(Mage::getBaseDir('var') . DS . 'export' . DS. $file);
155
+ $this->_fileDates[] = $currentModified;
156
+ $this->_dateFileArray[$currentModified] = $file;
157
+ }
158
+
159
+ /**
160
+ * Assigns blank CSV file to $this->_theDataArray and posts a log
161
+ *
162
+ * @param $dir Location of var/export.
163
+ */
164
+ protected function _getNoCsvFilePresentArr()
165
+ {
166
+ $dir = Mage::getBaseDir('var') . DS . 'export' . DS;
167
+ Mage::helper('wsacommon/log')->postMajor('WSA Helper','No file found in var/export with the name:', $dir);
168
+ return array('', 'blank');
169
+ }
170
+
171
+ }
172
+ ?>
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/Shipping/Carrier/Abstract.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *********** DEPRECATED - Now moved into WSAFreight Common - do not modify, here to support extn installs only ************************
43
+ *
44
+ */
45
+
46
+ abstract class Webshopapps_Wsacommon_Model_Shipping_Carrier_Abstract extends Webshopapps_Wsacommon_Model_Shipping_Carrier_Baseabstract
47
+ {
48
+
49
+ const USA_COUNTRY_ID = 'US';
50
+ const PUERTORICO_COUNTRY_ID = 'PR';
51
+ const GUAM_COUNTRY_ID = 'GU';
52
+ const GUAM_REGION_CODE = 'GU';
53
+
54
+ public function isCityRequired()
55
+ {
56
+ return false;
57
+ }
58
+
59
+ /**
60
+ * Determine whether zip-code is required for the country of destination
61
+ *
62
+ * @param string|null $countryId
63
+ * @return bool
64
+ */
65
+ public function isZipCodeRequired($countryId = null)
66
+ {
67
+ if (!is_null($countryId)) {
68
+ return !Mage::helper('directory')->isZipCodeOptional($countryId);
69
+ }
70
+ return true;
71
+ }
72
+
73
+ /**
74
+ * Processing additional validation to check is carrier applicable.
75
+ *
76
+ * @param Mage_Shipping_Model_Rate_Request $request
77
+ * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean
78
+ */
79
+ public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
80
+ {
81
+ return true;
82
+ }
83
+
84
+
85
+ protected function getLineItems($ignoreFreeItems, $useParent=true) {
86
+ $LineItemArray=array();
87
+ if(!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafreightcommon')){
88
+ $defaultFreightClass = $this->getConfigData('default_freight_class');
89
+ } else $defaultFreightClass = Mage::helper('wsafreightcommon')->getDefaultFreightClass();
90
+
91
+ foreach ($this->_request->getAllItems() as $item) {
92
+
93
+ $weight=0;
94
+ $qty=0;
95
+ $price=0;
96
+
97
+ if (!Mage::helper('wsacommon/shipping')->getItemTotals($item, $weight,$qty,$price,$useParent,$ignoreFreeItems)) {
98
+ continue;
99
+ }
100
+
101
+ $product = Mage::helper('wsacommon/shipping')->getProduct($item,$useParent);
102
+
103
+ $weight=ceil($weight); // round up to nearest whole - required for conway
104
+ $price=$price/$qty;
105
+ $class=$product->getData('freight_class');
106
+
107
+ if (empty($class) || $class=='') {
108
+ $class=$defaultFreightClass; // use default
109
+ }
110
+
111
+ if (empty($LineItemArray) || !array_key_exists($class,$LineItemArray)) {
112
+ $LineItemArray[$class]= $weight;
113
+ } else {
114
+
115
+ $LineItemArray[$class]= $LineItemArray[$class]+ ($weight);
116
+ }
117
+
118
+ }
119
+ return $LineItemArray;
120
+ }
121
+
122
+
123
+ protected function getShipmentMethods($allowedMethods) {
124
+ $shipmentMethods=array();
125
+ foreach ($allowedMethods as $method) {
126
+ $shipmentMethods[]=$this->getCode('method',$method);
127
+ }
128
+ return $shipmentMethods;
129
+ }
130
+
131
+
132
+ public function getAllowedMethods()
133
+ {
134
+ $arr = array();
135
+ $allowed = explode(',', $this->getConfigData('allowed_methods'));
136
+ foreach ($allowed as $k) {
137
+ $arr[$k] = $this->getCode('method', $k);
138
+ }
139
+
140
+ return $arr;
141
+ }
142
+
143
+ protected function _getCart()
144
+ {
145
+ return Mage::getSingleton('checkout/cart');
146
+ }
147
+
148
+ protected function _getQuote()
149
+ {
150
+ return $this->_getCart()->getQuote();
151
+ }
152
+ }
app/code/community/Webshopapps/Wsacommon/Model/Shipping/Carrier/Baseabstract.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ protected static $_quotesCache = array();
57
+
58
+ const XML_PATH_STORE_ADDRESS1 = 'shipping/origin/street_line1';
59
+ const XML_PATH_STORE_ADDRESS2 = 'shipping/origin/street_line2';
60
+ const XML_PATH_STORE_CITY = 'shipping/origin/city';
61
+ const XML_PATH_STORE_REGION_ID = 'shipping/origin/region_id';
62
+ const XML_PATH_STORE_ZIP = 'shipping/origin/postcode';
63
+ const XML_PATH_STORE_COUNTRY_ID = 'shipping/origin/country_id';
64
+
65
+
66
+ abstract protected function _getQuotes();
67
+ abstract public function getCode($type, $code='');
68
+
69
+ public function getTrackingInfo($tracking, $postcode=null, $orderId=null)
70
+ {
71
+ $info = array();
72
+
73
+ $result = $this->getTracking($tracking);
74
+
75
+ if($result instanceof Mage_Shipping_Model_Tracking_Result){
76
+ if ($trackings = $result->getAllTrackings()) {
77
+ return $trackings[0];
78
+ }
79
+ }
80
+ elseif (is_string($result) && !empty($result)) {
81
+ return $result;
82
+ } else {
83
+ $info['title'] = $this->getConfigData('title');
84
+ $info['number'] = $tracking;
85
+ return $info;
86
+ }
87
+
88
+ return false;
89
+ }
90
+
91
+ /**
92
+ * Check if carrier has shipping tracking option available
93
+ * All Mage_Usa carriers have shipping tracking option available
94
+ *
95
+ * @return boolean
96
+ */
97
+ public function isTrackingAvailable()
98
+ {
99
+ return true;
100
+ }
101
+
102
+ public function getResult()
103
+ {
104
+ return $this->_result;
105
+ }
106
+
107
+ /**
108
+ * Enter description here...
109
+ *
110
+ * @param Mage_Shipping_Model_Rate_Request $data
111
+ * @return Mage_Shipping_Model_Rate_Result
112
+ */
113
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
114
+ {
115
+ if (!$this->getConfigFlag('active')) {
116
+ return false;
117
+ }
118
+ if ($this->_modName == 'none') {
119
+ $this->_debug = $this->getConfigData('debug');
120
+ } else {
121
+ $this->_debug = Mage::helper('wsalogger')->isDebug($this->_modName);
122
+ }
123
+
124
+
125
+ $this->setRequest($request);
126
+
127
+ $this->_result = $this->_getQuotes();
128
+
129
+ $this->_updateFreeMethodQuote($request);
130
+
131
+ return $this->getResult();
132
+ }
133
+
134
+
135
+ protected function _setFreeMethodRequest($freeMethod)
136
+ {
137
+ $this->_rawRequest->setIgnoreFreeItems(true);
138
+ }
139
+
140
+ public function getAllowedMethods()
141
+ {
142
+ return array($this->_code=>$this->getConfigData('name'));
143
+ }
144
+
145
+ /**
146
+ * Returns cache key for some request to carrier quotes service
147
+ *
148
+ * @param string|array $requestParams
149
+ * @return string
150
+ */
151
+ protected function _getQuotesCacheKey($requestParams)
152
+ {
153
+ if (is_array($requestParams)) {
154
+ $requestParams = implode(',', array_merge(
155
+ array($this->getCarrierCode()),
156
+ array_keys($requestParams),
157
+ $requestParams)
158
+ );
159
+ }
160
+ return crc32($requestParams);
161
+ }
162
+
163
+ /**
164
+ * Checks whether some request to rates have already been done, so we have cache for it
165
+ * Used to reduce number of same requests done to carrier service during one session
166
+ *
167
+ * Returns cached response or null
168
+ *
169
+ * @param string|array $requestParams
170
+ * @return null|string
171
+ */
172
+ protected function _getCachedQuotes($requestParams)
173
+ {
174
+ $key = $this->_getQuotesCacheKey($requestParams);
175
+ return isset(self::$_quotesCache[$key]) ? self::$_quotesCache[$key] : null;
176
+ }
177
+
178
+ /**
179
+ * Sets received carrier quotes to cache
180
+ *
181
+ * @param string|array $requestParams
182
+ * @param string $response
183
+ * @return Mage_Usa_Model_Shipping_Carrier_Abstract
184
+ */
185
+ protected function _setCachedQuotes($requestParams, $response)
186
+ {
187
+ $key = $this->_getQuotesCacheKey($requestParams);
188
+ self::$_quotesCache[$key] = $response;
189
+ return $this;
190
+ }
191
+ }
app/code/community/Webshopapps/Wsacommon/Model/Shipping/Shipping.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Retrieve all methods for supplied shipping data
43
+ *
44
+ * @todo make it ordered
45
+ * @param Mage_Shipping_Model_Shipping_Method_Request $data
46
+ * @return Mage_Shipping_Model_Shipping
47
+ */
48
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
49
+ {
50
+
51
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Dropship','carriers/dropship/active')) {
52
+ if (!Mage::registry('dropship_shipmodel')) {
53
+ $model = Mage::getModel('dropship/shipping_shipping');
54
+ Mage::register('dropship_shipmodel', $model);
55
+ }
56
+ Mage::registry('dropship_shipmodel')->resetResult();
57
+ return Mage::registry('dropship_shipmodel')->collectRates($request);
58
+ }
59
+
60
+
61
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rgshipping','shipping/rgshipping/active')) {
62
+ if (!Mage::registry('rgshipping_shipmodel')) {
63
+ $model = Mage::getModel('rgshipping/shipping_shipping');
64
+ Mage::register('rgshipping_shipmodel', $model);
65
+ }
66
+ Mage::registry('rgshipping_shipmodel')->resetResult();
67
+ return Mage::registry('rgshipping_shipmodel')->collectRates($request);
68
+ }
69
+
70
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipmanager','carriers/shipmanager/active')) {
71
+ if (!Mage::registry('shipmanager_shipmodel')) {
72
+ $model = Mage::getModel('shipmanager/shipping_shipping');
73
+ Mage::register('shipmanager_shipmodel', $model);
74
+ }
75
+ Mage::registry('shipmanager_shipmodel')->resetResult();
76
+ return Mage::registry('shipmanager_shipmodel')->collectRates($request);
77
+ }
78
+
79
+
80
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shippingoverride2','shipping/shippingoverride2/active')) {
81
+ if (!Mage::registry('override2_shipmodel')) {
82
+ $model = Mage::getModel('shippingoverride2/shipping_shipping');
83
+ Mage::register('override2_shipmodel', $model);
84
+ }
85
+ Mage::registry('override2_shipmodel')->resetResult();
86
+ return Mage::registry('override2_shipmodel')->collectRates($request);
87
+ }
88
+
89
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Freightrate','carriers/freightrate/active')) {
90
+ if (!Mage::registry('freightrate_shipmodel')) {
91
+ $model = Mage::getModel('freightrate/shipping_shipping');
92
+ Mage::register('freightrate_shipmodel', $model);
93
+ }
94
+ Mage::registry('freightrate_shipmodel')->resetResult();
95
+ return Mage::registry('freightrate_shipmodel')->collectRates($request);
96
+ }
97
+
98
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafreightcommon','shipping/wsafreightcommon/active')) {
99
+ if (!Mage::registry('wsafreightcommon_shipmodel')) {
100
+ $model = Mage::getModel('wsafreightcommon/shipping_shipping');
101
+ Mage::register('wsafreightcommon_shipmodel', $model);
102
+ }
103
+ Mage::registry('wsafreightcommon_shipmodel')->resetResult();
104
+ return Mage::registry('wsafreightcommon_shipmodel')->collectRates($request);
105
+ }
106
+
107
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Estesfreight','carriers/estesfreight/active')) {
108
+ if (!Mage::registry('estes_shipmodel')) {
109
+ $model = Mage::getModel('estesfreight/shipping_shipping');
110
+ Mage::register('estes_shipmodel', $model);
111
+ }
112
+ Mage::registry('estes_shipmodel')->resetResult();
113
+ return Mage::registry('estes_shipmodel')->collectRates($request);
114
+ }
115
+
116
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Conwayfreight','carriers/conwayfreight/active')) {
117
+ if (!Mage::registry('conway_shipmodel')) {
118
+ $model = Mage::getModel('conwayfreight/shipping_shipping');
119
+ Mage::register('conway_shipmodel', $model);
120
+ }
121
+ Mage::registry('conway_shipmodel')->resetResult();
122
+ return Mage::registry('conway_shipmodel')->collectRates($request);
123
+ }
124
+
125
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsafedexfreight','carriers/wsafedexfreight/active')) {
126
+ if (!Mage::registry('wsafedexfreight_shipmodel')) {
127
+ $model = Mage::getModel('wsafedexfreight/shipping_shipping');
128
+ Mage::register('wsafedexfreight_shipmodel', $model);
129
+ }
130
+ Mage::registry('wsafedexfreight_shipmodel')->resetResult();
131
+ return Mage::registry('wsafedexfreight_shipmodel')->collectRates($request);
132
+ }
133
+
134
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Usslogistics','carriers/usslogistics/active')) {
135
+ if (!Mage::registry('usslogistics_shipmodel')) {
136
+ $model = Mage::getModel('usslogistics/shipping_shipping');
137
+ Mage::register('usslogistics_shipmodel', $model);
138
+ }
139
+ Mage::registry('usslogistics_shipmodel')->resetResult();
140
+ return Mage::registry('usslogistics_shipmodel')->collectRates($request);
141
+ }
142
+
143
+
144
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Abffreight','carriers/abffreight/active')) {
145
+ if (!Mage::registry('abffreight_shipmodel')) {
146
+ $model = Mage::getModel('abffreight/shipping_shipping');
147
+ Mage::register('abffreight_shipmodel', $model);
148
+ }
149
+ Mage::registry('abffreight_shipmodel')->resetResult();
150
+ return Mage::registry('abffreight_shipmodel')->collectRates($request);
151
+ }
152
+
153
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Wsaupsfreight','carriers/wsaupsfreight/active')) {
154
+ if (!Mage::registry('wsaupfreight_shipmodel')) {
155
+ $model = Mage::getModel('wsaupsfreight/shipping_shipping');
156
+ Mage::register('wsaupfreight_shipmodel', $model);
157
+ }
158
+ Mage::registry('wsaupfreight_shipmodel')->resetResult();
159
+ return Mage::registry('wsaupfreight_shipmodel')->collectRates($request);
160
+ }
161
+
162
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Yrcfreight','carriers/yrcfreight/active')) {
163
+ if (!Mage::registry('yrc_shipmodel')) {
164
+ $model = Mage::getModel('yrcfreight/shipping_shipping');
165
+ Mage::register('yrc_shipmodel', $model);
166
+ }
167
+ Mage::registry('yrc_shipmodel')->resetResult();
168
+ return Mage::registry('yrc_shipmodel')->collectRates($request);
169
+ }
170
+
171
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Rlfreight','carriers/rlfreight/active')) {
172
+ if (!Mage::registry('rlfreight_shipmodel')) {
173
+ $model = Mage::getModel('rlfreight/shipping_shipping');
174
+ Mage::register('rlfreight_shipmodel', $model);
175
+ }
176
+ Mage::registry('rlfreight_shipmodel')->resetResult();
177
+ return Mage::registry('rlfreight_shipmodel')->collectRates($request);
178
+ }
179
+
180
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingproduct','shipping/handlingproduct/active')) {
181
+ if (!Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipusa','shipping/shipusa/active')) {
182
+ if (Mage::registry('handlingproduct_shipmodel')) {
183
+ Mage::registry('handlingproduct_shipmodel')->resetResult();
184
+
185
+ }
186
+ }
187
+ }
188
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingmatrix','shipping/handlingmatrix/active')) {
189
+ if (Mage::registry('handlingmatrix_shipmodel')) {
190
+ Mage::registry('handlingmatrix_shipmodel')->resetResult();
191
+ }
192
+ }
193
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Insurance','shipping/insurance/active')) {
194
+ if (Mage::registry('insurance_shipmodel')) {
195
+ Mage::registry('insurance_shipmodel')->resetResult();
196
+ }
197
+ }
198
+
199
+ return parent::collectRates($request);
200
+ }
201
+
202
+
203
+ /**
204
+ * Overrides this method in core, and decides which extension to call
205
+ * Uses a hierarchy to decide on best extension
206
+ * @see app/code/core/Mage/Shipping/Model/Mage_Shipping_Model_Shipping::collectCarrierRates()
207
+ */
208
+ public function collectCarrierRates($carrierCode, $request)
209
+ {
210
+
211
+ // check to see if handling Product enabled
212
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingproduct','shipping/handlingproduct/active')) {
213
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipusa','shipping/shipusa/active')) {
214
+ return parent::collectCarrierRates($carrierCode,$request);
215
+
216
+ } else {
217
+ if (!Mage::registry('handlingproduct_shipmodel')) {
218
+ $model = Mage::getModel('handlingproduct/shipping_shipping');
219
+ Mage::register('handlingproduct_shipmodel', $model);
220
+ }
221
+ $model = Mage::registry('handlingproduct_shipmodel') ;
222
+ $model->collectCarrierRates($carrierCode, $request);
223
+ $this->_result=$model->getResult();
224
+ return $model;
225
+
226
+ }
227
+ }
228
+
229
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingmatrix','shipping/handlingmatrix/active')) {
230
+ if (!Mage::registry('handlingmatrix_shipmodel')) {
231
+ $model = Mage::getModel('handlingmatrix/shipping_shipping');
232
+ Mage::register('handlingmatrix_shipmodel', $model);
233
+ }
234
+ $model = Mage::registry('handlingmatrix_shipmodel');
235
+ $model->collectCarrierRates($carrierCode, $request);
236
+ $this->_result=$model->getResult();
237
+ return $model;
238
+ }
239
+
240
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Insurance','shipping/insurance/active')) {
241
+ if (!Mage::registry('insurance_shipmodel')) {
242
+ $model = Mage::getModel('insurance/shipping_shipping');
243
+ Mage::register('insurance_shipmodel', $model);
244
+ }
245
+ $model = Mage::registry('insurance_shipmodel');
246
+ $model->collectCarrierRates($carrierCode, $request);
247
+ $this->_result=$model->getResult();
248
+ return $model;
249
+ }
250
+
251
+
252
+ // default
253
+ return parent::collectCarrierRates($carrierCode,$request);
254
+
255
+ }
256
+
257
+
258
+ }
app/code/community/Webshopapps/Wsacommon/changelog.txt ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
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/Wsafreightcommon/Block/Adminhtml/Sales/Order/View/Freightinfo.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2012 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
+ * @category Webshopapps
28
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
29
+ * Copyright, 2013, Zowta, LLC - US license
30
+ * @author Karen Baker
31
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
32
+ */
33
+
34
+
35
+ class Webshopapps_Wsafreightcommon_Block_Adminhtml_Sales_Order_View_Freightinfo
36
+ extends Mage_Adminhtml_Block_Sales_Order_View_Info
37
+ {
38
+
39
+ public function getWsafreightcommonInfoHtml() {
40
+
41
+ $order = $this->getOrder();
42
+ $htmlOutput = '';
43
+ $innerHtmlOutput = $this->getFreightShippingInfo($order);
44
+
45
+ if (!empty($innerHtmlOutput)) {
46
+
47
+ $htmlOutput = '<div class="box-right"><div class="clear"></div><div class="entry-edit">';
48
+ $htmlOutput.= '<div class="entry-edit-head">';
49
+ $htmlOutput.= '<h4 class="icon-head head-shipping-method">';
50
+ $htmlOutput.= Mage::helper("sales")->__("Freight Shipping Information");
51
+ $htmlOutput.= '</h4>';
52
+ $htmlOutput.= '</div><fieldset>';
53
+ $htmlOutput.= $innerHtmlOutput;
54
+ $htmlOutput.= '</fieldset> <div class="clear"/></div></div>';
55
+ }
56
+ return "'".$htmlOutput."'";
57
+ }
58
+
59
+ public function getFreightShippingInfo($order) {
60
+ $innerHtmlOutput = '';
61
+ if ($order->getFreightQuoteId()) {
62
+ $innerHtmlOutput.= Mage::helper('sales')->__('Freight Reference Id - %s', $order->getFreightQuoteId()) ;
63
+ $innerHtmlOutput .= '<br />';
64
+ }
65
+ if ($order->getLiftgateRequired()) {
66
+ $innerHtmlOutput.= Mage::helper('sales')->__('Liftgate Required');
67
+ $innerHtmlOutput .= '<br />';
68
+ }
69
+ if ($order->getNotifyRequired()) {
70
+ $innerHtmlOutput.= Mage::helper('sales')->__('Scheduled Appointment Required') ;
71
+ $innerHtmlOutput .= '<br />';
72
+ }
73
+ if ($order->getInsideDelivery()) {
74
+ $innerHtmlOutput.= Mage::helper('sales')->__('Inside Delivery Required') ;
75
+ $innerHtmlOutput .= '<br />';
76
+ }
77
+ if (($order->getShiptoType()!='') && !Mage::getStoreConfig('shipping/wsafreightcommon/default_address',Mage::app()->getStore())) {
78
+ if ($order->getShiptoType() == 0) {
79
+ $innerHtmlOutput .= Mage::helper('sales')->__('Address Type - Residential');
80
+ } else {
81
+ $innerHtmlOutput .= Mage::helper('sales')->__('Address Type - Business');
82
+ }
83
+ $innerHtmlOutput .= '<br />';
84
+ } else if (($order->getShiptoType()!='') && Mage::getStoreConfig('shipping/wsafreightcommon/default_address',Mage::app()->getStore())) {
85
+ if ($order->getShiptoType() == 0) {
86
+ $innerHtmlOutput .= Mage::helper('sales')->__('Address Type - Business');
87
+ } else {
88
+ $innerHtmlOutput .= Mage::helper('sales')->__('Address Type - Residential');
89
+ }
90
+ $innerHtmlOutput .= '<br />';
91
+ }
92
+
93
+ return $innerHtmlOutput;
94
+
95
+ }
96
+
97
+ }
app/code/community/Webshopapps/Wsafreightcommon/Block/Checkout/Cart/Shipping.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_Checkout
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /*
28
+ * Webshopapps Residential Delivery Extension
29
+ *
30
+ * @author Webshopapps
31
+ * @license www.webshopapps.com/license/license.txt
32
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
33
+ * Copyright, 2013, Zowta, LLC - US license
34
+ * (c) Webshopapps.com Zowta Ltd 2010 - All rights reserved.
35
+ */
36
+ class Webshopapps_Wsafreightcommon_Block_Checkout_Cart_Shipping extends Mage_Checkout_Block_Cart_Shipping
37
+ {
38
+
39
+ public function getLiftgateRequired()
40
+ {
41
+ if(Mage::getStoreConfig('shipping/wsafreightcommon/default_liftgate',Mage::app()->getStore()) && $this->getAddress()->getLiftgateRequired() == ''){
42
+ return true;
43
+ } else {
44
+ return $this->getAddress()->getLiftgateRequired();
45
+ }
46
+ }
47
+
48
+ public function getShiptoType()
49
+ {
50
+ return $this->getAddress()->getShiptoType();
51
+ }
52
+
53
+ public function getCityActive()
54
+ {
55
+ $active = FALSE;
56
+
57
+ if (!$this->dontShowCommonFreight()) {
58
+ (bool)Mage::getStoreConfig('carriers/yrcfreight/active')
59
+ || (bool)Mage::getStoreConfig('carriers/abffreight/active') ? $active=TRUE : $active;
60
+ }
61
+ if (!$active) {
62
+ return parent::getCityActive();
63
+ } else {
64
+ return $active;
65
+ }
66
+ }
67
+
68
+
69
+ public function getStateActive()
70
+ {
71
+ return true;
72
+ }
73
+
74
+
75
+ /**
76
+ * Check if one of carriers require state/province
77
+ *
78
+ * @return bool
79
+ */
80
+ public function isStateProvinceRequired()
81
+ {
82
+ return true;
83
+ }
84
+
85
+ /**
86
+ * Check if one of carriers require city
87
+ *
88
+ * @return bool
89
+ */
90
+ public function isCityRequired()
91
+ {
92
+ $active = FALSE;
93
+
94
+ (bool)Mage::getStoreConfig('carriers/yrcfreight/active')
95
+ || (bool)Mage::getStoreConfig('carriers/abffreight/active') ? $active=TRUE : $active;
96
+
97
+ if (!$active) {
98
+ return parent::isCityRequired();
99
+ } else {
100
+ return $active;
101
+ }
102
+ }
103
+
104
+
105
+ public function getNotifyRequired()
106
+ {
107
+ return $this->getAddress()->getNotifyRequired();
108
+ }
109
+
110
+
111
+ public function getInsideDelivery()
112
+ {
113
+ return $this->getAddress()->getInsideDelivery();
114
+ }
115
+
116
+
117
+ public function getShiptoTypeHtmlSelect($defValue=null) {
118
+
119
+ if (is_null($defValue)) {
120
+ $defValue=$this->getShiptoType();
121
+ }
122
+
123
+ $options = Mage::helper('wsafreightcommon')->getOptions();
124
+
125
+ $html = $this->getLayout()->createBlock('core/html_select')
126
+ ->setName('shipto_type')
127
+ ->setTitle(Mage::helper('wsafreightcommon')->__('Address Type'))
128
+ ->setId('shipto_type')
129
+ ->setClass('required-entry')
130
+ ->setValue($defValue)
131
+ ->setOptions($options)
132
+ ->getHtml();
133
+ return $html;
134
+
135
+ }
136
+
137
+ public function dontShowCommonFreight() {
138
+ return Mage::helper('wsafreightcommon')->dontShowCommonFreight(
139
+ $this->getAddress()->getAllItems(),$this->getAddress()->getWeight());
140
+ }
141
+
142
+
143
+ }
app/code/community/Webshopapps/Wsafreightcommon/Block/Onepage.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Onepage checkout block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Checkout
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Webshopapps_Wsafreightcommon_Block_Onepage extends Mage_Checkout_Block_Onepage
35
+ {
36
+ public function getSteps()
37
+ {
38
+ if (Mage::helper('wsafreightcommon')->getAllFreightCarriers() < 1) {
39
+ return parent::getSteps();
40
+ }
41
+
42
+ $steps = array();
43
+
44
+ if (!$this->isCustomerLoggedIn()) {
45
+ $steps['login'] = $this->getCheckout()->getStepData('login');
46
+ }
47
+
48
+ if (Mage::helper('wsafreightcommon')->dontShowCommonFreight(
49
+ $this->getQuote()->getAllVisibleItems())) {
50
+ $skipExtras=true;
51
+ } else {
52
+ $skipExtras=false;
53
+ }
54
+
55
+ $stepCodes = array('billing', 'shipping', 'shippingextra', 'shipping_method', 'payment', 'review');
56
+
57
+ foreach ($stepCodes as $step) {
58
+ if ($skipExtras && $step=='shippingextra') {
59
+ continue;
60
+ }
61
+ $steps[$step] = $this->getCheckout()->getStepData($step);
62
+ }
63
+ return $steps;
64
+ }
65
+
66
+
67
+ }
app/code/community/Webshopapps/Wsafreightcommon/Block/Onepage/Progress.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
23
+ * @copyright Copyright (c) 2012 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
+ * One page checkout status
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Checkout
32
+ @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
33
+ * Copyright, 2013, Zowta, LLC - US license
34
+ * @author Magento Core Team <core@magentocommerce.com>
35
+ */
36
+ class Webshopapps_Wsafreightcommon_Block_Onepage_Progress extends Mage_Checkout_Block_Onepage_Progress
37
+ {
38
+ /**
39
+ * Overwriting to add in our step - required as of M1.7
40
+ *
41
+ * @param string $currentStep
42
+ * @return bool
43
+ */
44
+ public function isStepComplete($currentStep)
45
+ {
46
+ $stepsRevertIndex = array_flip(Mage::helper('wsafreightcommon')->_getStepCodes());
47
+
48
+ $toStep = $this->getRequest()->getParam('toStep');
49
+
50
+ if (empty($toStep) || !isset($stepsRevertIndex[$currentStep])) {
51
+ return $this->getCheckout()->getStepData($currentStep, 'complete');
52
+ }
53
+
54
+ if ($stepsRevertIndex[$currentStep] > $stepsRevertIndex[$toStep]) {
55
+ return false;
56
+ }
57
+
58
+ return $this->getCheckout()->getStepData($currentStep, 'complete');
59
+ }
60
+ }
app/code/community/Webshopapps/Wsafreightcommon/Block/Onepage/Shippingextra.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * One page checkout status
29
+ *
30
+ * @category Mage
31
+ * @category Mage
32
+ * @package Mage_Checkout
33
+ @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
34
+ * Copyright, 2013, Zowta, LLC - US license
35
+ * @author Magento Core Team <core@magentocommerce.com>
36
+ */
37
+ class Webshopapps_Wsafreightcommon_Block_Onepage_ShippingExtra extends Mage_Checkout_Block_Onepage_Abstract
38
+ {
39
+ protected function _construct()
40
+ {
41
+ $this->getCheckout()->setStepData('shippingextra', array(
42
+ 'label' => Mage::helper('checkout')->__('Freight Details'),
43
+ 'is_show' => true
44
+ ));
45
+
46
+ parent::_construct();
47
+ }
48
+
49
+ public function getLiftgateRequired()
50
+ {
51
+ if(Mage::getStoreConfig('shipping/wsafreightcommon/default_liftgate',Mage::app()->getStore())
52
+ && $this->getQuote()->getShippingAddress()->getLiftgateRequired() == ''){
53
+ return true;
54
+ } else {
55
+ return $this->getQuote()->getShippingAddress()->getLiftgateRequired();
56
+ }
57
+ }
58
+
59
+ public function getNotifyRequired()
60
+ {
61
+ return $this->getQuote()->getShippingAddress()->getNotifyRequired();
62
+ }
63
+
64
+ public function getInsideDelivery()
65
+ {
66
+ return $this->getQuote()->getShippingAddress()->getInsideDelivery();
67
+ }
68
+
69
+ public function getShiptoType()
70
+ {
71
+ return $this->getQuote()->getShippingAddress()->getShiptoType();
72
+ }
73
+
74
+ public function getShiptoTypeHtmlSelect($defValue=null) {
75
+
76
+ if (is_null($defValue)) {
77
+ $defValue=Mage::getStoreConfig('shipping/wsafreightcommon/default_address_type');
78
+ }
79
+
80
+ $options = Mage::helper('wsafreightcommon')->getOptions();
81
+
82
+ $html = $this->getLayout()->createBlock('core/html_select')
83
+ ->setName('shipto_type')
84
+ ->setTitle(Mage::helper('wsafreightcommon')->__('Address Type'))
85
+ ->setId('shipto_type')
86
+ ->setClass('required-entry')
87
+ ->setValue($defValue)
88
+ ->setOptions($options)
89
+ ->getHtml();
90
+ return $html;
91
+
92
+ }
93
+ }
app/code/community/Webshopapps/Wsafreightcommon/Helper/Data.php ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Catalog
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Catalog data helper
29
+ *
30
+ * @author Magento Core Team <core@magentocommerce.com>
31
+ */
32
+ class Webshopapps_Wsafreightcommon_Helper_Data extends Mage_Core_Helper_Abstract
33
+ {
34
+
35
+ protected static $_fixLiftgateFee;
36
+ protected static $_fixDeliveryType;
37
+ protected static $_residentialFee;
38
+ protected static $_liftgateFee;
39
+ protected static $_insideDeliveryFee;
40
+ protected static $_liveAccessories;
41
+ protected static $_hazardous;
42
+ protected static $_defaultFreightClass;
43
+ protected static $_minFreightWeight;
44
+ protected static $_fixedNotifyRequired;
45
+ protected static $_active;
46
+ protected static $_freeFreightResidentialFee;
47
+ protected static $_freeFreightLiftgateFee;
48
+
49
+ protected static $_possibleFreightCarriers = array(
50
+ 'Webshopapps_Wsafreightcommon' => 'freefreight',
51
+ 'Webshopapps_Cerasisfreight' => 'cerasisfreight',
52
+ 'Webshopapps_Ctsfreight' => 'ctsfreight',
53
+ 'Webshopapps_Dmtrans' => 'dmtrans',
54
+ 'Webshopapps_Newgistics' => 'newgistics',
55
+ 'Webshopapps_Abffreight' => 'abffreight',
56
+ 'Webshopapps_Wsafedexfreight' => 'wsafedexfreight',
57
+ 'Webshopapps_Conwayfreight' => 'conwayfreight',
58
+ 'Webshopapps_Estesfreight' => 'estesfreight',
59
+ 'Webshopapps_Echofreight' => 'echofreight',
60
+ 'Webshopapps_Rlfreight' => 'rlfreight',
61
+ 'Webshopapps_Wsaupsfreight' => 'wsaupsfreight',
62
+ 'Webshopapps_Yrcfreight' => 'yrcfreight',
63
+ 'Webshopapps_Wsaolddominion' => 'wsaolddominion',
64
+ );
65
+
66
+ public static function getDefaultFreightClass()
67
+ {
68
+ if (self::$_defaultFreightClass == NULL) {
69
+ self::$_defaultFreightClass = Mage::getStoreConfig('shipping/wsafreightcommon/default_freight_class');
70
+ }
71
+ return self::$_defaultFreightClass;
72
+ }
73
+
74
+ public static function isActive()
75
+ {
76
+ if (self::$_active == NULL) {
77
+ self::$_active = count(self::getAllFreightCarriers()) > 0;
78
+ }
79
+ return self::$_active;
80
+ }
81
+
82
+ public static function isFixedLiftgateFee()
83
+ {
84
+ if (self::$_fixLiftgateFee == NULL) {
85
+ self::$_fixLiftgateFee = Mage::getStoreConfig('shipping/wsafreightcommon/apply_live_liftgate');
86
+ }
87
+ return self::$_fixLiftgateFee;
88
+ }
89
+
90
+ public static function isFixedDeliveryType()
91
+ {
92
+ if (self::$_fixDeliveryType == NULL) {
93
+ self::$_fixDeliveryType = Mage::getStoreConfig('shipping/wsafreightcommon/apply_live_business');
94
+ }
95
+ return self::$_fixDeliveryType;
96
+ }
97
+
98
+ public static function isNotifyRequired()
99
+ {
100
+ if (self::$_fixedNotifyRequired == NULL) {
101
+ self::$_fixedNotifyRequired = Mage::getStoreConfig('shipping/wsafreightcommon/apply_live_notify');
102
+ }
103
+ return self::$_fixedNotifyRequired;
104
+ }
105
+
106
+ public static function getResidentialFee()
107
+ {
108
+ if (self::$_residentialFee == NULL) {
109
+ self::$_residentialFee = Mage::getStoreConfig('shipping/wsafreightcommon/residential_fee');
110
+ }
111
+ return self::$_residentialFee;
112
+ }
113
+
114
+ public static function getLiftgateFee()
115
+ {
116
+ if (self::$_liftgateFee == NULL) {
117
+ self::$_liftgateFee = Mage::getStoreConfig('shipping/wsafreightcommon/liftgate_fee');
118
+ }
119
+ return self::$_liftgateFee;
120
+ }
121
+
122
+ public static function getInsideDeliveryFee()
123
+ {
124
+ if (self::$_insideDeliveryFee == NULL) {
125
+ self::$_insideDeliveryFee = Mage::getStoreConfig('shipping/wsafreightcommon/inside_delivery_fee');
126
+ }
127
+ return self::$_insideDeliveryFee;
128
+ }
129
+
130
+ public static function getNotifyFee()
131
+ {
132
+ if (self::$_insideDeliveryFee == NULL) {
133
+ self::$_insideDeliveryFee = Mage::getStoreConfig('shipping/wsafreightcommon/notify_fee');
134
+ }
135
+ return self::$_insideDeliveryFee;
136
+ }
137
+
138
+ public static function getUseLiveAccessories()
139
+ {
140
+ if (self::$_liveAccessories == NULL) {
141
+ self::$_liveAccessories = Mage::getStoreConfig('shipping/wsafreightcommon/use_accessories');
142
+ }
143
+ return self::$_liveAccessories;
144
+ }
145
+
146
+ public static function isHazardous()
147
+ {
148
+ if (self::$_hazardous == NULL) {
149
+ self::$_hazardous = Mage::getStoreConfig('shipping/wsafreightcommon/hazardous');
150
+ }
151
+ return self::$_hazardous;
152
+ }
153
+
154
+ public static function getMinFreightWeight()
155
+ {
156
+ if (self::$_minFreightWeight == NULL) {
157
+ self::$_minFreightWeight = Mage::getStoreConfig('shipping/wsafreightcommon/min_weight');
158
+ }
159
+ return self::$_minFreightWeight;
160
+ }
161
+
162
+ public static function getFreeFreightResidentialFee()
163
+ {
164
+ if (self::$_freeFreightResidentialFee == NULL) {
165
+ self::$_freeFreightResidentialFee = Mage::getStoreConfig('carriers/freefreight/residential_fee');
166
+ }
167
+ return self::$_freeFreightResidentialFee;
168
+ }
169
+
170
+ public static function getFreeFreightLiftgateFee()
171
+ {
172
+ if (self::$_freeFreightLiftgateFee == NULL) {
173
+ self::$_freeFreightLiftgateFee = Mage::getStoreConfig('carriers/freefreight/liftgate_fee');
174
+ }
175
+ return self::$_freeFreightLiftgateFee;
176
+ }
177
+
178
+ public function isResSelectorEnabled()
179
+ {
180
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Desttype', 'shipping/desttype/active')) {
181
+ return true;
182
+ }
183
+ return false;
184
+ }
185
+
186
+ /**
187
+ * Retrieves enabled freight carriers.
188
+ */
189
+ public static function getAllFreightCarriers()
190
+ {
191
+ $enabledCarriers = array();
192
+
193
+ foreach (self::$_possibleFreightCarriers as $freightModuleName => $freightShortName) {
194
+ if (Mage::helper('wsacommon')->isModuleEnabled($freightModuleName,
195
+ 'carriers/' . $freightShortName . '/active')
196
+ ) {
197
+ $enabledCarriers[] = $freightShortName;
198
+ }
199
+
200
+ }
201
+
202
+ return $enabledCarriers;
203
+ }
204
+
205
+ public function showOnlyCommonFreight($items, $cartWeight)
206
+ {
207
+ $restrictRates = Mage::getStoreConfig('shipping/wsafreightcommon/restrict_rates');
208
+ $forceFreight = Mage::getStoreConfig('shipping/wsafreightcommon/force_freight');
209
+ $hasFreightItems = $this->hasFreightItems($items);
210
+
211
+ if (($restrictRates && $cartWeight >= Mage::getStoreConfig('shipping/wsafreightcommon/min_weight')) ||
212
+ ($forceFreight && $hasFreightItems)
213
+ ) {
214
+ return true;
215
+ }
216
+ return false;
217
+ }
218
+
219
+ public function dontShowCommonFreight($items, $cartWeight = null)
220
+ {
221
+
222
+ if (is_null($cartWeight)) {
223
+ $cartWeight = $this->getWeight($items);
224
+ }
225
+ $hasFreightItems = $this->hasFreightItems($items);
226
+ if ($cartWeight < Mage::getStoreConfig('shipping/wsafreightcommon/min_weight') &&
227
+ !$hasFreightItems
228
+ ) {
229
+ return true;
230
+ }
231
+ return false;
232
+ }
233
+
234
+ public function displayAccessorialsAtCheckout()
235
+ {
236
+ $display = true;
237
+ if (Mage::getStoreConfig('shipping/wsafreightcommon/apply_live_liftgate') && Mage::getStoreConfig('shipping/wsafreightcommon/apply_live_business') && (!$this->isNotifyOptionEnabled() || ($this->isNotifyOptionEnabled() && Mage::getStoreConfig('shipping/wsafreightcommon/apply_live_notify')))) {
238
+ $display = false;
239
+ }
240
+ return $display;
241
+ }
242
+
243
+ private function getWeight($items)
244
+ {
245
+ $addressWeight = 0;
246
+ foreach ($items as $item) {
247
+ /**
248
+ * Skip if this item is virtual
249
+ */
250
+
251
+ if ($item->getProduct()->isVirtual()) {
252
+ continue;
253
+ }
254
+ /**
255
+ * Children weight we calculate for parent
256
+ */
257
+ if ($item->getParentItem()) {
258
+ continue;
259
+ }
260
+
261
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
262
+ foreach ($item->getChildren() as $child) {
263
+ if ($child->getProduct()->isVirtual()) {
264
+ continue;
265
+ }
266
+
267
+ if (!$item->getProduct()->getWeightType()) {
268
+ $itemWeight = $child->getWeight();
269
+ $itemQty = $item->getQty() * $child->getQty();
270
+ $rowWeight = $itemWeight * $itemQty;
271
+ $addressWeight += $rowWeight;
272
+
273
+ }
274
+ }
275
+ if ($item->getProduct()->getWeightType()) {
276
+ $itemWeight = $item->getWeight();
277
+ $rowWeight = $itemWeight * $item->getQty();
278
+ $addressWeight += $rowWeight;
279
+
280
+ }
281
+ } else {
282
+
283
+ $itemWeight = $item->getWeight();
284
+ $rowWeight = $itemWeight * $item->getQty();
285
+ $addressWeight += $rowWeight;
286
+
287
+ }
288
+ }
289
+ return $addressWeight;
290
+ }
291
+
292
+ public function getOptions()
293
+ {
294
+ $enabledFreightCarriers = $this->getAllFreightCarriers();
295
+ if (in_array("echofreight", $enabledFreightCarriers)) {
296
+ if (Mage::getStoreConfig('shipping/wsafreightcommon/default_address', Mage::app()->getStore())) {
297
+ $options = array(
298
+ $this->__('Business'),
299
+ $this->__('Residential'),
300
+ $this->__('Construction Site'),
301
+ $this->__('Trade Show')
302
+ );
303
+ } else {
304
+ $options = array(
305
+ $this->__('Residential'),
306
+ $this->__('Business'),
307
+ $this->__('Construction Site'),
308
+ $this->__('Trade Show')
309
+ );
310
+ }
311
+ return $options;
312
+ } else {
313
+ if (Mage::getStoreConfig('shipping/wsafreightcommon/default_address', Mage::app()->getStore())) {
314
+ $options = array(
315
+ $this->__('Business'),
316
+ $this->__('Residential'),
317
+ );
318
+ } else {
319
+ $options = array(
320
+ $this->__('Residential'),
321
+ $this->__('Business')
322
+ );
323
+ }
324
+ return $options;
325
+ }
326
+ }
327
+
328
+ public function _getStepCodes()
329
+ {
330
+ return array('login', 'billing', 'shipping', 'shippingextra', 'shipping_method', 'payment', 'review');
331
+ }
332
+
333
+ public function hasFreightItems($items)
334
+ {
335
+
336
+ $globShipFreightClassPresent = Mage::getStoreConfig('shipping/wsafreightcommon/ship_freight_class_present');
337
+ $useParent = Mage::getStoreConfig('shipping/wsafreightcommon/use_parent');
338
+
339
+ foreach ($items as $item) {
340
+
341
+ $product = Mage::helper('wsacommon/shipping')->getProduct($item, $useParent);
342
+
343
+ $freightClass = $product->getData('freight_class');
344
+ $fedexClass = $product->getData('fedex_freight_class');
345
+ $freightClassSelect = $product->getData('freight_class_select');
346
+ $prodMustShipFreight = $product->getData('must_ship_freight');
347
+
348
+ if ($prodMustShipFreight || ($freightClass != "" || $fedexClass != "" || $freightClassSelect != "") && $globShipFreightClassPresent) {
349
+ return true;
350
+ }
351
+
352
+ }
353
+ return false;
354
+ }
355
+
356
+
357
+ public function isNotifyOptionEnabled()
358
+ {
359
+
360
+ $enabledCarriers = $this->getAllFreightCarriers();
361
+
362
+ $applicableCarriers = array('cerasisfreight', 'estesfreight', 'echofreight');
363
+
364
+ foreach ($applicableCarriers as $carrier) {
365
+
366
+ if (in_array($carrier, $enabledCarriers)) {
367
+ return true;
368
+ } else {
369
+ continue;
370
+ }
371
+ }
372
+ return false;
373
+ }
374
+
375
+ public function isInsideDeliveryEnabled()
376
+ {
377
+
378
+ $enabledCarriers = $this->getAllFreightCarriers();
379
+
380
+ $applicableCarriers = array('cerasisfreight', 'estesfreight');
381
+
382
+ foreach ($applicableCarriers as $carrier) {
383
+
384
+ if (in_array($carrier, $enabledCarriers)) {
385
+ return true;
386
+ } else {
387
+ continue;
388
+ }
389
+ }
390
+
391
+ return false;
392
+ }
393
+
394
+ public function setDateOffset($todaysDate, $carrier)
395
+ {
396
+
397
+ $blackoutDeliveryDates = Mage::getStoreConfig('carriers/' . $carrier . '/delivery_dates');
398
+
399
+ if (!empty($blackoutDeliveryDates)) {
400
+ $blackoutDates = explode(",", $blackoutDeliveryDates);
401
+
402
+ foreach ($blackoutDates as $dates) {
403
+
404
+ $dates = str_replace("/", "", $dates);
405
+
406
+ $year = substr($dates, -4);
407
+ $month = substr($dates, 0, -6);
408
+ $day = substr($dates, 2, -4);
409
+
410
+ $changeDate = $year . $month . $day;
411
+
412
+ if ($changeDate == $todaysDate) {
413
+ $todaysDate = date('Ymd', time() + 259200);
414
+ break;
415
+ }
416
+ }
417
+ }
418
+ return $todaysDate;
419
+ }
420
+
421
+
422
+ public function limitCarriersBasedOnFreightRules($request, $limitCarrier)
423
+ {
424
+
425
+ if (count($this->getAllFreightCarriers())<1) {
426
+ return $limitCarrier; // no currently active freight carriers
427
+ }
428
+ $restrictRates = Mage::getStoreConfig('shipping/wsafreightcommon/restrict_rates');
429
+ $forceFreight = Mage::getStoreConfig('shipping/wsafreightcommon/force_freight');
430
+ $hasFreightItems = $this->hasFreightItems($request->getAllItems());
431
+ $alwaysShowCarriersArr = explode(',', Mage::getStoreConfig('shipping/wsafreightcommon/show_carriers'));
432
+ $allFreightCarriers = $this->getAllFreightCarriers();
433
+ if (($restrictRates && $request->getPackageWeight() >= Mage::getStoreConfig('shipping/wsafreightcommon/min_weight')) ||
434
+ ($forceFreight && $hasFreightItems)
435
+ ) {
436
+ if (!$limitCarrier) {
437
+ $limitCarrier = array();
438
+
439
+ } else {
440
+ if (!is_array($limitCarrier)) {
441
+ $limitCarrier = array($limitCarrier);
442
+ }
443
+ }
444
+
445
+ if (!empty($alwaysShowCarriersArr)) {
446
+ foreach ($alwaysShowCarriersArr as $showCarrierCode) {
447
+ $limitCarrier[] = $showCarrierCode;
448
+ }
449
+ }
450
+
451
+ foreach ($allFreightCarriers as $limit) {
452
+ $limitCarrier[] = $limit;
453
+ }
454
+
455
+ } else if ($request->getPackageWeight() < Mage::getStoreConfig('shipping/wsafreightcommon/min_weight') && !$hasFreightItems) {
456
+ if (!$limitCarrier) {
457
+ $carriers = Mage::getStoreConfig('carriers', $request->getStoreId());
458
+ foreach ($carriers as $carrierCode => $carrierConfig) {
459
+ if (in_array($carrierCode, $allFreightCarriers)) {
460
+ continue;
461
+ }
462
+ $limitCarrier[] = $carrierCode;
463
+ }
464
+
465
+ } else {
466
+ if (!is_array($limitCarrier)) {
467
+ $limitCarrier = array($limitCarrier);
468
+ }
469
+ foreach ($limitCarrier as $carrierCode => $carrierConfig) {
470
+ if (in_array($carrierCode, $allFreightCarriers)) {
471
+ continue;
472
+ }
473
+ $limitCarrier[] = $carrierCode;
474
+ }
475
+ }
476
+
477
+ }
478
+ return $limitCarrier;
479
+ }
480
+
481
+ }
app/code/community/Webshopapps/Wsafreightcommon/LICENSE.pdf ADDED
Binary file
app/code/community/Webshopapps/Wsafreightcommon/Model/Carrier/Abstract.php ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* YRC Freight Shipping
3
+ *
4
+ * @category Webshopapps
5
+ * @package Webshopapps_Wsaupsfreight
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
+ abstract class Webshopapps_Wsafreightcommon_Model_Carrier_Abstract
13
+ extends Webshopapps_Wsacommon_Model_Shipping_Carrier_Baseabstract
14
+ {
15
+ const USA_COUNTRY_ID = 'US';
16
+ const PUERTORICO_COUNTRY_ID = 'PR';
17
+ const GUAM_COUNTRY_ID = 'GU';
18
+ const GUAM_REGION_CODE = 'GU';
19
+
20
+ public function isCityRequired()
21
+ {
22
+ return false;
23
+ }
24
+
25
+ /**
26
+ * Determine whether zip-code is required for the country of destination
27
+ *
28
+ * @param string|null $countryId
29
+ * @return bool
30
+ */
31
+ public function isZipCodeRequired($countryId = null) //Mage_Shipping_Model_Rate_Request $request = null TODO
32
+ {
33
+ /* if ($request instanceof Mage_Shipping_Model_Rate_Request) {
34
+ return !Mage::helper('directory')->isZipCodeOptional($request->getDestCountryId());
35
+ }*/
36
+
37
+ if (!is_null($countryId)) {
38
+ return !Mage::helper('directory')->isZipCodeOptional($countryId);
39
+ }
40
+
41
+ return true;
42
+ }
43
+
44
+ /**
45
+ * Processing additional validation to check is carrier applicable.
46
+ *
47
+ * @param Mage_Shipping_Model_Rate_Request $request
48
+ * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean
49
+ */
50
+ public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
51
+ {
52
+ return true;
53
+ }
54
+
55
+
56
+ protected function getLineItems($ignoreFreeItems, $useParent=true) {
57
+
58
+ // override use of $useParent and get from freight common instead
59
+ $useParent = Mage::getStoreConfig('shipping/wsafreightcommon/use_parent');
60
+
61
+ $LineItemArray=array();
62
+ $defaultFreightClass = Mage::helper('wsafreightcommon')->getDefaultFreightClass();
63
+
64
+ foreach ($this->_request->getAllItems() as $item) {
65
+
66
+ $weight=0;
67
+ $qty=0;
68
+ $price=0;
69
+
70
+ if (!Mage::helper('wsacommon/shipping')->getItemTotals($item, $weight,$qty,$price,$useParent,$ignoreFreeItems)) {
71
+ continue;
72
+ }
73
+
74
+ $product = Mage::helper('wsacommon/shipping')->getProduct($item,$useParent);
75
+
76
+ $weight=ceil($weight); // round up to nearest whole - required for conway
77
+ $class=$product->getData('freight_class');
78
+
79
+ if (empty($class) || $class=='') {
80
+ $class=$defaultFreightClass; // use default
81
+ }
82
+
83
+ if (empty($LineItemArray) || !array_key_exists($class,$LineItemArray)) {
84
+ $LineItemArray[$class]= $weight;
85
+ } else {
86
+
87
+ $LineItemArray[$class]= $LineItemArray[$class]+ ($weight);
88
+ }
89
+
90
+ }
91
+ return $LineItemArray;
92
+ }
93
+
94
+
95
+
96
+ protected function _getCart()
97
+ {
98
+ return Mage::getSingleton('checkout/cart');
99
+ }
100
+
101
+ protected function _getQuote()
102
+ {
103
+ return $this->_getCart()->getQuote();
104
+ }
105
+
106
+
107
+ public function setBaseRequest(Mage_Shipping_Model_Rate_Request $request)
108
+ {
109
+ $accArray=array();
110
+ $quoteShippingAddress = null;
111
+
112
+ $this->_request = $request;
113
+
114
+ $r = new Varien_Object();
115
+
116
+ if ($request->getLimitMethod()) { //TODO is this reqd?
117
+ $r->setService($request->getLimitMethod());
118
+ } else {
119
+ $r->setService('ALL');
120
+ }
121
+
122
+ $r->setAllowedMethods($this->getConfigData('allowed_methods'));
123
+ $r->setChargeLiftgateOnly($request->getChargeLiftgateOnly()); // declared in shipping override
124
+
125
+ $liftOrigin = Mage::getStoreConfigFlag('shipping/wsafreightcommon/liftgate_origin');
126
+ $r->setOriginLiftgateReqd($liftOrigin); // deprecated do not use
127
+ if ($liftOrigin) {
128
+ $accArray[]='LIFT_ORIGIN'; // please switch to using this rather than above, its a lot easier!
129
+ }
130
+
131
+ $resOrigin = Mage::getStoreConfigFlag('shipping/wsafreightcommon/residential_origin');
132
+ $r->setOriginResidential($resOrigin); // deprecated do not use
133
+
134
+ if ($resOrigin) {
135
+ $accArray[]='RES_ORIGIN'; // please switch to using this rather than above, its a lot easier!
136
+ }
137
+
138
+
139
+ if ($request->getOrigCountry()) {
140
+ $origCountry = $request->getOrigCountry();
141
+ } else {
142
+ $origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
143
+ }
144
+
145
+ $r->setOrigCountry(Mage::getModel('directory/country')->load($origCountry)->getIso2Code());
146
+ $r->setOrigCountryIso3(Mage::getModel('directory/country')->load($origCountry)->getIso3Code());
147
+
148
+ if ($request->getOrigRegionCode()) {
149
+ $origRegionCode = $request->getOrigRegionCode();
150
+ } else {
151
+ $origRegionCode = Mage::getStoreConfig('shipping/origin/region_id', $this->getStore());
152
+ if (is_numeric($origRegionCode)) {
153
+ $origRegionCode = Mage::getModel('directory/region')->load($origRegionCode)->getCode();
154
+ }
155
+ }
156
+ $r->setOrigRegionCode($origRegionCode);
157
+
158
+ if ($request->getOrigPostcode()) {
159
+ $r->setOrigPostal($request->getOrigPostcode());
160
+ } else {
161
+ $r->setOrigPostal(Mage::getStoreConfig('shipping/origin/postcode', $this->getStore()));
162
+ }
163
+
164
+ if ($request->getOrigCity()) {
165
+ $r->setOrigCity($request->getOrigCity());
166
+ } else {
167
+ $r->setOrigCity(Mage::getStoreConfig('shipping/origin/city', $this->getStore()));
168
+ }
169
+
170
+
171
+ if ($request->getDestCountryId()) {
172
+ $destCountry = $request->getDestCountryId();
173
+ } else {
174
+ $destCountry = self::USA_COUNTRY_ID;
175
+ }
176
+
177
+ //for UPS, puero rico state for US will assume as puerto rico country
178
+ if ($destCountry==self::USA_COUNTRY_ID && ($request->getDestPostcode()=='00912' || $request->getDestRegionCode()==self::PUERTORICO_COUNTRY_ID)) {
179
+ $destCountry = self::PUERTORICO_COUNTRY_ID;
180
+ }
181
+
182
+ // For UPS, Guam state of the USA will be represented by Guam country
183
+ if ($destCountry == self::USA_COUNTRY_ID && $request->getDestRegionCode() == self::GUAM_REGION_CODE) {
184
+ $destCountry = self::GUAM_COUNTRY_ID;
185
+ }
186
+
187
+ $r->setDestCountry(Mage::getModel('directory/country')->load($destCountry)->getIso2Code());
188
+ $r->setDestCountryIso3(Mage::getModel('directory/country')->load($destCountry)->getIso3Code());
189
+
190
+ $r->setDestRegionCode($request->getDestRegionCode());
191
+ $r->setDestCity($request->getDestCity());
192
+
193
+ if ($request->getDestPostcode()) {
194
+ $r->setDestPostal('US' == $r->getDestCountry() ? substr($request->getDestPostcode(), 0, 5) : $request->getDestPostcode());
195
+ }
196
+
197
+ $r->setValue($request->getPackageValue());
198
+
199
+ $r->setValueWithDiscount($request->getPackageValueWithDiscount());
200
+
201
+ if (is_object($this->_getQuote()->getShippingAddress())) {
202
+ $quoteShippingAddress = $this->_getQuote()->getShippingAddress();
203
+
204
+ if($quoteShippingAddress->getLiftgateRequired()) {
205
+ $r->setLiftgateRequired(true);
206
+ } else {
207
+ $r->setLiftgateRequired(false);
208
+ }
209
+
210
+ if(Mage::getStoreConfig('shipping/wsafreightcommon/default_address')){
211
+ $type = $this->_getQuote()->getShippingAddress()->getShiptoType();
212
+ $type == 0 || $type == '' ? $type = 1 : $type = 0;
213
+ $r->setShiptoType($type);
214
+ } else {
215
+ $r->setShiptoType($this->_getQuote()->getShippingAddress()->getShiptoType());
216
+ }
217
+
218
+ if($quoteShippingAddress->getInsideDelivery()){
219
+ $fee=Mage::helper('wsafreightcommon')->getInsideDeliveryFee();
220
+ if (is_numeric($fee) && $fee>0) {
221
+ $this->_topUpPrice += $fee;
222
+ }
223
+ $accArray[]="INSIDE";
224
+ }
225
+
226
+ } else {
227
+ $r->setLiftgateRequired(false);
228
+ $r->setShiptoType($this->_getQuote()->getShippingAddress()->getShiptoType());
229
+ }
230
+
231
+
232
+ if ((!is_null($quoteShippingAddress) && $quoteShippingAddress->getNotifyRequired())
233
+ || Mage::helper('wsafreightcommon')->isNotifyRequired()) {
234
+ $fee=Mage::helper('wsafreightcommon')->getNotifyFee();
235
+ if (is_numeric($fee) && $fee>0) {
236
+ $this->_topUpPrice += $fee;
237
+ }
238
+ $accArray[]="NOTIFY";
239
+ }
240
+
241
+ $this->_topUpPrice=0;
242
+ if ($r->getLiftgateRequired() || Mage::helper('wsafreightcommon')->isFixedLiftgateFee()) {
243
+ $fee=Mage::helper('wsafreightcommon')->getLiftgateFee();
244
+ if (is_numeric($fee) && $fee>0) {
245
+ $this->_topUpPrice = $fee;
246
+ }
247
+ $accArray[]="LIFT";
248
+ }
249
+
250
+ if (!is_null($r->getShiptoType() && !Mage::helper('wsafreightcommon')->isFixedDeliveryType())) {
251
+ $shipToType = $r->getShiptoType();
252
+ if ($shipToType=='0' || $shipToType=='Residential') {
253
+ $fee=Mage::helper('wsafreightcommon')->getResidentialFee();
254
+ if (is_numeric($fee) && $fee>0) {
255
+ $this->_topUpPrice += $fee;
256
+ }
257
+ $accArray[]="RES";
258
+ } elseif ($shipToType=='2' || $shipToType=='Construction Site') {
259
+ $accArray[]="CONSITE";
260
+ } elseif ($shipToType=='3' || $shipToType=='Trade Show') {
261
+ $accArray[]="TRADE";
262
+ }
263
+
264
+ }
265
+
266
+ if (Mage::getStoreConfigFlag('shipping/wsafreightcommon/hazardous')) {
267
+ $accArray[]="HAZ";
268
+ }
269
+
270
+ $r->setAccessories($accArray);
271
+ $r->setIgnoreFreeItems(false);
272
+
273
+ return $r;
274
+ }
275
+
276
+ protected function getResultSet($priceArr,$request,$response,$quoteId='') {
277
+
278
+ $path = 'carriers/'.$this->_code.'/';
279
+ $title = Mage::getStoreConfig($path.'title');
280
+ $defaultMethodTitle = Mage::helper('usa')->__(Mage::getStoreConfig($path.'name'));
281
+
282
+ $handlingProdFee =0;
283
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingproduct')) {
284
+ $handlingProdFee = Mage::getModel('handlingproduct/handlingproduct')->getHandlingRateForItems($this->_request->getAllItems());
285
+ if ($this->_debug) {
286
+ Mage::helper('wsacommon/log')->postNotice($this->_code,'Handling Fee',$handlingProdFee);
287
+ }
288
+ }
289
+
290
+ if ($this->_debug) {
291
+ Mage::helper('wsacommon/log')->postNotice($this->_code,'Price Arr',$priceArr);
292
+ }
293
+
294
+ $result = Mage::getModel('shipping/rate_result');
295
+ if (empty($priceArr)|| in_array('0',$priceArr) && $path != 'carriers/freefreight/') {
296
+ if (Mage::getStoreConfig($path.'apply_zero_fee') ) {
297
+ $rate = Mage::getModel('shipping/rate_result_method');
298
+ $rate->setCarrier($this->_code);
299
+ $rate->setCarrierTitle($title);
300
+ $rate->setFreightQuoteId($quoteId);
301
+ $rate->setMethod($this->_code);
302
+ $rate->setMethodTitle(Mage::helper('usa')->__(Mage::getStoreConfig($path.'zero_fee_text')));
303
+ $rate->setCost(0);
304
+ $rate->setPrice(0);
305
+ $result->append($rate);
306
+ } else {
307
+ $error = Mage::getModel('shipping/rate_result_error');
308
+ $error->setCarrier($this->_code);
309
+ $error->setCarrierTitle($title);
310
+ //$error->setErrorMessage($errorTitle);
311
+ $error->setErrorMessage(Mage::getStoreConfig($path.'specificerrmsg'));
312
+ $result->append($error);
313
+ }
314
+ Mage::helper('wsalogger/log')->postWarning($this->_code,'No rates found','');
315
+ Mage::helper('wsalogger/log')->postWarning($this->_code,'====== REQUEST:===== ',$request);
316
+ Mage::helper('wsalogger/log')->postWarning($this->_code,'====== RESPONSE: ====== ',$response);
317
+
318
+ } else {
319
+ $max_shipping_cost=Mage::getStoreConfig($path.'max_cost');
320
+ $apply_discount=Mage::getStoreConfig($path.'apply_discount');
321
+ foreach ($priceArr as $method=>$price) {
322
+ $methodTitle = $method == $this->_code ? $defaultMethodTitle
323
+ : $this->getCode('method', $method);
324
+ $rate = Mage::getModel('shipping/rate_result_method');
325
+ $rate->setCarrier($this->_code);
326
+ $rate->setCarrierTitle($title);
327
+ $rate->setFreightQuoteId($quoteId);
328
+ $rate->setMethod($method);
329
+ $rate->setMethodTitle($methodTitle);
330
+ // $rate->setCost($costArr[$method]+$this->_topUpPrice);
331
+ if (!empty($max_shipping_cost) && $max_shipping_cost>0) {
332
+ if (($price+$this->_topUpPrice)>$max_shipping_cost) {
333
+ $price=$max_shipping_cost;
334
+ }
335
+ }
336
+ if(!empty($apply_discount) && is_numeric($apply_discount) && $apply_discount>0)
337
+ { $discount_value = ($price/100)* $apply_discount;
338
+ $price = $price - $discount_value;
339
+ }
340
+ if((Mage::getStoreConfig('carriers/freefreight/active')) && ($this->_code == 'freefreight' )){
341
+ $rate->setPrice($price+$handlingProdFee);
342
+ }else{
343
+ $rate->setPrice($price+$this->_topUpPrice+$handlingProdFee);
344
+ }
345
+ $result->append($rate);
346
+ }
347
+ }
348
+ return $result;
349
+ }
350
+
351
+
352
+ protected function getShipmentMethods($allowedMethods) {
353
+ $shipmentMethods=array();
354
+ foreach ($allowedMethods as $method) {
355
+ $shipmentMethods[]=$this->getCode('method',$method);
356
+ }
357
+ return $shipmentMethods;
358
+ }
359
+
360
+
361
+ public function getAllowedMethods()
362
+ {
363
+ $arr = array();
364
+ $allowed = explode(',', $this->getConfigData('allowed_methods'));
365
+ foreach ($allowed as $k) {
366
+ $arr[$k] = $this->getCode('method', $k);
367
+ }
368
+
369
+ return $arr;
370
+ }
371
+
372
+ }
app/code/community/Webshopapps/Wsafreightcommon/Model/Carrier/Freefreight.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* YRC Freight Shipping
3
+ *
4
+ * @category Webshopapps
5
+ * @package Webshopapps_Freefreight
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
+ class Webshopapps_Wsafreightcommon_Model_Carrier_Freefreight
13
+ extends Webshopapps_Wsafreightcommon_Model_Carrier_Abstract
14
+ implements Mage_Shipping_Model_Carrier_Interface
15
+ {
16
+
17
+ protected $_code = 'freefreight';
18
+
19
+ protected $_modName = 'Webshopapps_Wsafreightcommon';
20
+
21
+ private $_freeFreightFees = 0;
22
+
23
+
24
+ public function setRequest(Mage_Shipping_Model_Rate_Request $request)
25
+ {
26
+ $r = $this->setBaseRequest($request);
27
+
28
+ $this->_rawRequest = $r;
29
+
30
+ return $this;
31
+ }
32
+
33
+ protected function _getQuotes()
34
+ {
35
+ return $this->_getFeeIncRate();
36
+ }
37
+
38
+ protected function _getFeeIncRate()
39
+ {
40
+ $r = $this->_rawRequest;
41
+
42
+ $resFee = Mage::helper('wsafreightcommon')->getFreeFreightResidentialFee();
43
+ $liftFee = Mage::helper('wsafreightcommon')->getFreeFreightLiftgateFee();
44
+
45
+ $accArray=$r->getAccessories();
46
+ foreach ($accArray as $acc) {
47
+ switch ($acc) {
48
+ case 'RES':
49
+ $this->_freeFreightFees += $resFee;
50
+ break;
51
+ case 'LIFT':
52
+ $this->_freeFreightFees += $liftFee;
53
+ break;
54
+ }
55
+ }
56
+
57
+ if($this->_freeFreightFees != 0){
58
+ //free freight plus fees
59
+ $priceArr = array($this->_code => $this->_freeFreightFees);
60
+ }
61
+ else{
62
+ //free freight
63
+ $priceArr = array($this->_code => 0);
64
+ }
65
+
66
+ return $this->getResultSet($priceArr,$params=null,$response=null);
67
+
68
+ }
69
+
70
+
71
+ public function getCode($type, $code='')
72
+ {
73
+ $codes = array(
74
+ 'method'=>array(
75
+ $this->_code => Mage::helper('usa')->__('Freefreight'),
76
+ ),
77
+ );
78
+
79
+ if (!isset($codes[$type])) {
80
+ return false;
81
+ } elseif (''===$code) {
82
+ return $codes[$type];
83
+ }
84
+
85
+ if (!isset($codes[$type][$code])) {
86
+ return false;
87
+ } else {
88
+ return $codes[$type][$code];
89
+ }
90
+ }
91
+
92
+
93
+ }
app/code/community/Webshopapps/Wsafreightcommon/Model/Observer.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento Webshopapps Module
5
+ *
6
+ * @category Webshopapps
7
+ * @package Webshopapps Wsafreightcommon
8
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
9
+ * Copyright, 2013, Zowta, LLC - US license
10
+ * @license www.webshopapps.com/license/license.txt
11
+ * @author Karen Baker <sales@webshopapps.com>
12
+ */
13
+
14
+ class Webshopapps_Wsafreightcommon_Model_Observer extends Mage_Core_Model_Abstract
15
+ {
16
+ public function postError($observer) {
17
+
18
+ $allFreightCarriers = Mage::helper('wsafreightcommon')->getAllFreightCarriers();
19
+
20
+ if (in_array('yrcfreight', $allFreightCarriers)){
21
+
22
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMveXJjZnJlaWdodC9zaGlwX29uY2U=','eXVtbXlnbGFzcw==','Y2FycmllcnMveXJjZnJlaWdodC9zZXJpYWw=')){
23
+ $session = Mage::getSingleton('adminhtml/session');
24
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIFlSQyBGcmVpZ2h0'))) ;
25
+ }
26
+ }
27
+ if (in_array('wsaupsfreight', $allFreightCarriers)){
28
+
29
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvd3NhdXBzZnJlaWdodC9zaGlwX29uY2U=','b25zaWRl','Y2FycmllcnMvd3NhdXBzZnJlaWdodC9zZXJpYWw=')){
30
+ $session = Mage::getSingleton('adminhtml/session');
31
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIFVQUyBGcmVpZ2h0'))) ;
32
+ }
33
+ }
34
+ if (in_array('wsafedexfreight', $allFreightCarriers)){
35
+
36
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvd3NhZmVkZXhmcmVpZ2h0L3NoaXBfb25jZQ==','d2Fyd29ybGQ=','Y2FycmllcnMvd3NhZmVkZXhmcmVpZ2h0L3NlcmlhbA==')){
37
+ $session = Mage::getSingleton('adminhtml/session');
38
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIEZlZGV4IEZyZWlnaHQ=')));
39
+ }
40
+ }
41
+ if (in_array('rlfreight', $allFreightCarriers)){
42
+
43
+ if(!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvcmxmcmVpZ2h0L3NoaXBfb25jZQ==','d2luZG93bW9vbg==','Y2FycmllcnMvcmxmcmVpZ2h0L3NlcmlhbA==')){
44
+ $session = Mage::getSingleton('adminhtml/session');
45
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIFJMIEZyZWlnaHQ=')));
46
+ }
47
+ }
48
+ if (in_array('echofreight', $allFreightCarriers)){
49
+
50
+ if(!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvZWNob2ZyZWlnaHQvc2hpcF9vbmNl','d2VuZHlob3VzZQ==','Y2FycmllcnMvZWNob2ZyZWlnaHQvc2VyaWFs')) {
51
+ $session = Mage::getSingleton('adminhtml/session');
52
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('CVNlcmlhbCBLZXkgSXMgTk9UIFZhbGlkIGZvciBXZWJTaG9wQXBwcyBFY2hvIEZyZWlnaHQ=')));
53
+ }
54
+ }
55
+ if (in_array('abffreight', $allFreightCarriers)){
56
+
57
+ if(!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvYWJmZnJlaWdodC9zaGlwX29uY2U=','YWJmdXBzaWRl','Y2FycmllcnMvYWJmZnJlaWdodC9zZXJpYWw=')) {
58
+ $session = Mage::getSingleton('adminhtml/session');
59
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('CVNlcmlhbCBLZXkgSXMgTk9UIFZhbGlkIGZvciBXZWJTaG9wQXBwcyBBQkYgRnJlaWdodA=='))) ;
60
+ }
61
+ }
62
+ if (in_array('newgistics', $allFreightCarriers)){
63
+
64
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvbmV3Z2lzdGljcy9zaGlwX29uY2U=','aHVsa3NtYXNo','Y2FycmllcnMvbmV3Z2lzdGljcy9zZXJpYWw=')) {
65
+ $session = Mage::getSingleton('adminhtml/session');
66
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIE5ld2dpc3RpY3MgRnJlaWdodA==')));
67
+ }
68
+ }
69
+ if (in_array('conwayfreight', $allFreightCarriers)){
70
+
71
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvY29ud2F5ZnJlaWdodC9zaGlwX29uY2U=','aGVyZWlhbQ==','Y2FycmllcnMvY29ud2F5ZnJlaWdodC9zZXJpYWw=')) {
72
+ $session = Mage::getSingleton('adminhtml/session');
73
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIENvbi1XYXkgRnJlaWdodA==')));
74
+ }
75
+ }
76
+ if (in_array('estesfreight', $allFreightCarriers)){
77
+
78
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvZXN0ZXNmcmVpZ2h0L3NoaXBfb25jZQ==','b3ZlcmxhbmRlcg==','Y2FycmllcnMvZXN0ZXNmcmVpZ2h0L3NlcmlhbA==')) {
79
+ $session = Mage::getSingleton('adminhtml/session');
80
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIEVzdGVzIEZyZWlnaHQ=')));
81
+ }
82
+ }
83
+ if (in_array('cerasisfreight', $allFreightCarriers)){
84
+
85
+ if (!Mage::helper('wsacommon')->checkItems('Y2FycmllcnMvY2VyYXNpc2ZyZWlnaHQvc2hpcF9vbmNl','Z3JpenpseWJlYXI=','Y2FycmllcnMvY2VyYXNpc2ZyZWlnaHQvc2VyaWFs')){
86
+ $session = Mage::getSingleton('adminhtml/session');
87
+ $session->addError(Mage::helper('adminhtml')->__(base64_decode('U2VyaWFsIEtleSBJcyBOT1QgVmFsaWQgZm9yIFdlYlNob3BBcHBzIENlcmFzaXMgRnJlaWdodA==')));
88
+ }
89
+ }
90
+ }
91
+
92
+ public function hookToControllerActionPreDispatch($observer) {
93
+ $actionName = $observer->getEvent()->getControllerAction()->getFullActionName();
94
+
95
+ //we compare action name to see if that's action for which we want to add our own event
96
+ if($actionName == 'checkout_cart_estimatePost')
97
+ {
98
+ $request = $observer->getControllerAction()->getRequest();
99
+ $country = (string) $request->getParam('country_id');
100
+ $postcode = (string) $request->getParam('estimate_postcode');
101
+ $city = (string) $request->getParam('estimate_city');
102
+ $regionId = (string) $request->getParam('region_id');
103
+ $region = (string) $request->getParam('region');
104
+ $liftgateRequired = (string) $request->getParam('liftgate_required');
105
+ $notifyRequired = (string) $request->getParam('notify_required');
106
+ $insideDelivery = (string) $request->getParam('inside_delivery');
107
+ $shiptoType = (string) $request->getParam('shipto_type');
108
+
109
+ switch ($shiptoType) {
110
+ case 0:
111
+ $destType = 'RES';
112
+ break;
113
+ case 1:
114
+ $destType = 'COM';
115
+ break;
116
+ default:
117
+ $destType = 'RES';
118
+ break;
119
+ }
120
+
121
+ $this->_getQuote()->getShippingAddress()
122
+ ->setCountryId($country)
123
+ ->setCity($city)
124
+ ->setPostcode($postcode)
125
+ ->setRegionId($regionId)
126
+ ->setRegion($region)
127
+ ->setLiftgateRequired($liftgateRequired)
128
+ ->setShiptoType($shiptoType)
129
+ ->setDestType($destType)
130
+ ->setNotifyRequired($notifyRequired)
131
+ ->setInsideDelivery($insideDelivery)
132
+ ->setCollectShippingRates(true);
133
+ $this->_getQuote()->save();
134
+ }
135
+ }
136
+
137
+ public function hookToControllerActionPostDispatch($observer) {
138
+
139
+ $orderStore = $this->_getQuote()->getStore();
140
+ $showCheapest = Mage::getStoreConfig('shipping/wsafreightcommon/auto_select_cheapest', $orderStore);
141
+
142
+
143
+ if($showCheapest){
144
+
145
+ $actionName = $observer->getEvent()->getControllerAction()->getFullActionName();
146
+
147
+ if($actionName == 'checkout_cart_estimatePost' || $actionName == 'checkout_cart_add' || $actionName == 'checkout_cart_updatePost' || 'checkout_onepage_saveShippingExtra')
148
+ {
149
+ $method = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
150
+
151
+ if(!empty($method)) { return; }
152
+
153
+ $rates = Mage::getSingleton('checkout/session')->getQuote()
154
+ ->getShippingAddress()->getGroupedAllShippingRates();
155
+
156
+ if(!count($rates)) {
157
+ Mage::getSingleton('checkout/session')->getQuote()
158
+ ->getShippingAddress()->collectShippingRates();
159
+
160
+ $rates = Mage::getSingleton('checkout/session')->getQuote()
161
+ ->getShippingAddress()->getGroupedAllShippingRates();
162
+ }
163
+
164
+ if (count($rates)) {
165
+ $topRate = null;
166
+ foreach($rates as $rateArray) {
167
+ $cheapest = reset($rateArray);
168
+
169
+ if($topRate) {
170
+ if($cheapest->getPrice() < $topRate->getPrice()) {
171
+ $topRate = $cheapest;
172
+ }
173
+ } else {
174
+ $topRate = $cheapest;
175
+ }
176
+ }
177
+
178
+ $code = $topRate->code;
179
+
180
+ try {
181
+ Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()
182
+ ->setShippingMethod($code);
183
+
184
+ Mage::getSingleton('checkout/session')->getQuote()->save();
185
+
186
+ Mage::getSingleton('checkout/session')->resetCheckout();
187
+
188
+ unset($cheapest);
189
+ unset($topRate);
190
+
191
+ }
192
+ catch (Mage_Core_Exception $e) {
193
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
194
+ }
195
+ catch (Exception $e) {
196
+ Mage::getSingleton('checkout/session')->addException(
197
+ $e, Mage::helper('checkout')->__('Load customer quote error')
198
+ );
199
+ }
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+ protected function _getQuote()
206
+ {
207
+ return $this->_getCart()->getQuote();
208
+ }
209
+
210
+ protected function _getCart()
211
+ {
212
+ return Mage::getSingleton('checkout/cart');
213
+ }
214
+ }
app/code/community/Webshopapps/Wsafreightcommon/Model/Quote/Address/Rate.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_Sales
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ /*
27
+ *
28
+ * @category Webshopapps
29
+ * @package Webshopapps_Wsafreightcommon
30
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
31
+ * Copyright, 2013, Zowta, LLC - US license
32
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
33
+ */
34
+
35
+ class Webshopapps_Wsafreightcommon_Model_Quote_Address_Rate extends Mage_Sales_Model_Quote_Address_Rate
36
+ {
37
+
38
+
39
+ public function importShippingRate(Mage_Shipping_Model_Rate_Result_Abstract $rate)
40
+ {
41
+ if ($rate instanceof Mage_Shipping_Model_Rate_Result_Error) {
42
+ $this
43
+ ->setCode($rate->getCarrier().'_error')
44
+ ->setCarrier($rate->getCarrier())
45
+ ->setCarrierTitle($rate->getCarrierTitle())
46
+ ->setErrorMessage($rate->getErrorMessage())
47
+ ;
48
+ } elseif ($rate instanceof Mage_Shipping_Model_Rate_Result_Method) {
49
+ $this
50
+ ->setCode($rate->getCarrier().'_'.$rate->getMethod())
51
+ ->setCarrier($rate->getCarrier())
52
+ ->setCarrierTitle($rate->getCarrierTitle())
53
+ ->setMethod($rate->getMethod())
54
+ ->setFreightQuoteId($rate->getFreightQuoteId())
55
+ ->setMethodTitle($rate->getMethodTitle())
56
+ ->setMethodDescription($rate->getMethodDescription())
57
+ ->setPrice($rate->getPrice())
58
+ ;
59
+ }
60
+ return $this;
61
+ }
62
+ }
app/code/community/Webshopapps/Wsafreightcommon/Model/Quote/Address/Total/Shipping.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_Sales
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ /* YRC Freight Shipping
27
+ *
28
+ * @category Webshopapps
29
+ * @package Webshopapps_Wsafreightcommon
30
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
31
+ * Copyright, 2013, Zowta, LLC - US license
32
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
33
+ */
34
+
35
+
36
+ class Webshopapps_Wsafreightcommon_Model_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Shipping
37
+ {
38
+ public function collect(Mage_Sales_Model_Quote_Address $address)
39
+ {
40
+
41
+ parent::collect($address);
42
+
43
+ $method = $address->getShippingMethod();
44
+
45
+ if ($method) {
46
+ foreach ($address->getAllShippingRates() as $rate) {
47
+ if ($rate->getCode()==$method) {
48
+ if ($rate->getFreightQuoteId()) {
49
+ $address->setFreightQuoteId($rate->getFreightQuoteId());
50
+ } else {
51
+ $address->setFreightQuoteId('');
52
+ }
53
+ break;
54
+ }
55
+ }
56
+ }
57
+
58
+ return $this;
59
+
60
+ }
61
+
62
+ }
app/code/community/Webshopapps/Wsafreightcommon/Model/Shipping/Shipping.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* YRC Freight Shipping
3
+ *
4
+ * @category Webshopapps
5
+ * @package Webshopapps_Wsafreightcommon
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
+ class Webshopapps_Wsafreightcommon_Model_Shipping_Shipping extends Mage_Shipping_Model_Shipping
13
+ {
14
+
15
+ /**
16
+ * Retrieve all methods for supplied shipping data
17
+ *
18
+ * @todo make it ordered
19
+ * @param Mage_Shipping_Model_Shipping_Method_Request $data
20
+ * @return Mage_Shipping_Model_Shipping
21
+ */
22
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
23
+ {
24
+
25
+ $limitCarrier = Mage::helper('wsafreightcommon')->limitCarriersBasedOnFreightRules($request,
26
+ $request->getLimitCarrier());
27
+
28
+ $request->setLimitCarrier($limitCarrier);
29
+
30
+
31
+ return parent::collectRates($request);
32
+ }
33
+
34
+ protected function hasFreightItems($items) {
35
+ return Mage::helper('wsafreightcommon')->hasFreightItems($items);
36
+ }
37
+
38
+
39
+ /**
40
+ * Overrides this method in core, and decides which extension to call
41
+ * Uses a hierarchy to decide on best extension
42
+ * @see app/code/core/Mage/Shipping/Model/Mage_Shipping_Model_Shipping::collectCarrierRates()
43
+ */
44
+ public function collectCarrierRates($carrierCode, $request)
45
+ {
46
+
47
+ // check to see if handling Product enabled
48
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingproduct','shipping/handlingproduct/active')) {
49
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Shipusa','shipping/shipusa/active')) {
50
+ return parent::collectCarrierRates($carrierCode,$request);
51
+
52
+ } else {
53
+ if (!Mage::registry('handlingproduct_shipmodel')) {
54
+ $model = Mage::getModel('handlingproduct/shipping_shipping');
55
+ Mage::register('handlingproduct_shipmodel', $model);
56
+ }
57
+ $model = Mage::registry('handlingproduct_shipmodel') ;
58
+ $model->collectCarrierRates($carrierCode, $request);
59
+ $this->_result=$model->getResult();
60
+ return $model;
61
+
62
+ }
63
+ }
64
+
65
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Handlingmatrix','shipping/handlingmatrix/active')) {
66
+ if (!Mage::registry('handlingmatrix_shipmodel')) {
67
+ $model = Mage::getModel('handlingmatrix/shipping_shipping');
68
+ Mage::register('handlingmatrix_shipmodel', $model);
69
+ }
70
+ $model = Mage::registry('handlingmatrix_shipmodel');
71
+ $model->collectCarrierRates($carrierCode, $request);
72
+ $this->_result=$model->getResult();
73
+ return $model;
74
+ }
75
+
76
+ if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Insurance','shipping/insurance/active')) {
77
+ if (!Mage::registry('insurance_shipmodel')) {
78
+ $model = Mage::getModel('insurance/shipping_shipping');
79
+ Mage::register('insurance_shipmodel', $model);
80
+ }
81
+ $model = Mage::registry('insurance_shipmodel');
82
+ $model->collectCarrierRates($carrierCode, $request);
83
+ $this->_result=$model->getResult();
84
+ return $model;
85
+ }
86
+
87
+
88
+ // default
89
+ return parent::collectCarrierRates($carrierCode,$request);
90
+
91
+ }
92
+
93
+ }
app/code/community/Webshopapps/Wsafreightcommon/Model/Source/Carriers.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_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
+ /* Webshopapps USA Shipping
27
+ *
28
+ * @category Webshopapps
29
+ * @package Webshopapps_Yrcfreight
30
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
31
+ * Copyright, 2013, Zowta, LLC - US license
32
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
33
+ */
34
+
35
+ class Webshopapps_Wsafreightcommon_Model_Source_Carriers
36
+ {
37
+ public function toOptionArray()
38
+ {
39
+
40
+ $arr = array();
41
+ $carriers = Mage::getStoreConfig('carriers');
42
+ $freightCarriers = Mage::helper('wsafreightcommon')->getAllFreightCarriers();
43
+
44
+ foreach ($carriers as $carrierCode => $carrierConfig) {
45
+ if (!isset($carrierConfig['title']) || in_array($carrierCode,$freightCarriers)) {
46
+ continue;
47
+ }
48
+ $title = $carrierConfig['title'];
49
+ if (isset($carrierConfig['name'])) {
50
+ $title=$title." - ".$carrierConfig['name'];
51
+ }
52
+ $arr[] = array('value'=>$carrierCode, 'label'=>$title);
53
+ }
54
+
55
+ array_unshift($arr, array('value'=>'', 'label'=>Mage::helper('shipping')->__('None')));
56
+
57
+ return $arr;
58
+ }
59
+ }
app/code/community/Webshopapps/Wsafreightcommon/Model/Type/Onepage.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Webshopapps_Wsafreightcommon_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
29
+ {
30
+
31
+ public function saveShippingExtra($liftgateRqd,$addressType,$notifyRqd="",$insideDelivery="")
32
+ {
33
+ $addresses=$this->getQuote()->getAllShippingAddresses();
34
+
35
+ foreach ($addresses as $address) {
36
+
37
+ if ($liftgateRqd != '') {
38
+ $address->setLiftgateRequired($liftgateRqd);
39
+ } else {
40
+ $address->setLiftgateRequired(0);
41
+ }
42
+
43
+ if ($notifyRqd != '') {
44
+ $address->setNotifyRequired($notifyRqd);
45
+ } else {
46
+ $address->setNotifyRequired(0);
47
+ }
48
+
49
+ if ($insideDelivery != '') {
50
+ $address->setInsideDelivery($insideDelivery);
51
+ } else {
52
+ $address->setInsideDelivery(0);
53
+ }
54
+
55
+ if ($addressType != '') {
56
+ $address->setShiptoType($addressType);
57
+ } else {
58
+ $address->setShiptoType("");
59
+ }
60
+ $address->setCollectShippingRates(true);
61
+
62
+ }
63
+
64
+ $this->getQuote()->collectTotals();
65
+ $this->getQuote()->save();
66
+
67
+ $this->getCheckout()
68
+ ->setStepData('shippingextra', 'complete', true)
69
+ ->setStepData('shippingextra', 'allow', true)
70
+ ->setStepData('shipping-method', 'allow', true);
71
+
72
+ return array();
73
+ }
74
+
75
+ /**
76
+ * Enter description here...
77
+ *
78
+ * @return Mage_Checkout_Model_Type_Onepage
79
+ */
80
+ public function initCheckout()
81
+ {
82
+ $checkout = $this->getCheckout();
83
+ $customerSession = $this->getCustomerSession();
84
+ if (is_array($checkout->getStepData())) {
85
+ foreach ($checkout->getStepData() as $step=>$data) {
86
+ if (!($step==='login' || $customerSession->isLoggedIn() && $step==='billing')) {
87
+ $checkout->setStepData($step, 'allow', false);
88
+ }
89
+ }
90
+ }
91
+
92
+ $checkout->setStepData('shippingextra', 'allow', true);
93
+
94
+ /**
95
+ * Reset multishipping flag before any manipulations with quote address
96
+ * addAddress method for quote object related on this flag
97
+ */
98
+ if ($this->getQuote()->getIsMultiShipping()) {
99
+ $this->getQuote()->setIsMultiShipping(false);
100
+ $this->getQuote()->save();
101
+ }
102
+
103
+ /*
104
+ * want to laod the correct customer information by assiging to address
105
+ * instead of just loading from sales/quote_address
106
+ */
107
+ $customer = $customerSession->getCustomer();
108
+ if ($customer) {
109
+ $this->getQuote()->assignCustomer($customer);
110
+ }
111
+ return $this;
112
+ }
113
+
114
+
115
+ }
app/code/community/Webshopapps/Wsafreightcommon/changelog.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.1 - Initial version.
2
+ 0.2 - Added FedEx Freight Compatibility
3
+ 0.3 - Made more functions available to outside extensions.
4
+ 0.4 - Latest WSACommon included.
5
+ 0.5 - Updated to include ABF Freight. Removed enable button, now instead will be enabled if a freight carrier is enabled. Moved to shipping as not a carrier.
6
+ 0.6 - Integration with WSA Common
7
+ 0.7 - Update to work with Magento 1.7
8
+ 0.8 - Made logic for checkout consistent with that of cart. Refactored controller logic to stop rewrite
9
+ 0.9 - Fixed Ship To residential and business in adminhtml
10
+ 0.10 - Added switch which allows you to enter a freight class but not ship an item freight.
11
+ 0.11 - Reformatted code change.
12
+ 0.12 - added new method to get default freight class.
13
+ 0.13 - Fixed incorrect arguments in hasFreightItems() call & added getDefaultFreightClass() to hasFreightItems() logic.
14
+ 1.0 - Refactored code to use Abstract class, keep settings when installing on site already running old freight extension. Made sql idempotent. General tidy up.
15
+ 1.1 - Rebuild using Automated ant tools for overlays. No code changes
16
+ 1.2 - Tidied sql to add attributes to all attribute sets. Ensured state always shows when required in estimator.
17
+ 1.3 - Re-packaged with latest Common
18
+ 1.4 - Changed Cart Controller to use event
19
+ 1.5 - Fixed issue with checkout controller being accidentally removed in last release for main Freight common
20
+ 1.6 - Added Newgistics Freight Compatibility
21
+ 1.7 - Added switch to automatically select Scheduled Appointment and hide from checkout & Added observer code to feed back to customer when serial key for Newgistics is invalid
22
+ 1.8 - Removed isFixedDelivery() && isFixedLiftgateFee() check function
23
+ 1.9 - Refactored retrieval of origin delivery type and liftgate
24
+ 1.10 - Moved 'return false;' so that logic now loops through all items in the cart and only returns false if no items in the cart are freight items.
25
+ 1.11 - Refactored adminhtml code to use separate webshopapps location and append to existing phtml
26
+ 1.12 - Added feature to auto-select cheapest rate when other carriers are configured to show
27
+ 1.13 - Added ability to set a inside delivery fee
28
+ 1.14 - Added support for EE theme files.
29
+ 1.15 - Moved Use Parent switch into Freight Common under shipping settings to fix issue with Must Ship Freight
30
+ 1.16 - Added observer code to feed back to customer when serial key for Estes is invalid
31
+ 1.17 - Added support holiday blackout support with ABF Freight
32
+ 1.18 - Added a fixed scheduled appointment fee
33
+ 1.19 - Added Free Freight extension
34
+ 1.20 - FREIGHT-30 - Added list-gate residential fee to Free Freight Shipping method
35
+ 1.21 - FREIGHT-36 - Freight Class attribute changed from int to text
36
+ 1.22 - FREIGHT-22 Updated base to include if statment to check for ee and ce and removed enterprise folders
37
+ 1.23 - FREIGHT-38 added fix to resolve problem with rates changing when residential selector is installed alongside a freight module
38
+ 1.24 - FREIGHT-42 Removed the city field from FedEx Freight
39
+ 1.25 - FREIGHT-44 Added Default to switch
40
+ 1.26 - HOC1 - Updated to support adding liftgate fee even when free shipping. Refactor code to improve
41
+ 1.27 - Added support for Old Dominion and Freight 41 - Removed addres.php rewrite
app/code/community/Webshopapps/Wsafreightcommon/controllers/Checkout/OnepageController.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
27
+
28
+
29
+ class Webshopapps_Wsafreightcommon_Checkout_OnepageController extends Mage_Checkout_OnepageController
30
+ {
31
+ private $_skipFreight = false;
32
+
33
+ /**
34
+ * save checkout billing address
35
+ */
36
+ public function saveBillingAction()
37
+ {
38
+ if (Mage::helper('wsafreightcommon')->getAllFreightCarriers() < 1) {
39
+ return parent::saveBillingAction();
40
+ }
41
+ if ($this->_expireAjax()) {
42
+ return;
43
+ }
44
+ if ($this->getRequest()->isPost()) {
45
+ $postData = $this->getRequest()->getPost('billing', array());
46
+ $data = $this->_filterPostData($postData);
47
+ $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
48
+ if (isset($data['email'])) {
49
+ $data['email'] = trim($data['email']);
50
+ }
51
+ $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
52
+ if (!isset($result['error'])) {
53
+ /* check quote for virtual */
54
+ if ($this->getOnepage()->getQuote()->isVirtual()) {
55
+ $result['goto_section'] = 'payment';
56
+ $result['update_section'] = array(
57
+ 'name' => 'payment-method',
58
+ 'html' => $this->_getPaymentMethodsHtml()
59
+ );
60
+ } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
61
+ if (Mage::helper('wsafreightcommon')->dontShowCommonFreight(
62
+ $this->getOnepage()->getQuote()->getAllVisibleItems())) {
63
+ $this->_skipFreight=true;
64
+ }
65
+ if(!Mage::helper('wsafreightcommon')->displayAccessorialsAtCheckout()) {
66
+ $this->_skipFreight=true;
67
+ }
68
+
69
+ if ($this->_skipFreight) {
70
+ $result['goto_section'] = 'shipping_method';
71
+
72
+ $result['update_section'] = array(
73
+ 'name' => 'shipping-method',
74
+ 'html' => $this->_getShippingMethodsHtml()
75
+ );
76
+ } else {
77
+
78
+ $result['goto_section'] = 'shippingextra';
79
+ }
80
+
81
+ $result['allow_sections'] = array('shipping');
82
+ $result['duplicateBillingInfo'] = 'true';
83
+ } else {
84
+ $result['goto_section'] = 'shipping';
85
+ }
86
+ }
87
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
88
+ }
89
+ }
90
+
91
+ public function saveShippingAction()
92
+ {
93
+ if (!Mage::getStoreConfig('shipping/wsafreightcommon/active')) {
94
+ return parent::saveShippingAction();
95
+ }
96
+ $this->_expireAjax();
97
+ if ($this->getRequest()->isPost()) {
98
+ $data = $this->getRequest()->getPost('shipping', array());
99
+ $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
100
+ $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
101
+
102
+ if (!isset($result['error'])) {
103
+ if (Mage::helper('wsafreightcommon')->dontShowCommonFreight(
104
+ $this->getOnepage()->getQuote()->getAllVisibleItems()) || !Mage::helper('wsafreightcommon')->displayAccessorialsAtCheckout()) {
105
+ $this->_skipFreight=true;
106
+ $result['goto_section'] = 'shipping_method';
107
+ $result['update_section'] = array(
108
+ 'name' => 'shipping-method',
109
+ 'html' => $this->_getShippingMethodsHtml()
110
+ );
111
+ } else {
112
+ $result['goto_section'] = 'shippingextra';
113
+ /* $result['update_section'] = array(
114
+ 'name' => 'shippingextra',
115
+ 'html' => $this->_getShippingExtraHtml()
116
+ );*/
117
+ }
118
+
119
+
120
+ }
121
+ $this->getResponse()->setBody(Zend_Json::encode($result));
122
+ }
123
+ }
124
+
125
+ protected function _getShippingExtraHtml()
126
+ {
127
+ $layout = $this->getLayout();
128
+ $update = $layout->getUpdate();
129
+ $update->load('wsafreightcommon_onepage_shippingextra');
130
+ $layout->generateXml();
131
+ $layout->generateBlocks();
132
+ $output = $layout->getOutput();
133
+ return $output;
134
+ }
135
+
136
+ public function saveShippingExtraAction()
137
+ {
138
+ $this->_expireAjax();
139
+ if ($this->getRequest()->isPost()) {
140
+ $liftgateReqd = $this->getRequest()->getPost('liftgate_required', '');
141
+ $notifyReqd = $this->getRequest()->getPost('allow_notify', '');
142
+ $insideDelivery = $this->getRequest()->getPost('inside_delivery', '');
143
+
144
+ $addressType = $this->getRequest()->getPost('shipto_type', '');
145
+ $result = $this->getOnepage()->saveShippingExtra($liftgateReqd,$addressType,$notifyReqd,$insideDelivery);
146
+ /*
147
+ $result will have erro data if shipping method is empty
148
+ */
149
+ if(!$result) {
150
+
151
+ $result['goto_section'] = 'shipping_method';
152
+ $result['update_section'] = array(
153
+ 'name' => 'shipping-method',
154
+ 'html' => $this->_getShippingMethodsHtml()
155
+ );
156
+
157
+ }
158
+ $this->getResponse()->setBody(Zend_Json::encode($result));
159
+ }
160
+ }
161
+ }
app/code/community/Webshopapps/Wsafreightcommon/etc/config.xml ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * @author WebShopApps
23
+ * @license www.WebShopApps.com/license/license.txt
24
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
25
+ * Copyright, 2013, Zowta, LLC - US license
26
+ *
27
+ * (c) Webshopapps.com Zowta Ltd 2012 - All rights reserved.
28
+ */
29
+ -->
30
+ <config>
31
+ <modules>
32
+ <Webshopapps_Wsafreightcommon>
33
+ <version>0.0.6</version>
34
+ <depends>
35
+ <Mage_Shipping />
36
+ </depends>
37
+ </Webshopapps_Wsafreightcommon>
38
+ </modules>
39
+ <global>
40
+ <models>
41
+ <wsafreightcommon>
42
+ <class>Webshopapps_Wsafreightcommon_Model</class>
43
+ </wsafreightcommon>
44
+ <wsafreightcommon_shipping>
45
+ <class>Webshopapps_Wsafreightcommon_Model</class>
46
+ </wsafreightcommon_shipping>
47
+ <checkout>
48
+ <rewrite>
49
+ <type_onepage>Webshopapps_Wsafreightcommon_Model_Type_Onepage</type_onepage>
50
+ </rewrite>
51
+ </checkout>
52
+ <sales>
53
+ <rewrite>
54
+ <quote_address_total_shipping>Webshopapps_Wsafreightcommon_Model_Quote_Address_Total_Shipping</quote_address_total_shipping>
55
+ <quote_address_rate>Webshopapps_Wsafreightcommon_Model_Quote_Address_Rate</quote_address_rate>
56
+ </rewrite>
57
+ </sales>
58
+ <shipping>
59
+ <rewrite>
60
+ <shipping>Webshopapps_Wsacommon_Model_Shipping_Shipping</shipping>
61
+ </rewrite>
62
+ </shipping>
63
+ </models>
64
+ <events>
65
+ <admin_system_config_changed_section_carriers>
66
+ <observers>
67
+ <wsafreightcommon_observer>
68
+ <class>wsafreightcommon/observer</class>
69
+ <method>postError</method>
70
+ </wsafreightcommon_observer>
71
+ </observers>
72
+ </admin_system_config_changed_section_carriers>
73
+ <controller_action_predispatch>
74
+ <observers>
75
+ <controller_action_before>
76
+ <class>wsafreightcommon/observer</class>
77
+ <method>hookToControllerActionPreDispatch</method>
78
+ </controller_action_before>
79
+ </observers>
80
+ </controller_action_predispatch>
81
+ <controller_action_postdispatch>
82
+ <observers>
83
+ <controller_action_before>
84
+ <class>wsafreightcommon/observer</class>
85
+ <method>hookToControllerActionPostDispatch</method>
86
+ </controller_action_before>
87
+ </observers>
88
+ </controller_action_postdispatch>
89
+ </events>
90
+ <blocks>
91
+ <wsafreightcommon>
92
+ <class>Webshopapps_Wsafreightcommon_Block</class>
93
+ </wsafreightcommon>
94
+ <checkout>
95
+ <rewrite>
96
+ <onepage>Webshopapps_Wsafreightcommon_Block_Onepage</onepage>
97
+ <onepage_progress>Webshopapps_Wsafreightcommon_Block_Onepage_Progress</onepage_progress>
98
+ </rewrite>
99
+ </checkout>
100
+ </blocks>
101
+ <resources>
102
+ <wsafreightcommon_setup>
103
+ <setup>
104
+ <module>Webshopapps_Wsafreightcommon</module>
105
+ <class>Mage_Eav_Model_Entity_Setup</class>
106
+ </setup>
107
+ <connection>
108
+ <use>core_setup</use>
109
+ </connection>
110
+ </wsafreightcommon_setup>
111
+ </resources>
112
+ <sales>
113
+ </sales>
114
+ <fieldsets>
115
+ <sales_convert_quote_address>
116
+ <freight_quote_id><to_order>*</to_order></freight_quote_id>
117
+ <liftgate_required><to_order>*</to_order></liftgate_required>
118
+ <notify_required><to_order>*</to_order></notify_required>
119
+ <inside_delivery><to_order>*</to_order></inside_delivery>
120
+ <shipto_type><to_order>*</to_order></shipto_type>
121
+ </sales_convert_quote_address>
122
+ <sales_convert_order>
123
+ <freight_quote_id><to_quote_address_shipping>*</to_quote_address_shipping></freight_quote_id>
124
+ <notify_required><to_quote_address_shipping>*</to_quote_address_shipping></notify_required>
125
+ <inside_delivery><to_quote_address_shipping>*</to_quote_address_shipping></inside_delivery>
126
+ <liftgate_required><to_quote_address_shipping>*</to_quote_address_shipping></liftgate_required>
127
+ <shipto_type><to_quote_address_shipping>*</to_quote_address_shipping></shipto_type>
128
+ </sales_convert_order>
129
+ </fieldsets>
130
+ <helpers>
131
+ <wsafreightcommon>
132
+ <class>Webshopapps_Wsafreightcommon_Helper</class>
133
+ </wsafreightcommon>
134
+ </helpers>
135
+ <sales>
136
+ <quote>
137
+ <item>
138
+ <product_attributes>
139
+ <freight_class/>
140
+ <must_ship_freight/>
141
+ </product_attributes>
142
+ </item>
143
+ </quote>
144
+ </sales>
145
+ </global>
146
+ <frontend>
147
+ <routers>
148
+ <webshopapps_wsafreightcommon>
149
+ <use>standard</use>
150
+ <args>
151
+ <module>Webshopapps_Wsafreightcommon</module>
152
+ <frontName>wsafreightcommon</frontName>
153
+ </args>
154
+ </webshopapps_wsafreightcommon>
155
+ <checkout>
156
+ <args>
157
+ <modules>
158
+ <Webshopapps_Wsafreightcommon before="Mage_Checkout">Webshopapps_Wsafreightcommon_Checkout</Webshopapps_Wsafreightcommon>
159
+ </modules>
160
+ </args>
161
+ </checkout>
162
+ </routers>
163
+ <translate>
164
+ <modules>
165
+ <Webshopapps_Wsafreightcommon>
166
+ <files>
167
+ <default>Webshopapps_Wsafreightcommon.csv</default>
168
+ </files>
169
+ </Webshopapps_Wsafreightcommon>
170
+ </modules>
171
+ </translate>
172
+ <layout>
173
+ <updates>
174
+ <wsafreightcommon>
175
+ <file>webshopapps_wsafreightcommon.xml</file>
176
+ </wsafreightcommon>
177
+ </updates>
178
+ </layout>
179
+ </frontend>
180
+ <adminhtml>
181
+ <translate>
182
+ <modules>
183
+ <Webshopapps_Wsafreightcommon>
184
+ <files>
185
+ <default>Webshopapps_Wsafreightcommon.csv</default>
186
+ </files>
187
+ </Webshopapps_Wsafreightcommon>
188
+ </modules>
189
+ </translate>
190
+ <layout>
191
+ <updates>
192
+ <wsafreightcommon>
193
+ <file>webshopapps_wsafreightcommon.xml</file>
194
+ </wsafreightcommon>
195
+ </updates>
196
+ </layout>
197
+ </adminhtml>
198
+ <default>
199
+ <shipping>
200
+ <wsafreightcommon>
201
+ <active>1</active>
202
+ <restrict_rates>1</restrict_rates>
203
+ <ship_freight_class_present>1</ship_freight_class_present>
204
+ <use_accessories>1</use_accessories>
205
+ <max_package_weight>10000</max_package_weight>
206
+ <use_parent>1</use_parent>
207
+ <min_weight>150</min_weight>
208
+ <default_freight_class>55</default_freight_class>
209
+ <liftgate_fee>0</liftgate_fee>
210
+ <residential_fee>0</residential_fee>
211
+ <inside_delivery_fee>0</inside_delivery_fee>
212
+ <notify_fee>0</notify_fee>
213
+ <debug>0</debug>
214
+ <apply_live_liftgate>0</apply_live_liftgate>
215
+ <apply_live_business>0</apply_live_business>
216
+ <inside_delivery_fee>0</inside_delivery_fee>
217
+ <liftgate_origin>0</liftgate_origin>
218
+ <residential_origin>0</residential_origin>
219
+ <force_freight>1</force_freight>
220
+ <restrict_rates>1</restrict_rates>
221
+ <auto_select_cheapest>0</auto_select_cheapest>
222
+ </wsafreightcommon>
223
+ </shipping>
224
+ <carriers>
225
+ <global>
226
+ <models>
227
+ <wsafreightcommon>
228
+ <class>Webshopapps_Wsafreightcommon_Model</class>
229
+ </wsafreightcommon>
230
+ <wsafreightcommon_shipping>
231
+ <class>Webshopapps_Wsafreightcommon_Model</class>
232
+ </wsafreightcommon_shipping>
233
+ </models>
234
+ </global>
235
+ <freefreight>
236
+ <active>0</active>
237
+ <model>wsafreightcommon_shipping/carrier_freefreight</model>
238
+ <title>Select Shipping Method</title>
239
+ <name>Freefreight</name>
240
+ <liftgate_fee>0</liftgate_fee>
241
+ <residential_fee>0</residential_fee>
242
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
243
+ <allowed_methods>freefreight</allowed_methods>
244
+ </freefreight>
245
+ </carriers>
246
+ </default>
247
+ </config>
app/code/community/Webshopapps/Wsafreightcommon/etc/system.xml ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * @author WebShopApps
23
+ * @license www.WebShopApps.com/license/license.txt
24
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
25
+ * Copyright, 2013, Zowta, LLC - US license
26
+ * (c) Webshopapps.com Zowta Ltd 2012 - All rights reserved.
27
+ **/-->
28
+ <config>
29
+ <sections>
30
+ <shipping translate="label" module="shipping">
31
+ <groups>
32
+ <wsafreightcommon translate="label">
33
+ <label>Webshopapps Freight Common Settings</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>99</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <fields>
40
+ <when_show_heading translate="label">
41
+ <label>Display Criteria</label>
42
+ <frontend_model>wsacommon_adminhtml/system_config_form_field_heading
43
+ </frontend_model>
44
+ <sort_order>54</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ </when_show_heading>
48
+ <default_freight_class translate="label">
49
+ <label>Default Freight NMFC class</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>56</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment>If no NMFC freight class on product will use this. For FedEx Freight, set class in FedEx Freight configuration</comment>
56
+ </default_freight_class>
57
+ <min_weight translate="label">
58
+ <label>Minimum Weight</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>60</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <comment>Minimum weight at which Freight Rates are displayed</comment>
65
+ <tooltip>Will still show Freight Rates if item is marked with a Freight Class</tooltip>
66
+ </min_weight>
67
+ <max_package_weight translate="label">
68
+ <label>Maximum Package Weight</label>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>65</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ <comment>Please consult your shipping carrier for maximum supported shipping weight</comment>
75
+ </max_package_weight>
76
+ <use_parent translate="label">
77
+ <label>Use Parent Configurable/Bundled Group?</label>
78
+ <frontend_type>select</frontend_type>
79
+ <sort_order>66</sort_order>
80
+ <source_model>adminhtml/system_config_source_yesno</source_model>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ <comment>
85
+ Should shipping settings on parent item (actual configurable/bundle product) be used
86
+ for freight calculations or should the child (simple) product be used?
87
+ </comment>
88
+ </use_parent>
89
+ <ship_freight_class_present translate="label">
90
+ <label>Ship via Freight if Freight class assigned to Product</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>adminhtml/system_config_source_yesno</source_model>
93
+ <sort_order>67</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
+ <comment>If set to No, products with a freight class only ship freight when weight limit exceeded or 'Must Ship Freight' is set to Yes.</comment>
98
+ </ship_freight_class_present>
99
+ <restrict_rates translate="label">
100
+ <label>Display just Freight Carrier when weight threshold Reached</label>
101
+ <frontend_type>select</frontend_type>
102
+ <source_model>adminhtml/system_config_source_yesno</source_model>
103
+ <sort_order>70</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ <comment>If YES all other shipping rates are not shown</comment>
108
+ </restrict_rates>
109
+ <force_freight translate="label">
110
+ <label>Display just Freight Carrier when Freight Product in Cart</label>
111
+ <frontend_type>select</frontend_type>
112
+ <source_model>adminhtml/system_config_source_yesno</source_model>
113
+ <sort_order>75</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </force_freight>
118
+ <show_carriers translate="label">
119
+ <label>Always Display these Other Carriers</label>
120
+ <frontend_type>multiselect</frontend_type>
121
+ <source_model>wsafreightcommon/source_carriers</source_model>
122
+ <sort_order>80</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ <comment>Will always show these shipping carriers with Freight</comment>
127
+ </show_carriers>
128
+ <auto_select_cheapest translate="label">
129
+ <label>Autoselect Cheapest Rate</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <sort_order>83</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ <comment>Will auto select the cheapest rate if other carriers are set to always display</comment>
137
+ </auto_select_cheapest>
138
+ <accessories_heading translate="label">
139
+ <label>Destination Accessorial Settings</label>
140
+ <frontend_model>wsacommon_adminhtml/system_config_form_field_heading
141
+ </frontend_model>
142
+ <sort_order>85</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ </accessories_heading>
146
+ <use_accessories translate="label">
147
+ <label>Calculate Live Accessorial Charge</label>
148
+ <frontend_type>select</frontend_type>
149
+ <source_model>adminhtml/system_config_source_yesno</source_model>
150
+ <sort_order>95</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ <comment>If NO then can use flat fees below</comment>
155
+ </use_accessories>
156
+ <liftgate_fee translate="label">
157
+ <label>Flat Liftgate Fee</label>
158
+ <frontend_type>text</frontend_type>
159
+ <sort_order>100</sort_order>
160
+ <show_in_default>1</show_in_default>
161
+ <show_in_website>1</show_in_website>
162
+ <show_in_store>1</show_in_store>
163
+ </liftgate_fee>
164
+ <residential_fee translate="label">
165
+ <label>Flat Residential Fee</label>
166
+ <frontend_type>text</frontend_type>
167
+ <sort_order>110</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </residential_fee>
172
+ <inside_delivery_fee translate="label">
173
+ <label>Flat Inside Fee</label>
174
+ <frontend_type>text</frontend_type>
175
+ <sort_order>111</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
+ </inside_delivery_fee>
180
+ <notify_fee translate="label">
181
+ <label>Flat Scheduled Appointment Fee</label>
182
+ <frontend_type>text</frontend_type>
183
+ <sort_order>112</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ </notify_fee>
188
+ <apply_live_liftgate translate="label">
189
+ <label>Always add Liftgate Fee</label>
190
+ <frontend_type>select</frontend_type>
191
+ <source_model>adminhtml/system_config_source_yesno</source_model>
192
+ <sort_order>113</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ <show_in_store>1</show_in_store>
196
+ <comment>If YES will not give customer option for selecting
197
+ liftgate, but will always apply liftgate</comment>
198
+ </apply_live_liftgate>
199
+ <apply_live_business translate="label">
200
+ <label>Always add Business Fee</label>
201
+ <frontend_type>select</frontend_type>
202
+ <source_model>adminhtml/system_config_source_yesno</source_model>
203
+ <sort_order>114</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</show_in_store>
207
+ <comment>If YES will not give customer option for selecting
208
+ deliver type, but will always apply business delivery</comment>
209
+ </apply_live_business>
210
+ <apply_live_notify translate="label">
211
+ <label>Always add Scheduled Appointment Fee</label>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>adminhtml/system_config_source_yesno</source_model>
214
+ <sort_order>116</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ <comment>If YES will not give customer option for selecting
219
+ scheduled delivery, but will always apply scheduled</comment>
220
+ </apply_live_notify>
221
+ <default_address translate="label">
222
+ <label>Set Default Address Type to Business</label>
223
+ <frontend_type>select</frontend_type>
224
+ <sort_order>135</sort_order>
225
+ <source_model>adminhtml/system_config_source_yesno</source_model>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>1</show_in_website>
228
+ <show_in_store>1</show_in_store>
229
+ </default_address>
230
+ <default_liftgate translate="label">
231
+ <label>Set Liftgate to Yes by Default</label>
232
+ <frontend_type>select</frontend_type>
233
+ <sort_order>140</sort_order>
234
+ <source_model>adminhtml/system_config_source_yesno</source_model>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ </default_liftgate>
239
+ <accessories__origin_heading translate="label">
240
+ <label>Origin Accessorial Settings</label>
241
+ <frontend_model>wsacommon_adminhtml/system_config_form_field_heading
242
+ </frontend_model>
243
+ <sort_order>200</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ </accessories__origin_heading>
247
+ <hazardous translate="label">
248
+ <label>All products are Hazardous</label>
249
+ <frontend_type>select</frontend_type>
250
+ <source_model>adminhtml/system_config_source_yesno</source_model>
251
+ <sort_order>210</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ </hazardous>
256
+ <liftgate_origin translate="label">
257
+ <label>Liftgate required at Origin</label>
258
+ <frontend_type>select</frontend_type>
259
+ <source_model>adminhtml/system_config_source_yesno</source_model>
260
+ <sort_order>220</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ </liftgate_origin>
265
+ <residential_origin translate="label">
266
+ <label>Residential Origin</label>
267
+ <frontend_type>select</frontend_type>
268
+ <source_model>adminhtml/system_config_source_yesno</source_model>
269
+ <sort_order>230</sort_order>
270
+ <show_in_default>1</show_in_default>
271
+ <show_in_website>1</show_in_website>
272
+ <show_in_store>1</show_in_store>
273
+ </residential_origin>
274
+ </fields>
275
+ </wsafreightcommon>
276
+ </groups>
277
+ </shipping>
278
+ <carriers translate="label" module="shipping">
279
+ <groups>
280
+ <freefreight translate="label">
281
+ <label>Webshopapps Free Freight Shipping</label>
282
+ <frontend_type>text</frontend_type>
283
+ <sort_order>20</sort_order>
284
+ <show_in_default>1</show_in_default>
285
+ <show_in_website>1</show_in_website>
286
+ <show_in_store>1</show_in_store>
287
+ <comment>
288
+ <![CDATA[
289
+ <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
290
+ This module was developed by <a href="http://www.webshopapps.com" target="_blank">WebShopApps.com</a> - <b>Magento Shipping Extension Specialists</b>.
291
+ </div>
292
+ ]]>
293
+ </comment>
294
+ <fields>
295
+ <active translate="label">
296
+ <label>Enabled</label>
297
+ <frontend_type>select</frontend_type>
298
+ <source_model>adminhtml/system_config_source_yesno</source_model>
299
+ <sort_order>30</sort_order>
300
+ <show_in_default>1</show_in_default>
301
+ <show_in_website>1</show_in_website>
302
+ <show_in_store>1</show_in_store>
303
+ </active>
304
+ <title translate="label">
305
+ <label>Title</label>
306
+ <frontend_type>text</frontend_type>
307
+ <sort_order>50</sort_order>
308
+ <show_in_default>1</show_in_default>
309
+ <show_in_website>1</show_in_website>
310
+ <show_in_store>1</show_in_store>
311
+ </title>
312
+ <name translate="label">
313
+ <label>Method name</label>
314
+ <frontend_type>text</frontend_type>
315
+ <sort_order>60</sort_order>
316
+ <show_in_default>1</show_in_default>
317
+ <show_in_website>1</show_in_website>
318
+ <show_in_store>1</show_in_store>
319
+ </name>
320
+ <liftgate_fee translate="label">
321
+ <label>Flat Liftgate Fee</label>
322
+ <frontend_type>text</frontend_type>
323
+ <sort_order>70</sort_order>
324
+ <show_in_default>1</show_in_default>
325
+ <show_in_website>1</show_in_website>
326
+ <show_in_store>1</show_in_store>
327
+ </liftgate_fee>
328
+ <residential_fee translate="label">
329
+ <label>Flat Residential Fee</label>
330
+ <frontend_type>text</frontend_type>
331
+ <sort_order>80</sort_order>
332
+ <show_in_default>1</show_in_default>
333
+ <show_in_website>1</show_in_website>
334
+ <show_in_store>1</show_in_store>
335
+ </residential_fee>
336
+ <handling_type translate="label">
337
+ <label>Calculate Handling Fee</label>
338
+ <frontend_type>select</frontend_type>
339
+ <source_model>shipping/source_handlingType</source_model>
340
+ <sort_order>210</sort_order>
341
+ <show_in_default>1</show_in_default>
342
+ <show_in_website>1</show_in_website>
343
+ <show_in_store>0</show_in_store>
344
+ </handling_type>
345
+ <handling_fee translate="label">
346
+ <label>Handling Fee</label>
347
+ <frontend_type>text</frontend_type>
348
+ <sort_order>225</sort_order>
349
+ <show_in_default>1</show_in_default>
350
+ <show_in_website>1</show_in_website>
351
+ <show_in_store>1</show_in_store>
352
+ </handling_fee>
353
+ <specificerrmsg translate="label">
354
+ <label>Displayed Error Message</label>
355
+ <frontend_type>textarea</frontend_type>
356
+ <sort_order>240</sort_order>
357
+ <show_in_default>1</show_in_default>
358
+ <show_in_website>1</show_in_website>
359
+ <show_in_store>1</show_in_store>
360
+ </specificerrmsg>
361
+ <sallowspecific translate="label">
362
+ <label>Ship to applicable countries</label>
363
+ <frontend_type>select</frontend_type>
364
+ <sort_order>250</sort_order>
365
+ <frontend_class>shipping-applicable-country</frontend_class>
366
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
367
+ <show_in_default>1</show_in_default>
368
+ <show_in_website>1</show_in_website>
369
+ <show_in_store>1</show_in_store>
370
+ </sallowspecific>
371
+ <specificcountry translate="label">
372
+ <label>Ship to specific countries</label>
373
+ <frontend_type>multiselect</frontend_type>
374
+ <sort_order>260</sort_order>
375
+ <source_model>adminhtml/system_config_source_country</source_model>
376
+ <show_in_default>1</show_in_default>
377
+ <show_in_website>1</show_in_website>
378
+ <show_in_store>1</show_in_store>
379
+ </specificcountry>
380
+ <showmethod translate="label">
381
+ <label>Show method if Not Applicable</label>
382
+ <frontend_type>select</frontend_type>
383
+ <sort_order>270</sort_order>
384
+ <source_model>adminhtml/system_config_source_yesno</source_model>
385
+ <frontend_class>shipping-skip-hide</frontend_class>
386
+ <show_in_default>1</show_in_default>
387
+ <show_in_website>1</show_in_website>
388
+ <show_in_store>1</show_in_store>
389
+ </showmethod>
390
+ <sort_order translate="label">
391
+ <label>Sort Order</label>
392
+ <frontend_type>text</frontend_type>
393
+ <sort_order>500</sort_order>
394
+ <show_in_default>1</show_in_default>
395
+ <show_in_website>1</show_in_website>
396
+ <show_in_store>1</show_in_store>
397
+ </sort_order>
398
+ </fields>
399
+ </freefreight>
400
+ </groups>
401
+ </carriers>
402
+ </sections>
403
+ </config>
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.1.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='catalog_product';
10
+ select @attribute_set_id:=attribute_set_id from {$this->getTable('eav_attribute_set')} where entity_type_id=@entity_type_id and attribute_set_name='Default';
11
+
12
+ insert ignore into {$this->getTable('eav_attribute_group')}
13
+ set attribute_set_id = @attribute_set_id,
14
+ attribute_group_name = 'Shipping',
15
+ sort_order = 99;
16
+
17
+ select @attribute_group_id:=attribute_group_id from {$this->getTable('eav_attribute_group')} where attribute_group_name='Shipping' and attribute_set_id=@attribute_set_id;
18
+
19
+ insert ignore into {$this->getTable('eav_attribute')}
20
+ set entity_type_id = @entity_type_id,
21
+ attribute_code = 'freight_class',
22
+ backend_type = 'int',
23
+ frontend_input = 'text',
24
+ is_required = 0,
25
+ is_user_defined = 1,
26
+ frontend_label = 'Freight Class';
27
+
28
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='freight_class';
29
+
30
+ insert ignore into {$this->getTable('eav_entity_attribute')}
31
+ set entity_type_id = @entity_type_id,
32
+ attribute_set_id = @attribute_set_id,
33
+ attribute_group_id = @attribute_group_id,
34
+ attribute_id = @attribute_id;
35
+
36
+
37
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
38
+ set attribute_id = @attribute_id,
39
+ is_visible = 1,
40
+ used_in_product_listing = 1,
41
+ is_filterable_in_search = 1;
42
+
43
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='order';
44
+
45
+ insert ignore into {$this->getTable('eav_attribute')}
46
+ set entity_type_id = @entity_type_id,
47
+ attribute_code = 'freight_quote_id',
48
+ backend_type = 'varchar',
49
+ frontend_input = 'text';
50
+
51
+ select @attribute_set_id:=attribute_set_id from {$this->getTable('eav_attribute_set')} where entity_type_id=@entity_type_id;
52
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='freight_quote_id';
53
+ select @attribute_group_id:=attribute_group_id from {$this->getTable('eav_attribute_group')} where attribute_group_name='General' and attribute_set_id=@attribute_set_id;
54
+
55
+ insert ignore into {$this->getTable('eav_entity_attribute')}
56
+ set entity_type_id = @entity_type_id,
57
+ attribute_set_id = @attribute_set_id,
58
+ attribute_group_id = @attribute_group_id,
59
+ attribute_id = @attribute_id;
60
+
61
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='order';
62
+
63
+ insert ignore into {$this->getTable('eav_attribute')}
64
+ set entity_type_id = @entity_type_id,
65
+ attribute_code = 'liftgate_required',
66
+ backend_type = 'int',
67
+ frontend_input = 'boolean';
68
+
69
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD liftgate_required tinyint(1);
70
+
71
+ insert ignore into {$this->getTable('eav_attribute')}
72
+ set entity_type_id = @entity_type_id,
73
+ attribute_code = 'notify_required',
74
+ backend_type = 'int',
75
+ frontend_input = 'boolean';
76
+
77
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD notify_required tinyint(1);
78
+
79
+ insert ignore into {$this->getTable('eav_attribute')}
80
+ set entity_type_id = @entity_type_id,
81
+ attribute_code = 'shipto_type',
82
+ backend_type = 'varchar',
83
+ frontend_input = 'text';
84
+
85
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD shipto_type varchar(20);
86
+
87
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='liftgate_required';
88
+ select @attribute_group_id:=attribute_group_id from {$this->getTable('eav_attribute_group')} where attribute_group_name='General' and attribute_set_id=@attribute_set_id;
89
+
90
+ insert ignore into {$this->getTable('eav_entity_attribute')}
91
+ set entity_type_id = @entity_type_id,
92
+ attribute_set_id = @attribute_set_id,
93
+ attribute_group_id = @attribute_group_id,
94
+ attribute_id = @attribute_id;
95
+
96
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='shipto_type';
97
+ select @attribute_group_id:=attribute_group_id from {$this->getTable('eav_attribute_group')} where attribute_group_name='General' and attribute_set_id=@attribute_set_id;
98
+
99
+ insert ignore into {$this->getTable('eav_entity_attribute')}
100
+ set entity_type_id = @entity_type_id,
101
+ attribute_set_id = @attribute_set_id,
102
+ attribute_group_id = @attribute_group_id,
103
+ attribute_id = @attribute_id;
104
+
105
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='notify_required';
106
+ select @attribute_group_id:=attribute_group_id from {$this->getTable('eav_attribute_group')} where attribute_group_name='General' and attribute_set_id=@attribute_set_id;
107
+
108
+ insert ignore into {$this->getTable('eav_entity_attribute')}
109
+ set entity_type_id = @entity_type_id,
110
+ attribute_set_id = @attribute_set_id,
111
+ attribute_group_id = @attribute_group_id,
112
+ attribute_id = @attribute_id;
113
+
114
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD freight_quote_id varchar(30);
115
+
116
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_shipping_rate')} ADD freight_quote_id varchar(30);
117
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD freight_quote_id varchar(30);
118
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD shipto_type varchar(20);
119
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD liftgate_required tinyint(1);
120
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD notify_required int(1);
121
+
122
+ ");
123
+
124
+ $installer->endSetup();
125
+
126
+
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.3.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='catalog_product';
10
+
11
+ insert ignore into {$this->getTable('eav_attribute')}
12
+ set entity_type_id = @entity_type_id,
13
+ attribute_code = 'freight_class',
14
+ backend_type = 'int',
15
+ frontend_input = 'text',
16
+ is_required = 0,
17
+ is_user_defined = 1,
18
+ frontend_label = 'Freight Class';
19
+
20
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='freight_class';
21
+
22
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
23
+ set attribute_id = @attribute_id,
24
+ is_visible = 1,
25
+ used_in_product_listing = 0,
26
+ is_filterable_in_search = 0;
27
+
28
+ insert ignore into {$this->getTable('eav_attribute')}
29
+ set entity_type_id = @entity_type_id,
30
+ attribute_code = 'must_ship_freight',
31
+ backend_type = 'int',
32
+ frontend_input = 'boolean',
33
+ is_required = 0,
34
+ is_user_defined = 1,
35
+ frontend_label = 'Must ship freight';
36
+
37
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='must_ship_freight';
38
+
39
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
40
+ set attribute_id = @attribute_id,
41
+ is_visible = 1,
42
+ used_in_product_listing = 0,
43
+ is_filterable_in_search = 0;
44
+
45
+ ");
46
+
47
+ $freightCarriers = array ('yrcfreight','wsaupsfreight','estesfreight','echofreight','abffreight','conwayfreight','wsafedexfreight','rlfreight');
48
+
49
+ foreach ($freightCarriers as $carrier) {
50
+
51
+ $rows = $installer->_conn->fetchAll("select * from {$this->getTable('core_config_data')} where path in ('carriers/$carrier/min_weight','carriers/$carrier/use_accessories', 'carriers/$carrier/max_package_weight','carriers/$carrier/default_freight_class','carriers/$carrier/liftgate_fee','carriers/$carrier/residential_fee','carriers/$carrier/apply_live_liftgate', 'carriers/$carrier/apply_live_business','carriers/$carrier/liftgate_origin','carriers/$carrier/residential_origin','carriers/$carrier/restrict_rates','carriers/$carrier/force_freight','carriers/$carrier/show_carriers','carriers/$carrier/hazardous','carriers/$carrier/default_address','carriers/$carrier/default_liftgate')");
52
+ $search = array('carriers',$carrier);
53
+ $replace = array ('shipping','wsafreightcommon');
54
+
55
+ foreach ($rows as $r) {
56
+ $r['path'] = str_replace($search,$replace,$r['path']);
57
+ $installer->_conn->update($this->getTable('core_config_data'), $r, 'config_id='.$r['config_id']);
58
+ }
59
+ }
60
+
61
+ if (Mage::helper('wsalogger')->getNewVersion() > 10 ) {
62
+ $lifeGateAttr = array(
63
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
64
+ 'comment' => 'Liftgate Required',
65
+ 'length' => '1',
66
+ 'nullable' => 'true');
67
+
68
+ $notifyReqdAttr = array(
69
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
70
+ 'comment' => 'Notify Required',
71
+ 'length' => '1',
72
+ 'nullable' => 'true');
73
+
74
+ $shipToAttr = array(
75
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
76
+ 'comment' => 'Ship To Type',
77
+ 'nullable' => 'true',
78
+ );
79
+
80
+ $freightQuoteIdAttr = array(
81
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
82
+ 'comment' => 'Freight Quote Id',
83
+ 'nullable' => 'true',
84
+ );
85
+
86
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'liftgate_required', $lifeGateAttr );
87
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'notify_required',$notifyReqdAttr);
88
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'shipto_type',$shipToAttr);
89
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'freight_quote_id',$freightQuoteIdAttr);
90
+
91
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address_shipping_rate'),'freight_quote_id',$freightQuoteIdAttr);
92
+
93
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'freight_quote_id',$freightQuoteIdAttr);
94
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'shipto_type',$shipToAttr);
95
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'liftgate_required',$lifeGateAttr);
96
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'notify_required',$notifyReqdAttr);
97
+
98
+ } else {
99
+
100
+ $installer->run("
101
+
102
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD liftgate_required tinyint(1);
103
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD shipto_type varchar(20);
104
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD notify_required tinyint(1);
105
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD freight_quote_id varchar(30);
106
+
107
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_shipping_rate')} ADD freight_quote_id varchar(30);
108
+
109
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD freight_quote_id varchar(30);
110
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD shipto_type varchar(20);
111
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD liftgate_required tinyint(1);
112
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD notify_required int(1);
113
+
114
+ ");
115
+ }
116
+
117
+ $entityTypeId = $installer->getEntityTypeId('catalog_product');
118
+
119
+ $attributeSetArr = $installer->getConnection()->fetchAll("SELECT attribute_set_id FROM {$this->getTable('eav_attribute_set')} WHERE entity_type_id={$entityTypeId}");
120
+
121
+ $attributeIdArry = array($installer->getAttributeId($entityTypeId,'freight_class'),$installer->getAttributeId($entityTypeId,'must_ship_freight'));
122
+
123
+ foreach( $attributeSetArr as $attr)
124
+ {
125
+
126
+ $attributeSetId= $attr['attribute_set_id'];
127
+
128
+ $installer->addAttributeGroup($entityTypeId,$attributeSetId,'Shipping','99');
129
+
130
+ $attributeGroupId = $installer->getAttributeGroupId($entityTypeId,$attributeSetId,'Shipping');
131
+
132
+ foreach( $attributeIdArry as $attributeId) {
133
+ $installer->addAttributeToGroup($entityTypeId,$attributeSetId,$attributeGroupId,$attributeId,'99');
134
+ }
135
+
136
+ };
137
+
138
+ $installer->endSetup();
139
+
140
+
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.4.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='catalog_product';
10
+
11
+ insert ignore into {$this->getTable('eav_attribute')}
12
+ set entity_type_id = @entity_type_id,
13
+ attribute_code = 'freight_class',
14
+ backend_type = 'int',
15
+ frontend_input = 'text',
16
+ is_required = 0,
17
+ is_user_defined = 1,
18
+ frontend_label = 'Freight Class';
19
+
20
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='freight_class';
21
+
22
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
23
+ set attribute_id = @attribute_id,
24
+ is_visible = 1,
25
+ used_in_product_listing = 0,
26
+ is_filterable_in_search = 0;
27
+
28
+ insert ignore into {$this->getTable('eav_attribute')}
29
+ set entity_type_id = @entity_type_id,
30
+ attribute_code = 'must_ship_freight',
31
+ backend_type = 'int',
32
+ frontend_input = 'boolean',
33
+ is_required = 0,
34
+ is_user_defined = 1,
35
+ frontend_label = 'Must ship freight';
36
+
37
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='must_ship_freight';
38
+
39
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
40
+ set attribute_id = @attribute_id,
41
+ is_visible = 1,
42
+ used_in_product_listing = 0,
43
+ is_filterable_in_search = 0;
44
+
45
+ ");
46
+
47
+ $freightCarriers = array ('yrcfreight','wsaupsfreight','estesfreight','echofreight','abffreight','conwayfreight','wsafedexfreight','rlfreight');
48
+
49
+ foreach ($freightCarriers as $carrier) {
50
+
51
+ $rows = $installer->_conn->fetchAll("select * from {$this->getTable('core_config_data')} where path in ('carriers/$carrier/min_weight','carriers/$carrier/use_accessories', 'carriers/$carrier/max_package_weight','carriers/$carrier/default_freight_class','carriers/$carrier/liftgate_fee','carriers/$carrier/residential_fee','carriers/$carrier/apply_live_liftgate', 'carriers/$carrier/apply_live_business','carriers/$carrier/liftgate_origin','carriers/$carrier/residential_origin','carriers/$carrier/restrict_rates','carriers/$carrier/force_freight','carriers/$carrier/show_carriers','carriers/$carrier/hazardous','carriers/$carrier/default_address','carriers/$carrier/default_liftgate')");
52
+ $search = array('carriers',$carrier);
53
+ $replace = array ('shipping','wsafreightcommon');
54
+
55
+ foreach ($rows as $r) {
56
+ $r['path'] = str_replace($search,$replace,$r['path']);
57
+ $installer->_conn->update($this->getTable('core_config_data'), $r, 'config_id='.$r['config_id']);
58
+ }
59
+ }
60
+
61
+ if (Mage::helper('wsalogger')->getNewVersion() > 10 ) {
62
+ $lifeGateAttr = array(
63
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
64
+ 'comment' => 'Liftgate Required',
65
+ 'length' => '1',
66
+ 'nullable' => 'true');
67
+
68
+ $notifyReqdAttr = array(
69
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
70
+ 'comment' => 'Notify Required',
71
+ 'length' => '1',
72
+ 'nullable' => 'true');
73
+
74
+ $insideDeliveryAttr = array(
75
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
76
+ 'comment' => 'Inside Delivery',
77
+ 'length' => '1',
78
+ 'nullable' => 'true');
79
+
80
+ $shipToAttr = array(
81
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
82
+ 'comment' => 'Ship To Type',
83
+ 'nullable' => 'true',
84
+ );
85
+
86
+ $freightQuoteIdAttr = array(
87
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
88
+ 'comment' => 'Freight Quote Id',
89
+ 'nullable' => 'true',
90
+ );
91
+
92
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'liftgate_required', $lifeGateAttr );
93
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'notify_required',$notifyReqdAttr);
94
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'inside_delivery',$insideDeliveryAttr);
95
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'shipto_type',$shipToAttr);
96
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'freight_quote_id',$freightQuoteIdAttr);
97
+
98
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address_shipping_rate'),'freight_quote_id',$freightQuoteIdAttr);
99
+
100
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'freight_quote_id',$freightQuoteIdAttr);
101
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'shipto_type',$shipToAttr);
102
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'liftgate_required',$lifeGateAttr);
103
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'notify_required',$notifyReqdAttr);
104
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'inside_delivery',$insideDeliveryAttr);
105
+
106
+ } else {
107
+
108
+ $installer->run("
109
+
110
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD liftgate_required tinyint(1);
111
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD shipto_type varchar(20);
112
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD inside_delivery tinyint(1);
113
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD notify_required tinyint(1);
114
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD freight_quote_id varchar(30);
115
+
116
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_shipping_rate')} ADD freight_quote_id varchar(30);
117
+
118
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD freight_quote_id varchar(30);
119
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD shipto_type varchar(20);
120
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD liftgate_required tinyint(1);
121
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD notify_required int(1);
122
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD inside_delivery int(1);
123
+
124
+ ");
125
+ }
126
+
127
+ $entityTypeId = $installer->getEntityTypeId('catalog_product');
128
+
129
+ $attributeSetArr = $installer->getConnection()->fetchAll("SELECT attribute_set_id FROM {$this->getTable('eav_attribute_set')} WHERE entity_type_id={$entityTypeId}");
130
+
131
+ $attributeIdArry = array($installer->getAttributeId($entityTypeId,'freight_class'),$installer->getAttributeId($entityTypeId,'must_ship_freight'));
132
+
133
+ foreach( $attributeSetArr as $attr)
134
+ {
135
+
136
+ $attributeSetId= $attr['attribute_set_id'];
137
+
138
+ $installer->addAttributeGroup($entityTypeId,$attributeSetId,'Shipping','99');
139
+
140
+ $attributeGroupId = $installer->getAttributeGroupId($entityTypeId,$attributeSetId,'Shipping');
141
+
142
+ foreach( $attributeIdArry as $attributeId) {
143
+ $installer->addAttributeToGroup($entityTypeId,$attributeSetId,$attributeGroupId,$attributeId,'99');
144
+ }
145
+
146
+ };
147
+
148
+ $installer->endSetup();
149
+
150
+
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.5.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='catalog_product';
10
+
11
+ insert ignore into {$this->getTable('eav_attribute')}
12
+ set entity_type_id = @entity_type_id,
13
+ attribute_code = 'freight_class',
14
+ backend_type = 'int',
15
+ frontend_input = 'text',
16
+ is_required = 0,
17
+ is_user_defined = 1,
18
+ frontend_label = 'Freight Class';
19
+
20
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='freight_class';
21
+
22
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
23
+ set attribute_id = @attribute_id,
24
+ is_visible = 1,
25
+ used_in_product_listing = 0,
26
+ is_filterable_in_search = 0;
27
+
28
+ insert ignore into {$this->getTable('eav_attribute')}
29
+ set entity_type_id = @entity_type_id,
30
+ attribute_code = 'must_ship_freight',
31
+ backend_type = 'int',
32
+ frontend_input = 'boolean',
33
+ is_required = 0,
34
+ is_user_defined = 1,
35
+ frontend_label = 'Must ship freight';
36
+
37
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='must_ship_freight';
38
+
39
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
40
+ set attribute_id = @attribute_id,
41
+ is_visible = 1,
42
+ used_in_product_listing = 0,
43
+ is_filterable_in_search = 0;
44
+
45
+ ");
46
+
47
+ $freightCarriers = array ('yrcfreight','wsaupsfreight','estesfreight','echofreight','abffreight','conwayfreight','wsafedexfreight','rlfreight');
48
+
49
+ foreach ($freightCarriers as $carrier) {
50
+
51
+ $rows = $installer->_conn->fetchAll("select * from {$this->getTable('core_config_data')} where path in ('carriers/$carrier/min_weight','carriers/$carrier/use_accessories', 'carriers/$carrier/max_package_weight','carriers/$carrier/default_freight_class','carriers/$carrier/liftgate_fee','carriers/$carrier/residential_fee','carriers/$carrier/apply_live_liftgate', 'carriers/$carrier/apply_live_business','carriers/$carrier/liftgate_origin','carriers/$carrier/residential_origin','carriers/$carrier/restrict_rates','carriers/$carrier/force_freight','carriers/$carrier/show_carriers','carriers/$carrier/hazardous','carriers/$carrier/default_address','carriers/$carrier/default_liftgate')");
52
+ $search = array('carriers',$carrier);
53
+ $replace = array ('shipping','wsafreightcommon');
54
+
55
+ foreach ($rows as $r) {
56
+ $r['path'] = str_replace($search,$replace,$r['path']);
57
+ $installer->_conn->update($this->getTable('core_config_data'), $r, 'config_id='.$r['config_id']);
58
+ }
59
+ }
60
+
61
+ if (Mage::helper('wsalogger')->getNewVersion() > 10 ) {
62
+ $lifeGateAttr = array(
63
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
64
+ 'comment' => 'Liftgate Required',
65
+ 'length' => '1',
66
+ 'nullable' => 'true');
67
+
68
+ $notifyReqdAttr = array(
69
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
70
+ 'comment' => 'Notify Required',
71
+ 'length' => '1',
72
+ 'nullable' => 'true');
73
+
74
+ $insideDeliveryAttr = array(
75
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
76
+ 'comment' => 'Inside Delivery',
77
+ 'length' => '1',
78
+ 'nullable' => 'true');
79
+
80
+ $shipToAttr = array(
81
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
82
+ 'comment' => 'Ship To Type',
83
+ 'nullable' => 'true',
84
+ );
85
+
86
+ $freightQuoteIdAttr = array(
87
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
88
+ 'comment' => 'Freight Quote Id',
89
+ 'nullable' => 'true',
90
+ );
91
+
92
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'liftgate_required', $lifeGateAttr );
93
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'notify_required',$notifyReqdAttr);
94
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'inside_delivery',$insideDeliveryAttr);
95
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'shipto_type',$shipToAttr);
96
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'freight_quote_id',$freightQuoteIdAttr);
97
+
98
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address_shipping_rate'),'freight_quote_id',$freightQuoteIdAttr);
99
+
100
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'freight_quote_id',$freightQuoteIdAttr);
101
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'shipto_type',$shipToAttr);
102
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'liftgate_required',$lifeGateAttr);
103
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'notify_required',$notifyReqdAttr);
104
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'inside_delivery',$insideDeliveryAttr);
105
+
106
+ } else {
107
+
108
+ $installer->run("
109
+
110
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD liftgate_required tinyint(1);
111
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD shipto_type varchar(20);
112
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD inside_delivery tinyint(1);
113
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD notify_required tinyint(1);
114
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD freight_quote_id varchar(30);
115
+
116
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_shipping_rate')} ADD freight_quote_id varchar(30);
117
+
118
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD freight_quote_id varchar(30);
119
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD shipto_type varchar(20);
120
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD liftgate_required tinyint(1);
121
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD notify_required int(1);
122
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD inside_delivery int(1);
123
+
124
+ ");
125
+ }
126
+
127
+ $entityTypeId = $installer->getEntityTypeId('catalog_product');
128
+
129
+ $attributeSetArr = $installer->getConnection()->fetchAll("SELECT attribute_set_id FROM {$this->getTable('eav_attribute_set')} WHERE entity_type_id={$entityTypeId}");
130
+
131
+ $attributeIdArry = array($installer->getAttributeId($entityTypeId,'freight_class'),$installer->getAttributeId($entityTypeId,'must_ship_freight'));
132
+
133
+ foreach( $attributeSetArr as $attr)
134
+ {
135
+
136
+ $attributeSetId= $attr['attribute_set_id'];
137
+
138
+ $installer->addAttributeGroup($entityTypeId,$attributeSetId,'Shipping','99');
139
+
140
+ $attributeGroupId = $installer->getAttributeGroupId($entityTypeId,$attributeSetId,'Shipping');
141
+
142
+ foreach( $attributeIdArry as $attributeId) {
143
+ $installer->addAttributeToGroup($entityTypeId,$attributeSetId,$attributeGroupId,$attributeId,'99');
144
+ }
145
+
146
+ };
147
+
148
+ $installer->endSetup();
149
+
150
+
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-install-0.0.6.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='catalog_product';
10
+
11
+ insert ignore into {$this->getTable('eav_attribute')}
12
+ set entity_type_id = @entity_type_id,
13
+ attribute_code = 'freight_class',
14
+ backend_type = 'text',
15
+ frontend_input = 'text',
16
+ is_required = 0,
17
+ is_user_defined = 1,
18
+ frontend_label = 'Freight Class';
19
+
20
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='freight_class';
21
+
22
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
23
+ set attribute_id = @attribute_id,
24
+ is_visible = 1,
25
+ used_in_product_listing = 0,
26
+ is_filterable_in_search = 0;
27
+
28
+ insert ignore into {$this->getTable('eav_attribute')}
29
+ set entity_type_id = @entity_type_id,
30
+ attribute_code = 'must_ship_freight',
31
+ backend_type = 'int',
32
+ frontend_input = 'boolean',
33
+ is_required = 0,
34
+ is_user_defined = 1,
35
+ frontend_label = 'Must ship freight';
36
+
37
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='must_ship_freight';
38
+
39
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
40
+ set attribute_id = @attribute_id,
41
+ is_visible = 1,
42
+ used_in_product_listing = 0,
43
+ is_filterable_in_search = 0;
44
+
45
+ ");
46
+
47
+ $freightCarriers = array ('yrcfreight','wsaupsfreight','estesfreight','echofreight','abffreight','conwayfreight','wsafedexfreight','rlfreight', 'wsaolddominion');
48
+
49
+ foreach ($freightCarriers as $carrier) {
50
+
51
+ $rows = $installer->_conn->fetchAll("select * from {$this->getTable('core_config_data')} where path in ('carriers/$carrier/min_weight','carriers/$carrier/use_accessories', 'carriers/$carrier/max_package_weight','carriers/$carrier/default_freight_class','carriers/$carrier/liftgate_fee','carriers/$carrier/residential_fee','carriers/$carrier/apply_live_liftgate', 'carriers/$carrier/apply_live_business','carriers/$carrier/liftgate_origin','carriers/$carrier/residential_origin','carriers/$carrier/restrict_rates','carriers/$carrier/force_freight','carriers/$carrier/show_carriers','carriers/$carrier/hazardous','carriers/$carrier/default_address','carriers/$carrier/default_liftgate')");
52
+ $search = array('carriers',$carrier);
53
+ $replace = array ('shipping','wsafreightcommon');
54
+
55
+ foreach ($rows as $r) {
56
+ $r['path'] = str_replace($search,$replace,$r['path']);
57
+ $installer->_conn->update($this->getTable('core_config_data'), $r, 'config_id='.$r['config_id']);
58
+ }
59
+ }
60
+
61
+ if (Mage::helper('wsalogger')->getNewVersion() > 10 ) {
62
+ $lifeGateAttr = array(
63
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
64
+ 'comment' => 'Liftgate Required',
65
+ 'length' => '1',
66
+ 'nullable' => 'true');
67
+
68
+ $notifyReqdAttr = array(
69
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
70
+ 'comment' => 'Notify Required',
71
+ 'length' => '1',
72
+ 'nullable' => 'true');
73
+
74
+ $insideDeliveryAttr = array(
75
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
76
+ 'comment' => 'Inside Delivery',
77
+ 'length' => '1',
78
+ 'nullable' => 'true');
79
+
80
+ $shipToAttr = array(
81
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
82
+ 'comment' => 'Ship To Type',
83
+ 'nullable' => 'true',
84
+ );
85
+
86
+ $freightQuoteIdAttr = array(
87
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
88
+ 'comment' => 'Freight Quote Id',
89
+ 'nullable' => 'true',
90
+ );
91
+
92
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'liftgate_required', $lifeGateAttr );
93
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'notify_required',$notifyReqdAttr);
94
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'inside_delivery',$insideDeliveryAttr);
95
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'shipto_type',$shipToAttr);
96
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'freight_quote_id',$freightQuoteIdAttr);
97
+
98
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address_shipping_rate'),'freight_quote_id',$freightQuoteIdAttr);
99
+
100
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'freight_quote_id',$freightQuoteIdAttr);
101
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'shipto_type',$shipToAttr);
102
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'liftgate_required',$lifeGateAttr);
103
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'notify_required',$notifyReqdAttr);
104
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'inside_delivery',$insideDeliveryAttr);
105
+
106
+ } else {
107
+
108
+ $installer->run("
109
+
110
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD liftgate_required tinyint(1);
111
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD shipto_type varchar(20);
112
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD inside_delivery tinyint(1);
113
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD notify_required tinyint(1);
114
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD freight_quote_id varchar(30);
115
+
116
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_shipping_rate')} ADD freight_quote_id varchar(30);
117
+
118
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD freight_quote_id varchar(30);
119
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD shipto_type varchar(20);
120
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD liftgate_required tinyint(1);
121
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD notify_required int(1);
122
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD inside_delivery int(1);
123
+
124
+ ");
125
+ }
126
+
127
+ $entityTypeId = $installer->getEntityTypeId('catalog_product');
128
+
129
+ $attributeSetArr = $installer->getConnection()->fetchAll("SELECT attribute_set_id FROM {$this->getTable('eav_attribute_set')} WHERE entity_type_id={$entityTypeId}");
130
+
131
+ $attributeIdArry = array($installer->getAttributeId($entityTypeId,'freight_class'),$installer->getAttributeId($entityTypeId,'must_ship_freight'));
132
+
133
+ foreach( $attributeSetArr as $attr)
134
+ {
135
+
136
+ $attributeSetId= $attr['attribute_set_id'];
137
+
138
+ $installer->addAttributeGroup($entityTypeId,$attributeSetId,'Shipping','99');
139
+
140
+ $attributeGroupId = $installer->getAttributeGroupId($entityTypeId,$attributeSetId,'Shipping');
141
+
142
+ foreach( $attributeIdArry as $attributeId) {
143
+ $installer->addAttributeToGroup($entityTypeId,$attributeSetId,$attributeGroupId,$attributeId,'99');
144
+ }
145
+
146
+ };
147
+
148
+ $installer->endSetup();
149
+
150
+
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.1-0.0.2.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Wsafreightcommon
24
+ * @copyright Copyright (c) 2012 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
+ delete from {$this->getTable('core_config_data')} where path like 'carriers/wsafreightcommon%';
34
+ ");
35
+ $installer->endSetup();
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.2-0.0.3.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Wsafreightcommon
24
+ * @copyright Copyright (c) 2012 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
+
34
+ select @entity_type_id:=entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code='catalog_product';
35
+ select @attribute_set_id:=attribute_set_id from {$this->getTable('eav_attribute_set')} where entity_type_id=@entity_type_id and attribute_set_name='Default';
36
+
37
+ insert ignore into {$this->getTable('eav_attribute_group')}
38
+ set attribute_set_id = @attribute_set_id,
39
+ attribute_group_name = 'Shipping',
40
+ sort_order = 99;
41
+
42
+ select @attribute_group_id:=attribute_group_id from {$this->getTable('eav_attribute_group')} where attribute_group_name='Shipping' and attribute_set_id=@attribute_set_id;
43
+
44
+ insert ignore into {$this->getTable('eav_attribute')}
45
+ set entity_type_id = @entity_type_id,
46
+ attribute_code = 'must_ship_freight',
47
+ backend_type = 'int',
48
+ frontend_input = 'boolean',
49
+ is_required = 0,
50
+ is_user_defined = 1,
51
+ frontend_label = 'Must ship freight';
52
+
53
+ select @attribute_id:=attribute_id from {$this->getTable('eav_attribute')} where attribute_code='must_ship_freight';
54
+
55
+ insert ignore into {$this->getTable('eav_entity_attribute')}
56
+ set entity_type_id = @entity_type_id,
57
+ attribute_set_id = @attribute_set_id,
58
+ attribute_group_id = @attribute_group_id,
59
+ attribute_id = @attribute_id;
60
+
61
+
62
+ insert ignore into {$this->getTable('catalog_eav_attribute')}
63
+ set attribute_id = @attribute_id,
64
+ is_visible = 1,
65
+ used_in_product_listing = 1,
66
+ is_filterable_in_search = 1;");
67
+ $installer->endSetup();
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.3-0.0.4.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Wsafreightcommon
24
+ * @copyright Copyright (c) 2012 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
+
33
+ if (Mage::helper('wsalogger')->getNewVersion() > 10 ) {
34
+
35
+
36
+ $insideDeliveryAttr = array(
37
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
38
+ 'comment' => 'Inside Delivery',
39
+ 'length' => '1',
40
+ 'nullable' => 'true');
41
+
42
+
43
+ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'inside_delivery',$insideDeliveryAttr);
44
+ $installer->getConnection()->addColumn($installer->getTable('sales/order'),'inside_delivery',$insideDeliveryAttr);
45
+
46
+ } else {
47
+
48
+ $installer->run("
49
+
50
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_quote_address')} ADD inside_delivery tinyint(1);
51
+ ALTER IGNORE TABLE {$this->getTable('sales_flat_order')} ADD inside_delivery int(1);
52
+
53
+ ");
54
+ }
55
+
56
+
57
+
58
+ $installer->endSetup();
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.4-0.0.5.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Wsafreightcommon
24
+ * @copyright Copyright (c) 2012 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
+
33
+ $freightCarriers = array ('yrcfreight','wsaupsfreight','estesfreight','echofreight','abffreight','conwayfreight','wsafedexfreight','rlfreight','ctsfreight','dmtrans');
34
+
35
+ foreach ($freightCarriers as $carrier) {
36
+
37
+ $rows = $installer->_conn->fetchAll("select * from {$this->getTable('core_config_data')} where path in ('carriers/$carrier/use_parent')");
38
+ $search = array('carriers',$carrier);
39
+ $replace = array ('shipping','wsafreightcommon');
40
+
41
+ foreach ($rows as $r) {
42
+ $r['path'] = str_replace($search,$replace,$r['path']);
43
+ $installer->_conn->update($this->getTable('core_config_data'), $r, 'config_id='.$r['config_id']);
44
+ }
45
+ }
46
+
47
+
48
+ $installer->endSetup();
app/code/community/Webshopapps/Wsafreightcommon/sql/wsafreightcommon_setup/mysql4-upgrade-0.0.5-0.0.6.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Wsafreightcommon
24
+ * @copyright Copyright (c) 2012 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
+
34
+ set @attribute_id = (select attribute_id from {$this->getTable('eav_attribute')} where attribute_code = 'freight_class');
35
+ update eav_attribute set backend_type = 'text' where attribute_id = @attribute_id
36
+
37
+ ");
38
+
39
+
40
+ $installer->endSetup();
app/code/community/Webshopapps/Wsafreightcommon/versions_supported.txt ADDED
@@ -0,0 +1 @@
 
1
+ 1.4.1+
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,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
70
+ sort($modules);
71
+
72
+ foreach ($modules as $moduleName) {
73
+ if ($moduleName==='Mage_Adminhtml' ||$moduleName==='Webshopapps_Wsacommon' || $moduleName==='Webshopapps_Wsalogger'
74
+ || stripos($moduleName,'Mage_') !== false) {
75
+ continue;
76
+ }
77
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/view_all_extns') && stripos($moduleName,'webshopapps_') === false) {
78
+ continue;
79
+ }
80
+ $html.= $this->_getFieldHtml($element, $moduleName);
81
+ }
82
+ $html .= $this->_getFooterHtml($element);
83
+
84
+ return $html;
85
+ }
86
+
87
+ protected function _getDummyElement()
88
+ {
89
+ if (empty($this->_dummyElement)) {
90
+ $this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
91
+ }
92
+ return $this->_dummyElement;
93
+ }
94
+
95
+ protected function _getFieldRenderer()
96
+ {
97
+ if (empty($this->_fieldRenderer)) {
98
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
99
+ }
100
+ return $this->_fieldRenderer;
101
+ }
102
+
103
+ protected function _getValues()
104
+ {
105
+ if (empty($this->_values)) {
106
+ $this->_values = array(
107
+ array('label'=>Mage::helper('adminhtml')->__('Logging Disabled'), 'value'=>0),
108
+ array('label'=>Mage::helper('adminhtml')->__('Logging Enabled'), 'value'=>1),
109
+ );
110
+ }
111
+ return $this->_values;
112
+ }
113
+
114
+ protected function _getFieldHtml($fieldset, $moduleName)
115
+ {
116
+ $configData = $this->getConfigData();
117
+ $path = 'wsalogmenu/modules_disable_logger/'.$moduleName; //TODO: move as property of form
118
+ if (isset($configData[$path])) {
119
+ $data = $configData[$path];
120
+ $inherit = false;
121
+ } else {
122
+ $data = 0;
123
+ $inherit = true;
124
+ }
125
+
126
+ $e = $this->_getDummyElement();
127
+
128
+ $field = $fieldset->addField($moduleName, 'select',
129
+ array(
130
+ 'name' => 'groups[modules_disable_logger][fields]['.$moduleName.'][value]',
131
+ 'label' => $moduleName,
132
+ 'value' => $data,
133
+ 'values' => $this->_getValues(),
134
+ 'inherit' => $inherit,
135
+ 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
136
+ 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
137
+ ))->setRenderer($this->_getFieldRenderer());
138
+
139
+ return $field->toHtml();
140
+ }
141
+ }
app/code/community/Webshopapps/Wsalogger/Helper/Data.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $eeVersion = 0;
38
+ if (version_compare($version, '1.6', '>=')) {
39
+ if (version_compare($version, '1.12') >= 0) $eeVersion = 12;
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.7') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 12; //CE 1.7, EE unknown at present
43
+ else if (version_compare($version, '1.6') >= 0 && !self::isEnterpriseEdition()) $eeVersion = 11; //CE 1.6, EE unknown at present
44
+ else if (version_compare($version, '1.9') >= 0) $eeVersion = 9;
45
+ else if (version_compare($version, '1.8') >= 0) $eeVersion = 8;
46
+ else if (version_compare($version, '1.7') >= 0) $eeVersion = 7;
47
+ else if (version_compare($version, '1.6') >= 0) $eeVersion = 6; //EE 1.6
48
+ else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
49
+ }
50
+ else {
51
+ if (version_compare($version, '1.5') >= 0) $eeVersion = 10;
52
+ else if (version_compare($version, '1.4.2') >= 0) $eeVersion = 9;
53
+ else if (version_compare($version, '1.4.1') >= 0) $eeVersion = 8;
54
+ else if (version_compare($version, '1.4.0') >= 0) $eeVersion = 7;
55
+ else if (version_compare($version, '1.3.2.4') >= 0) $eeVersion = 6;
56
+ else $eeVersion = 8; // default to this if unsure, changed to assume is 1.4.1+
57
+ }
58
+ return $eeVersion;
59
+ }
60
+
61
+
62
+ public static function isEnterpriseEdition() {
63
+ if (!Mage::getConfig()->getNode('modules/Enterprise_Cms')) {
64
+ return false;
65
+ }
66
+ return true;
67
+ }
68
+
69
+ public function isDebug($moduleName) {
70
+
71
+ $path = 'wsalogmenu/modules_disable_logger/'.$moduleName;
72
+ return Mage::getStoreConfig($path) ? true : false;
73
+
74
+ }
75
+
76
+ }
app/code/community/Webshopapps/Wsalogger/Helper/Log.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Enter description here ...
40
+ * @param unknown_type $severity - CRITIAL,MAJOR,MINOR,NOTICE - 1-4
41
+ * @param unknown_type $title
42
+ * @param unknown_type $description
43
+ * @param unknown_type $url
44
+ */
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
+ public static function postInfo($extension,$title,$description,$debug=true,$code=0,$url='') {
64
+
65
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
66
+ return ;
67
+ }
68
+
69
+
70
+ Mage::dispatchEvent('wsalogger_log_mesasge',
71
+ array('severity'=>self::SEVERITY_MINOR,
72
+ 'extension' => $extension,
73
+ 'title' => $title,
74
+ 'description' => $description,
75
+ 'code' => $code,
76
+ 'url' => $url
77
+ ));
78
+ }
79
+
80
+
81
+ public static function postWarning($extension,$title,$description,$debug=true,$code=0,$url='') {
82
+
83
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
84
+ return ;
85
+ }
86
+
87
+ Mage::dispatchEvent('wsalogger_log_mesasge',
88
+ array('severity'=>self::SEVERITY_MAJOR,
89
+ 'title' => $title,
90
+ 'extension' => $extension,
91
+ 'description' => $description,
92
+ 'code' => $code,
93
+ 'url' => $url
94
+ ));
95
+ }
96
+
97
+ public static function postCritical($extension,$title,$description,$debug=true,$code=0,$url='') {
98
+
99
+ if (!Mage::getStoreConfig('wsalogmenu/wsalog/active')) {
100
+ return ;
101
+ }
102
+
103
+ Mage::dispatchEvent('wsalogger_log_mesasge',
104
+ array('severity'=>self::SEVERITY_CRITICAL,
105
+ 'title' => $title,
106
+ 'extension' => $extension,
107
+ 'description' => $description,
108
+ 'code' => $code,
109
+ 'url' => $url
110
+ ));
111
+ }
112
+
113
+
114
+ public function getSeverities($severity = null)
115
+ {
116
+
117
+ return Mage::getSingleton('wsalogger/log')->getSeverities($severity);
118
+
119
+ }
120
+
121
+
122
+ }
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,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $emailTemplate->setSenderName(Mage::getStoreConfig('wsalogmenu/wsalog/sender_email_name'));
71
+ $emailTemplate->setSenderEmail(Mage::getStoreConfig('wsalogmenu/wsalog/sender_email'));
72
+ $emailTemplate->setTemplateSubject(Mage::getStoreConfig('wsalogmenu/wsalog/email_subject'));
73
+
74
+ if (is_array($description) || is_object($description)) {
75
+ $description = print_r($description, true);
76
+ }
77
+ $description = htmlentities($description);
78
+
79
+ //Create an array of variables to assign to template
80
+ //TODO add severity
81
+ $emailTemplateVariables = array();
82
+ $emailTemplateVariables['title'] = $title;
83
+ $emailTemplateVariables['severity'] = $severity;
84
+ $emailTemplateVariables['extension'] = $extension;
85
+ $emailTemplateVariables['description'] = $description;
86
+ $emailTemplateVariables['code'] = $code;
87
+ $emailTemplateVariables['url'] = $url;
88
+
89
+
90
+ $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
91
+ /* * Or you can send the email directly, * note getProcessedTemplate is called inside send() */
92
+
93
+ $emailTemplate->send(Mage::getStoreConfig('wsalogmenu/wsalog/contact_email'),'', $emailTemplateVariables);
94
+
95
+ }
96
+ }
97
+ }
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,9 @@
 
 
 
 
 
 
 
 
 
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
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_wsafreightcommon.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Webshopapps
5
+ * @copyright Copyright (c) 2013 Zowta Ltd (http://www.WebShopApps.com)
6
+ * Copyright, 2013, Zowta, LLC - US license
7
+ * @license http://www.webshopapps.com/license/license.txt - Commercial license
8
+ */
9
+ -->
10
+
11
+ <layout version="0.1.0">
12
+
13
+ <!-- ORDERS -->
14
+ <adminhtml_sales_order_view>
15
+ <reference name="order_tab_info">
16
+ <action method="setTemplate">
17
+ <template>webshopapps/wsafreightcommon/sales/order/view/tab/info_container.phtml</template>
18
+ </action>
19
+ <block type="wsafreightcommon/adminhtml_sales_order_view_freightinfo" name="wsafreightcommon_info" template="webshopapps/wsafreightcommon/sales/order/view/wsafreightcommon_info.phtml"/>
20
+ <block type="adminhtml/sales_order_view_tab_info" name="order_info_orig" template="sales/order/view/tab/info.phtml">
21
+ <block type="adminhtml/sales_order_view_messages" name="order_messages"></block>
22
+ <block type="adminhtml/sales_order_view_info" name="order_info" template="sales/order/view/info.phtml"></block>
23
+ <block type="adminhtml/sales_order_view_items" name="order_items" template="sales/order/view/items.phtml">
24
+ <action method="addItemRender"><type>default</type><block>adminhtml/sales_order_view_items_renderer_default</block><template>sales/order/view/items/renderer/default.phtml</template></action>
25
+ <action method="addColumnRender"><column>qty</column><block>adminhtml/sales_items_column_qty</block><template>sales/items/column/qty.phtml</template></action>
26
+ <action method="addColumnRender"><column>name</column><block>adminhtml/sales_items_column_name</block><template>sales/items/column/name.phtml</template></action>
27
+ <action method="addColumnRender"><column>name</column><block>adminhtml/sales_items_column_name_grouped</block><template>sales/items/column/name.phtml</template><type>grouped</type></action>
28
+ <block type="core/text_list" name="order_item_extra_info" />
29
+ </block>
30
+ <block type="adminhtml/sales_order_payment" name="order_payment"/>
31
+ <block type="adminhtml/sales_order_view_history" name="order_history" template="sales/order/view/history.phtml"></block>
32
+ <block type="adminhtml/template" name="gift_options" template="sales/order/giftoptions.phtml">
33
+ <block type="adminhtml/sales_order_view_giftmessage" name="order_giftmessage" template="sales/order/view/giftmessage.phtml"></block>
34
+ </block>
35
+ <block type="adminhtml/sales_order_totals" name="order_totals" template="sales/order/totals.phtml">
36
+ <block type="adminhtml/sales_order_totals_tax" name="tax" template="sales/order/totals/tax.phtml" />
37
+ <block type="adminhtml/sales_order_totals_item" name="giftcardaccount" template="enterprise/giftcardaccount/sales/order/totals/giftcardaccount.phtml">
38
+ <action method="setBeforeCondition"><param>customerbalance</param></action>
39
+ </block>
40
+ </block>
41
+ </block>
42
+ </reference>
43
+ </adminhtml_sales_order_view>
44
+
45
+
46
+
47
+
48
+
49
+ </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/frontend/base/default/layout/webshopapps_wsafreightcommon.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <checkout_onepage_index>
4
+ <reference name="checkout.onepage">
5
+ <block type="wsafreightcommon/onepage_shippingextra" name="wsafreightcommon.onepage.shippingextra" as="shippingextra" after="checkout.onepage.billing" template="webshopapps/wsafreightcommon/onepage/shippingextra.phtml"/>
6
+ </reference>
7
+ </checkout_onepage_index>
8
+
9
+
10
+ <checkout_cart_index>
11
+ <reference name="checkout.cart">
12
+ <block type="wsafreightcommon/checkout_cart_shipping" name="checkout.cart.shipping" as="shipping" template="webshopapps/wsafreightcommon/checkout/cart/shipping.phtml"/>
13
+ </reference>
14
+ </checkout_cart_index>
15
+ </layout>
app/design/frontend/base/default/template/webshopapps/wsafreightcommon/checkout/cart/shipping.phtml ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * @see Mage_Checkout_Block_Cart_Shipping
30
+ */
31
+ ?>
32
+ <div class="shipping">
33
+ <h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
34
+ <div class="shipping-form">
35
+ <form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
36
+ <p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
37
+ <ul class="form-list">
38
+ <li>
39
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
40
+ <div class="input-box">
41
+ <?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
42
+ </div>
43
+ </li>
44
+ <?php //if($this->getStateActive()): ?>
45
+ <li>
46
+ <label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
47
+ <div class="input-box">
48
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
49
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
50
+ </select>
51
+ <script type="text/javascript">
52
+ //<![CDATA[
53
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
54
+ //]]>
55
+ </script>
56
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getEstimateRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
57
+ </div>
58
+ </li>
59
+ <?php //endif; ?>
60
+ <?php if($this->getCityActive()): ?>
61
+ <li>
62
+ <label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
63
+ <div class="input-box">
64
+ <input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->htmlEscape($this->getEstimateCity()) ?>" />
65
+ </div>
66
+ </li>
67
+ <?php endif; ?>
68
+ <li>
69
+ <label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
70
+ <div class="input-box">
71
+ <input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->htmlEscape($this->getEstimatePostcode()) ?>" />
72
+ </div>
73
+ </li>
74
+ </ul>
75
+ <?php $showFreight = !$this->dontShowCommonFreight(); ?>
76
+ <?php if (( $showFreight && !$this->helper('wsafreightcommon')->isFixedDeliveryType()) || $this->helper('wsafreightcommon')->isResSelectorEnabled()): ?>
77
+ <p><label for="shipto_type"><?php echo $this->__('Address Type') ?> <?php echo $this->getShiptoTypeHtmlSelect($this->getShiptoType()) ?></label><br /></p>
78
+ <?php endif; ?>
79
+
80
+ <?php if ($showFreight): ?>
81
+ <?php if (!$this->helper('wsafreightcommon')->isFixedLiftgateFee()): ?>
82
+ <div class="a-left input-checkbox">
83
+ <input type="hidden" name="liftgate_required" value="0">
84
+ <input type="checkbox" name="liftgate_required" id="liftgate_required" value="1" <?php if ($this->getLiftgateRequired()):?> checked="checked"<?php endif;?> />
85
+ <label for="liftgate_required"><?php echo $this->__('Do you need a Liftgate?') ?></label>
86
+ </div>
87
+ <?php endif; ?>
88
+ <?php if ($this->helper('wsafreightcommon')->isNotifyOptionEnabled() && !$this->helper('wsafreightcommon')->isNotifyRequired()): ?>
89
+ <div class="a-left input-checkbox">
90
+ <input type="hidden" name="notify_required" value="0">
91
+ <input type="checkbox" name="notify_required" id="notify_required" value="1" <?php if ($this->getNotifyRequired()):?> checked="checked"<?php endif;?> />
92
+ <label for="notify_required"><?php echo $this->__('Scheduled Appointment?') ?></label>
93
+ </div>
94
+ <?php endif; ?>
95
+ <?php if ($this->helper('wsafreightcommon')->isInsideDeliveryEnabled()): ?>
96
+ <div class="a-left input-checkbox">
97
+ <input type="checkbox" name="inside_delivery" id="inside_delivery" value="1" <?php if ($this->getInsideDelivery()):?> checked="checked"<?php endif;?> />
98
+ <label for="inside_delivery"><?php echo $this->__('Inside Delivery?') ?></label>
99
+ </div>
100
+ <?php endif; ?>
101
+ <?php endif; ?>
102
+ <div class="buttons-set">
103
+ <button type="button" title="<?php echo $this->__('Get a Quote') ?>" onclick="coShippingMethodForm.submit()" class="button"><span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
104
+ </div>
105
+ </form>
106
+ <script type="text/javascript">
107
+ //<![CDATA[
108
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
109
+ //]]>
110
+ </script>
111
+
112
+ <?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
113
+ <form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
114
+ <dl class="sp-methods">
115
+ <?php foreach ($_shippingRateGroups as $code => $_rates): ?>
116
+ <dt><?php echo $this->getCarrierName($code) ?></dt>
117
+ <dd>
118
+ <ul>
119
+ <?php foreach ($_rates as $_rate): ?>
120
+ <li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
121
+ <?php if ($_rate->getErrorMessage()): ?>
122
+ <?php echo $_rate->getErrorMessage() ?>
123
+ <?php else: ?>
124
+ <input name="estimate_method" type="radio" value="<?php echo $this->htmlEscape($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
125
+ <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
126
+ <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
127
+ <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
128
+ <?php echo $_excl; ?>
129
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
130
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
131
+ <?php endif; ?>
132
+ </label>
133
+ <?php endif ?>
134
+ </li>
135
+ <?php endforeach; ?>
136
+ </ul>
137
+ </dd>
138
+ <?php endforeach; ?>
139
+ </dl>
140
+ <div class="buttons-set">
141
+ <button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do" value="<?php echo $this->__('Update Total') ?>"><span><span><?php echo $this->__('Update Total') ?></span></span></button>
142
+ </div>
143
+ </form>
144
+ <?php endif; ?>
145
+ <script type="text/javascript">
146
+ //<![CDATA[
147
+ var coShippingMethodForm = new VarienForm('shipping-zip-form');
148
+ var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
149
+
150
+ coShippingMethodForm.submit = function () {
151
+ var country = $F('country');
152
+ var optionalZip = false;
153
+
154
+ for (i=0; i < countriesWithOptionalZip.length; i++) {
155
+ if (countriesWithOptionalZip[i] == country) {
156
+ optionalZip = true;
157
+ }
158
+ }
159
+ if (optionalZip) {
160
+ $('postcode').removeClassName('required-entry');
161
+ }
162
+ else {
163
+ $('postcode').addClassName('required-entry');
164
+ }
165
+ return VarienForm.prototype.submit.bind(coShippingMethodForm)();
166
+ }
167
+ //]]>
168
+ </script>
169
+ </div>
170
+ </div>
app/design/frontend/base/default/template/webshopapps/wsafreightcommon/onepage/shippingextra.phtml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form id="co-shippingextra-form" action="">
28
+
29
+ <?php
30
+
31
+ $_options = array(
32
+ $this->__('Residential'),
33
+ $this->__('Business')
34
+ );
35
+
36
+ ?>
37
+ <div class="inner-box">
38
+ <?php if (!$this->helper('wsafreightcommon')->isFixedDeliveryType() && !$this->helper('wsafreightcommon')->isResSelectorEnabled()): ?>
39
+ <p><label for="shipto_type"><?php echo $this->__('Address Type') ?> <?php echo $this->getShiptoTypeHtmlSelect($this->getShiptoType()) ?></label><br /></p>
40
+ <?php endif; ?>
41
+ <?php if ($this->helper('wsafreightcommon')->isNotifyOptionEnabled() && !$this->helper('wsafreightcommon')->isNotifyRequired()): ?>
42
+ <div class="a-left input-checkbox">
43
+ <input type="checkbox" name="allow_notify" id="allow_notify" value="1" <?php if ($this->getNotifyRequired()):?> checked="checked"<?php endif;?> />
44
+ <label for="allow_notify"><?php echo $this->__('Scheduled Appointment?') ?></label>
45
+ </div>
46
+ <?php endif; ?>
47
+ <?php if ($this->helper('wsafreightcommon')->isInsideDeliveryEnabled()): ?>
48
+ <div class="a-left input-checkbox">
49
+ <input type="checkbox" name="inside_delivery" id="inside_delivery" value="1" <?php if ($this->getInsideDelivery()):?> checked="checked"<?php endif;?> />
50
+ <label for="inside_delivery"><?php echo $this->__('Inside Delivery?') ?></label>
51
+ </div>
52
+ <?php endif; ?>
53
+ <?php if (!$this->helper('wsafreightcommon')->isFixedLiftgateFee()): ?>
54
+ <div class="a-left input-checkbox">
55
+ <input type="checkbox" name="liftgate_required" id="liftgate_required" value="1" <?php if ($this->getLiftgateRequired()):?> checked="checked"<?php endif; ?> />
56
+ <label for="liftgate_required"><?php echo $this->__('Do you need a Liftgate?') ?></label>
57
+ </div>
58
+ <?php endif; ?>
59
+ </div>
60
+ <br/>
61
+ <?php
62
+ if (Mage::helper('wsacommon')->isEnterpriseEdition()) {
63
+ ?>
64
+ <div class="buttons-set" id="shippingextra-buttons-container">
65
+ <a href="#" onclick="checkout.back(); return false;" class="back left"><?php echo $this->__('Back') ?></a>
66
+ <button type="button" class="button" onclick="shippingextra.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
67
+ <span id="shippingextra-please-wait" class="please-wait" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="" class="v-middle" /> <?php echo $this->__('Loading next step...') ?></span>
68
+ </div>
69
+ <?php } else {
70
+ ?>
71
+ <div class="buttons-set" id="shippingextra-buttons-container">
72
+ <a href="#" onclick="checkout.back(); return false;" class="back left"><?php echo $this->__('Back') ?></a>
73
+ <button type="button" class="button" onclick="shippingextra.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
74
+ <span id="shippingextra-please-wait" style="display:none;" class="opc-please-wait">
75
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt="" /> &nbsp; <?php echo $this->__('Loading next step...') ?> &nbsp;
76
+ </span>
77
+ </div>
78
+ <?php } ?>
79
+ </form>
80
+ <script type="text/javascript">
81
+ //<![CDATA[
82
+
83
+ var ShippingExtra = Class.create();
84
+ ShippingExtra.prototype = {
85
+ initialize: function(form, saveUrl){
86
+ this.form = form;
87
+ if ($(this.form)) {
88
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
89
+ }
90
+ this.saveUrl = saveUrl;
91
+ this.onSave = this.nextStep.bindAsEventListener(this);
92
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
93
+ },
94
+
95
+ save: function(){
96
+ if (checkout.loadWaiting!=false) return;
97
+
98
+ var validator = new Validation(this.form);
99
+ if (validator.validate()) {
100
+
101
+ checkout.setLoadWaiting('shippingextra');
102
+
103
+
104
+ var request = new Ajax.Request(
105
+ this.saveUrl,
106
+ {
107
+ method: 'post',
108
+ onComplete: this.onComplete,
109
+ onSuccess: this.onSave,
110
+ onFailure: checkout.ajaxFailure.bind(checkout),
111
+ parameters: Form.serialize(this.form)
112
+ }
113
+ );
114
+ }
115
+ },
116
+
117
+ resetLoadWaiting: function(transport){
118
+ checkout.setLoadWaiting(false);
119
+ },
120
+
121
+ nextStep: function(transport){
122
+ if (transport && transport.responseText){
123
+ try{
124
+ response = eval('(' + transport.responseText + ')');
125
+ }
126
+ catch (e) {
127
+ response = {};
128
+ }
129
+ }
130
+
131
+ if (response.error){
132
+ if ((typeof response.message) == 'string') {
133
+ alert(response.message);
134
+ } else {
135
+ if (window.billingRegionUpdater) {
136
+ billingRegionUpdater.update();
137
+ }
138
+
139
+ alert(response.message.join("\n"));
140
+ }
141
+
142
+ return false;
143
+ }
144
+
145
+ checkout.setStepResponse(response);
146
+ }
147
+ }
148
+
149
+ var shippingextra = new ShippingExtra('co-shippingextra-form', "<?php echo $this->getUrl('checkout/onepage/saveShippingExtra') ?>");
150
+ //]]>
151
+
152
+ </script>
app/etc/modules/Webshopapps_Cerasisfreight.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webshopapps_Cerasisfreight>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Webshopapps_Cerasisfreight>
8
+ </modules>
9
+ </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_Wsafreightcommon.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webshopapps_Wsafreightcommon>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Shipping />
9
+ <Webshopapps_Wsacommon />
10
+ </depends>
11
+ </Webshopapps_Wsafreightcommon>
12
+ </modules>
13
+
14
+ </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 data.extension}}
4
+ <br/>
5
+ Severity: {{var data.severity}}
6
+ <br/>
7
+ Title: {{var data.title}}
8
+ <br/>
9
+ Description:
10
+ <br/>
11
+ {{var data.description}}
12
+
13
+
14
+
15
+ </div>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>WebShopApps_Cerasis</name>
4
+ <version>1.4.1</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>Our Cerasis Freight extension retrieves freight rates via the Cerasis service</summary>
10
+ <description>Our Cerasis Freight extension retrieves freight rates via the Cerasis service. Carriers include: FedEx, DHL, YRC, Con-Way, R&amp;L, Holland, Estes and many more. With the option to offer freight shipping only when an item marked as freight is in the cart, or if a pre-defined weight limit is exceeded, this extension is ideal if you sell a mix of freight and non-freight items.</description>
11
+ <notes>Abstracted methods in preparation for book shipment and tracking logic</notes>
12
+ <authors><author><name>Karen Baker</name><user>birches</user><email>sales@webshopapps.com</email></author></authors>
13
+ <date>2013-06-14</date>
14
+ <time>10:25:22</time>
15
+ <contents><target name="magecommunity"><dir name="Webshopapps"><dir name="Cerasisfreight"><dir name="Helper"><file name="Data.php" hash="d5dde1542c975e605038c5a00edad9cd"/></dir><file name="LICENSE.pdf" hash="aff2ebfbef29983464ee0e672d90a787"/><dir name="Model"><dir name="Carrier"><dir name="Cerasisfreight"><dir name="Source"><file name="Billingtype.php" hash="b5c07eb9ae091e177351701edb26af80"/><file name="Freemethod.php" hash="9de31dfc348e277e51ed6d3111338aef"/><file name="Method.php" hash="31460724f02632c6736f1b40b17195a5"/></dir></dir><file name="Cerasisfreight.php" hash="dc441295b26812df97884e8b0be364fd"/></dir></dir><file name="changelog.txt" hash="41c418d3d4829cdc35ab15236b46478e"/><dir name="etc"><file name="config.xml" hash="3d7f87432e0d34215a56aaff05272dbc"/><file name="system.xml" hash="53437dfe6d22bd50f47ccacea3a2b7bb"/></dir><dir name="sql"><dir name="cerasisfreight_setup"><file name="mysql4-install-0.0.1.php" hash="bea03a43034211bf48536d44a853d53e"/></dir></dir><file name="versions_supported.txt" hash="a3e69dd4d9f892aab0dcbf0a5dd246e2"/></dir><dir name="Wsacommon"><dir name="Block"><dir name="Adminhtml"><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="Data.php" hash="9d64f6fabd72e731adb9802aee2d03d9"/><file name="Log.php" hash="7358a374220be363c383bb9ea14f972e"/><file name="Shipping.php" hash="b33a99098c69f05f97b3f297873226d8"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><dir name="Export"><file name="Csv.php" hash="ef14a0139fda1251cff3955485f4e6cd"/></dir><dir name="Resource"><file name="Resource.php" hash="cfa41489dc5b8d5f29e92c87361a40df"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Abstract.php" hash="4fafb21a7a52a4286fe6d3906e9f9b9e"/><file name="Baseabstract.php" hash="3ae8a90eb5fda7d4e8c52814f5284bb3"/></dir><file name="Shipping.php" hash="2cead391d4f47e7c7fba76fcad25e251"/></dir></dir><file name="changelog.txt" hash="71f6178dd143a42a4bc40627fed94f42"/><dir name="controllers"><dir name="System"><file name="ConfigController.php" hash="4f59fd0565f628d65a1b950cc6a77a91"/></dir></dir><dir name="etc"><file name="config.xml" hash="47eeeb7cce2dd055f17c738352101444"/></dir></dir><dir name="Wsafreightcommon"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><file name="Freightinfo.php" hash="f783ff522eb07cebd18ee153783e7535"/></dir></dir></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Shipping.php" hash="9250cac06648e818a875a6024d8c439d"/></dir></dir><dir name="Onepage"><file name="Progress.php" hash="7d0ea064fc08a6feb0b970e0156ae1d8"/><file name="Shippingextra.php" hash="c8343246729b0aea553156eb41be7478"/></dir><file name="Onepage.php" hash="d13bc7fda1690b7145aa985ab2658dca"/></dir><dir name="Helper"><file name="Data.php" hash="e9cdf19b7a62ec8782996e9173f5b0a8"/></dir><file name="LICENSE.pdf" hash="aff2ebfbef29983464ee0e672d90a787"/><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="e6633aa86f1587ad882c4859d0d480d1"/><file name="Freefreight.php" hash="71cc40df066d90d33247d814e9cedefb"/></dir><file name="Observer.php" hash="8e24a784afcdc1d2807f6305af2b0a5d"/><dir name="Quote"><dir name="Address"><file name="Rate.php" hash="8b5f96bad1539bafc74af3d39e656380"/><dir name="Total"><file name="Shipping.php" hash="2f6c22a29f9b1661da0abfabeb686b6b"/></dir></dir></dir><dir name="Shipping"><file name="Shipping.php" hash="1bac7cd01c74162f351b436bbdb8939e"/></dir><dir name="Source"><file name="Carriers.php" hash="f43b4205848b0e5d5be2a697eafd7bb1"/></dir><dir name="Type"><file name="Onepage.php" hash="4bf65dacc3612467d76797e23029cddc"/></dir></dir><file name="changelog.txt" hash="f00ee15fc6dfffc2947ac36afb1f41a4"/><dir name="controllers"><dir name="Checkout"><file name="OnepageController.php" hash="205fb6d92086560043c689df7a4620a4"/></dir></dir><dir name="etc"><file name="config.xml" hash="6f54a6c61c100233bf50fb4f196696f6"/><file name="system.xml" hash="cecad63015903309f2253018776b4b79"/></dir><dir name="sql"><dir name="wsafreightcommon_setup"><file name="mysql4-install-0.0.1.php" hash="c6ece71ffa882495e9b564493e0dd14b"/><file name="mysql4-install-0.0.3.php" hash="127d49999f00542eaf9dd26472a299d9"/><file name="mysql4-install-0.0.4.php" hash="f2e1ba514a7b19339b5831552778e367"/><file name="mysql4-install-0.0.5.php" hash="f2e1ba514a7b19339b5831552778e367"/><file name="mysql4-install-0.0.6.php" hash="d5c82669c474d841b40b5ba2f7007712"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="f9d072bb1523f9633be8f480d0891326"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="1aea5db4e00271869a705f1261844857"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="ab8438ea207135f7bf31be9061828a56"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="929423a1b058b09f9ab65a242ac8ba53"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="f1316626f1642a50a90a09d32db1ffc1"/></dir></dir><file name="versions_supported.txt" hash="cead91e60ad25ad4e9637be402939797"/></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="5964a1e9de3a3a382f7fcc94072a3ead"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="54e11dd5b9bf6a6716e15ddb7a0682cc"/><file name="Log.php" hash="c8d7ad4ad387aa4dbfda8b787152ce52"/></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="6132121f75593118f383521cc6c4f9c4"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Severities.php" hash="b0f96c4ebe133ae8dbdd762a5947ff6f"/></dir></dir></dir></dir><file name="changelog.txt" hash="de2baa423b0d6af185a17cdd7e0cba54"/><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="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="webshopapps_log_email.html" hash="d4978604c26b0703fa290be175775dd9"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="webshopapps_wsafreightcommon.xml" hash="5cd84707f5b16e461e6fec3eaaa0a891"/><file name="webshopapps_wsalogger.xml" hash="804b47419205e7a73b02ca72cdbd3213"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="webshopapps_wsafreightcommon.xml" hash="da6a7b20e5dc5ab844c8a788440754ad"/></dir><dir name="template"><dir name="webshopapps"><dir name="wsafreightcommon"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="07ac60f9227d798d2c7c4f12081595d6"/></dir></dir><dir name="onepage"><file name="shippingextra.phtml" hash="93f510f4330f02f7cd7e4905b23c331f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Webshopapps_Cerasisfreight.xml" hash="7e976c7fda51b59d854dabdb45be6803"/><file name="Webshopapps_Wsacommon.xml" hash="384a3ae94b83d7bccb3c96e0bb2d270f"/><file name="Webshopapps_Wsafreightcommon.xml" hash="0ea712a90f20eea60691742038baab45"/><file name="Webshopapps_Wsalogger.xml" hash="199d449ef7cf012fcfc32357de430cfd"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>