Version Notes
-
Download this release
Release Info
Developer | Mr. Shiphawk |
Extension | ShipHawk |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.9 to 2.0.0
- app/code/community/Shiphawk/MyCarrier/Model/Carrier.php +111 -0
- app/code/community/Shiphawk/MyCarrier/etc/config.xml +49 -0
- app/code/community/Shiphawk/MyCarrier/etc/system.xml +98 -0
- app/code/community/Shiphawk/Order/Block/System/Link.php +9 -0
- app/code/community/Shiphawk/Order/Helper/Data.php +4 -0
- app/code/community/Shiphawk/Order/Model/Command/ChangeStatus.php +31 -0
- app/code/community/Shiphawk/Order/Model/Command/CheckConfiguration.php +23 -0
- app/code/community/Shiphawk/Order/Model/Command/SendOrder.php +106 -0
- app/code/community/Shiphawk/Order/Model/Cron/ProcessOrderForLast14Days.php +26 -0
- app/code/community/Shiphawk/Order/Model/Observer/Config.php +9 -0
- app/code/community/Shiphawk/Order/Model/Observer/Order.php +22 -0
- app/code/community/Shiphawk/Order/Model/Source/Gateway.php +13 -0
- app/code/community/Shiphawk/Order/Model/StatusMapper.php +18 -0
- app/code/community/Shiphawk/Order/etc/config.xml +105 -0
- app/code/community/Shiphawk/Order/etc/system.xml +68 -0
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins.php +0 -12
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins/Edit.php +0 -27
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins/Edit/Form.php +0 -140
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins/Grid.php +0 -97
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/Sales/Order/Shipment/View.php +0 -20
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/Sales/Order/View.php +0 -45
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/Shipment.php +0 -599
- app/code/community/Shiphawk/Shipping/Block/Adminhtml/System/Config/Form/Button.php +0 -50
- app/code/community/Shiphawk/Shipping/Block/Catalog/Product/Helper/Form/Disabled.php +0 -14
- app/code/community/Shiphawk/Shipping/Block/Catalog/Product/Helper/Form/Type.php +0 -64
- app/code/community/Shiphawk/Shipping/Block/Shipping/Tracking/Popup.php +0 -10
- app/code/community/Shiphawk/Shipping/Block/Version.php +0 -14
- app/code/community/Shiphawk/Shipping/Helper/Data.php +0 -479
- app/code/community/Shiphawk/Shipping/Helper/Origin.php +0 -76
- app/code/community/Shiphawk/Shipping/Model/Api.php +0 -592
- app/code/community/Shiphawk/Shipping/Model/Carrier.php +0 -1021
- app/code/community/Shiphawk/Shipping/Model/Observer.php +0 -351
- app/code/community/Shiphawk/Shipping/Model/Origins.php +0 -9
- app/code/community/Shiphawk/Shipping/Model/Product/Attribute/Source/Location.php +0 -25
- app/code/community/Shiphawk/Shipping/Model/Resource/Origins.php +0 -8
- app/code/community/Shiphawk/Shipping/Model/Resource/Origins/Collection.php +0 -8
- app/code/community/Shiphawk/Shipping/Model/Source/Adminratefilter.php +0 -11
- app/code/community/Shiphawk/Shipping/Model/Source/Carriertype.php +0 -15
- app/code/community/Shiphawk/Shipping/Model/Source/Freeshipping.php +0 -12
- app/code/community/Shiphawk/Shipping/Model/Source/Gateway.php +0 -11
- app/code/community/Shiphawk/Shipping/Model/Source/Location.php +0 -11
- app/code/community/Shiphawk/Shipping/Model/Source/Ratefilter.php +0 -15
- app/code/community/Shiphawk/Shipping/Model/Source/Received.php +0 -11
- app/code/community/Shiphawk/Shipping/controllers/Adminhtml/ImportController.php +0 -87
- app/code/community/Shiphawk/Shipping/controllers/Adminhtml/OriginsController.php +0 -133
- app/code/community/Shiphawk/Shipping/controllers/Adminhtml/ShipmentController.php +0 -331
- app/code/community/Shiphawk/Shipping/controllers/IndexController.php +0 -210
- app/code/community/Shiphawk/Shipping/etc/adminhtml.xml +0 -16
- app/code/community/Shiphawk/Shipping/etc/config.xml +0 -237
- app/code/community/Shiphawk/Shipping/etc/system.xml +0 -359
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-install-0.1.0.php +0 -269
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-0.7.0-0.7.1.php +0 -9
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.0-1.0.1.php +0 -21
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.1-1.0.2.php +0 -27
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.10-1.0.11.php +0 -43
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.11-1.0.12.php +0 -10
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.12-1.0.13.php +0 -10
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.13-1.1.0.php +0 -41
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.2-1.0.3.php +0 -21
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.4-1.0.5.php +0 -9
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.5-1.0.6.php +0 -19
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.6-1.0.7.php +0 -7
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.7-1.0.8.php +0 -7
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.8-1.0.9.php +0 -9
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.9-1.0.10.php +0 -10
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.0-1.1.1.php +0 -32
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.3-1.1.4.php +0 -33
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.4-1.1.5.php +0 -19
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.5.1-1.1.5.3.php +0 -44
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.5.3-1.1.6.php +0 -8
- app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.7-1.1.8.php +0 -49
- app/design/adminhtml/default/default/layout/shiphawk.xml +0 -127
- app/design/adminhtml/default/default/template/shiphawk/amount.phtml +0 -287
- app/design/adminhtml/default/default/template/shiphawk/button.phtml +0 -24
- app/design/adminhtml/default/default/template/shiphawk/shiphawkjsfile.phtml +0 -8
- app/design/adminhtml/default/default/template/shiphawk/shipment.phtml +0 -137
- app/design/adminhtml/default/default/template/shiphawk/shipping/form.phtml +0 -193
- app/design/adminhtml/default/default/template/shiphawk/shipping/method/form.phtml +0 -268
- app/design/frontend/base/default/layout/shiphawk.xml +0 -61
- app/design/frontend/base/default/template/shiphawk/checkout/onepage/billing.phtml +0 -227
- app/design/frontend/base/default/template/shiphawk/checkout/onepage/progress/billing.phtml +0 -44
- app/design/frontend/base/default/template/shiphawk/checkout/onepage/progress/shipping.phtml +0 -48
- app/design/frontend/base/default/template/shiphawk/checkout/onepage/progress/shipping_method.phtml +0 -74
- app/design/frontend/base/default/template/shiphawk/checkout/onepage/review/totals.phtml +0 -70
- app/design/frontend/base/default/template/shiphawk/checkout/onepage/shipping.phtml +0 -167
- app/design/frontend/base/default/template/shiphawk/checkout/onepage/shipping_method/available.phtml +0 -157
- app/design/frontend/base/default/template/shiphawk/popup.phtml +0 -244
- app/etc/modules/Shiphawk_Shipping.xml +0 -12
- app/locale/en_US/template/email/shiphawk_error_email.html +0 -21
- js/shiphawk/shiphawk.css +0 -41
- js/shiphawk/shiphawk.js +0 -171
- js/shiphawk/shiphawk_order.js +0 -6
- js/shiphawk/shiphawk_shipment.js +0 -50
- package.xml +11 -29
- skin/frontend/base/default/shiphawk/css/sh-style.css +0 -19
app/code/community/Shiphawk/MyCarrier/Model/Carrier.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ShipHawk_MyCarrier_Model_Carrier
|
3 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
4 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
5 |
+
{
|
6 |
+
protected $_code = 'shiphawk_mycarrier';
|
7 |
+
|
8 |
+
public function collectRates( Mage_Shipping_Model_Rate_Request $request )
|
9 |
+
{
|
10 |
+
$result = Mage::getModel('shipping/rate_result');
|
11 |
+
/* @var $result Mage_Shipping_Model_Rate_Result */
|
12 |
+
|
13 |
+
$items = $this->getItems($request);
|
14 |
+
$rateRequest = array(
|
15 |
+
'items' => $items,
|
16 |
+
'origin_address'=> array(
|
17 |
+
'zip'=>Mage::getStoreConfig('shipping/origin/postcode')
|
18 |
+
),
|
19 |
+
'destination_address'=> array(
|
20 |
+
'zip'=>$to_zip = $request->getDestPostcode()
|
21 |
+
),
|
22 |
+
'apply_rules'=>'true'
|
23 |
+
);
|
24 |
+
|
25 |
+
Mage::log($rateRequest);
|
26 |
+
|
27 |
+
$rateResponse = $this->getRates($rateRequest);
|
28 |
+
|
29 |
+
Mage::log($rateResponse);
|
30 |
+
|
31 |
+
if($rateResponse && $rateResponse->isSuccessful())
|
32 |
+
{
|
33 |
+
$rateArray = json_decode($rateResponse->getBody());
|
34 |
+
Mage::log($rateArray);
|
35 |
+
}
|
36 |
+
|
37 |
+
Mage::getSingleton('core/session')->setSHRateAarray($rateArray->rates);
|
38 |
+
foreach($rateArray->rates as $rateRow)
|
39 |
+
{
|
40 |
+
$result->append($this->_buildRate($rateRow));
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
return $result;
|
45 |
+
}
|
46 |
+
|
47 |
+
protected function _buildRate($shRate)
|
48 |
+
{
|
49 |
+
Mage::log('processing rate');
|
50 |
+
Mage::log($shRate);
|
51 |
+
$rate = Mage::getModel('shipping/rate_result_method');
|
52 |
+
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
53 |
+
|
54 |
+
$rate->setCarrier($this->_code);
|
55 |
+
/**
|
56 |
+
* getConfigData(config_key) returns the configuration value for the
|
57 |
+
* carriers/[carrier_code]/[config_key]
|
58 |
+
*/
|
59 |
+
$rate->setCarrierTitle($shRate->carrier);
|
60 |
+
|
61 |
+
$rate->setMethod($shRate->carrier. '-' . $shRate->service_level);
|
62 |
+
$rate->setMethodTitle($shRate->service_level);
|
63 |
+
|
64 |
+
$rate->setPrice($shRate->price);
|
65 |
+
$rate->setCost($shRate->price);
|
66 |
+
|
67 |
+
return $rate;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getRates($rateRequest)
|
71 |
+
{
|
72 |
+
$url = Mage::getStoreConfig('shiphawk/order/gateway_url');
|
73 |
+
$key = Mage::getStoreConfig('shiphawk/order/api_key');
|
74 |
+
|
75 |
+
$jsonRateRequest = json_encode($rateRequest);
|
76 |
+
|
77 |
+
$client = new Zend_Http_Client($url . 'rates?api_key=' . $key);
|
78 |
+
|
79 |
+
Mage::log($jsonRateRequest, Zend_Log::INFO, 'shiphawk_rates.log', true);
|
80 |
+
|
81 |
+
$client->setRawData($jsonRateRequest, 'application/json');
|
82 |
+
try {
|
83 |
+
$response = $client->request(Zend_Http_Client::POST);
|
84 |
+
Mage::log('ShipHawk Response: ' . var_export($response, true), Zend_Log::INFO, 'shiphawk_rates.log', true);
|
85 |
+
|
86 |
+
return $response;
|
87 |
+
} catch (Exception $e) {
|
88 |
+
Mage::logException($e);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
public function getItems($request)
|
93 |
+
{
|
94 |
+
$items = array();
|
95 |
+
foreach ($request->getAllItems() as $item) {
|
96 |
+
$items[] = array(
|
97 |
+
'product_sku' => $item->getSku()
|
98 |
+
);
|
99 |
+
}
|
100 |
+
|
101 |
+
Mage::log($items);
|
102 |
+
|
103 |
+
return $items;
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
public function getAllowedMethods()
|
108 |
+
{
|
109 |
+
return array();
|
110 |
+
}
|
111 |
+
}
|
app/code/community/Shiphawk/MyCarrier/etc/config.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Shiphawk_MyCarrier>
|
5 |
+
<module>2.0.0</module>
|
6 |
+
</Shiphawk_MyCarrier>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<shiphawk_mycarrier>
|
11 |
+
<class>Shiphawk_MyCarrier_Model</class>
|
12 |
+
</shiphawk_mycarrier>
|
13 |
+
</models>
|
14 |
+
</global>
|
15 |
+
<!-- Default configuration -->
|
16 |
+
<default>
|
17 |
+
<carriers>
|
18 |
+
<shiphawk_mycarrier>
|
19 |
+
<active>1</active>
|
20 |
+
<!--
|
21 |
+
This configuration should not be made visible
|
22 |
+
to the administrator, because it specifies
|
23 |
+
the model to be used for this carrier.
|
24 |
+
-->
|
25 |
+
<model>shiphawk_mycarrier/carrier</model>
|
26 |
+
<!--
|
27 |
+
The title as referenced in the carrier class
|
28 |
+
-->
|
29 |
+
<title>ShipHawk</title>
|
30 |
+
<!--
|
31 |
+
The sort order specifies the position that
|
32 |
+
this carrier appears relative to the other
|
33 |
+
carriers available in checkout.
|
34 |
+
-->
|
35 |
+
<sort_order>1</sort_order>
|
36 |
+
<!--
|
37 |
+
Out of the box, Magento offers shipping
|
38 |
+
carriers the ability to restrict themselves
|
39 |
+
to specific countries. For this configuration
|
40 |
+
option, 0 means allow all countries available,
|
41 |
+
and 1 means allow all countries specified
|
42 |
+
in the country list that we will add later
|
43 |
+
in system.xml
|
44 |
+
-->
|
45 |
+
<sallowspecific>0</sallowspecific>
|
46 |
+
</shiphawk_mycarrier>
|
47 |
+
</carriers>
|
48 |
+
</default>
|
49 |
+
</config>
|
app/code/community/Shiphawk/MyCarrier/etc/system.xml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers translate="label" module="shipping">
|
5 |
+
<groups>
|
6 |
+
<shiphawk_mycarrier translate="label">
|
7 |
+
<label>ShipHawk</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>2</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<!--
|
15 |
+
The following fields are available
|
16 |
+
to modify in the admin panel.
|
17 |
+
The values are saved in the
|
18 |
+
database.
|
19 |
+
|
20 |
+
This shipping carrier abstract checks
|
21 |
+
this value to determine whether
|
22 |
+
the carrier should be shown.
|
23 |
+
-->
|
24 |
+
<active translate="label">
|
25 |
+
<label>Enabled</label>
|
26 |
+
<frontend_type>select</frontend_type>
|
27 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
28 |
+
<sort_order>1</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>0</show_in_store>
|
32 |
+
</active>
|
33 |
+
<!--
|
34 |
+
This value can be used to specify a
|
35 |
+
custom title for our method.
|
36 |
+
-->
|
37 |
+
<title translate="label">
|
38 |
+
<label>Title</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>2</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</title>
|
45 |
+
<!--
|
46 |
+
The sort order is used in Magento
|
47 |
+
to determine what order the carrier
|
48 |
+
will appear in relative to the
|
49 |
+
other carriers available.
|
50 |
+
-->
|
51 |
+
<sort_order translate="label">
|
52 |
+
<label>Sort Order</label>
|
53 |
+
<frontend_type>text</frontend_type>
|
54 |
+
<sort_order>100</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>0</show_in_store>
|
58 |
+
</sort_order>
|
59 |
+
<!--
|
60 |
+
This value is used to specify whether
|
61 |
+
the carrier is available only for
|
62 |
+
specific countries or all countries
|
63 |
+
available in the current Magento
|
64 |
+
installation.
|
65 |
+
-->
|
66 |
+
<sallowspecific translate="label">
|
67 |
+
<label>Applicable Destination Countries</label>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<sort_order>90</sort_order>
|
70 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
71 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>0</show_in_store>
|
75 |
+
</sallowspecific>
|
76 |
+
<!--
|
77 |
+
If 'specific countries' is chosen
|
78 |
+
in the previous option, then this field
|
79 |
+
allows the administrator to specify
|
80 |
+
which specific countries this carrier
|
81 |
+
should be available for.
|
82 |
+
-->
|
83 |
+
<specificcountry translate="label">
|
84 |
+
<label>Specific Destination Countries</label>
|
85 |
+
<frontend_type>multiselect</frontend_type>
|
86 |
+
<sort_order>91</sort_order>
|
87 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>0</show_in_store>
|
91 |
+
<can_be_empty>1</can_be_empty>
|
92 |
+
</specificcountry>
|
93 |
+
</fields>
|
94 |
+
</shiphawk_mycarrier>
|
95 |
+
</groups>
|
96 |
+
</carriers>
|
97 |
+
</sections>
|
98 |
+
</config>
|
app/code/community/Shiphawk/Order/Block/System/Link.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Block_System_Link extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
return "<a target=\"_blank\" href=\"{$element->getOriginalData('link')}\">{$element->getLabel()}</a>";
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Shiphawk/Order/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{}
|
app/code/community/Shiphawk/Order/Model/Command/ChangeStatus.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_Command_ChangeStatus
|
4 |
+
{
|
5 |
+
public function execute(Mage_Sales_Model_Order $order)
|
6 |
+
{
|
7 |
+
$url = Mage::getStoreConfig('shiphawk/order/gateway_url');
|
8 |
+
$key = Mage::getStoreConfig('shiphawk/order/api_key');
|
9 |
+
|
10 |
+
$client = new Zend_Http_Client($url . 'orders/' . $order->getIncrementId() . '/cancelled?api_key=' . $key);
|
11 |
+
|
12 |
+
$orderRequest = json_encode(
|
13 |
+
array(
|
14 |
+
'source_system' => 'magento',
|
15 |
+
'source_system_id' => $order->getEntityId(),
|
16 |
+
'source_system_processed_at' => '',
|
17 |
+
'canceled_at' => $order->getUpdatedAt(),
|
18 |
+
'status' => Mage::getSingleton('shiphawk_order/statusMapper')->map($order->getStatus()),
|
19 |
+
)
|
20 |
+
);
|
21 |
+
|
22 |
+
Mage::log('ShipHawk Request: ' . $client->getUri(true) . $orderRequest, Zend_Log::INFO, 'shiphawk_order.log', true);
|
23 |
+
$client->setRawData($orderRequest, 'application/json');
|
24 |
+
try {
|
25 |
+
$response = $client->request(Zend_Http_Client::POST);
|
26 |
+
Mage::log('ShipHawk Response: ' . var_export($response, true), Zend_Log::INFO, 'shiphawk_order.log', true);
|
27 |
+
} catch (Exception $e) {
|
28 |
+
Mage::logException($e);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Shiphawk/Order/Model/Command/CheckConfiguration.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_Command_CheckConfiguration
|
4 |
+
{
|
5 |
+
public function execute()
|
6 |
+
{
|
7 |
+
$url = Mage::getStoreConfig('shiphawk/order/gateway_url');
|
8 |
+
$key = Mage::getStoreConfig('shiphawk/order/api_key');
|
9 |
+
$client = new Zend_Http_Client($url . 'user?api_key=' . $key);
|
10 |
+
|
11 |
+
$response = $client->request(Zend_Http_Client::GET);
|
12 |
+
|
13 |
+
if ($response->isSuccessful()) {
|
14 |
+
Mage::getSingleton('adminhtml/session')
|
15 |
+
->addSuccess(Mage::helper('shiphawk_order')->__('Your account successfully linked.'));
|
16 |
+
Mage::getConfig()->saveConfig('shiphawk/order/status', 1);
|
17 |
+
} else {
|
18 |
+
Mage::getSingleton('adminhtml/session')
|
19 |
+
->addError(Mage::helper('shiphawk_order')->__('Unable to authenticate API key.'));
|
20 |
+
Mage::getConfig()->saveConfig('shiphawk/order/status', 0);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Shiphawk/Order/Model/Command/SendOrder.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_Command_SendOrder
|
4 |
+
{
|
5 |
+
public function execute(Mage_Sales_Model_Order $order)
|
6 |
+
{
|
7 |
+
Mage::log('building order object for Shiphawk');
|
8 |
+
$url = Mage::getStoreConfig('shiphawk/order/gateway_url');
|
9 |
+
$key = Mage::getStoreConfig('shiphawk/order/api_key');
|
10 |
+
$client = new Zend_Http_Client($url . 'orders?api_key=' . $key);
|
11 |
+
|
12 |
+
$itemsRequest = [];
|
13 |
+
$shippingRateId = '';
|
14 |
+
|
15 |
+
Mage::log('rates array:...');
|
16 |
+
Mage::log(Mage::getSingleton('core/session')->getSHRateAarray());
|
17 |
+
|
18 |
+
$SHRates = Mage::getSingleton('core/session')->getSHRateAarray();
|
19 |
+
foreach($SHRates as $rateRow){
|
20 |
+
if(($rateRow->carrier . ' - ' . $rateRow->service_level) == $order->getShippingDescription()){
|
21 |
+
$shippingRateId = $rateRow->id;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
foreach ($order->getAllItems() as $item) {
|
27 |
+
/** @var Mage_Sales_Model_Order_Item $item */
|
28 |
+
$itemsRequest[] = array(
|
29 |
+
'source_system_id' => $item->getProductId(),
|
30 |
+
'name' => $item->getName(),
|
31 |
+
'sku' => $item->getSku(),
|
32 |
+
'quantity' => $item->getQtyOrdered(),
|
33 |
+
'price' => $item->getPrice(),
|
34 |
+
'length' => $item->getLength(),
|
35 |
+
'width' => $item->getWidth(),
|
36 |
+
'height' => $item->getHeight(),
|
37 |
+
'weight' => $item->getWeight(),
|
38 |
+
'item_type' => $item->getProductType(),
|
39 |
+
'unpacked_item_type_id' => 0,
|
40 |
+
'handling_unit_type' => '',
|
41 |
+
'hs_code' => '',
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
$orderRequest = json_encode(
|
46 |
+
array(
|
47 |
+
'order_number' => $order->getIncrementId(),
|
48 |
+
'source_system' => 'magento',
|
49 |
+
'source_system_id' => $order->getEntityId(),
|
50 |
+
'source_system_processed_at' => '',
|
51 |
+
'rate_uuid' => $shippingRateId,
|
52 |
+
'requested_shipping_details'=> $order->getShippingDescription(),
|
53 |
+
'origin_address' => $this->getOriginAddress(),
|
54 |
+
'destination_address' => $this->prepareAddress($order->getShippingAddress()),
|
55 |
+
'order_line_items' => $itemsRequest,
|
56 |
+
'total_price' => $order->getGrandTotal(),
|
57 |
+
'shipping_price' => $order->getShippingAmount(),
|
58 |
+
'tax_price' => $order->getTaxAmount(),
|
59 |
+
'items_price' => $order->getSubtotal(),
|
60 |
+
'status' => Mage::getSingleton('shiphawk_order/statusMapper')->map($order->getStatus()),
|
61 |
+
)
|
62 |
+
);
|
63 |
+
|
64 |
+
Mage::log('ShipHawk Request: ' . $orderRequest, Zend_Log::INFO, 'shiphawk_order.log', true);
|
65 |
+
$client->setRawData($orderRequest, 'application/json');
|
66 |
+
try {
|
67 |
+
$response = $client->request(Zend_Http_Client::POST);
|
68 |
+
Mage::log('ShipHawk Response: ' . var_export($response, true), Zend_Log::INFO, 'shiphawk_order.log', true);
|
69 |
+
} catch (Exception $e) {
|
70 |
+
Mage::logException($e);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
protected function prepareAddress(Mage_Sales_Model_Order_Address $address)
|
75 |
+
{
|
76 |
+
return array(
|
77 |
+
'name' => $address->getFirstname() . ' '
|
78 |
+
. $address->getMiddlename() . ' '
|
79 |
+
. $address->getLastname(),
|
80 |
+
'company' => $address->getCompany(),
|
81 |
+
'street1' => $address->getStreet1(),
|
82 |
+
'street2' => $address->getStreet2(),
|
83 |
+
'phone_number' => $address->getTelephone(),
|
84 |
+
'city' => $address->getCity(),
|
85 |
+
'state' => $address->getRegionCode(),
|
86 |
+
'country' => $address->getCountryId(),
|
87 |
+
'zip' => $address->getPostcode(),
|
88 |
+
'email' => $address->getEmail(),
|
89 |
+
'code' => $address->getAddressType(),
|
90 |
+
);
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function getOriginAddress()
|
94 |
+
{
|
95 |
+
return array(
|
96 |
+
'street1' => Mage::getStoreConfig('shipping/origin/street_line1'),
|
97 |
+
'street2' => Mage::getStoreConfig('shipping/origin/street_line2'),
|
98 |
+
'city' => Mage::getStoreConfig('shipping/origin/city'),
|
99 |
+
'state' => Mage::getModel('directory/region')
|
100 |
+
->load(Mage::getStoreConfig('shipping/origin/region_id'))
|
101 |
+
->getCode(),
|
102 |
+
'country' => Mage::getStoreConfig('shipping/origin/country_id'),
|
103 |
+
'zip' => Mage::getStoreConfig('shipping/origin/postcode'),
|
104 |
+
);
|
105 |
+
}
|
106 |
+
}
|
app/code/community/Shiphawk/Order/Model/Cron/ProcessOrderForLast14Days.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_Cron_ProcessOrderForLast14Days
|
4 |
+
{
|
5 |
+
public function run()
|
6 |
+
{
|
7 |
+
$key = preg_match('sendbox', Mage::getStoreConfig('shiphawk/order/gateway_url'))
|
8 |
+
? 'shiphawk/order/posecces_sendbox'
|
9 |
+
: 'shiphawk/order/posecces_production';
|
10 |
+
|
11 |
+
if (!Mage::getStoreConfigFlag('shiphawk/order/status') || Mage::getStoreConfigFlag($key)) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
$orders = Mage::getSingleton('sales/order')->getCollection()->addAttributeToFilter(
|
16 |
+
'created_at',
|
17 |
+
['gt' => strtotime('now - 14 days')]
|
18 |
+
);
|
19 |
+
|
20 |
+
foreach ($orders as $order) {
|
21 |
+
Mage::getSingleton('shiphawk_order/command_sendOrder')->execute($order);
|
22 |
+
}
|
23 |
+
Mage::getConfig()->saveConfig($key, 1);
|
24 |
+
Mage::getConfig()->cleanCache();
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Shiphawk/Order/Model/Observer/Config.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_Observer_Config
|
4 |
+
{
|
5 |
+
public function check($observer)
|
6 |
+
{
|
7 |
+
Mage::getSingleton('shiphawk_order/command_checkConfiguration')->execute();
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Shiphawk/Order/Model/Observer/Order.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_Observer_Order
|
4 |
+
{
|
5 |
+
protected function isAvailable() {
|
6 |
+
return Mage::getStoreConfig('shiphawk/order/active') == 1;
|
7 |
+
}
|
8 |
+
|
9 |
+
public function push($observer)
|
10 |
+
{
|
11 |
+
if ($this->isAvailable()) {
|
12 |
+
Mage::getSingleton('shiphawk_order/command_sendOrder')->execute($observer->getOrder());
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public function changeStatus($observer)
|
17 |
+
{
|
18 |
+
if ($this->isAvailable()) {
|
19 |
+
Mage::getModel('shiphawk_order/command_changeStatus')->execute($observer->getOrder());
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Shiphawk/Order/Model/Source/Gateway.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_Source_Gateway
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value'=>'https://shiphawk.com/api/v4/', 'label' => Mage::helper('adminhtml')->__('Live')),
|
9 |
+
array('value'=>'https://sandbox.shiphawk.com/api/v4/', 'label' => Mage::helper('adminhtml')->__('Sandbox')),
|
10 |
+
array('value'=>'https://qa.shiphawk.com/api/v4/', 'label' => Mage::helper('adminhtml')->__('QA')),
|
11 |
+
);
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Shiphawk/Order/Model/StatusMapper.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shiphawk_Order_Model_StatusMapper
|
4 |
+
{
|
5 |
+
public function map($status)
|
6 |
+
{
|
7 |
+
switch ($status) {
|
8 |
+
case 'canceled':
|
9 |
+
return 'cancelled';
|
10 |
+
case 'complete':
|
11 |
+
return 'shipped';
|
12 |
+
case 'processing':
|
13 |
+
return 'partially_shipped';
|
14 |
+
default:
|
15 |
+
return 'new';
|
16 |
+
}
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Shiphawk/Order/etc/config.xml
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Shiphawk_Order>
|
5 |
+
<version>2.0.0</version>
|
6 |
+
</Shiphawk_Order>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<shiphawk_order>
|
11 |
+
<class>Shiphawk_Order_Block</class>
|
12 |
+
</shiphawk_order>
|
13 |
+
</blocks>
|
14 |
+
<models>
|
15 |
+
<shiphawk_order>
|
16 |
+
<class>Shiphawk_Order_Model</class>
|
17 |
+
</shiphawk_order>
|
18 |
+
</models>
|
19 |
+
<helpers>
|
20 |
+
<shiphawk_order>
|
21 |
+
<class>Shiphawk_Order_Helper</class>
|
22 |
+
</shiphawk_order>
|
23 |
+
</helpers>
|
24 |
+
<resources>
|
25 |
+
<shiphawk_order_setup>
|
26 |
+
<setup>
|
27 |
+
<module>Shiphawk_Order</module>
|
28 |
+
</setup>
|
29 |
+
<connection>
|
30 |
+
<use>core_setup</use>
|
31 |
+
</connection>
|
32 |
+
</shiphawk_order_setup>
|
33 |
+
</resources>
|
34 |
+
<events>
|
35 |
+
<sales_order_save_after>
|
36 |
+
<observers>
|
37 |
+
<shiphawk_order_save>
|
38 |
+
<type>singleton</type>
|
39 |
+
<class>shiphawk_order/observer_order</class>
|
40 |
+
<method>changeStatus</method>
|
41 |
+
</shiphawk_order_save>
|
42 |
+
</observers>
|
43 |
+
</sales_order_save_after>
|
44 |
+
<sales_order_place_after>
|
45 |
+
<observers>
|
46 |
+
<shiphawk_order_place>
|
47 |
+
<type>singleton</type>
|
48 |
+
<class>shiphawk_order/observer_order</class>
|
49 |
+
<method>push</method>
|
50 |
+
</shiphawk_order_place>
|
51 |
+
</observers>
|
52 |
+
</sales_order_place_after>
|
53 |
+
<admin_system_config_changed_section_shiphawk>
|
54 |
+
<observers>
|
55 |
+
<shiphawk_order_sytem_config_changed>
|
56 |
+
<type>singleton</type>
|
57 |
+
<class>shiphawk_order/observer_config</class>
|
58 |
+
<method>check</method>
|
59 |
+
</shiphawk_order_sytem_config_changed>
|
60 |
+
</observers>
|
61 |
+
</admin_system_config_changed_section_shiphawk>
|
62 |
+
</events>
|
63 |
+
</global>
|
64 |
+
<default>
|
65 |
+
<shiphawk>
|
66 |
+
<order>
|
67 |
+
<active>1</active>
|
68 |
+
<gateway_url>https://shiphawk.com/api/v4/</gateway_url>
|
69 |
+
</order>
|
70 |
+
</shiphawk>
|
71 |
+
</default>
|
72 |
+
<adminhtml>
|
73 |
+
<acl>
|
74 |
+
<resources>
|
75 |
+
<admin>
|
76 |
+
<children>
|
77 |
+
<system>
|
78 |
+
<children>
|
79 |
+
<config>
|
80 |
+
<children>
|
81 |
+
<shiphawk translate="title" module="shiphawk_order">
|
82 |
+
<title>Shiphawk Settings</title>
|
83 |
+
</shiphawk>
|
84 |
+
</children>
|
85 |
+
</config>
|
86 |
+
</children>
|
87 |
+
</system>
|
88 |
+
</children>
|
89 |
+
</admin>
|
90 |
+
</resources>
|
91 |
+
</acl>
|
92 |
+
</adminhtml>
|
93 |
+
<crontab>
|
94 |
+
<jobs>
|
95 |
+
<shiphawk_order_procces_14days>
|
96 |
+
<schedule>
|
97 |
+
<cron_expr>* * */1 * *</cron_expr>
|
98 |
+
</schedule>
|
99 |
+
<run>
|
100 |
+
<model>shiphawk_order/cron_processOrderForLast14Days::run</model>
|
101 |
+
</run>
|
102 |
+
</shiphawk_order_procces_14days>
|
103 |
+
</jobs>
|
104 |
+
</crontab>
|
105 |
+
</config>
|
app/code/community/Shiphawk/Order/etc/system.xml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<shiphawk translate="label" module="shiphawk_order">
|
5 |
+
<label><![CDATA[<div style="position: absolute; display: flex; align-items: center;"><img id="shiphawk_block" style="width:18px; margin-right: 5px;" src="" alt="" border="0" />ShipHawk</div> <script>$('shiphawk_block').src = SKIN_URL + "images/shiphawk/shiphawkicon.png";</script>]]></label>
|
6 |
+
<sort_order>999999</sort_order>
|
7 |
+
</shiphawk>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<shiphawk translate="label" module="shiphawk_order">
|
11 |
+
<label>Shiphawk Settings</label>
|
12 |
+
<tab>shiphawk</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1000</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<order translate="label">
|
20 |
+
<label>ShipHawk</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>2</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<active translate="label">
|
28 |
+
<label>Enabled to send orders to ShipHawk</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>10</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</active>
|
36 |
+
<api_key translate="label">
|
37 |
+
<label>Api Key</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>20</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</api_key>
|
44 |
+
<gateway_url translate="label">
|
45 |
+
<label>Gateway Mode</label>
|
46 |
+
<frontend_type>select</frontend_type>
|
47 |
+
<source_model>shiphawk_order/source_gateway</source_model>
|
48 |
+
<sort_order>21</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</gateway_url>
|
53 |
+
<register translate="label">
|
54 |
+
<label>Register on ShipHawk.com</label>
|
55 |
+
<link><![CDATA[https://shiphawk.com/reg/?p=basic&utm_medium=product&utm_source=magento&utm_campaign=connectpage]]></link>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<frontend_model>shiphawk_order/system_link</frontend_model>
|
58 |
+
<sort_order>30</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</register>
|
63 |
+
</fields>
|
64 |
+
</order>
|
65 |
+
</groups>
|
66 |
+
</shiphawk>
|
67 |
+
</sections>
|
68 |
+
</config>
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_Origins extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
-
{
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_addButtonLabel = Mage::helper('shiphawk_shipping')->__('Add New Origins');
|
7 |
-
|
8 |
-
$this->_blockGroup = 'shiphawk_shipping';
|
9 |
-
$this->_controller = 'adminhtml_origins';
|
10 |
-
$this->_headerText = Mage::helper('shiphawk_shipping')->__('Origins');
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins/Edit.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_Origins_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
-
{
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_blockGroup = 'shiphawk_shipping';
|
7 |
-
$this->_mode = 'edit';
|
8 |
-
$this->_controller = 'adminhtml_origins';
|
9 |
-
|
10 |
-
$faq_id = (int)$this->getRequest()->getParam($this->_objectId);
|
11 |
-
|
12 |
-
$faq = Mage::getModel('shiphawk_shipping/origins')->load($faq_id);
|
13 |
-
Mage::register('current_origins', $faq);
|
14 |
-
|
15 |
-
$this->_removeButton('reset');
|
16 |
-
}
|
17 |
-
|
18 |
-
public function getHeaderText()
|
19 |
-
{
|
20 |
-
$faq = Mage::registry('current_origins');
|
21 |
-
if ($faq->getId()) {
|
22 |
-
return Mage::helper('shiphawk_shipping')->__("Edit origins '%s'", $this->escapeHtml($faq->getShiphawkOriginTitle()));
|
23 |
-
} else {
|
24 |
-
return Mage::helper('shiphawk_shipping')->__("Add new origins");
|
25 |
-
}
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins/Edit/Form.php
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_Origins_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
3 |
-
{
|
4 |
-
protected function _prepareForm()
|
5 |
-
{
|
6 |
-
$faq = Mage::registry('current_origins');
|
7 |
-
$form = new Varien_Data_Form();
|
8 |
-
$fieldset = $form->addFieldset('edit_origins', array(
|
9 |
-
'legend' => Mage::helper('shiphawk_shipping')->__('Origins Details')
|
10 |
-
));
|
11 |
-
|
12 |
-
if ($faq->getId()) {
|
13 |
-
$fieldset->addField('id', 'hidden', array(
|
14 |
-
'name' => 'id',
|
15 |
-
'required' => true
|
16 |
-
));
|
17 |
-
}
|
18 |
-
|
19 |
-
|
20 |
-
$fieldset->addField('shiphawk_origin_title', 'text', array(
|
21 |
-
'name' => 'shiphawk_origin_title',
|
22 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Title'),
|
23 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Title'),
|
24 |
-
'required' => true,
|
25 |
-
'width' => '400px'
|
26 |
-
));
|
27 |
-
|
28 |
-
$fieldset->addField('shiphawk_origin_firstname', 'text', array(
|
29 |
-
'name' => 'shiphawk_origin_firstname',
|
30 |
-
'title' => Mage::helper('shiphawk_shipping')->__('First Name'),
|
31 |
-
'label' => Mage::helper('shiphawk_shipping')->__('First Name'),
|
32 |
-
'required' => true,
|
33 |
-
'width' => '400px'
|
34 |
-
));
|
35 |
-
|
36 |
-
$fieldset->addField('shiphawk_origin_lastname', 'text', array(
|
37 |
-
'name' => 'shiphawk_origin_lastname',
|
38 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Last Name'),
|
39 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Last Name'),
|
40 |
-
'required' => true,
|
41 |
-
'width' => '400px'
|
42 |
-
));
|
43 |
-
|
44 |
-
$fieldset->addField('shiphawk_origin_addressline1', 'text', array(
|
45 |
-
'name' => 'shiphawk_origin_addressline1',
|
46 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Address'),
|
47 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Address'),
|
48 |
-
'required' => true,
|
49 |
-
'width' => '400px'
|
50 |
-
));
|
51 |
-
|
52 |
-
$fieldset->addField('shiphawk_origin_addressline2', 'text', array(
|
53 |
-
'name' => 'shiphawk_origin_addressline2',
|
54 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Address'),
|
55 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Address Line 2'),
|
56 |
-
'required' => false,
|
57 |
-
'width' => '400px'
|
58 |
-
));
|
59 |
-
|
60 |
-
$fieldset->addField('shiphawk_origin_city', 'text', array(
|
61 |
-
'name' => 'shiphawk_origin_city',
|
62 |
-
'title' => Mage::helper('shiphawk_shipping')->__('City'),
|
63 |
-
'label' => Mage::helper('shiphawk_shipping')->__('City'),
|
64 |
-
'required' => true,
|
65 |
-
'width' => '400px'
|
66 |
-
));
|
67 |
-
|
68 |
-
$regions = $this->getRegions();
|
69 |
-
|
70 |
-
$fieldset->addField('shiphawk_origin_state', 'select', array(
|
71 |
-
'name' => 'shiphawk_origin_state',
|
72 |
-
'title' => Mage::helper('shiphawk_shipping')->__('State'),
|
73 |
-
'label' => Mage::helper('shiphawk_shipping')->__('State'),
|
74 |
-
'required' => true,
|
75 |
-
'values' => $regions,
|
76 |
-
'width' => '100%'
|
77 |
-
));
|
78 |
-
|
79 |
-
$fieldset->addField('shiphawk_origin_zipcode', 'text', array(
|
80 |
-
'name' => 'shiphawk_origin_zipcode',
|
81 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Zip Code'),
|
82 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Zip Code'),
|
83 |
-
'required' => true,
|
84 |
-
'width' => '400px'
|
85 |
-
));
|
86 |
-
|
87 |
-
|
88 |
-
$fieldset->addField('shiphawk_origin_phonenum', 'text', array(
|
89 |
-
'name' => 'shiphawk_origin_phonenum',
|
90 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Phone number'),
|
91 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Phone number'),
|
92 |
-
'required' => true,
|
93 |
-
'width' => '400px'
|
94 |
-
));
|
95 |
-
|
96 |
-
$fieldset->addField('shiphawk_origin_location', 'select', array(
|
97 |
-
'name' => 'shiphawk_origin_location',
|
98 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Location'),
|
99 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Location'),
|
100 |
-
'required' => true,
|
101 |
-
'values' => array(
|
102 |
-
array( 'value'=>'commercial', 'label'=>'commercial'),
|
103 |
-
array( 'value'=>'residential', 'label'=>'residential'),
|
104 |
-
),
|
105 |
-
'width' => '400px'
|
106 |
-
));
|
107 |
-
|
108 |
-
$fieldset->addField('shiphawk_origin_email', 'text', array(
|
109 |
-
'name' => 'shiphawk_origin_email',
|
110 |
-
'title' => Mage::helper('shiphawk_shipping')->__('Email'),
|
111 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Email'),
|
112 |
-
'required' => false,
|
113 |
-
'width' => '400px'
|
114 |
-
));
|
115 |
-
|
116 |
-
$form->setMethod('post');
|
117 |
-
$form->setUseContainer(true);
|
118 |
-
$form->setId('edit_form');
|
119 |
-
$form->setAction($this->getUrl('*/*/save'));
|
120 |
-
$form->setValues($faq->getData());
|
121 |
-
|
122 |
-
$this->setForm($form);
|
123 |
-
}
|
124 |
-
|
125 |
-
public function getRegions($county_code = 'US') {
|
126 |
-
$regions = array();
|
127 |
-
$regionCollection = Mage::getModel('directory/region_api')->items($county_code);
|
128 |
-
foreach($regionCollection as $region) {
|
129 |
-
$regions[]= array(
|
130 |
-
'value' => $region['code'],
|
131 |
-
'label' => $region['name']
|
132 |
-
);
|
133 |
-
}
|
134 |
-
return $regions;
|
135 |
-
}
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/Origins/Grid.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_Origins_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
-
{
|
4 |
-
|
5 |
-
protected function _construct()
|
6 |
-
{
|
7 |
-
$this->setId('originsGrid');
|
8 |
-
$this->_controller = 'adminhtml_origins';
|
9 |
-
$this->setUseAjax(true);
|
10 |
-
|
11 |
-
$this->setDefaultSort('id');
|
12 |
-
$this->setDefaultDir('desc');
|
13 |
-
}
|
14 |
-
|
15 |
-
protected function _prepareCollection()
|
16 |
-
{
|
17 |
-
$collection = Mage::getModel('shiphawk_shipping/origins')->getCollection();
|
18 |
-
$this->setCollection($collection);
|
19 |
-
|
20 |
-
return parent::_prepareCollection();
|
21 |
-
}
|
22 |
-
|
23 |
-
protected function _prepareColumns()
|
24 |
-
{
|
25 |
-
$this->addColumn('id', array(
|
26 |
-
'header' => Mage::helper('shiphawk_shipping')->__('ID'),
|
27 |
-
'align' => 'right',
|
28 |
-
'width' => '20px',
|
29 |
-
'filter_index' => 'id',
|
30 |
-
'index' => 'id'
|
31 |
-
));
|
32 |
-
|
33 |
-
$this->addColumn('shiphawk_origin_title', array(
|
34 |
-
'header' => Mage::helper('shiphawk_shipping')->__('Title'),
|
35 |
-
'align' => 'right',
|
36 |
-
|
37 |
-
'filter_index' => 'shiphawk_origin_title',
|
38 |
-
'index' => 'shiphawk_origin_title'
|
39 |
-
));
|
40 |
-
|
41 |
-
$this->addColumn('shiphawk_origin_firstname', array(
|
42 |
-
'header' => Mage::helper('shiphawk_shipping')->__('First name'),
|
43 |
-
'align' => 'left',
|
44 |
-
'filter_index' => 'shiphawk_origin_firstname',
|
45 |
-
'index' => 'shiphawk_origin_firstname',
|
46 |
-
|
47 |
-
));
|
48 |
-
|
49 |
-
$this->addColumn('shiphawk_origin_lastname', array(
|
50 |
-
'header' => Mage::helper('shiphawk_shipping')->__('Last name'),
|
51 |
-
'align' => 'left',
|
52 |
-
'filter_index' => 'shiphawk_origin_lastname',
|
53 |
-
'index' => 'shiphawk_origin_lastname',
|
54 |
-
|
55 |
-
));
|
56 |
-
|
57 |
-
$this->addColumn('shiphawk_origin_zipcode', array(
|
58 |
-
'header' => Mage::helper('shiphawk_shipping')->__('Origin Zip Code'),
|
59 |
-
'align' => 'left',
|
60 |
-
'filter_index' => 'shiphawk_origin_zipcode',
|
61 |
-
'index' => 'shiphawk_origin_zipcode',
|
62 |
-
|
63 |
-
));
|
64 |
-
|
65 |
-
$this->addExportType('*/*/export', Mage::helper('shiphawk_shipping')->__('CSV'));
|
66 |
-
|
67 |
-
return parent::_prepareColumns();
|
68 |
-
}
|
69 |
-
|
70 |
-
protected function _prepareMassaction()
|
71 |
-
{
|
72 |
-
$this->setMassactionIdField('id');
|
73 |
-
$this->getMassactionBlock()->setFormFieldName('origins');
|
74 |
-
|
75 |
-
$this->getMassactionBlock()->addItem('delete', array(
|
76 |
-
'label' => Mage::helper('shiphawk_shipping')->__('Delete'),
|
77 |
-
'url' => $this->getUrl('*/*/massDelete'),
|
78 |
-
'confirm' => Mage::helper('shiphawk_shipping')->__('Are you sure?')
|
79 |
-
));
|
80 |
-
|
81 |
-
|
82 |
-
return $this;
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
public function getRowUrl($faqs)
|
87 |
-
{
|
88 |
-
return $this->getUrl('*/*/edit', array(
|
89 |
-
'id' => $faqs->getId(),
|
90 |
-
));
|
91 |
-
}
|
92 |
-
|
93 |
-
public function getGridUrl()
|
94 |
-
{
|
95 |
-
return $this->getUrl('*/*/grid', array('_current'=>true));
|
96 |
-
}
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/Sales/Order/Shipment/View.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View {
|
3 |
-
public function __construct() {
|
4 |
-
|
5 |
-
parent::__construct();
|
6 |
-
|
7 |
-
/* if ($this->getShipment()->getId()) {
|
8 |
-
$this->_addButton('subscribe', array(
|
9 |
-
'label' => Mage::helper('sales')->__('Subscribe to Tracking Information'),
|
10 |
-
'class' => 'save',
|
11 |
-
'onclick' => 'setLocation(\''.$this->getShipTrackUrl($this->getShipment()->getId()).'\')'
|
12 |
-
)
|
13 |
-
);
|
14 |
-
}*/
|
15 |
-
}
|
16 |
-
|
17 |
-
public function getShipTrackUrl($shipment_id) {
|
18 |
-
return Mage::helper("adminhtml")->getUrl("adminshiphawk/adminhtml_shipment/subscribe", array('shipment_id' => $shipment_id));
|
19 |
-
}
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/Sales/Order/View.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
3 |
-
public function __construct() {
|
4 |
-
|
5 |
-
parent::__construct();
|
6 |
-
|
7 |
-
$order_id = $this->getOrderId();
|
8 |
-
$order = $this->getOrder();
|
9 |
-
|
10 |
-
$manual_shipping = Mage::getStoreConfig('carriers/shiphawk_shipping/book_shipment');
|
11 |
-
$shipping_code = $order->getShippingMethod();
|
12 |
-
|
13 |
-
$confirm_messsage = $this->__('Are you sure to process?');
|
14 |
-
$check_shiphawk = Mage::helper('shiphawk_shipping')->isShipHawkShipping($shipping_code);
|
15 |
-
if($check_shiphawk !== false) {
|
16 |
-
if ($order->canShip()) {
|
17 |
-
if($manual_shipping) {
|
18 |
-
$this->_addButton('shiphawk_shipping', array(
|
19 |
-
'label' => Mage::helper('shiphawk_shipping')->__('ShipHawk Shipment'),
|
20 |
-
//'onclick' => "confirmSetLocation('{$confirm_messsage}', '{$this->getShipHawkUrl($order_id)}')",
|
21 |
-
'onclick' => "reBook('{$this->getShipHawkUrl($order_id)}', '{$order_id}', '{$this->getNewShipHawkUrl($order_id)}')",
|
22 |
-
'class' => 'go'
|
23 |
-
), 0, 100, 'header', 'header');
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}else{
|
27 |
-
if ($order->canShip()) {
|
28 |
-
$this->_addButton('shiphawk_shipping_new', array(
|
29 |
-
'label' => Mage::helper('shiphawk_shipping')->__('New ShipHawk Shipment'),
|
30 |
-
'class' => 'newshipment',
|
31 |
-
'onclick' => "showPopup('{$this->getNewShipHawkUrl($order_id)}')"
|
32 |
-
), 0, 150, 'header', 'header');
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
public function getShipHawkUrl($order_id) {
|
39 |
-
return Mage::helper("adminhtml")->getUrl("adminshiphawk/adminhtml_shipment/saveshipment", array('order_id' => $order_id));
|
40 |
-
}
|
41 |
-
|
42 |
-
public function getNewShipHawkUrl($order_id) {
|
43 |
-
return Mage::helper("adminhtml")->getUrl("adminshiphawk/adminhtml_shipment/newshipment", array('order_id' => $order_id));
|
44 |
-
}
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/Shipment.php
DELETED
@@ -1,599 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_Shipment extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Get ShipHawk Shipping Rate for order with not ShipHawk shipping method
|
6 |
-
* @param $order
|
7 |
-
* @return array|null
|
8 |
-
*/
|
9 |
-
public function getNewShipHawkRate($order) {
|
10 |
-
|
11 |
-
$carrier = Mage::getModel('shiphawk_shipping/carrier');
|
12 |
-
$api = Mage::getModel('shiphawk_shipping/api');
|
13 |
-
$helper = Mage::helper('shiphawk_shipping');
|
14 |
-
|
15 |
-
$shLocationType = $order->getShiphawkLocationType();
|
16 |
-
|
17 |
-
$result = array();
|
18 |
-
|
19 |
-
$items = $carrier->getShiphawkItems($order);
|
20 |
-
|
21 |
-
/* sort items by origin id */
|
22 |
-
$grouped_items_by_zip = $carrier->getGroupedItemsByZip($items);
|
23 |
-
|
24 |
-
// sort items by carrier type
|
25 |
-
$grouped_items_by_carrier_type = $carrier->getGroupedItemsByCarrierType($items);
|
26 |
-
|
27 |
-
$error_message = 'Sorry, not all products have necessary ShipHawk fields filled in. Please add necessary data for next products (or check required attributes):';
|
28 |
-
|
29 |
-
$shippingAddress = $order->getShippingAddress();
|
30 |
-
$to_zip = $shippingAddress->getPostcode();
|
31 |
-
|
32 |
-
$ship_responces = array();
|
33 |
-
$toOrder= array();
|
34 |
-
$api_error = false;
|
35 |
-
$is_multi_zip = false;
|
36 |
-
$is_multi_carrier = false;
|
37 |
-
|
38 |
-
if(count($grouped_items_by_zip) > 1) {
|
39 |
-
$is_multi_zip = true;
|
40 |
-
}
|
41 |
-
|
42 |
-
if(count($grouped_items_by_carrier_type) > 1) {
|
43 |
-
$is_multi_carrier = true;
|
44 |
-
$is_multi_zip = true;
|
45 |
-
}
|
46 |
-
|
47 |
-
$is_admin = $helper->checkIsAdmin();
|
48 |
-
$rate_filter = Mage::helper('shiphawk_shipping')->getRateFilter($is_admin, $order);
|
49 |
-
$carrier_type = Mage::getStoreConfig('carriers/shiphawk_shipping/carrier_type');
|
50 |
-
|
51 |
-
$custom_packing_price_setting = Mage::getStoreConfig('carriers/shiphawk_shipping/shiphawk_custom_packing_price');
|
52 |
-
|
53 |
-
$self_pack = $helper->getSelfPacked();
|
54 |
-
|
55 |
-
$charge_customer_for_packing = Mage::getStoreConfig('carriers/shiphawk_shipping/charge_customer_for_packing');
|
56 |
-
|
57 |
-
$result['error'] = '';
|
58 |
-
//default origin zip code
|
59 |
-
$from_zip = Mage::getStoreConfig('carriers/shiphawk_shipping/default_origin');
|
60 |
-
|
61 |
-
/* items has various carrier type */
|
62 |
-
if($is_multi_carrier) {
|
63 |
-
foreach($grouped_items_by_carrier_type as $carrier_type=>$items_) {
|
64 |
-
|
65 |
-
if($carrier_type) {
|
66 |
-
$carrier_type = explode(',', $carrier_type);
|
67 |
-
}else{
|
68 |
-
$carrier_type = '';
|
69 |
-
}
|
70 |
-
|
71 |
-
$grouped_items_by_origin = $carrier->getGroupedItemsByZip($items_);
|
72 |
-
|
73 |
-
foreach($grouped_items_by_origin as $origin_id=>$items__) {
|
74 |
-
|
75 |
-
if ($origin_id != 'origin_per_product') { // product has origin id or primary origin
|
76 |
-
|
77 |
-
$rate_filter = 'best'; // multi carrier
|
78 |
-
|
79 |
-
if($origin_id) {
|
80 |
-
$shipHawkOrigin = Mage::getModel('shiphawk_shipping/origins')->load($origin_id);
|
81 |
-
$from_zip = $shipHawkOrigin->getShiphawkOriginZipcode();
|
82 |
-
}
|
83 |
-
|
84 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items__, $rate_filter);
|
85 |
-
|
86 |
-
if(empty($checkattributes)) {
|
87 |
-
|
88 |
-
$grouped_items_by_discount_or_markup = $carrier->getGroupedItemsByDiscountOrMarkup($items__);
|
89 |
-
|
90 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
91 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
92 |
-
$from_zip = $items__[0]['zip'];
|
93 |
-
$location_type = $items__[0]['location_type'];
|
94 |
-
// 1. multi carrier, multi origin, not origin per product
|
95 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
96 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
97 |
-
|
98 |
-
$custom_products_packing_price = 0;
|
99 |
-
|
100 |
-
if($custom_packing_price_setting) {
|
101 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
102 |
-
}
|
103 |
-
|
104 |
-
$ship_responces[] = $responceObject;
|
105 |
-
|
106 |
-
if(is_object($responceObject)) {
|
107 |
-
$api_error = true;
|
108 |
-
$shiphawk_error = (string) $responceObject->error;
|
109 |
-
//Mage::log('ShipHawk response: '. $shiphawk_error, null, 'ShipHawk.log');
|
110 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
111 |
-
$error_message = 'ShipHawk error: '. $shiphawk_error;
|
112 |
-
echo $error_message ;
|
113 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
114 |
-
return null;
|
115 |
-
}else{
|
116 |
-
// if $rate_filter = 'best' then it is only one rate
|
117 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
118 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
119 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
120 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
121 |
-
|
122 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $carrier->getProductIds($discount_items);
|
123 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0]);
|
124 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
125 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
126 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
127 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
128 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
129 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
130 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $carrier->getCarrierName($responceObject[0]);
|
131 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $carrier->getPackeges($responceObject[0]);
|
132 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
133 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
134 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
135 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
136 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
137 |
-
$toOrder[$responceObject[0]->id]['carrier_accessorial'] = $responceObject[0]->shipping->carrier_accessorial;
|
138 |
-
//$responce->shipping->carrier_accessorial;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
if($is_multi_zip) {
|
143 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
}else{
|
148 |
-
$api_error = true;
|
149 |
-
/*foreach($checkattributes as $rate_error) {
|
150 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
151 |
-
}*/
|
152 |
-
echo $error_message . '<br />';
|
153 |
-
if(!empty($checkattributes['items']['name']))
|
154 |
-
if(count($checkattributes['items']['name'])>0)
|
155 |
-
foreach($checkattributes['items']['name'] as $names) {
|
156 |
-
echo $names . '<br />';
|
157 |
-
}
|
158 |
-
|
159 |
-
if (!empty($checkattributes['from_zip'])) {
|
160 |
-
echo 'From Zip' . '<br />';
|
161 |
-
}
|
162 |
-
if (!empty($checkattributes['to_zip'])) {
|
163 |
-
echo 'To Zip' . '<br />';
|
164 |
-
}
|
165 |
-
|
166 |
-
if (!empty($checkattributes['rate_filter'])) {
|
167 |
-
echo 'Rate Filter' . '<br />';
|
168 |
-
}
|
169 |
-
return null;
|
170 |
-
}
|
171 |
-
}else{ // product items has all required shipping origin fields
|
172 |
-
|
173 |
-
$grouped_items_per_product_by_zip = $carrier->getGroupedItemsByZipPerProduct($items__);
|
174 |
-
|
175 |
-
if(count($grouped_items_per_product_by_zip) > 1 ) {
|
176 |
-
$is_multi_zip = true;
|
177 |
-
}
|
178 |
-
|
179 |
-
if($is_multi_zip) {
|
180 |
-
$rate_filter = 'best';
|
181 |
-
}
|
182 |
-
|
183 |
-
foreach ($grouped_items_per_product_by_zip as $from_zip=>$items_per_product) {
|
184 |
-
|
185 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items_per_product, $rate_filter);
|
186 |
-
|
187 |
-
if(empty($checkattributes)) {
|
188 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
189 |
-
$from_zip = $items_[0]['zip'];
|
190 |
-
$location_type = $items_[0]['location_type'];
|
191 |
-
|
192 |
-
$grouped_items_by_discount_or_markup = $carrier->getGroupedItemsByDiscountOrMarkup($items_per_product);
|
193 |
-
|
194 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
195 |
-
|
196 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
197 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
198 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
199 |
-
|
200 |
-
if($carrier_type) {
|
201 |
-
$carrier_type = explode(',', $carrier_type);
|
202 |
-
}else{
|
203 |
-
$carrier_type = '';
|
204 |
-
}
|
205 |
-
|
206 |
-
// 2. multi carrier, multi origin, origin per product
|
207 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
208 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
209 |
-
|
210 |
-
$custom_products_packing_price = 0;
|
211 |
-
|
212 |
-
if($custom_packing_price_setting) {
|
213 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
214 |
-
}
|
215 |
-
|
216 |
-
$ship_responces[] = $responceObject;
|
217 |
-
|
218 |
-
if(is_object($responceObject)) {
|
219 |
-
$api_error = true;
|
220 |
-
$shiphawk_error = (string) $responceObject->error;
|
221 |
-
//Mage::log('ShipHawk response: '. $shiphawk_error, null, 'ShipHawk.log');
|
222 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
223 |
-
$error_message = 'ShipHawk error: '. $shiphawk_error;
|
224 |
-
echo $error_message ;
|
225 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
226 |
-
return null;
|
227 |
-
}else{
|
228 |
-
// if $rate_filter = 'best' then it is only one rate
|
229 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
230 |
-
|
231 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $carrier->getProductIds($discount_items);
|
232 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0]);
|
233 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
234 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
235 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
236 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
237 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
238 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
239 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $carrier->getCarrierName($responceObject[0]);
|
240 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $carrier->getPackeges($responceObject[0]);
|
241 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
242 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
243 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
244 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
245 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
246 |
-
$toOrder[$responceObject[0]->id]['carrier_accessorial'] = $responceObject[0]->shipping->carrier_accessorial;
|
247 |
-
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
if($is_multi_zip) {
|
252 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
253 |
-
}
|
254 |
-
|
255 |
-
}
|
256 |
-
|
257 |
-
}else{
|
258 |
-
$api_error = true;
|
259 |
-
/*foreach($checkattributes as $rate_error) {
|
260 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
261 |
-
}*/
|
262 |
-
echo $error_message . '<br />';
|
263 |
-
if(!empty($checkattributes['items']['name']))
|
264 |
-
if(count($checkattributes['items']['name'])>0)
|
265 |
-
foreach($checkattributes['items']['name'] as $names) {
|
266 |
-
echo $names . '<br />';
|
267 |
-
}
|
268 |
-
|
269 |
-
if (!empty($checkattributes['from_zip'])) {
|
270 |
-
echo 'From Zip' . '<br />';
|
271 |
-
}
|
272 |
-
if (!empty($checkattributes['to_zip'])) {
|
273 |
-
echo 'To Zip' . '<br />';
|
274 |
-
}
|
275 |
-
|
276 |
-
if (!empty($checkattributes['rate_filter'])) {
|
277 |
-
echo 'Rate Filter' . '<br />';
|
278 |
-
}
|
279 |
-
return null;
|
280 |
-
}
|
281 |
-
|
282 |
-
}
|
283 |
-
|
284 |
-
}
|
285 |
-
|
286 |
-
}
|
287 |
-
}
|
288 |
-
}else{
|
289 |
-
|
290 |
-
/* all product items has one carrier type or carrier type is null in all items */
|
291 |
-
foreach($grouped_items_by_zip as $origin_id=>$items_) {
|
292 |
-
|
293 |
-
/* get carrier type from first item because items grouped by carrier type and not multi carrier */
|
294 |
-
/* if carrier type is null, get default carrier type from settings */
|
295 |
-
if($items_[0]['shiphawk_carrier_type']) {
|
296 |
-
$carrier_type = (explode(',', $items_[0]['shiphawk_carrier_type'])) ? (explode(',', $items_[0]['shiphawk_carrier_type'])) : Mage::getStoreConfig('carriers/shiphawk_shipping/carrier_type');
|
297 |
-
}else{
|
298 |
-
$carrier_type = '';
|
299 |
-
}
|
300 |
-
|
301 |
-
if ($origin_id != 'origin_per_product') {
|
302 |
-
|
303 |
-
if($is_multi_zip) {
|
304 |
-
$rate_filter = 'best';
|
305 |
-
}
|
306 |
-
|
307 |
-
if($origin_id) {
|
308 |
-
$shipHawkOrigin = Mage::getModel('shiphawk_shipping/origins')->load($origin_id);
|
309 |
-
$from_zip = $shipHawkOrigin->getShiphawkOriginZipcode();
|
310 |
-
}
|
311 |
-
|
312 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items_, $rate_filter);
|
313 |
-
|
314 |
-
if(empty($checkattributes)) {
|
315 |
-
|
316 |
-
$grouped_items_by_discount_or_markup = $carrier->getGroupedItemsByDiscountOrMarkup($items_);
|
317 |
-
|
318 |
-
if(count($grouped_items_by_discount_or_markup)>1) {
|
319 |
-
$is_multi_zip = true;
|
320 |
-
}
|
321 |
-
|
322 |
-
if($is_multi_zip) {
|
323 |
-
$rate_filter = 'best';
|
324 |
-
}
|
325 |
-
|
326 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
327 |
-
|
328 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
329 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
330 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
331 |
-
|
332 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
333 |
-
$from_zip = $discount_items[0]['zip'];
|
334 |
-
$location_type = $discount_items[0]['location_type'];
|
335 |
-
|
336 |
-
// 3. one carrier, multi origin, not origin per product
|
337 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
338 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
339 |
-
|
340 |
-
$custom_products_packing_price = 0;
|
341 |
-
|
342 |
-
if($custom_packing_price_setting) {
|
343 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
344 |
-
}
|
345 |
-
|
346 |
-
$ship_responces[] = $responceObject;
|
347 |
-
|
348 |
-
if(is_object($responceObject) or (empty($responceObject))) {
|
349 |
-
$api_error = true;
|
350 |
-
$shiphawk_error = (string) $responceObject->error;
|
351 |
-
//Mage::log('ShipHawk response: '. $shiphawk_error, null, 'ShipHawk.log');
|
352 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
353 |
-
$error_message = 'ShipHawk error: '. $shiphawk_error;
|
354 |
-
echo $error_message ;
|
355 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
356 |
-
return null;
|
357 |
-
}else{
|
358 |
-
// if $rate_filter = 'best' then it is only one rate
|
359 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
360 |
-
|
361 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $carrier->getProductIds($discount_items);
|
362 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0]);
|
363 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
364 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
365 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
366 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
367 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
368 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
369 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $carrier->getCarrierName($responceObject[0]);
|
370 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $carrier->getPackeges($responceObject[0]);
|
371 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
372 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
373 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
374 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
375 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
376 |
-
$toOrder[$responceObject[0]->id]['carrier_accessorial'] = $responceObject[0]->shipping->carrier_accessorial;
|
377 |
-
}else{
|
378 |
-
Mage::getSingleton('core/session')->setMultiZipCode(false);
|
379 |
-
foreach ($responceObject as $responce) {
|
380 |
-
$toOrder[$responce->id]['product_ids'] = $carrier->getProductIds($discount_items);
|
381 |
-
//$toOrder[$responce->id]['price'] = $helper->getSummaryPrice($responce);
|
382 |
-
//$toOrder[$responce->id]['price'] = $helper->getShipHawkPrice($responce, $self_pack, $charge_customer_for_packing);
|
383 |
-
$toOrder[$responce->id]['price'] = $helper->getSummaryPrice($responce, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
384 |
-
$toOrder[$responce->id]['name'] = $responce->shipping->service;//
|
385 |
-
$toOrder[$responce->id]['items'] = $discount_items;
|
386 |
-
$toOrder[$responce->id]['from_zip'] = $from_zip;
|
387 |
-
$toOrder[$responce->id]['to_zip'] = $to_zip;
|
388 |
-
$toOrder[$responce->id]['carrier'] = $carrier->getCarrierName($responce);
|
389 |
-
$toOrder[$responce->id]['packing_info'] = $carrier->getPackeges($responce);
|
390 |
-
$toOrder[$responce->id]['carrier_type'] = $carrier_type;
|
391 |
-
$toOrder[$responce->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
392 |
-
$toOrder[$responce->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
393 |
-
$toOrder[$responce->id]['self_pack'] = $self_pack;
|
394 |
-
$toOrder[$responce->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
395 |
-
$toOrder[$responce->id]['carrier_accessorial'] = $responce->shipping->carrier_accessorial;
|
396 |
-
}
|
397 |
-
}
|
398 |
-
|
399 |
-
if($is_multi_zip) {
|
400 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
401 |
-
}
|
402 |
-
}
|
403 |
-
}
|
404 |
-
}else{
|
405 |
-
$api_error = true;
|
406 |
-
/*foreach($checkattributes as $rate_error) {
|
407 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
408 |
-
}*/
|
409 |
-
echo $error_message . '<br />';
|
410 |
-
if(!empty($checkattributes['items']['name']))
|
411 |
-
if(count($checkattributes['items']['name'])>0)
|
412 |
-
foreach($checkattributes['items']['name'] as $names) {
|
413 |
-
echo $names . '<br />';
|
414 |
-
}
|
415 |
-
|
416 |
-
if (!empty($checkattributes['from_zip'])) {
|
417 |
-
echo 'From Zip' . '<br />';
|
418 |
-
}
|
419 |
-
if (!empty($checkattributes['to_zip'])) {
|
420 |
-
echo 'To Zip' . '<br />';
|
421 |
-
}
|
422 |
-
|
423 |
-
if (!empty($checkattributes['rate_filter'])) {
|
424 |
-
echo 'Rate Filter' . '<br />';
|
425 |
-
}
|
426 |
-
return null;
|
427 |
-
}
|
428 |
-
}else{
|
429 |
-
|
430 |
-
/* product items has per product origin, grouped by zip code */
|
431 |
-
$grouped_items_per_product_by_zip = $carrier->getGroupedItemsByZipPerProduct($items_);
|
432 |
-
|
433 |
-
if(count($grouped_items_per_product_by_zip) > 1 ) {
|
434 |
-
$is_multi_zip = true;
|
435 |
-
}
|
436 |
-
|
437 |
-
if($is_multi_zip) {
|
438 |
-
$rate_filter = 'best';
|
439 |
-
}
|
440 |
-
|
441 |
-
foreach ($grouped_items_per_product_by_zip as $from_zip=>$items_per_product) {
|
442 |
-
|
443 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items_per_product, $rate_filter);
|
444 |
-
|
445 |
-
if(empty($checkattributes)) {
|
446 |
-
|
447 |
-
$grouped_items_by_discount_or_markup = $carrier->getGroupedItemsByDiscountOrMarkup($items_per_product);
|
448 |
-
|
449 |
-
if(count($grouped_items_by_discount_or_markup)>1) {
|
450 |
-
$is_multi_zip = true;
|
451 |
-
}
|
452 |
-
|
453 |
-
if($is_multi_zip) {
|
454 |
-
$rate_filter = 'best';
|
455 |
-
}
|
456 |
-
|
457 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
458 |
-
|
459 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
460 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
461 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
462 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
463 |
-
$from_zip = $discount_items[0]['zip'];
|
464 |
-
$location_type = $discount_items[0]['location_type'];
|
465 |
-
|
466 |
-
// 4. one carrier, multi origin, origin per product
|
467 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
468 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
469 |
-
|
470 |
-
$custom_products_packing_price = 0;
|
471 |
-
|
472 |
-
if($custom_packing_price_setting) {
|
473 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
474 |
-
}
|
475 |
-
|
476 |
-
$ship_responces[] = $responceObject;
|
477 |
-
|
478 |
-
if(is_object($responceObject)) {
|
479 |
-
$api_error = true;
|
480 |
-
$shiphawk_error = (string) $responceObject->error;
|
481 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
482 |
-
$error_message = 'ShipHawk error: '. $shiphawk_error;
|
483 |
-
echo $error_message ;
|
484 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
485 |
-
return null;
|
486 |
-
}else{
|
487 |
-
// if $rate_filter = 'best' then it is only one rate
|
488 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
489 |
-
|
490 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $carrier->getProductIds($discount_items);
|
491 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0]);
|
492 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
493 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
494 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
495 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
496 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
497 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
498 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $carrier->getCarrierName($responceObject[0]);
|
499 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $carrier->getPackeges($responceObject[0]);
|
500 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
501 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
502 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
503 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
504 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
505 |
-
$toOrder[$responceObject[0]->id]['carrier_accessorial'] = $responceObject[0]->shipping->carrier_accessorial;
|
506 |
-
}else{
|
507 |
-
Mage::getSingleton('core/session')->setMultiZipCode(false);
|
508 |
-
foreach ($responceObject as $responce) {
|
509 |
-
$toOrder[$responce->id]['product_ids'] = $carrier->getProductIds($discount_items);
|
510 |
-
//$toOrder[$responce->id]['price'] = $helper->getSummaryPrice($responce);
|
511 |
-
//$toOrder[$responce->id]['price'] = $helper->getShipHawkPrice($responce, $self_pack, $charge_customer_for_packing);
|
512 |
-
$toOrder[$responce->id]['price'] = $helper->getSummaryPrice($responce, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
513 |
-
$toOrder[$responce->id]['name'] = $responce->shipping->service;//
|
514 |
-
$toOrder[$responce->id]['items'] = $discount_items;
|
515 |
-
$toOrder[$responce->id]['from_zip'] = $from_zip;
|
516 |
-
$toOrder[$responce->id]['to_zip'] = $to_zip;
|
517 |
-
$toOrder[$responce->id]['carrier'] = $carrier->getCarrierName($responce);
|
518 |
-
$toOrder[$responce->id]['packing_info'] = $carrier->getPackeges($responce);
|
519 |
-
$toOrder[$responce->id]['carrier_type'] = $carrier_type;
|
520 |
-
$toOrder[$responce->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
521 |
-
$toOrder[$responce->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
522 |
-
$toOrder[$responce->id]['self_pack'] = $self_pack;
|
523 |
-
$toOrder[$responce->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
524 |
-
$toOrder[$responce->id]['carrier_accessorial'] = $responce->shipping->carrier_accessorial;
|
525 |
-
}
|
526 |
-
}
|
527 |
-
|
528 |
-
if($is_multi_zip) {
|
529 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
530 |
-
}
|
531 |
-
}
|
532 |
-
}
|
533 |
-
}else{
|
534 |
-
$api_error = true;
|
535 |
-
/*foreach($checkattributes as $rate_error) {
|
536 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
537 |
-
}*/
|
538 |
-
|
539 |
-
echo $error_message . '<br />';
|
540 |
-
if(!empty($checkattributes['items']['name']))
|
541 |
-
if(count($checkattributes['items']['name'])>0)
|
542 |
-
foreach($checkattributes['items']['name'] as $names) {
|
543 |
-
echo $names . '<br />';
|
544 |
-
}
|
545 |
-
|
546 |
-
if (!empty($checkattributes['from_zip'])) {
|
547 |
-
echo 'From Zip' . '<br />';
|
548 |
-
}
|
549 |
-
if (!empty($checkattributes['to_zip'])) {
|
550 |
-
echo 'To Zip' . '<br />';
|
551 |
-
}
|
552 |
-
|
553 |
-
if (!empty($checkattributes['rate_filter'])) {
|
554 |
-
echo 'Rate Filter' . '<br />';
|
555 |
-
}
|
556 |
-
return null;
|
557 |
-
}
|
558 |
-
|
559 |
-
}
|
560 |
-
|
561 |
-
}
|
562 |
-
}
|
563 |
-
}
|
564 |
-
|
565 |
-
$name_service = '';
|
566 |
-
$summ_price = 0;
|
567 |
-
if(!$api_error) {
|
568 |
-
|
569 |
-
$services = $carrier->getServices($ship_responces, $toOrder, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting);
|
570 |
-
|
571 |
-
foreach ($services as $id_service=>$service) {
|
572 |
-
if (!$is_multi_zip) {
|
573 |
-
|
574 |
-
}else{
|
575 |
-
$name_service .= $service['name'] . ', ';
|
576 |
-
$summ_price += $service['price'];
|
577 |
-
}
|
578 |
-
}
|
579 |
-
//save rate_id info for Book in PopUP
|
580 |
-
Mage::getSingleton('core/session')->setNewShiphawkBookId($toOrder);
|
581 |
-
|
582 |
-
//remove last comma
|
583 |
-
if(strlen($name_service) >2) {
|
584 |
-
if ($name_service{strlen($name_service)-2} == ',') {
|
585 |
-
$name_service = substr($name_service,0,-2);
|
586 |
-
}
|
587 |
-
}
|
588 |
-
}
|
589 |
-
|
590 |
-
$result['name_service'] = $name_service;
|
591 |
-
$result['summ_price'] = $summ_price;
|
592 |
-
$result['rate_filter'] = $rate_filter;
|
593 |
-
$result['is_multi_zip'] = $is_multi_zip;
|
594 |
-
$result['to_order'] = $toOrder;
|
595 |
-
|
596 |
-
return $result;
|
597 |
-
}
|
598 |
-
|
599 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Adminhtml/System/Config/Form/Button.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
-
{
|
4 |
-
/*
|
5 |
-
* Set template
|
6 |
-
*/
|
7 |
-
protected function _construct()
|
8 |
-
{
|
9 |
-
parent::_construct();
|
10 |
-
$this->setTemplate('shiphawk/button.phtml');
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Return element html
|
15 |
-
*
|
16 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
17 |
-
* @return string
|
18 |
-
*/
|
19 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
20 |
-
{
|
21 |
-
return $this->_toHtml();
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Return ajax url for button
|
26 |
-
*
|
27 |
-
* @return string
|
28 |
-
*/
|
29 |
-
public function getAjaxCheckUrl()
|
30 |
-
{
|
31 |
-
return Mage::helper("adminhtml")->getUrl("adminshiphawk/adminhtml_import/import");
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Generate button html
|
36 |
-
*
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
public function getButtonHtml()
|
40 |
-
{
|
41 |
-
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
42 |
-
->setData(array(
|
43 |
-
'id' => 'faqs_button',
|
44 |
-
'label' => $this->helper('adminhtml')->__('Start Import'),
|
45 |
-
'onclick' => 'javascript:importcsv(); return false;'
|
46 |
-
));
|
47 |
-
|
48 |
-
return $button->toHtml();
|
49 |
-
}
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Catalog/Product/Helper/Form/Disabled.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Catalog_Product_Helper_Form_Disabled extends Varien_Data_Form_Element_Text
|
3 |
-
{
|
4 |
-
public function getAfterElementHtml()
|
5 |
-
{
|
6 |
-
$html = parent::getAfterElementHtml();
|
7 |
-
return $html." <script>
|
8 |
-
$('".$this->getHtmlId()."').hide();
|
9 |
-
</script>";
|
10 |
-
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Catalog/Product/Helper/Form/Type.php
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Catalog_Product_Helper_Form_Type extends Varien_Data_Form_Element_Text
|
3 |
-
{
|
4 |
-
public function getAfterElementHtml()
|
5 |
-
{
|
6 |
-
$html = parent::getAfterElementHtml();
|
7 |
-
|
8 |
-
$html .= '<style>
|
9 |
-
.type_link:hover {
|
10 |
-
text-decoration: underline;
|
11 |
-
cursor: pointer;
|
12 |
-
}
|
13 |
-
</style>';
|
14 |
-
|
15 |
-
$html .= '<div id="type_product" style="position: absolute; z-index: 99; background-color: #ffffff" ></div>';
|
16 |
-
return $html." <script>
|
17 |
-
|
18 |
-
var typeloader;
|
19 |
-
$('".$this->getHtmlId()."').observe('keyup', function(event){
|
20 |
-
clearTimeout(typeloader);
|
21 |
-
typeloader = setTimeout(function(){ respondToClick(event); }, 750);
|
22 |
-
});
|
23 |
-
|
24 |
-
function setIdValue(el) {
|
25 |
-
|
26 |
-
$('shiphawk_type_of_product').value = el.innerHTML;
|
27 |
-
$('shiphawk_type_of_product_value').value = el.id;
|
28 |
-
$('type_product').hide();
|
29 |
-
}
|
30 |
-
|
31 |
-
function respondToClick(event) {
|
32 |
-
|
33 |
-
var element = event.element();
|
34 |
-
|
35 |
-
var minlength = 3;
|
36 |
-
|
37 |
-
var url = '".$this->getTypeUrl()."';
|
38 |
-
var parameters = {
|
39 |
-
search_tag: element.value
|
40 |
-
};
|
41 |
-
|
42 |
-
if(element.value.length >= minlength ) {
|
43 |
-
new Ajax.Request(url, {
|
44 |
-
method: 'post',
|
45 |
-
parameters: parameters,
|
46 |
-
onSuccess: function(transport) {
|
47 |
-
$('type_product').update(transport.responseText);
|
48 |
-
$('type_product').show();
|
49 |
-
},
|
50 |
-
onLoading:function(transport)
|
51 |
-
{
|
52 |
-
}
|
53 |
-
});
|
54 |
-
}
|
55 |
-
}
|
56 |
-
</script>";
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
public function getTypeUrl() {
|
61 |
-
return Mage::getUrl('shiphawk/index/search');
|
62 |
-
}
|
63 |
-
|
64 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Shipping/Tracking/Popup.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Block_Shipping_Tracking_Popup extends Mage_Shipping_Block_Tracking_Popup
|
3 |
-
{
|
4 |
-
public function getTrackingInfo()
|
5 |
-
{
|
6 |
-
$_results = parent::getTrackingInfo();
|
7 |
-
return $_results;
|
8 |
-
}
|
9 |
-
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Block/Version.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Shiphawk_Shipping_Block_Version extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
-
{
|
5 |
-
|
6 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
7 |
-
{
|
8 |
-
$ver = (Mage::getConfig()->getModuleConfig('Shiphawk_Shipping')->version);
|
9 |
-
$html = 'You current config version is ' . $ver;
|
10 |
-
|
11 |
-
return $html;
|
12 |
-
}
|
13 |
-
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Helper/Data.php
DELETED
@@ -1,479 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Shiphawk_Shipping_Helper_Data extends
|
4 |
-
Mage_Core_Helper_Abstract
|
5 |
-
{
|
6 |
-
/**
|
7 |
-
* Get api key
|
8 |
-
*
|
9 |
-
* @return mixed
|
10 |
-
*/
|
11 |
-
public function getApiKey()
|
12 |
-
{
|
13 |
-
return Mage::getStoreConfig('carriers/shiphawk_shipping/api_key');
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Get callback url for shipments
|
18 |
-
*
|
19 |
-
* @return mixed
|
20 |
-
*/
|
21 |
-
public function getCallbackUrl($api_key)
|
22 |
-
{
|
23 |
-
return Mage::getUrl('shiphawk/index/tracking', array('api_key' => $api_key));
|
24 |
-
}
|
25 |
-
|
26 |
-
public function getRateFilter($is_admin = false, $order = null)
|
27 |
-
{
|
28 |
-
if($order) {
|
29 |
-
if($order->getShiphawkRateFilter()) {
|
30 |
-
return $order->getShiphawkRateFilter();
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
if ($is_admin == true) {
|
35 |
-
return Mage::getStoreConfig('carriers/shiphawk_shipping/admin_rate_filter');
|
36 |
-
}
|
37 |
-
|
38 |
-
return Mage::getStoreConfig('carriers/shiphawk_shipping/rate_filter');
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Get api url
|
43 |
-
*
|
44 |
-
* @return mixed
|
45 |
-
*/
|
46 |
-
public function getApiUrl()
|
47 |
-
{
|
48 |
-
//return 'https://sandbox.shiphawk.com/api/v1/';
|
49 |
-
return Mage::getStoreConfig('carriers/shiphawk_shipping/gateway_url');
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Get Shiphawk attributes codes
|
54 |
-
*
|
55 |
-
* @return array
|
56 |
-
*/
|
57 |
-
public function getAttributes()
|
58 |
-
{
|
59 |
-
$shiphawk_attributes = array('shiphawk_length','shiphawk_width', 'shiphawk_height', 'shiphawk_origin_zipcode', 'shiphawk_origin_firstname', 'shiphawk_origin_lastname'
|
60 |
-
,'shiphawk_origin_addressline1','shiphawk_origin_phonenum','shiphawk_origin_city','shiphawk_origin_state','shiphawk_type_of_product','shiphawk_type_of_product_value'
|
61 |
-
,'shiphawk_quantity', 'shiphawk_item_value','shiphawk_item_is_packed','shiphawk_origin_location');
|
62 |
-
|
63 |
-
return $shiphawk_attributes;
|
64 |
-
}
|
65 |
-
|
66 |
-
public function isShipHawkShipping($shipping_code) {
|
67 |
-
$result = strpos($shipping_code, 'shiphawk_shipping');
|
68 |
-
return $result;
|
69 |
-
}
|
70 |
-
|
71 |
-
public function getShipHawkCode($shiphawk_book_id, $shipping_code) {
|
72 |
-
$result = array();
|
73 |
-
|
74 |
-
foreach ($shiphawk_book_id as $rate_id=>$method_data) {
|
75 |
-
//if( strpos($shipping_description, $method_data['name']) !== false ) {
|
76 |
-
//if( $shipping_code == $method_data['price'] ) {
|
77 |
-
$shipping_price = (string) $method_data['price'];
|
78 |
-
if($this->getOriginalShipHawkShippingPrice($shipping_code, $shipping_price)) {
|
79 |
-
$result = array($rate_id => $method_data);
|
80 |
-
return $result;
|
81 |
-
}
|
82 |
-
}
|
83 |
-
return $result;
|
84 |
-
}
|
85 |
-
|
86 |
-
public function checkIsAdmin () {
|
87 |
-
if(Mage::app()->getStore()->isAdmin())
|
88 |
-
{
|
89 |
-
return true;
|
90 |
-
}
|
91 |
-
|
92 |
-
if(Mage::getDesign()->getArea() == 'adminhtml')
|
93 |
-
{
|
94 |
-
return true;
|
95 |
-
}
|
96 |
-
|
97 |
-
return false;
|
98 |
-
}
|
99 |
-
|
100 |
-
public function generateRandomString($length = 10) {
|
101 |
-
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
102 |
-
$charactersLength = strlen($characters);
|
103 |
-
$randomString = '';
|
104 |
-
for ($i = 0; $i < $length; $i++) {
|
105 |
-
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
106 |
-
}
|
107 |
-
return $randomString;
|
108 |
-
}
|
109 |
-
|
110 |
-
public function checkShipHawkAttributes($from_zip, $to_zip, $items_, $rate_filter) {
|
111 |
-
$error = array();
|
112 |
-
if (empty($from_zip)) {
|
113 |
-
$error['from_zip'] = 'empty from zip';
|
114 |
-
}
|
115 |
-
|
116 |
-
if (empty($to_zip)) {
|
117 |
-
$error['to_zip'] = 'empty to zip';
|
118 |
-
}
|
119 |
-
|
120 |
-
if (empty($rate_filter)) {
|
121 |
-
$error['rate_filter'] = 'rate_filter error';
|
122 |
-
}
|
123 |
-
|
124 |
-
foreach ($items_ as $item) {
|
125 |
-
|
126 |
-
if($this->checkItem($item)) {
|
127 |
-
$error['items'][] = $this->checkItem($item);
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
-
return $error;
|
132 |
-
}
|
133 |
-
|
134 |
-
public function checkItem($item) {
|
135 |
-
$product_name = Mage::getModel('catalog/product')->load($item['product_id'])->getName();
|
136 |
-
|
137 |
-
if(empty($item['width'])) return $product_name . " doesn't have width";
|
138 |
-
if(empty($item['length'])) return $product_name . " doesn't have length";
|
139 |
-
if(empty($item['height'])) return $product_name . " doesn't have height";
|
140 |
-
if(empty($item['quantity'])) return $product_name . " doesn't have quantity";
|
141 |
-
if(empty($item['packed'])) return $product_name . " doesn't have packed";
|
142 |
-
if(empty($item['id'])) return $product_name . " doesn't have product type id";
|
143 |
-
|
144 |
-
return null;
|
145 |
-
}
|
146 |
-
|
147 |
-
public function discountPercentage($price) {
|
148 |
-
$discountPercentage = Mage::getStoreConfig('carriers/shiphawk_shipping/discount_percentage');
|
149 |
-
|
150 |
-
if(!empty($discountPercentage)) {
|
151 |
-
$price = $price + ($price * ($discountPercentage/100));
|
152 |
-
}
|
153 |
-
|
154 |
-
|
155 |
-
return $price;
|
156 |
-
}
|
157 |
-
|
158 |
-
public function discountFixed($price) {
|
159 |
-
$discountFixed = Mage::getStoreConfig('carriers/shiphawk_shipping/discount_fixed');
|
160 |
-
if(!empty($discountFixed)) {
|
161 |
-
$price = $price + ($discountFixed);
|
162 |
-
}
|
163 |
-
|
164 |
-
return $price;
|
165 |
-
}
|
166 |
-
|
167 |
-
public function getDiscountShippingPrice($price) {
|
168 |
-
$price = $this->discountPercentage($price);
|
169 |
-
$price = $this->discountFixed($price);
|
170 |
-
|
171 |
-
if($price <= 0) {
|
172 |
-
return 0;
|
173 |
-
}
|
174 |
-
return $price;
|
175 |
-
}
|
176 |
-
|
177 |
-
public function getOriginalShipHawkShippingPrice($shipping_code, $shipping_method_value) {
|
178 |
-
$result = strpos($shipping_code, $shipping_method_value);
|
179 |
-
return $result;
|
180 |
-
}
|
181 |
-
|
182 |
-
public function checkShipHawkOriginAttributes($product) {
|
183 |
-
|
184 |
-
$required_origins_attributes = array('shiphawk_origin_firstname', 'shiphawk_origin_lastname', 'shiphawk_origin_addressline1', 'shiphawk_origin_city', 'shiphawk_origin_state', 'shiphawk_origin_zipcode', 'shiphawk_origin_phonenum', 'shiphawk_origin_location');
|
185 |
-
|
186 |
-
foreach($required_origins_attributes as $attribute_code) {
|
187 |
-
$attribute_value = $product->getData($attribute_code);
|
188 |
-
if(empty($attribute_value)) {
|
189 |
-
return false;
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
-
return true;
|
194 |
-
}
|
195 |
-
|
196 |
-
/**
|
197 |
-
* @param $object Object of rate response
|
198 |
-
* @param null $opt_to_self_pack "Opt to Self Pack" from settings
|
199 |
-
* @param null $charge_customer_for_packing
|
200 |
-
* @param null $custom_packing_price "Custom Packing Prices?" from settings
|
201 |
-
* @param null $custom_packing_price_amount Sum of custom prices for product packaging
|
202 |
-
* @return mixed
|
203 |
-
*/
|
204 |
-
|
205 |
-
public function getSummaryPrice($object, $opt_to_self_pack = null, $charge_customer_for_packing = null, $custom_packing_price = null, $custom_packing_price_amount = null) {
|
206 |
-
|
207 |
-
if(!$opt_to_self_pack) {
|
208 |
-
return $object->shipping->price + $object->packing->price + $object->pickup->price + $object->delivery->price + $object->insurance->price;
|
209 |
-
}else{
|
210 |
-
if (( $opt_to_self_pack == 1) && ($custom_packing_price == 1)) {
|
211 |
-
|
212 |
-
if($this->ChargeCustomerForPacking($opt_to_self_pack, $charge_customer_for_packing) == false) {
|
213 |
-
return $object->shipping->price + $object->delivery->price + $object->insurance->price;
|
214 |
-
}
|
215 |
-
|
216 |
-
return $object->shipping->price + $object->delivery->price + $object->insurance->price + $custom_packing_price_amount;
|
217 |
-
|
218 |
-
}else{
|
219 |
-
if($this->ChargeCustomerForPacking($opt_to_self_pack, $charge_customer_for_packing) == false) {
|
220 |
-
return $object->shipping->price + $object->delivery->price + $object->insurance->price;
|
221 |
-
}
|
222 |
-
|
223 |
-
|
224 |
-
}
|
225 |
-
return $object->shipping->price + $object->packing->price + $object->pickup->price + $object->delivery->price + $object->insurance->price;
|
226 |
-
|
227 |
-
}
|
228 |
-
|
229 |
-
}
|
230 |
-
|
231 |
-
public function getShipHawkPrice($object, $opt_to_self_pack = null, $charge_customer_for_packing = null) {
|
232 |
-
|
233 |
-
if(!$opt_to_self_pack) {
|
234 |
-
return $object->shipping->price + $object->packing->price + $object->pickup->price + $object->delivery->price + $object->insurance->price;
|
235 |
-
}else{
|
236 |
-
|
237 |
-
return $object->shipping->price + $object->delivery->price + $object->insurance->price;
|
238 |
-
|
239 |
-
}
|
240 |
-
|
241 |
-
}
|
242 |
-
|
243 |
-
public function ChargeCustomerForPacking($opt_to_self_pack = null, $charge_customer_for_packing = null) {
|
244 |
-
|
245 |
-
$opt_to_self_pack = ($opt_to_self_pack === null) ? Mage::getStoreConfig('carriers/shiphawk_shipping/opt_to_self_pack') : $opt_to_self_pack;
|
246 |
-
|
247 |
-
$charge_customer_for_packing = ($charge_customer_for_packing === null) ? Mage::getStoreConfig('carriers/shiphawk_shipping/charge_customer_for_packing') : $charge_customer_for_packing;
|
248 |
-
|
249 |
-
if(($opt_to_self_pack == 1)) {
|
250 |
-
return $charge_customer_for_packing;
|
251 |
-
}
|
252 |
-
|
253 |
-
return false;
|
254 |
-
}
|
255 |
-
|
256 |
-
public function getCustomPackingPriceSumm($items) {
|
257 |
-
$packing_summ = 0;
|
258 |
-
foreach($items as $item) {
|
259 |
-
if(isset($item['shiphawk_custom_packing_price']))
|
260 |
-
$packing_summ += $item['shiphawk_custom_packing_price']*$item['quantity'];
|
261 |
-
}
|
262 |
-
|
263 |
-
return $packing_summ;
|
264 |
-
}
|
265 |
-
|
266 |
-
public function getSelfPacked() {
|
267 |
-
$opt_to_self_pack = Mage::getStoreConfig('carriers/shiphawk_shipping/opt_to_self_pack');
|
268 |
-
$charge_customer_for_packing = Mage::getStoreConfig('carriers/shiphawk_shipping/charge_customer_for_packing');
|
269 |
-
|
270 |
-
/* if(($opt_to_self_pack == 1) && ($charge_customer_for_packing == 1)) {
|
271 |
-
return 0;
|
272 |
-
}*/
|
273 |
-
|
274 |
-
return $opt_to_self_pack;
|
275 |
-
}
|
276 |
-
|
277 |
-
public function getBOLurl($shipment_id) {
|
278 |
-
|
279 |
-
$api_key = $this->getApiKey();
|
280 |
-
|
281 |
-
$bol_url = $this->getApiUrl() . 'shipments/' . $shipment_id . '/bol?api_key=' . $api_key;
|
282 |
-
|
283 |
-
$curl = curl_init();
|
284 |
-
|
285 |
-
curl_setopt($curl, CURLOPT_URL, $bol_url);
|
286 |
-
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
|
287 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
288 |
-
|
289 |
-
$resp = curl_exec($curl);
|
290 |
-
$arr_res = json_decode($resp);
|
291 |
-
|
292 |
-
return $arr_res;
|
293 |
-
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* For get shipping price with personal product shipping discount
|
298 |
-
*
|
299 |
-
* @param $price
|
300 |
-
* @param $orderData
|
301 |
-
* @return int
|
302 |
-
*
|
303 |
-
* @version 20150706
|
304 |
-
*/
|
305 |
-
public function getTotalDiscountShippingPrice($price, $orderData) {
|
306 |
-
$items = $orderData['items'];
|
307 |
-
$result = 0;
|
308 |
-
|
309 |
-
if (empty($items)) {
|
310 |
-
return $result;
|
311 |
-
}
|
312 |
-
|
313 |
-
$productModel = Mage::getModel('catalog/product');
|
314 |
-
|
315 |
-
// if one items in pack get discount from product, if it empty then for sys. config
|
316 |
-
if (count($items) == 1) {
|
317 |
-
$product = $productModel->load($items[0]['product_id']);
|
318 |
-
$shiphawkDiscountPercentage = $product->getShiphawkDiscountPercentage();
|
319 |
-
$shiphawkDiscountFixed = $product->getShiphawkDiscountFixed();
|
320 |
-
|
321 |
-
if (empty($shiphawkDiscountPercentage) && empty($shiphawkDiscountFixed)) {
|
322 |
-
return $this->getDiscountShippingPrice($price);
|
323 |
-
}
|
324 |
-
|
325 |
-
$result = $price + ($price * ($shiphawkDiscountPercentage/100));
|
326 |
-
$result = $result + ($shiphawkDiscountFixed);
|
327 |
-
|
328 |
-
if($result <= 0) {
|
329 |
-
return 0;
|
330 |
-
}
|
331 |
-
} else {
|
332 |
-
$discount_arr = array();
|
333 |
-
foreach($items as $item) {
|
334 |
-
$product = $productModel->load($item['product_id']);
|
335 |
-
$shiphawkDiscountPercentage = $product->getShiphawkDiscountPercentage();
|
336 |
-
$shiphawkDiscountFixed = $product->getShiphawkDiscountFixed();
|
337 |
-
|
338 |
-
if (empty($shiphawkDiscountFixed) && empty($shiphawkDiscountPercentage)) {
|
339 |
-
$discount_arr['empty_val'] = array('percentage' => 0, 'fixed' => 0);
|
340 |
-
} else {
|
341 |
-
$discount_arr[$shiphawkDiscountPercentage . '_' . $shiphawkDiscountFixed] = array(
|
342 |
-
'percentage' => $shiphawkDiscountPercentage,
|
343 |
-
'fixed' => $shiphawkDiscountFixed
|
344 |
-
);
|
345 |
-
}
|
346 |
-
}
|
347 |
-
|
348 |
-
if (count($discount_arr) == 1 && !empty($discount_arr['empty_val'])) {
|
349 |
-
return $this->getDiscountShippingPrice($price);
|
350 |
-
}
|
351 |
-
|
352 |
-
if (count($discount_arr) > 1) {
|
353 |
-
return $price;
|
354 |
-
}
|
355 |
-
|
356 |
-
foreach($discount_arr as $discount) {
|
357 |
-
$result = $price + ($price * ($discount['percentage']/100));
|
358 |
-
$result = $result + ($discount['fixed']);
|
359 |
-
break;
|
360 |
-
}
|
361 |
-
}
|
362 |
-
|
363 |
-
return $result;
|
364 |
-
}
|
365 |
-
|
366 |
-
public function getProductCarrierType($product) {
|
367 |
-
$carrier_types = explode(',', $product->getShiphawkCarrierType());
|
368 |
-
|
369 |
-
$attr = Mage::getModel('catalog/product')->getResource()->getAttribute('shiphawk_carrier_type');
|
370 |
-
$carrier_types_labels = array();
|
371 |
-
|
372 |
-
foreach($carrier_types as $carrier_type) {
|
373 |
-
if ($attr->usesSource()) {
|
374 |
-
$carrier_types_label = $attr->getSource()->getOptionText($carrier_type);
|
375 |
-
|
376 |
-
if(($carrier_types_label == 'All')||(!$carrier_types_label)) {
|
377 |
-
return '';
|
378 |
-
}
|
379 |
-
|
380 |
-
$carrier_types_labels[] = $carrier_types_label;
|
381 |
-
}
|
382 |
-
}
|
383 |
-
|
384 |
-
return implode(",", $carrier_types_labels);
|
385 |
-
|
386 |
-
}
|
387 |
-
|
388 |
-
public function getProductDiscountMarkupPrice($shipping_price, $shiphawk_discount_percentage, $shiphawk_discount_fixed) {
|
389 |
-
|
390 |
-
if(!empty($shiphawk_discount_percentage)) {
|
391 |
-
$shipping_price = $shipping_price + ($shipping_price * ($shiphawk_discount_percentage/100));
|
392 |
-
}
|
393 |
-
|
394 |
-
if(!empty($shiphawk_discount_fixed)) {
|
395 |
-
$shipping_price = $shipping_price + ($shiphawk_discount_fixed);
|
396 |
-
}
|
397 |
-
|
398 |
-
if($shipping_price <= 0) {
|
399 |
-
return 0;
|
400 |
-
}
|
401 |
-
|
402 |
-
return $shipping_price;
|
403 |
-
}
|
404 |
-
|
405 |
-
public function shlog($var, $file = 'shiphawk-error.log') {
|
406 |
-
$enable_log = Mage::getStoreConfig('carriers/shiphawk_shipping/enable_log');
|
407 |
-
|
408 |
-
if($enable_log == 1) {
|
409 |
-
Mage::log($var, null, $file);
|
410 |
-
}
|
411 |
-
}
|
412 |
-
|
413 |
-
public function sendErrorMessageToShipHawk($error_text) {
|
414 |
-
$enable_log = Mage::getStoreConfig('carriers/shiphawk_shipping/enable_log');
|
415 |
-
$enable_sending_message = Mage::getStoreConfig('carriers/shiphawk_shipping/email_error_to_shiphawk');
|
416 |
-
|
417 |
-
if(($enable_log == 1)&&($enable_sending_message == 1)) {
|
418 |
-
|
419 |
-
$this->sendMailToShiphawk($error_text);
|
420 |
-
|
421 |
-
}
|
422 |
-
}
|
423 |
-
|
424 |
-
public function sendMailToShiphawk($shiphawk_error_log) {
|
425 |
-
$template_id = 'shiphawk_error_email';
|
426 |
-
$shiphawk_api_key = $this->getApiKey();
|
427 |
-
|
428 |
-
$email_to = 'extensionslog@shiphawk.com';
|
429 |
-
|
430 |
-
$email_template = Mage::getModel('core/email_template')->loadDefault($template_id);
|
431 |
-
|
432 |
-
$email_template_variables = array(
|
433 |
-
'shiphawk_error_log' => $shiphawk_error_log,
|
434 |
-
'shiphawk_api_key' => $shiphawk_api_key
|
435 |
-
);
|
436 |
-
|
437 |
-
|
438 |
-
$sender_name = 'store owner';
|
439 |
-
|
440 |
-
$sender_email = Mage::getStoreConfig('trans_email/ident_general/email');
|
441 |
-
$email_template->setSenderName('Store Owner');
|
442 |
-
$email_template->setSenderEmail($sender_email);
|
443 |
-
|
444 |
-
$email_template->send($email_to, $sender_name, $email_template_variables);
|
445 |
-
|
446 |
-
}
|
447 |
-
|
448 |
-
public function getAccessoriesPrice($accessoriesPriceData) {
|
449 |
-
$accessoriesPrice = 0;
|
450 |
-
|
451 |
-
if(!empty($accessoriesPriceData)) {
|
452 |
-
foreach($accessoriesPriceData as $typeName => $type) {
|
453 |
-
foreach($type as $name => $values) {
|
454 |
-
foreach($values as $key => $value) {
|
455 |
-
|
456 |
-
$accessoriesPrice += (float)$value;
|
457 |
-
}
|
458 |
-
}
|
459 |
-
}
|
460 |
-
}
|
461 |
-
|
462 |
-
return $accessoriesPrice;
|
463 |
-
}
|
464 |
-
|
465 |
-
public function checkIsItCartPage() {
|
466 |
-
$request = Mage::app()->getFrontController()->getRequest();
|
467 |
-
$module = $request->getModuleName();
|
468 |
-
$controller = $request->getControllerName();
|
469 |
-
$action = $request->getActionName();
|
470 |
-
|
471 |
-
if($module == 'checkout' && $controller == 'cart' && $action == 'index')
|
472 |
-
{
|
473 |
-
return true;
|
474 |
-
}
|
475 |
-
|
476 |
-
return false;
|
477 |
-
}
|
478 |
-
|
479 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Helper/Origin.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Shiphawk_Shipping_Helper_Origin extends
|
4 |
-
Mage_Core_Helper_Abstract
|
5 |
-
{
|
6 |
-
/**
|
7 |
-
* Contains current collection
|
8 |
-
* @var string
|
9 |
-
*/
|
10 |
-
protected $_list = null;
|
11 |
-
|
12 |
-
public function __construct()
|
13 |
-
{
|
14 |
-
$collection = Mage::getModel('shiphawk_shipping/origins')->getCollection()
|
15 |
-
;
|
16 |
-
|
17 |
-
$this->setList($collection);
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Sets current collection
|
22 |
-
* @param $query
|
23 |
-
*/
|
24 |
-
public function setList($collection)
|
25 |
-
{
|
26 |
-
$this->_list = $collection;
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Returns indexes of the fetched array as headers for CSV
|
31 |
-
* @param array $products
|
32 |
-
* @return array
|
33 |
-
*/
|
34 |
-
protected function _getCsvHeaders($questions)
|
35 |
-
{
|
36 |
-
$question = current($questions);
|
37 |
-
$headers = array_keys($question->getData());
|
38 |
-
|
39 |
-
return $headers;
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Generates CSV file with items's list according to the collection in the $this->_list
|
44 |
-
* @return array
|
45 |
-
*/
|
46 |
-
public function generateQuestList()
|
47 |
-
{
|
48 |
-
if (!is_null($this->_list)) {
|
49 |
-
$items = $this->_list->getItems();
|
50 |
-
if (count($items) > 0) {
|
51 |
-
|
52 |
-
$io = new Varien_Io_File();
|
53 |
-
$path = Mage::getBaseDir('var') . DS . 'export' . DS;
|
54 |
-
$name = md5(microtime());
|
55 |
-
$file = $path . DS . $name . '.csv';
|
56 |
-
$io->setAllowCreateFolders(true);
|
57 |
-
$io->open(array('path' => $path));
|
58 |
-
$io->streamOpen($file, 'w+');
|
59 |
-
$io->streamLock(true);
|
60 |
-
|
61 |
-
$io->streamWriteCsv($this->_getCsvHeaders($items));
|
62 |
-
foreach ($items as $question) {
|
63 |
-
$io->streamWriteCsv($question->getData());
|
64 |
-
}
|
65 |
-
|
66 |
-
return array(
|
67 |
-
'type' => 'filename',
|
68 |
-
'value' => $file,
|
69 |
-
'rm' => true // can delete file after use
|
70 |
-
);
|
71 |
-
}
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Api.php
DELETED
@@ -1,592 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Api extends Mage_Core_Model_Abstract
|
3 |
-
{
|
4 |
-
public function getShiphawkRate($from_zip, $to_zip, $items, $rate_filter, $carrier_type, $location_type, $shLocationType) {
|
5 |
-
|
6 |
-
$helper = Mage::helper('shiphawk_shipping');
|
7 |
-
$api_key = $helper->getApiKey();
|
8 |
-
//$url_api_rates = $helper->getApiUrl() . 'rates/full?api_key=' . $api_key;
|
9 |
-
$url_api_rates = $helper->getApiUrl() . 'rates?api_key=' . $api_key;
|
10 |
-
|
11 |
-
$curl = curl_init();
|
12 |
-
|
13 |
-
if($carrier_type == '') {
|
14 |
-
$items_array = array(
|
15 |
-
'from_zip'=> $from_zip,
|
16 |
-
'to_zip'=> $to_zip,
|
17 |
-
'rate_filter' => $rate_filter,
|
18 |
-
'items' => $items,
|
19 |
-
'from_type' => $location_type,
|
20 |
-
'to_type' => $shLocationType,
|
21 |
-
);
|
22 |
-
}else{
|
23 |
-
$items_array = array(
|
24 |
-
'from_zip'=> $from_zip,
|
25 |
-
'to_zip'=> $to_zip,
|
26 |
-
'rate_filter' => $rate_filter,
|
27 |
-
'carrier_type' => $carrier_type,
|
28 |
-
'items' => $items,
|
29 |
-
'from_type' => $location_type,
|
30 |
-
'to_type' => $shLocationType,
|
31 |
-
);
|
32 |
-
}
|
33 |
-
|
34 |
-
$items_array = json_encode($items_array);
|
35 |
-
|
36 |
-
curl_setopt($curl, CURLOPT_URL, $url_api_rates);
|
37 |
-
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
|
38 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $items_array);
|
39 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
40 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
|
41 |
-
'Content-Type: application/json',
|
42 |
-
'Content-Length: ' . strlen($items_array)
|
43 |
-
)
|
44 |
-
);
|
45 |
-
|
46 |
-
$resp = curl_exec($curl);
|
47 |
-
|
48 |
-
$arr_res = json_decode($resp);
|
49 |
-
|
50 |
-
curl_close($curl);
|
51 |
-
return $arr_res;
|
52 |
-
}
|
53 |
-
|
54 |
-
public function toBook($order, $rate_id, $products_ids, $accessories = array(), $is_auto = false, $self_packed, $is_rerate = null)
|
55 |
-
{
|
56 |
-
$ship_addr = $order->getShippingAddress()->getData();
|
57 |
-
$bill_addr = $order->getBillingAddress()->getData();
|
58 |
-
$order_increment_id = $order->getIncrementId();
|
59 |
-
$helper = Mage::helper('shiphawk_shipping');
|
60 |
-
|
61 |
-
$api_key = Mage::helper('shiphawk_shipping')->getApiKey();
|
62 |
-
$api_url = Mage::helper('shiphawk_shipping')->getApiUrl();
|
63 |
-
$url_api = $api_url . 'shipments?api_key=' . $api_key;
|
64 |
-
|
65 |
-
$self_packed = $self_packed ? 'true' : 'false';
|
66 |
-
|
67 |
-
/* get shiphawk origin data from first product, because products are grouped by origin (or by zip code) and have same address */
|
68 |
-
$origin_product = Mage::getModel('catalog/product')->load($products_ids['product_ids'][0]);
|
69 |
-
$per_product = Mage::helper('shiphawk_shipping')->checkShipHawkOriginAttributes($origin_product);
|
70 |
-
$origin_address_product = $this->_getProductOriginData($products_ids['product_ids'][0], $per_product);
|
71 |
-
/* */
|
72 |
-
|
73 |
-
$curl = curl_init();
|
74 |
-
|
75 |
-
$default_origin_address = $this->_getDefaultOriginData();
|
76 |
-
|
77 |
-
$order_email = $ship_addr['email'];
|
78 |
-
|
79 |
-
if (Mage::getStoreConfig('carriers/shiphawk_shipping/order_received') == 1) {
|
80 |
-
$administrator_email = Mage::getStoreConfig('carriers/shiphawk_shipping/administrator_email');
|
81 |
-
$order_email = ($administrator_email) ? $administrator_email : $ship_addr['email'];
|
82 |
-
}
|
83 |
-
|
84 |
-
$origin_address = (empty($origin_address_product)) ? $default_origin_address : $origin_address_product;
|
85 |
-
|
86 |
-
/* For accessories */
|
87 |
-
$orderAccessories = $order->getShiphawkShippingAccessories();
|
88 |
-
|
89 |
-
if ($is_auto) {
|
90 |
-
$orderAccessories = json_decode($orderAccessories, true);
|
91 |
-
if($is_rerate) {
|
92 |
-
|
93 |
-
foreach($accessories as $orderAccessoriesType => $orderAccessor) {
|
94 |
-
foreach($orderAccessor as $key => $orderAccessorValues) {
|
95 |
-
$itemsAccessories[] = array('id' => str_replace("'", '', $key));
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}else{
|
99 |
-
foreach($orderAccessories as $orderAccessoriesType => $orderAccessor) {
|
100 |
-
foreach($orderAccessor as $key => $orderAccessorValues) {
|
101 |
-
$itemsAccessories[] = array('id' => str_replace("'", '', $key));
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
} else {
|
106 |
-
$itemsAccessories = $this->getAccessoriesForBook($accessories, $orderAccessories);
|
107 |
-
}
|
108 |
-
|
109 |
-
$next_bussines_day = date('Y-m-d', strtotime('now +1 Weekday'));
|
110 |
-
$items_array = array(
|
111 |
-
'rate_id'=> $rate_id,
|
112 |
-
'order_email'=> $order_email,
|
113 |
-
'xid'=>$order_increment_id,
|
114 |
-
'self_packed'=>$self_packed,
|
115 |
-
'insurance'=>'true',
|
116 |
-
'origin_address' =>
|
117 |
-
$origin_address,
|
118 |
-
'destination_address' =>
|
119 |
-
array(
|
120 |
-
'first_name' => $ship_addr['firstname'],
|
121 |
-
'last_name' => $ship_addr['lastname'],
|
122 |
-
'street1' => $ship_addr['street'],
|
123 |
-
'phone_number' => $ship_addr['telephone'],
|
124 |
-
'city' => $ship_addr['city'],
|
125 |
-
'state' => $ship_addr['region'],
|
126 |
-
'zip' => $ship_addr['postcode'],
|
127 |
-
'email' => $ship_addr['email']
|
128 |
-
),
|
129 |
-
'billing_address' =>
|
130 |
-
array(
|
131 |
-
'first_name' => $bill_addr['firstname'],
|
132 |
-
'last_name' => $bill_addr['lastname'],
|
133 |
-
'street1' => $bill_addr['street'],
|
134 |
-
'phone_number' => $bill_addr['telephone'],
|
135 |
-
'city' => $bill_addr['city'],
|
136 |
-
'state' => $bill_addr['region'], //'NY',
|
137 |
-
'zip' => $bill_addr['postcode'],
|
138 |
-
'email' => $bill_addr['email']
|
139 |
-
),
|
140 |
-
'pickup' =>
|
141 |
-
array(
|
142 |
-
array(
|
143 |
-
'start_time' => $next_bussines_day.'T04:00:00.645-07:00',
|
144 |
-
'end_time' => $next_bussines_day.'T20:00:00.645-07:00',
|
145 |
-
),
|
146 |
-
array(
|
147 |
-
'start_time' => $next_bussines_day.'T04:00:00.645-07:00',
|
148 |
-
'end_time' => $next_bussines_day.'T20:00:00.646-07:00',
|
149 |
-
)
|
150 |
-
),
|
151 |
-
|
152 |
-
'accessorials' => $itemsAccessories
|
153 |
-
|
154 |
-
);
|
155 |
-
|
156 |
-
|
157 |
-
$helper->shlog($items_array, 'shiphawk-book.log');
|
158 |
-
|
159 |
-
$items_array = json_encode($items_array);
|
160 |
-
|
161 |
-
curl_setopt($curl, CURLOPT_URL, $url_api);
|
162 |
-
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
|
163 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $items_array);
|
164 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
165 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
|
166 |
-
'Content-Type: application/json',
|
167 |
-
'Content-Length: ' . strlen($items_array)
|
168 |
-
)
|
169 |
-
);
|
170 |
-
|
171 |
-
$resp = curl_exec($curl);
|
172 |
-
$arr_res = json_decode($resp);
|
173 |
-
|
174 |
-
//$helper->shlog($arr_res, 'shiphawk-book.log');
|
175 |
-
|
176 |
-
curl_close($curl);
|
177 |
-
|
178 |
-
return $arr_res;
|
179 |
-
|
180 |
-
}
|
181 |
-
|
182 |
-
protected function _getDefaultOriginData() {
|
183 |
-
$origin_address = array();
|
184 |
-
|
185 |
-
$origin_address['first_name'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_first_name');
|
186 |
-
$origin_address['last_name'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_last_name');
|
187 |
-
$origin_address['street1'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_address');
|
188 |
-
$origin_address['street2'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_address2');
|
189 |
-
$origin_address['state'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_state');
|
190 |
-
$origin_address['city'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_city');
|
191 |
-
$origin_address['zip'] = Mage::getStoreConfig('carriers/shiphawk_shipping/default_origin');
|
192 |
-
$origin_address['phone_number'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_phone');
|
193 |
-
$origin_address['email'] = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_email');
|
194 |
-
|
195 |
-
return $origin_address;
|
196 |
-
}
|
197 |
-
|
198 |
-
protected function _getProductOriginData($products_id, $per_product = false) {
|
199 |
-
$origin_address_product = array();
|
200 |
-
|
201 |
-
try
|
202 |
-
{
|
203 |
-
// get first product item
|
204 |
-
$origin_product = Mage::getModel('catalog/product')->load($products_id);
|
205 |
-
|
206 |
-
$shipping_origin_id = $origin_product->getData('shiphawk_shipping_origins');
|
207 |
-
$helper = Mage::helper('shiphawk_shipping');
|
208 |
-
|
209 |
-
|
210 |
-
/* if product origin id == default (origin id == '') and product have all per product origin attribute
|
211 |
-
than get origin address from first product in origin group */
|
212 |
-
if($per_product == true) {
|
213 |
-
|
214 |
-
$origin_address_product['first_name'] = $origin_product->getData('shiphawk_origin_firstname');
|
215 |
-
$origin_address_product['last_name'] = $origin_product->getData('shiphawk_origin_lastname');
|
216 |
-
$origin_address_product['street1'] = $origin_product->getData('shiphawk_origin_addressline1');
|
217 |
-
$origin_address_product['street2'] = $origin_product->getData('shiphawk_origin_addressline2');
|
218 |
-
$origin_address_product['state'] = $origin_product->getData('shiphawk_origin_state');
|
219 |
-
$origin_address_product['city'] = $origin_product->getData('shiphawk_origin_city');
|
220 |
-
$origin_address_product['zip'] = $origin_product->getData('shiphawk_origin_zipcode');
|
221 |
-
$origin_address_product['phone_number'] = $origin_product->getData('shiphawk_origin_phonenum');
|
222 |
-
$origin_address_product['email'] = $origin_product->getData('shiphawk_origin_email');
|
223 |
-
}else{
|
224 |
-
if($shipping_origin_id) {
|
225 |
-
/* if product have origin id, then get origin address from origin model */
|
226 |
-
$shipping_origin = Mage::getModel('shiphawk_shipping/origins')->load($shipping_origin_id);
|
227 |
-
|
228 |
-
$origin_address_product['first_name'] = $shipping_origin->getData('shiphawk_origin_firstname');
|
229 |
-
$origin_address_product['last_name'] = $shipping_origin->getData('shiphawk_origin_lastname');
|
230 |
-
$origin_address_product['street1'] = $shipping_origin->getData('shiphawk_origin_addressline1');
|
231 |
-
$origin_address_product['street2'] = $shipping_origin->getData('shiphawk_origin_addressline2');
|
232 |
-
$origin_address_product['state'] = $shipping_origin->getData('shiphawk_origin_state');
|
233 |
-
$origin_address_product['city'] = $shipping_origin->getData('shiphawk_origin_city');
|
234 |
-
$origin_address_product['zip'] = $shipping_origin->getData('shiphawk_origin_zipcode');
|
235 |
-
$origin_address_product['phone_number'] = $shipping_origin->getData('shiphawk_origin_phonenum');
|
236 |
-
$origin_address_product['email'] = $shipping_origin->getData('shiphawk_origin_email');
|
237 |
-
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
-
}
|
242 |
-
catch(Exception $e)
|
243 |
-
{
|
244 |
-
Mage::log($e->getMessage());
|
245 |
-
}
|
246 |
-
|
247 |
-
return $origin_address_product;
|
248 |
-
}
|
249 |
-
|
250 |
-
protected function getOriginAddress($origin_address_product, $default_origin_address) {
|
251 |
-
|
252 |
-
|
253 |
-
foreach($origin_address_product as $key=>$value) {
|
254 |
-
|
255 |
-
if($key != 'origin_address2') {
|
256 |
-
if(empty($value)) {
|
257 |
-
return $default_origin_address;
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
return $origin_address_product;
|
263 |
-
|
264 |
-
}
|
265 |
-
|
266 |
-
|
267 |
-
/**
|
268 |
-
* Auto booking. Save shipment in sales_order_place_after event, if manual booking set to No
|
269 |
-
* We can save only new shipment. Existing shipments are not editable
|
270 |
-
*
|
271 |
-
*
|
272 |
-
*/
|
273 |
-
public function saveshipment($orderId)
|
274 |
-
{
|
275 |
-
try {
|
276 |
-
$order = Mage::getModel('sales/order')->load($orderId);
|
277 |
-
$helper = Mage::helper('shiphawk_shipping');
|
278 |
-
|
279 |
-
$shiphawk_rate_data = unserialize($order->getData('shiphawk_book_id')); //rate id
|
280 |
-
|
281 |
-
foreach($shiphawk_rate_data as $rate_id=>$products_ids) {
|
282 |
-
$shipment = $this->_initShipHawkShipment($order,$products_ids);
|
283 |
-
|
284 |
-
$shipment->register();
|
285 |
-
|
286 |
-
$this->_saveShiphawkShipment($shipment, $products_ids['name'], $products_ids['price']);
|
287 |
-
|
288 |
-
$self_pack = $products_ids['self_pack'];
|
289 |
-
|
290 |
-
// add book, auto booking - true
|
291 |
-
$track_data = $this->toBook($order, $rate_id, $products_ids, array(), true, $self_pack);
|
292 |
-
|
293 |
-
$helper->shlog($track_data, 'shiphawk-book-response.log');
|
294 |
-
|
295 |
-
if (property_exists($track_data, 'error')) {
|
296 |
-
Mage::getSingleton('core/session')->addError("The booking was not successful, please try again later.");
|
297 |
-
//Mage::getSingleton('core/session')->addError($track_data->error);
|
298 |
-
$helper->shlog('ShipHawk response: '.$track_data->error);
|
299 |
-
return;
|
300 |
-
}
|
301 |
-
|
302 |
-
// add track
|
303 |
-
if($track_number = $track_data->details->id) {
|
304 |
-
$this->addTrackNumber($shipment, $track_number);
|
305 |
-
// subscribe automaticaly after book
|
306 |
-
$this->subscribeToTrackingInfo($shipment->getId());
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
} catch (Mage_Core_Exception $e) {
|
311 |
-
|
312 |
-
Mage::logException($e);
|
313 |
-
|
314 |
-
} catch (Exception $e) {
|
315 |
-
Mage::logException($e);
|
316 |
-
}
|
317 |
-
}
|
318 |
-
|
319 |
-
/**
|
320 |
-
* Initialize shipment model instance
|
321 |
-
*
|
322 |
-
* @return Mage_Sales_Model_Order_Shipment|bool
|
323 |
-
*/
|
324 |
-
public function _initShipHawkShipment($order, $products_ids)
|
325 |
-
{
|
326 |
-
$shipment = false;
|
327 |
-
if(is_object($order)) {
|
328 |
-
|
329 |
-
$savedQtys = $this->_getItems($order, $products_ids);
|
330 |
-
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($savedQtys);
|
331 |
-
}
|
332 |
-
|
333 |
-
return $shipment;
|
334 |
-
}
|
335 |
-
|
336 |
-
public function _getItems($order, $products_ids) {
|
337 |
-
$qty = array();
|
338 |
-
if(is_object($order)) {
|
339 |
-
foreach($order->getAllItems() as $eachOrderItem){
|
340 |
-
|
341 |
-
if(in_array($eachOrderItem->getProductId(),$products_ids['product_ids'])) {
|
342 |
-
$Itemqty = 0;
|
343 |
-
$Itemqty = $eachOrderItem->getQtyOrdered()
|
344 |
-
- $eachOrderItem->getQtyShipped()
|
345 |
-
- $eachOrderItem->getQtyRefunded()
|
346 |
-
- $eachOrderItem->getQtyCanceled();
|
347 |
-
$qty[$eachOrderItem->getId()] = $Itemqty;
|
348 |
-
}else{
|
349 |
-
$qty[$eachOrderItem->getId()] = 0;
|
350 |
-
}
|
351 |
-
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
return $qty;
|
356 |
-
}
|
357 |
-
|
358 |
-
/**
|
359 |
-
* Save shipment and order in one transaction
|
360 |
-
*
|
361 |
-
* @param Mage_Sales_Model_Order_Shipment $shipment
|
362 |
-
* @return Mage_Adminhtml_Sales_Order_ShipmentController
|
363 |
-
*/
|
364 |
-
public function _saveShiphawkShipment($shipment, $shiphawk_shipment_title = null, $shiphawk_shipment_price = null)
|
365 |
-
{
|
366 |
-
$shipment->getOrder()->setIsInProcess(true);
|
367 |
-
$shipment->setShiphawkShippingMethodTitle($shiphawk_shipment_title);
|
368 |
-
$shipment->setShiphawkShippingPrice($shiphawk_shipment_price);
|
369 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
370 |
-
->addObject($shipment)
|
371 |
-
->addObject($shipment->getOrder())
|
372 |
-
->save();
|
373 |
-
|
374 |
-
return $this;
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Add new tracking number action
|
379 |
-
*/
|
380 |
-
public function addTrackNumber($shipment, $number)
|
381 |
-
{
|
382 |
-
try {
|
383 |
-
$carrier = 'shiphawk_shipping';
|
384 |
-
$helper = Mage::helper('shiphawk_shipping');
|
385 |
-
$title = 'ShipHawk Shipping';
|
386 |
-
if (empty($carrier)) {
|
387 |
-
Mage::throwException($this->__('The carrier needs to be specified.'));
|
388 |
-
}
|
389 |
-
if (empty($number)) {
|
390 |
-
Mage::throwException($this->__('Tracking number cannot be empty.'));
|
391 |
-
}
|
392 |
-
|
393 |
-
if ($shipment) {
|
394 |
-
$track = Mage::getModel('sales/order_shipment_track')
|
395 |
-
->setNumber($number)
|
396 |
-
->setCarrierCode($carrier)
|
397 |
-
->setTitle($title);
|
398 |
-
$shipment->addTrack($track)
|
399 |
-
->save();
|
400 |
-
|
401 |
-
} else {
|
402 |
-
$helper->shlog('Cannot initialize shipment for adding tracking number.', 'shiphawk-tracking.log');
|
403 |
-
}
|
404 |
-
} catch (Mage_Core_Exception $e) {
|
405 |
-
Mage::log($e->getMessage());
|
406 |
-
} catch (Exception $e) {
|
407 |
-
$helper = Mage::helper('shiphawk_shipping');
|
408 |
-
$helper->shlog('Cannot add tracking number.', 'shiphawk-tracking.log');
|
409 |
-
}
|
410 |
-
|
411 |
-
}
|
412 |
-
|
413 |
-
public function subscribeToTrackingInfo($shipment_id) {
|
414 |
-
|
415 |
-
$helper = Mage::helper('shiphawk_shipping');
|
416 |
-
$api_key = $helper->getApiKey();
|
417 |
-
|
418 |
-
if($shipment_id) {
|
419 |
-
try{
|
420 |
-
$shipment = Mage::getModel('sales/order_shipment')->load($shipment_id);
|
421 |
-
|
422 |
-
$shipment_id_track = $this->_getTrackNumber($shipment);
|
423 |
-
|
424 |
-
//PUT /api/v3/shipments/{id}/tracking
|
425 |
-
$subscribe_url = $helper->getApiUrl() . 'shipments/' . $shipment_id_track . '/tracking?api_key=' . $api_key;
|
426 |
-
$callback_url = $helper->getCallbackUrl($api_key);
|
427 |
-
|
428 |
-
$items_array = array(
|
429 |
-
'callback_url'=> $callback_url
|
430 |
-
);
|
431 |
-
|
432 |
-
$curl = curl_init();
|
433 |
-
$items_array = json_encode($items_array);
|
434 |
-
|
435 |
-
curl_setopt($curl, CURLOPT_URL, $subscribe_url);
|
436 |
-
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
437 |
-
curl_setopt($curl, CURLOPT_POSTFIELDS, $items_array);
|
438 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
439 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
|
440 |
-
'Content-Type: application/json',
|
441 |
-
'Content-Length: ' . strlen($items_array)
|
442 |
-
)
|
443 |
-
);
|
444 |
-
|
445 |
-
$resp = curl_exec($curl);
|
446 |
-
$arr_res = json_decode($resp);
|
447 |
-
|
448 |
-
$helper->shlog($arr_res, 'shiphawk-tracking.log');
|
449 |
-
|
450 |
-
if (!empty($arr_res)) {
|
451 |
-
$comment = '';
|
452 |
-
$event_list = '';
|
453 |
-
|
454 |
-
if (count($arr_res->events)) {
|
455 |
-
|
456 |
-
foreach ($arr_res->events as $event) {
|
457 |
-
$event_list .= $event . '<br>';
|
458 |
-
}
|
459 |
-
}
|
460 |
-
|
461 |
-
try {
|
462 |
-
|
463 |
-
$crated_time = $this->convertDateTome($arr_res->created_at);
|
464 |
-
|
465 |
-
$comment = $arr_res->resource_name . ': ' . $arr_res->id . '<br>' . 'Created: ' . $crated_time['date'] . ' at ' . $crated_time['time'] . '<br>' . $event_list;
|
466 |
-
$shipment->addComment($comment);
|
467 |
-
$shipment->sendEmail(true,$comment);
|
468 |
-
|
469 |
-
}catch (Mage_Core_Exception $e) {
|
470 |
-
Mage::logException($e);
|
471 |
-
}
|
472 |
-
|
473 |
-
}
|
474 |
-
|
475 |
-
$shipment->save();
|
476 |
-
|
477 |
-
curl_close($curl);
|
478 |
-
|
479 |
-
}catch (Mage_Core_Exception $e) {
|
480 |
-
$this->_getSession()->addError($e->getMessage());
|
481 |
-
Mage::logException($e);
|
482 |
-
|
483 |
-
} catch (Exception $e) {
|
484 |
-
Mage::logException($e);
|
485 |
-
|
486 |
-
}
|
487 |
-
|
488 |
-
}else{
|
489 |
-
|
490 |
-
Mage::logException($this->__('No ShipHawk tracking number'));
|
491 |
-
}
|
492 |
-
|
493 |
-
}
|
494 |
-
|
495 |
-
public function convertDateTome ($date_time) {
|
496 |
-
$result = array();
|
497 |
-
$t = explode('T', $date_time);
|
498 |
-
$result['date'] = date("m/d/y", strtotime($t[0]));
|
499 |
-
|
500 |
-
$result['time'] = date("g:i a", strtotime(substr($t[1], 0, -1)));
|
501 |
-
|
502 |
-
return $result;
|
503 |
-
}
|
504 |
-
|
505 |
-
protected function _getTrackNumber($shipment) {
|
506 |
-
|
507 |
-
foreach($shipment->getAllTracks() as $tracknum)
|
508 |
-
{
|
509 |
-
//ShipHawk track number only one
|
510 |
-
if($tracknum->getCarrierCode() == 'shiphawk_shipping') {
|
511 |
-
return $tracknum->getNumber();
|
512 |
-
}
|
513 |
-
}
|
514 |
-
return null;
|
515 |
-
}
|
516 |
-
|
517 |
-
public function getShipmentStatus($shipment_id_track) {
|
518 |
-
|
519 |
-
$helper = Mage::helper('shiphawk_shipping');
|
520 |
-
$api_key = $helper->getApiKey();
|
521 |
-
|
522 |
-
$subscribe_url = $helper->getApiUrl() . 'shipments/' . $shipment_id_track . '/tracking?api_key=' . $api_key;
|
523 |
-
|
524 |
-
$curl = curl_init();
|
525 |
-
|
526 |
-
curl_setopt($curl, CURLOPT_URL, $subscribe_url);
|
527 |
-
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
|
528 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
529 |
-
|
530 |
-
$resp = curl_exec($curl);
|
531 |
-
$arr_res = json_decode($resp);
|
532 |
-
|
533 |
-
return $arr_res;
|
534 |
-
|
535 |
-
}
|
536 |
-
|
537 |
-
/**
|
538 |
-
* For book shipping with accessories
|
539 |
-
*
|
540 |
-
* @param $accessories
|
541 |
-
* @param $orderAccessories
|
542 |
-
* @return array
|
543 |
-
*
|
544 |
-
* @version 20150624, WhideGroup
|
545 |
-
*/
|
546 |
-
public function getAccessoriesForBook($accessories, $orderAccessories) {
|
547 |
-
|
548 |
-
if (empty($accessories) || empty($orderAccessories)) {
|
549 |
-
return array();
|
550 |
-
}
|
551 |
-
|
552 |
-
$helper = Mage::helper('shiphawk_shipping');
|
553 |
-
|
554 |
-
$orderAccessories = json_decode($orderAccessories, true);
|
555 |
-
$itemsAccessories = array();
|
556 |
-
|
557 |
-
foreach ($accessories as $accessoriesType => $accessor) {
|
558 |
-
foreach($accessor as $accessorRow) {
|
559 |
-
foreach($orderAccessories as $orderAccessoriesType => $orderAccessor) {
|
560 |
-
foreach($orderAccessor as $orderAccessorValues) {
|
561 |
-
$orderAccessorValuesName = str_replace("'", '', $orderAccessorValues['name']);
|
562 |
-
$orderAccessorValuesName = trim($orderAccessorValuesName);
|
563 |
-
|
564 |
-
$accessorName = (string)$accessorRow->accessorial_type . ' (' . (string)$accessorRow->accessorial_options . ')';
|
565 |
-
$accessorName = trim($accessorName);
|
566 |
-
|
567 |
-
if (str_replace("'", '', $orderAccessoriesType) == $accessoriesType && $accessorName == $orderAccessorValuesName) {
|
568 |
-
$itemsAccessories[] = array('id' => $accessorRow->id);
|
569 |
-
}
|
570 |
-
}
|
571 |
-
}
|
572 |
-
}
|
573 |
-
}
|
574 |
-
|
575 |
-
if (empty($itemsAccessories)) {
|
576 |
-
|
577 |
-
$helper->shlog('Empty accessories!', 'shiphawk-book.log');
|
578 |
-
|
579 |
-
$helper->shlog($accessories, 'shiphawk-book.log');
|
580 |
-
|
581 |
-
$helper->shlog($orderAccessories, 'shiphawk-book.log');
|
582 |
-
} else {
|
583 |
-
|
584 |
-
$helper->shlog('Accessories!', 'shiphawk-book.log');
|
585 |
-
|
586 |
-
$helper->shlog($itemsAccessories, 'shiphawk-book.log');
|
587 |
-
}
|
588 |
-
|
589 |
-
return $itemsAccessories;
|
590 |
-
}
|
591 |
-
|
592 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Carrier.php
DELETED
@@ -1,1021 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Shiphawk_Shipping_Model_Carrier
|
4 |
-
extends Mage_Shipping_Model_Carrier_Abstract
|
5 |
-
implements Mage_Shipping_Model_Carrier_Interface
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Carrier's code, as defined in parent class
|
9 |
-
*
|
10 |
-
* @var string
|
11 |
-
*/
|
12 |
-
protected $_code = 'shiphawk_shipping';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Returns available shipping rates for Shiphawk Shipping carrier
|
16 |
-
*
|
17 |
-
* @param Mage_Shipping_Model_Rate_Request $request
|
18 |
-
* @return Mage_Shipping_Model_Rate_Result
|
19 |
-
*/
|
20 |
-
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
21 |
-
{
|
22 |
-
/** @var Mage_Shipping_Model_Rate_Result $result */
|
23 |
-
$result = Mage::getModel('shipping/rate_result');
|
24 |
-
|
25 |
-
$helper = Mage::helper('shiphawk_shipping');
|
26 |
-
$default_origin_zip = Mage::getStoreConfig('carriers/shiphawk_shipping/default_origin');
|
27 |
-
|
28 |
-
$hide_on_frontend = Mage::getStoreConfig('carriers/shiphawk_shipping/hide_on_frontend');
|
29 |
-
$is_admin = $helper->checkIsAdmin();
|
30 |
-
// hide ShipHawk method on frontend , allow only in admin area
|
31 |
-
if (($hide_on_frontend == 1) && (!$is_admin)) {
|
32 |
-
return $result;
|
33 |
-
}
|
34 |
-
|
35 |
-
/* For location type */
|
36 |
-
$shLocationType = 'residential';
|
37 |
-
if ($is_admin) {
|
38 |
-
// if is admin this means that we have already set the value in setlocationtypeAction
|
39 |
-
$shLocationType = Mage::getSingleton('checkout/session')->getData('shiphawk_location_type_shipping');
|
40 |
-
} else {
|
41 |
-
$shippingRequest = Mage::app()->getRequest()->getPost();
|
42 |
-
|
43 |
-
if (!empty($shippingRequest['billing'])) {
|
44 |
-
$shLocationType = $shippingRequest['billing']['shiphawk_location_type'];
|
45 |
-
$shLocationType = $shLocationType != 'commercial' && $shLocationType != 'residential' ? 'residential' : $shLocationType;
|
46 |
-
Mage::getSingleton('checkout/session')->setData('shiphawk_location_type_billing', $shLocationType);
|
47 |
-
|
48 |
-
if ($shippingRequest['billing']['use_for_shipping']) {
|
49 |
-
Mage::getSingleton('checkout/session')->setData('shiphawk_location_type_shipping', $shLocationType);
|
50 |
-
}
|
51 |
-
} else if (!empty($shippingRequest['shipping'])) {
|
52 |
-
$shLocationType = $shippingRequest['shipping']['shiphawk_location_type'];
|
53 |
-
$shLocationType = $shLocationType != 'commercial' && $shLocationType != 'residential' ? 'residential' : $shLocationType;
|
54 |
-
Mage::getSingleton('checkout/session')->setData('shiphawk_location_type_shipping', $shLocationType);
|
55 |
-
} else {
|
56 |
-
$shLocationType = Mage::getSingleton('checkout/session')->getData('shiphawk_location_type_shipping');
|
57 |
-
$shLocationType = $shLocationType != 'commercial' && $shLocationType != 'residential' ? 'residential' : $shLocationType;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
$to_zip = $this->getShippingZip();
|
62 |
-
$api = Mage::getModel('shiphawk_shipping/api');
|
63 |
-
$items = $this->getShiphawkItems($request);
|
64 |
-
|
65 |
-
$grouped_items_by_zip = $this->getGroupedItemsByZip($items);
|
66 |
-
|
67 |
-
$grouped_items_by_carrier_type = $this->getGroupedItemsByCarrierType($items);
|
68 |
-
|
69 |
-
$ship_responces = array();
|
70 |
-
$toOrder= array();
|
71 |
-
$api_error = false;
|
72 |
-
$is_multi_zip = false;
|
73 |
-
$is_multi_carrier = false;
|
74 |
-
|
75 |
-
if(count($grouped_items_by_zip) > 1) {
|
76 |
-
$is_multi_zip = true;
|
77 |
-
}
|
78 |
-
|
79 |
-
if(count($grouped_items_by_carrier_type) > 1) {
|
80 |
-
$is_multi_carrier = true;
|
81 |
-
$is_multi_zip = true;
|
82 |
-
}
|
83 |
-
|
84 |
-
$rate_filter = Mage::helper('shiphawk_shipping')->getRateFilter($is_admin);
|
85 |
-
|
86 |
-
$custom_packing_price_setting = Mage::getStoreConfig('carriers/shiphawk_shipping/shiphawk_custom_packing_price');
|
87 |
-
|
88 |
-
$self_pack = $helper->getSelfPacked();
|
89 |
-
|
90 |
-
$charge_customer_for_packing = Mage::getStoreConfig('carriers/shiphawk_shipping/charge_customer_for_packing');
|
91 |
-
|
92 |
-
//default origin zip code from config settings
|
93 |
-
$from_zip = Mage::getStoreConfig('carriers/shiphawk_shipping/default_origin');
|
94 |
-
|
95 |
-
try {
|
96 |
-
|
97 |
-
/* items has various carrier type */
|
98 |
-
if($is_multi_carrier) {
|
99 |
-
foreach($grouped_items_by_carrier_type as $carrier_type=>$items_) {
|
100 |
-
|
101 |
-
if($carrier_type) {
|
102 |
-
$carrier_type = explode(',', $carrier_type);
|
103 |
-
}else{
|
104 |
-
$carrier_type = '';
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
$grouped_items_by_origin = $this->getGroupedItemsByZip($items_);
|
109 |
-
|
110 |
-
foreach($grouped_items_by_origin as $origin_id=>$items__) {
|
111 |
-
|
112 |
-
if ($origin_id != 'origin_per_product') { // product has origin id or primary origin
|
113 |
-
|
114 |
-
$rate_filter = 'best'; // multi carrier
|
115 |
-
|
116 |
-
if($origin_id) {
|
117 |
-
$shipHawkOrigin = Mage::getModel('shiphawk_shipping/origins')->load($origin_id);
|
118 |
-
$from_zip = $shipHawkOrigin->getShiphawkOriginZipcode();
|
119 |
-
}
|
120 |
-
|
121 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items__, $rate_filter);
|
122 |
-
|
123 |
-
if(empty($checkattributes)) {
|
124 |
-
|
125 |
-
$grouped_items_by_discount_or_markup = $this->getGroupedItemsByDiscountOrMarkup($items__);
|
126 |
-
|
127 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
128 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
129 |
-
$from_zip = $items__[0]['zip'];
|
130 |
-
$location_type = $items__[0]['location_type'];
|
131 |
-
// 1. multi carrier, multi origin, not origin per product
|
132 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
133 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
134 |
-
|
135 |
-
$custom_products_packing_price = 0;
|
136 |
-
|
137 |
-
if($custom_packing_price_setting) {
|
138 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
139 |
-
}
|
140 |
-
|
141 |
-
$ship_responces[] = $responceObject;
|
142 |
-
|
143 |
-
if(is_object($responceObject)) {
|
144 |
-
$api_error = true;
|
145 |
-
$shiphawk_error = (string) $responceObject->error;
|
146 |
-
//Mage::log('ShipHawk response: '. $shiphawk_error, null, 'ShipHawk.log');
|
147 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
148 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
149 |
-
}else{
|
150 |
-
// if $rate_filter = 'best' then it is only one rate
|
151 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
152 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
153 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
154 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
155 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $this->getProductIds($discount_items);
|
156 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
157 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
158 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
159 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
160 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
161 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
162 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $this->getCarrierName($responceObject[0]);
|
163 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $this->getPackeges($responceObject[0]);
|
164 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
165 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
166 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
167 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
168 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
169 |
-
}
|
170 |
-
|
171 |
-
if($is_multi_zip) {
|
172 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
173 |
-
}
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
}else{
|
178 |
-
$api_error = true;
|
179 |
-
foreach($checkattributes as $rate_error) {
|
180 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
181 |
-
$helper->sendErrorMessageToShipHawk($rate_error);
|
182 |
-
}
|
183 |
-
}
|
184 |
-
}else{ // product items has all required shipping origin fields
|
185 |
-
|
186 |
-
$grouped_items_per_product_by_zip = $this->getGroupedItemsByZipPerProduct($items__);
|
187 |
-
|
188 |
-
if(count($grouped_items_per_product_by_zip) > 1 ) {
|
189 |
-
$is_multi_zip = true;
|
190 |
-
}
|
191 |
-
|
192 |
-
if($is_multi_zip) {
|
193 |
-
$rate_filter = 'best';
|
194 |
-
}
|
195 |
-
|
196 |
-
foreach ($grouped_items_per_product_by_zip as $from_zip=>$items_per_product) {
|
197 |
-
|
198 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items_per_product, $rate_filter);
|
199 |
-
|
200 |
-
if(empty($checkattributes)) {
|
201 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
202 |
-
$from_zip = $items_[0]['zip'];
|
203 |
-
$location_type = $items_[0]['location_type'];
|
204 |
-
|
205 |
-
$grouped_items_by_discount_or_markup = $this->getGroupedItemsByDiscountOrMarkup($items_per_product);
|
206 |
-
|
207 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
208 |
-
|
209 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
210 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
211 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
212 |
-
|
213 |
-
if($carrier_type) {
|
214 |
-
$carrier_type = explode(',', $carrier_type);
|
215 |
-
}else{
|
216 |
-
$carrier_type = '';
|
217 |
-
}
|
218 |
-
|
219 |
-
|
220 |
-
// 2. multi carrier, multi origin, origin per product
|
221 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
222 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
223 |
-
|
224 |
-
$custom_products_packing_price = 0;
|
225 |
-
|
226 |
-
if($custom_packing_price_setting) {
|
227 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
228 |
-
}
|
229 |
-
|
230 |
-
|
231 |
-
$ship_responces[] = $responceObject;
|
232 |
-
|
233 |
-
if(is_object($responceObject)) {
|
234 |
-
$api_error = true;
|
235 |
-
$shiphawk_error = (string) $responceObject->error;
|
236 |
-
//Mage::log('ShipHawk response: '. $shiphawk_error, null, 'ShipHawk.log');
|
237 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
238 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
239 |
-
}else{
|
240 |
-
// if $rate_filter = 'best' then it is only one rate
|
241 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
242 |
-
|
243 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $this->getProductIds($discount_items);
|
244 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
245 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
246 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
247 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
248 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
249 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
250 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $this->getCarrierName($responceObject[0]);
|
251 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $this->getPackeges($responceObject[0]);
|
252 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
253 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
254 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
255 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
256 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
257 |
-
|
258 |
-
}
|
259 |
-
|
260 |
-
if($is_multi_zip) {
|
261 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
262 |
-
}
|
263 |
-
}
|
264 |
-
|
265 |
-
}
|
266 |
-
|
267 |
-
|
268 |
-
}else{
|
269 |
-
$api_error = true;
|
270 |
-
foreach($checkattributes as $rate_error) {
|
271 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
272 |
-
$helper->sendErrorMessageToShipHawk($rate_error);
|
273 |
-
}
|
274 |
-
}
|
275 |
-
|
276 |
-
}
|
277 |
-
|
278 |
-
}
|
279 |
-
|
280 |
-
}
|
281 |
-
}
|
282 |
-
}else{
|
283 |
-
|
284 |
-
/* all product items has one carrier type or carrier type is null in all items */
|
285 |
-
foreach($grouped_items_by_zip as $origin_id=>$items_) {
|
286 |
-
|
287 |
-
/* get carrier type from first item because items grouped by carrier type and not multi carrier */
|
288 |
-
/* if carrier type is null, get default carrier type from settings */
|
289 |
-
if($items_[0]['shiphawk_carrier_type']) {
|
290 |
-
$carrier_type = (explode(',', $items_[0]['shiphawk_carrier_type'])) ? (explode(',', $items_[0]['shiphawk_carrier_type'])) : Mage::getStoreConfig('carriers/shiphawk_shipping/carrier_type');
|
291 |
-
}else{
|
292 |
-
$carrier_type = '';
|
293 |
-
}
|
294 |
-
|
295 |
-
|
296 |
-
if ($origin_id != 'origin_per_product') {
|
297 |
-
|
298 |
-
if($is_multi_zip) {
|
299 |
-
$rate_filter = 'best';
|
300 |
-
}
|
301 |
-
|
302 |
-
if($origin_id) {
|
303 |
-
$shipHawkOrigin = Mage::getModel('shiphawk_shipping/origins')->load($origin_id);
|
304 |
-
$from_zip = $shipHawkOrigin->getShiphawkOriginZipcode();
|
305 |
-
}
|
306 |
-
|
307 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items_, $rate_filter);
|
308 |
-
|
309 |
-
if(empty($checkattributes)) {
|
310 |
-
|
311 |
-
$grouped_items_by_discount_or_markup = $this->getGroupedItemsByDiscountOrMarkup($items_);
|
312 |
-
|
313 |
-
if(count($grouped_items_by_discount_or_markup)>1) {
|
314 |
-
$is_multi_zip = true;
|
315 |
-
}
|
316 |
-
|
317 |
-
if($is_multi_zip) {
|
318 |
-
$rate_filter = 'best';
|
319 |
-
}
|
320 |
-
|
321 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
322 |
-
|
323 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
324 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
325 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
326 |
-
|
327 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
328 |
-
$from_zip = $discount_items[0]['zip'];
|
329 |
-
$location_type = $discount_items[0]['location_type'];
|
330 |
-
|
331 |
-
// 3. one carrier, multi origin, not origin per product
|
332 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
333 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
334 |
-
|
335 |
-
$custom_products_packing_price = 0;
|
336 |
-
|
337 |
-
if($custom_packing_price_setting) {
|
338 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
339 |
-
}
|
340 |
-
|
341 |
-
$ship_responces[] = $responceObject;
|
342 |
-
|
343 |
-
if(is_object($responceObject) or (empty($responceObject))) {
|
344 |
-
$api_error = true;
|
345 |
-
$shiphawk_error = (string) $responceObject->error;
|
346 |
-
//Mage::log('ShipHawk response: '. $shiphawk_error, null, 'ShipHawk.log');
|
347 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
348 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
349 |
-
}else{
|
350 |
-
// if $rate_filter = 'best' then it is only one rate
|
351 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
352 |
-
|
353 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $this->getProductIds($discount_items);
|
354 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
355 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
356 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
357 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
358 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
359 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
360 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $this->getCarrierName($responceObject[0]);
|
361 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $this->getPackeges($responceObject[0]);
|
362 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
363 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
364 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
365 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
366 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
367 |
-
}else{
|
368 |
-
Mage::getSingleton('core/session')->setMultiZipCode(false);
|
369 |
-
foreach ($responceObject as $responce) {
|
370 |
-
$toOrder[$responce->id]['product_ids'] = $this->getProductIds($discount_items);
|
371 |
-
//$toOrder[$responce->id]['price'] = $helper->getSummaryPrice($responce, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
372 |
-
$toOrder[$responce->id]['price'] = $helper->getShipHawkPrice($responce, $self_pack, $charge_customer_for_packing);
|
373 |
-
$toOrder[$responce->id]['name'] = $responce->shipping->service;//
|
374 |
-
$toOrder[$responce->id]['items'] = $discount_items;
|
375 |
-
$toOrder[$responce->id]['from_zip'] = $from_zip;
|
376 |
-
$toOrder[$responce->id]['to_zip'] = $to_zip;
|
377 |
-
$toOrder[$responce->id]['carrier'] = $this->getCarrierName($responce);
|
378 |
-
$toOrder[$responce->id]['packing_info'] = $this->getPackeges($responce);
|
379 |
-
$toOrder[$responce->id]['carrier_type'] = $carrier_type;
|
380 |
-
$toOrder[$responce->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
381 |
-
$toOrder[$responce->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
382 |
-
$toOrder[$responce->id]['self_pack'] = $self_pack;
|
383 |
-
$toOrder[$responce->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
384 |
-
|
385 |
-
}
|
386 |
-
}
|
387 |
-
|
388 |
-
if($is_multi_zip) {
|
389 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
390 |
-
}
|
391 |
-
}
|
392 |
-
}
|
393 |
-
}else{
|
394 |
-
$api_error = true;
|
395 |
-
foreach($checkattributes as $rate_error) {
|
396 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
397 |
-
$helper->sendErrorMessageToShipHawk($rate_error);
|
398 |
-
}
|
399 |
-
}
|
400 |
-
}else{
|
401 |
-
|
402 |
-
/* product items has per product origin, grouped by zip code */
|
403 |
-
$grouped_items_per_product_by_zip = $this->getGroupedItemsByZipPerProduct($items_);
|
404 |
-
|
405 |
-
if(count($grouped_items_per_product_by_zip) > 1 ) {
|
406 |
-
$is_multi_zip = true;
|
407 |
-
}
|
408 |
-
|
409 |
-
if($is_multi_zip) {
|
410 |
-
$rate_filter = 'best';
|
411 |
-
}
|
412 |
-
|
413 |
-
foreach ($grouped_items_per_product_by_zip as $from_zip=>$items_per_product) {
|
414 |
-
|
415 |
-
$checkattributes = $helper->checkShipHawkAttributes($from_zip, $to_zip, $items_per_product, $rate_filter);
|
416 |
-
|
417 |
-
if(empty($checkattributes)) {
|
418 |
-
|
419 |
-
$grouped_items_by_discount_or_markup = $this->getGroupedItemsByDiscountOrMarkup($items_per_product);
|
420 |
-
|
421 |
-
if(count($grouped_items_by_discount_or_markup)>1) {
|
422 |
-
$is_multi_zip = true;
|
423 |
-
}
|
424 |
-
|
425 |
-
if($is_multi_zip) {
|
426 |
-
$rate_filter = 'best';
|
427 |
-
}
|
428 |
-
|
429 |
-
foreach($grouped_items_by_discount_or_markup as $mark_up_discount=>$discount_items) {
|
430 |
-
|
431 |
-
//get percentage and flat markup-discount from first item, because all item in group has identical markup-discount
|
432 |
-
$flat_markup_discount = $discount_items[0]['shiphawk_discount_fixed'];
|
433 |
-
$percentage_markup_discount = $discount_items[0]['shiphawk_discount_percentage'];
|
434 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
435 |
-
$from_zip = $discount_items[0]['zip'];
|
436 |
-
$location_type = $discount_items[0]['location_type'];
|
437 |
-
|
438 |
-
// 4. one carrier, multi origin, origin per product
|
439 |
-
$responceObject = $api->getShiphawkRate($from_zip, $to_zip, $discount_items, $rate_filter, $carrier_type, $location_type, $shLocationType);
|
440 |
-
$helper->shlog($discount_items, 'shiphawk-items-request.log');
|
441 |
-
// $helper->shlog($responceObject, 'shiphawk-rate-responce.log');
|
442 |
-
|
443 |
-
$custom_products_packing_price = 0;
|
444 |
-
|
445 |
-
if($custom_packing_price_setting) {
|
446 |
-
$custom_products_packing_price = $helper->getCustomPackingPriceSumm($discount_items);
|
447 |
-
}
|
448 |
-
|
449 |
-
$ship_responces[] = $responceObject;
|
450 |
-
|
451 |
-
if(is_object($responceObject)) {
|
452 |
-
$api_error = true;
|
453 |
-
$shiphawk_error = (string) $responceObject->error;
|
454 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
455 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
456 |
-
}else{
|
457 |
-
// if $rate_filter = 'best' then it is only one rate
|
458 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
459 |
-
|
460 |
-
$toOrder[$responceObject[0]->id]['product_ids'] = $this->getProductIds($discount_items);
|
461 |
-
//$toOrder[$responceObject[0]->id]['price'] = $helper->getSummaryPrice($responceObject[0], $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
462 |
-
$toOrder[$responceObject[0]->id]['price'] = $helper->getShipHawkPrice($responceObject[0], $self_pack, $charge_customer_for_packing);
|
463 |
-
$toOrder[$responceObject[0]->id]['name'] = $responceObject[0]->shipping->service;//
|
464 |
-
$toOrder[$responceObject[0]->id]['items'] = $discount_items;
|
465 |
-
$toOrder[$responceObject[0]->id]['from_zip'] = $from_zip;
|
466 |
-
$toOrder[$responceObject[0]->id]['to_zip'] = $to_zip;
|
467 |
-
$toOrder[$responceObject[0]->id]['carrier'] = $this->getCarrierName($responceObject[0]);
|
468 |
-
$toOrder[$responceObject[0]->id]['packing_info'] = $this->getPackeges($responceObject[0]);
|
469 |
-
$toOrder[$responceObject[0]->id]['carrier_type'] = $carrier_type;
|
470 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
471 |
-
$toOrder[$responceObject[0]->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
472 |
-
$toOrder[$responceObject[0]->id]['self_pack'] = $self_pack;
|
473 |
-
$toOrder[$responceObject[0]->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
474 |
-
}else{
|
475 |
-
Mage::getSingleton('core/session')->setMultiZipCode(false);
|
476 |
-
foreach ($responceObject as $responce) {
|
477 |
-
$toOrder[$responce->id]['product_ids'] = $this->getProductIds($discount_items);
|
478 |
-
//$toOrder[$responce->id]['price'] = $helper->getSummaryPrice($responce, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
479 |
-
$toOrder[$responce->id]['price'] = $helper->getShipHawkPrice($responce, $self_pack, $charge_customer_for_packing);
|
480 |
-
$toOrder[$responce->id]['name'] = $responce->shipping->service;//
|
481 |
-
$toOrder[$responce->id]['items'] = $discount_items;
|
482 |
-
$toOrder[$responce->id]['from_zip'] = $from_zip;
|
483 |
-
$toOrder[$responce->id]['to_zip'] = $to_zip;
|
484 |
-
$toOrder[$responce->id]['carrier'] = $this->getCarrierName($responce);
|
485 |
-
$toOrder[$responce->id]['packing_info'] = $this->getPackeges($responce);
|
486 |
-
$toOrder[$responce->id]['carrier_type'] = $carrier_type;
|
487 |
-
$toOrder[$responce->id]['shiphawk_discount_fixed'] = $flat_markup_discount;
|
488 |
-
$toOrder[$responce->id]['shiphawk_discount_percentage'] = $percentage_markup_discount;
|
489 |
-
$toOrder[$responce->id]['self_pack'] = $self_pack;
|
490 |
-
$toOrder[$responce->id]['custom_products_packing_price'] = $custom_products_packing_price;
|
491 |
-
}
|
492 |
-
}
|
493 |
-
|
494 |
-
if($is_multi_zip) {
|
495 |
-
Mage::getSingleton('core/session')->setMultiZipCode(true);
|
496 |
-
}
|
497 |
-
}
|
498 |
-
}
|
499 |
-
}else{
|
500 |
-
$api_error = true;
|
501 |
-
foreach($checkattributes as $rate_error) {
|
502 |
-
$helper->shlog('ShipHawk error: '.$rate_error);
|
503 |
-
$helper->sendErrorMessageToShipHawk($rate_error);
|
504 |
-
}
|
505 |
-
}
|
506 |
-
|
507 |
-
}
|
508 |
-
|
509 |
-
}
|
510 |
-
}
|
511 |
-
}
|
512 |
-
|
513 |
-
|
514 |
-
if(!$api_error) {
|
515 |
-
$services = $this->getServices($ship_responces, $toOrder, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting);
|
516 |
-
$name_service = '';
|
517 |
-
$summ_price = 0;
|
518 |
-
$package_info = '';
|
519 |
-
$multi_shipping_price = 0;
|
520 |
-
|
521 |
-
$free_shipping_setting = Mage::getStoreConfig('carriers/shiphawk_shipping/free_method');
|
522 |
-
|
523 |
-
$chipiest_rate_id = $this->_getChipiestRateId($services);
|
524 |
-
|
525 |
-
|
526 |
-
foreach ($services as $id_service=>$service) {
|
527 |
-
if (!$is_multi_zip) {
|
528 |
-
//add ShipHawk shipping
|
529 |
-
//$shipping_price = $helper->getTotalDiscountShippingPrice($service['price'], $toOrder[$id_service]);
|
530 |
-
$shipping_price = $service['price'];
|
531 |
-
if((empty($service['shiphawk_discount_fixed']))&&(empty($service['shiphawk_discount_percentage']))) {
|
532 |
-
$shipping_price = $helper->getDiscountShippingPrice($service['price']);
|
533 |
-
}else{
|
534 |
-
$shipping_price = $helper->getProductDiscountMarkupPrice($service['price'], $service['shiphawk_discount_percentage'], $service['shiphawk_discount_fixed']);
|
535 |
-
}
|
536 |
-
|
537 |
-
if($free_shipping_setting != 'none') {
|
538 |
-
if ($request->getFreeShipping()) {
|
539 |
-
|
540 |
-
// get chipiest rate id
|
541 |
-
if($chipiest_rate_id == $id_service){
|
542 |
-
$shipping_price = 0;
|
543 |
-
}
|
544 |
-
|
545 |
-
if ($free_shipping_setting == 'all') {
|
546 |
-
$shipping_price = 0;
|
547 |
-
}
|
548 |
-
}
|
549 |
-
}
|
550 |
-
|
551 |
-
if($is_admin == false) {
|
552 |
-
$result->append($this->_getShiphawkRateObject($service['name'], $shipping_price, $service['shiphawk_price'], $service['accessorial']));
|
553 |
-
}else{
|
554 |
-
$result->append($this->_getShiphawkRateObject($service['name'] . ' - ' . $service['carrier'], $shipping_price, $service['shiphawk_price'], $service['accessorial']));
|
555 |
-
}
|
556 |
-
|
557 |
-
}else{
|
558 |
-
$name_service .= $service['name'] . ', ';
|
559 |
-
$summ_price += $service['price'];
|
560 |
-
|
561 |
-
$shipping_price = $service['price'];
|
562 |
-
if((empty($service['shiphawk_discount_fixed']))&&(empty($service['shiphawk_discount_percentage']))) {
|
563 |
-
$shipping_price = $helper->getDiscountShippingPrice($service['price']);
|
564 |
-
}else{
|
565 |
-
$shipping_price = $helper->getProductDiscountMarkupPrice($service['price'], $service['shiphawk_discount_percentage'], $service['shiphawk_discount_fixed']);
|
566 |
-
}
|
567 |
-
|
568 |
-
$multi_shipping_price += $shipping_price;
|
569 |
-
if ($request->getFreeShipping()) {
|
570 |
-
/**
|
571 |
-
* If the request has the free shipping flag,
|
572 |
-
* append a free shipping rate to the result.
|
573 |
-
*/
|
574 |
-
if($free_shipping_setting != 'none') {
|
575 |
-
$multi_shipping_price = 0;
|
576 |
-
}
|
577 |
-
|
578 |
-
}
|
579 |
-
//$multi_shipping_price += $helper->getTotalDiscountShippingPrice($service['price'], $toOrder[$id_service]);
|
580 |
-
}
|
581 |
-
}
|
582 |
-
|
583 |
-
//save rate_id info for Book
|
584 |
-
Mage::getSingleton('core/session')->setShiphawkBookId($toOrder);
|
585 |
-
|
586 |
-
$helper->shlog($toOrder, 'shiphawk-toOrder.log');
|
587 |
-
|
588 |
-
//save rate filter to order
|
589 |
-
Mage::getSingleton('core/session')->setShiphawkRateFilter($rate_filter);
|
590 |
-
|
591 |
-
if($is_multi_zip) {
|
592 |
-
//add ShipHawk shipping
|
593 |
-
$name_service = 'Shipping from multiple locations';
|
594 |
-
$shipping_price = $multi_shipping_price;
|
595 |
-
Mage::getSingleton('core/session')->setSummPrice($summ_price);
|
596 |
-
|
597 |
-
foreach($toOrder as $rateid=>$rate_data) {
|
598 |
-
$package_info .= $rate_data['name']. ' - ' . $rate_data['carrier'] . ' - ' .$rate_data['packing_info'];
|
599 |
-
}
|
600 |
-
|
601 |
-
Mage::getSingleton('core/session')->setPackageInfo($package_info);
|
602 |
-
$result->append($this->_getShiphawkRateObject($name_service, $shipping_price, $summ_price, null));
|
603 |
-
}
|
604 |
-
}else{
|
605 |
-
$error_text_from_config = Mage::getStoreConfig('carriers/shiphawk_shipping/shiphawk_error_message');
|
606 |
-
Mage::getSingleton('core/session')->setShiphawkErrorRate($error_text_from_config);
|
607 |
-
}
|
608 |
-
|
609 |
-
}catch (Mage_Core_Exception $e) {
|
610 |
-
Mage::logException($e->getMessage());
|
611 |
-
} catch (Exception $e) {
|
612 |
-
Mage::logException($e->getMessage());
|
613 |
-
}
|
614 |
-
|
615 |
-
return $result;
|
616 |
-
}
|
617 |
-
|
618 |
-
protected function _getFreeShippingRate()
|
619 |
-
{
|
620 |
-
$rate = Mage::getModel('shipping/rate_result_method');
|
621 |
-
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
622 |
-
$rate->setCarrier($this->_code);
|
623 |
-
$rate->setCarrierTitle($this->getConfigData('title'));
|
624 |
-
$rate->setMethod('free_shipping');
|
625 |
-
$rate->setMethodTitle('Free Shipping');
|
626 |
-
$rate->setPrice(0);
|
627 |
-
$rate->setCost(0);
|
628 |
-
return $rate;
|
629 |
-
}
|
630 |
-
|
631 |
-
|
632 |
-
/**
|
633 |
-
* Returns Allowed shipping methods
|
634 |
-
*
|
635 |
-
* @return array
|
636 |
-
*/
|
637 |
-
public function getAllowedMethods()
|
638 |
-
{
|
639 |
-
return array(
|
640 |
-
'ground' => 'Ground delivery'
|
641 |
-
);
|
642 |
-
}
|
643 |
-
|
644 |
-
public function getProductIds($_items) {
|
645 |
-
$products_ids = array();
|
646 |
-
foreach($_items as $_item) {
|
647 |
-
$products_ids[] = $_item['product_id'];
|
648 |
-
}
|
649 |
-
return $products_ids;
|
650 |
-
}
|
651 |
-
|
652 |
-
/**
|
653 |
-
* Get Standard rate object
|
654 |
-
*
|
655 |
-
* @return Mage_Shipping_Model_Rate_Result_Method
|
656 |
-
*/
|
657 |
-
protected function _getShiphawkRateObject($method_title, $price, $true_price, $accessorial)
|
658 |
-
{
|
659 |
-
/** @var Mage_Shipping_Model_Rate_Result_Method $rate */
|
660 |
-
$rate = Mage::getModel('shipping/rate_result_method');
|
661 |
-
|
662 |
-
$ship_rate_id = str_replace('-', '_', str_replace(',', '', str_replace(' ', '_', $method_title.$true_price)));
|
663 |
-
|
664 |
-
$rate->setCarrier($this->_code);
|
665 |
-
$rate->setCarrierTitle('ShipHawk');
|
666 |
-
$rate->setMethodTitle($method_title);
|
667 |
-
$rate->setMethod($ship_rate_id);
|
668 |
-
$rate->setPrice($price);
|
669 |
-
$rate->setCost($price);
|
670 |
-
if(!empty($accessorial)) {
|
671 |
-
$rate->setMethodDescription(serialize($accessorial));
|
672 |
-
|
673 |
-
}
|
674 |
-
|
675 |
-
return $rate;
|
676 |
-
}
|
677 |
-
|
678 |
-
public function getShiphawkItems($request) {
|
679 |
-
$items = array();
|
680 |
-
$productModel = Mage::getModel('catalog/product');
|
681 |
-
|
682 |
-
$custom_packing_price_setting = Mage::getStoreConfig('carriers/shiphawk_shipping/shiphawk_custom_packing_price');
|
683 |
-
|
684 |
-
foreach ($request->getAllItems() as $item) {
|
685 |
-
$product_id = $item->getProductId();
|
686 |
-
$product = Mage::getModel('catalog/product')->load($product_id);
|
687 |
-
|
688 |
-
$freightClass = $product->getShiphawkFreightClass();
|
689 |
-
$freightClassValue = '';
|
690 |
-
|
691 |
-
if (!empty($freightClass)) {
|
692 |
-
$attr = $productModel->getResource()->getAttribute('shiphawk_freight_class');
|
693 |
-
$freightClassValue = $attr->getSource()->getOptionText($freightClass);
|
694 |
-
}
|
695 |
-
|
696 |
-
$type_id = $product->getTypeId();
|
697 |
-
if($type_id == 'simple') {
|
698 |
-
$product_qty = (($product->getShiphawkQuantity() > 0)) ? $product->getShiphawkQuantity() : 1;
|
699 |
-
|
700 |
-
/** @var $helper Shiphawk_Shipping_Helper_Data */
|
701 |
-
$helper = Mage::helper('shiphawk_shipping');
|
702 |
-
$carrier_type = $helper->getProductCarrierType($product);
|
703 |
-
|
704 |
-
//hack for admin shipment in popup
|
705 |
-
$qty_ordered = ($item->getQty() > 0 ) ? $item->getQty() : $item->getData('qty_ordered');
|
706 |
-
|
707 |
-
$items[] = array(
|
708 |
-
'width' => $product->getShiphawkWidth(),
|
709 |
-
'length' => $product->getShiphawkLength(),
|
710 |
-
'height' => $product->getShiphawkHeight(),
|
711 |
-
'weight' => ($product->getWeight()) ? ($product->getWeight()) : 0,
|
712 |
-
'value' => $this->getShipHawkItemValue($product),
|
713 |
-
//'quantity' => $product_qty*$item->getQty(),
|
714 |
-
'quantity' => $product_qty*$qty_ordered,
|
715 |
-
'packed' => $this->getIsPacked($product),
|
716 |
-
'id' => $product->getShiphawkTypeOfProductValue(),
|
717 |
-
'zip'=> $this->getOriginZip($product),
|
718 |
-
'product_id'=> $product_id,
|
719 |
-
'xid'=> $product_id,
|
720 |
-
'origin'=> $this->getShiphawkShippingOrigin($product),
|
721 |
-
'location_type'=> $this->getOriginLocation($product),
|
722 |
-
'require_crating'=> false,
|
723 |
-
'nmfc'=> '',
|
724 |
-
'freight_class'=> $freightClassValue,
|
725 |
-
'shiphawk_carrier_type'=> $carrier_type,
|
726 |
-
'shiphawk_discount_fixed'=> $product->getShiphawkDiscountFixed(),
|
727 |
-
'shiphawk_discount_percentage'=> $product->getShiphawkDiscountPercentage(),
|
728 |
-
'shiphawk_custom_packing_price'=> (($this->getIsPacked($product) == 'true')&&($custom_packing_price_setting)) ? null : $product->getShiphawkCustomPackingPrice(),
|
729 |
-
);
|
730 |
-
}
|
731 |
-
}
|
732 |
-
|
733 |
-
return $items;
|
734 |
-
}
|
735 |
-
|
736 |
-
public function getShiphawkShippingOrigin($product) {
|
737 |
-
|
738 |
-
/** @var $helper Shiphawk_Shipping_Helper_Data */
|
739 |
-
$helper = Mage::helper('shiphawk_shipping');
|
740 |
-
|
741 |
-
if($helper->checkShipHawkOriginAttributes($product)) {
|
742 |
-
return 'origin_per_product';
|
743 |
-
}
|
744 |
-
|
745 |
-
$product_origin_id = $product->getShiphawkShippingOrigins();
|
746 |
-
|
747 |
-
if ($product_origin_id) {
|
748 |
-
return $product_origin_id;
|
749 |
-
}
|
750 |
-
|
751 |
-
return null;
|
752 |
-
|
753 |
-
}
|
754 |
-
|
755 |
-
public function getShippingZip() {
|
756 |
-
if (Mage::app()->getStore()->isAdmin()) {
|
757 |
-
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
|
758 |
-
}else{
|
759 |
-
/** @var $cart Mage_Checkout_Model_Cart */
|
760 |
-
$cart = Mage::getSingleton('checkout/cart');
|
761 |
-
$quote = $cart->getQuote();
|
762 |
-
}
|
763 |
-
$shippingAddress = $quote->getShippingAddress();
|
764 |
-
$zip_code = $shippingAddress->getPostcode();
|
765 |
-
return $zip_code;
|
766 |
-
}
|
767 |
-
|
768 |
-
public function getShipHawkItemValue($product) {
|
769 |
-
if($product->getShiphawkQuantity() > 0) {
|
770 |
-
$product_price = $product->getPrice()/$product->getShiphawkQuantity();
|
771 |
-
}else{
|
772 |
-
$product_price = $product->getPrice();
|
773 |
-
}
|
774 |
-
$item_value = ($product->getShiphawkItemValue() > 0) ? $product->getShiphawkItemValue() : $product_price;
|
775 |
-
return $item_value;
|
776 |
-
}
|
777 |
-
|
778 |
-
public function getOriginZip($product) {
|
779 |
-
$default_origin_zip = Mage::getStoreConfig('carriers/shiphawk_shipping/default_origin');
|
780 |
-
|
781 |
-
$shipping_origin_id = $product->getData('shiphawk_shipping_origins');
|
782 |
-
|
783 |
-
$helper = Mage::helper('shiphawk_shipping');
|
784 |
-
/* check if all origin attributes are set */
|
785 |
-
$per_product = $helper->checkShipHawkOriginAttributes($product);
|
786 |
-
|
787 |
-
if($per_product == true) {
|
788 |
-
return $product->getData('shiphawk_origin_zipcode');
|
789 |
-
}
|
790 |
-
|
791 |
-
if($shipping_origin_id) {
|
792 |
-
// get zip code from Shiping Origin
|
793 |
-
$shipping_origin = Mage::getModel('shiphawk_shipping/origins')->load($shipping_origin_id);
|
794 |
-
$product_origin_zip_code = $shipping_origin->getData('shiphawk_origin_zipcode');
|
795 |
-
return $product_origin_zip_code;
|
796 |
-
}
|
797 |
-
|
798 |
-
return $default_origin_zip;
|
799 |
-
}
|
800 |
-
|
801 |
-
public function getOriginLocation($product) {
|
802 |
-
$default_origin_location = Mage::getStoreConfig('carriers/shiphawk_shipping/origin_location_type');
|
803 |
-
|
804 |
-
$shipping_origin_id = $product->getData('shiphawk_shipping_origins');
|
805 |
-
|
806 |
-
$helper = Mage::helper('shiphawk_shipping');
|
807 |
-
/* check if all origin attributes are set */
|
808 |
-
$per_product = $helper->checkShipHawkOriginAttributes($product);
|
809 |
-
|
810 |
-
if($per_product == true) {
|
811 |
-
return $product->getAttributeText('shiphawk_origin_location');
|
812 |
-
}
|
813 |
-
|
814 |
-
if($shipping_origin_id) {
|
815 |
-
// get zip code from Shiping Origin
|
816 |
-
$shipping_origin = Mage::getModel('shiphawk_shipping/origins')->load($shipping_origin_id);
|
817 |
-
$product_origin_zip_code = $shipping_origin->getData('shiphawk_origin_location');
|
818 |
-
return $product_origin_zip_code;
|
819 |
-
}
|
820 |
-
|
821 |
-
return $default_origin_location;
|
822 |
-
}
|
823 |
-
|
824 |
-
public function getIsPacked($product) {
|
825 |
-
$default_is_packed = Mage::getStoreConfig('carriers/shiphawk_shipping/item_is_packed');
|
826 |
-
$product_is_packed = $product->getShiphawkItemIsPacked();
|
827 |
-
$product_is_packed = ($product_is_packed == 2) ? $default_is_packed : $product_is_packed;
|
828 |
-
|
829 |
-
return ($product_is_packed ? 'true' : 'false');
|
830 |
-
}
|
831 |
-
|
832 |
-
/* sort items by origin id */
|
833 |
-
public function getGroupedItemsByZip($items) {
|
834 |
-
$tmp = array();
|
835 |
-
foreach($items as $item) {
|
836 |
-
$tmp[$item['origin']][] = $item;
|
837 |
-
}
|
838 |
-
return $tmp;
|
839 |
-
}
|
840 |
-
|
841 |
-
/* sort items by origin zip code */
|
842 |
-
public function getGroupedItemsByZipPerProduct($items) {
|
843 |
-
$tmp = array();
|
844 |
-
foreach($items as $item) {
|
845 |
-
$tmp[$item['zip']][] = $item;
|
846 |
-
}
|
847 |
-
return $tmp;
|
848 |
-
}
|
849 |
-
|
850 |
-
/* sort items by carrier type */
|
851 |
-
public function getGroupedItemsByCarrierType($items) {
|
852 |
-
$tmp = array();
|
853 |
-
foreach($items as $item) {
|
854 |
-
$tmp[$item['shiphawk_carrier_type']][] = $item;
|
855 |
-
}
|
856 |
-
return $tmp;
|
857 |
-
}
|
858 |
-
|
859 |
-
/* sort items by discount or markup */
|
860 |
-
public function getGroupedItemsByDiscountOrMarkup($items) {
|
861 |
-
$tmp = array();
|
862 |
-
foreach($items as $item) {
|
863 |
-
$tmp[$item['shiphawk_discount_percentage']. '-' .$item['shiphawk_discount_fixed']][] = $item;
|
864 |
-
}
|
865 |
-
return $tmp;
|
866 |
-
}
|
867 |
-
|
868 |
-
/* sort items by shiphawk_custom_packing_price */
|
869 |
-
public function getGroupedItemsByCustomPackingPrice($items) {
|
870 |
-
$tmp = array();
|
871 |
-
foreach($items as $item) {
|
872 |
-
$tmp[$item['shiphawk_custom_packing_price']][] = $item;
|
873 |
-
}
|
874 |
-
return $tmp;
|
875 |
-
}
|
876 |
-
|
877 |
-
protected function _getChipiestRateId($services) {
|
878 |
-
|
879 |
-
$t = array();
|
880 |
-
foreach ($services as $id_service=>$service) {
|
881 |
-
$t[$id_service] = $service['price'];
|
882 |
-
}
|
883 |
-
|
884 |
-
asort($t);
|
885 |
-
|
886 |
-
$rate_id = key($t);
|
887 |
-
|
888 |
-
return $rate_id;
|
889 |
-
}
|
890 |
-
|
891 |
-
public function getServices($ship_responces, $toOrder, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting) {
|
892 |
-
|
893 |
-
$services = array();
|
894 |
-
$helper = Mage::helper('shiphawk_shipping');
|
895 |
-
foreach($ship_responces as $ship_responce) {
|
896 |
-
if(is_array($ship_responce)) {
|
897 |
-
$custom_products_packing_price = 0;
|
898 |
-
foreach($ship_responce as $object) {
|
899 |
-
$services[$object->id]['name'] = $this->_getServiceName($object);
|
900 |
-
|
901 |
-
foreach($toOrder as $rate_id=>$rate_data) {
|
902 |
-
if($rate_id == $object->id){
|
903 |
-
$services[$object->id]['custom_products_packing_price'] = $rate_data['custom_products_packing_price'];
|
904 |
-
$custom_products_packing_price = $rate_data['custom_products_packing_price'];
|
905 |
-
break;
|
906 |
-
}
|
907 |
-
}
|
908 |
-
|
909 |
-
$services[$object->id]['price'] = $helper->getSummaryPrice($object, $self_pack, $charge_customer_for_packing, $custom_packing_price_setting, $custom_products_packing_price);
|
910 |
-
$services[$object->id]['carrier'] = $this->getCarrierName($object);
|
911 |
-
$services[$object->id]['shiphawk_price'] = $helper->getShipHawkPrice($object, $self_pack, $charge_customer_for_packing);
|
912 |
-
|
913 |
-
/* packing info */
|
914 |
-
$services[$object->id]['packing']['price'] = $object->packing->price;
|
915 |
-
$services[$object->id]['packing']['info'] = $this->getPackeges($object);
|
916 |
-
$services[$object->id]['delivery'] = ''; //todo delivery
|
917 |
-
$services[$object->id]['carrier_type'] = ''; //todo carrier type
|
918 |
-
|
919 |
-
/* accesorial info */
|
920 |
-
$services[$object->id]['accessorial'] = $object->shipping->carrier_accessorial;
|
921 |
-
|
922 |
-
/* discount-markup by product or by sys. conf. */
|
923 |
-
|
924 |
-
foreach($toOrder as $rate_id=>$rate_data) {
|
925 |
-
if($rate_id == $object->id){
|
926 |
-
$services[$object->id]['shiphawk_discount_fixed'] = $rate_data['shiphawk_discount_fixed'];
|
927 |
-
$services[$object->id]['shiphawk_discount_percentage'] = $rate_data['shiphawk_discount_percentage'];
|
928 |
-
break;
|
929 |
-
}
|
930 |
-
}
|
931 |
-
}
|
932 |
-
}
|
933 |
-
}
|
934 |
-
|
935 |
-
return $services;
|
936 |
-
}
|
937 |
-
|
938 |
-
public function getPackeges($object) {
|
939 |
-
$result = array();
|
940 |
-
$i=0;
|
941 |
-
$package_info = '';
|
942 |
-
foreach ($object->packing->packages as $package_object) {
|
943 |
-
$result[$i]['tracking_number'] = $package_object->tracking_number;
|
944 |
-
$result[$i]['tracking_url'] = $package_object->tracking_url;
|
945 |
-
$result[$i]['packing_type'] = $package_object->packing_type;
|
946 |
-
$result[$i]['dimensions']['length'] = $package_object->dimensions->length;
|
947 |
-
$result[$i]['dimensions']['width'] = $package_object->dimensions->width;
|
948 |
-
$result[$i]['dimensions']['height'] = $package_object->dimensions->height;
|
949 |
-
$result[$i]['dimensions']['weight'] = $package_object->dimensions->weight;
|
950 |
-
$result[$i]['dimensions']['volume'] = $package_object->dimensions->volume;
|
951 |
-
$result[$i]['dimensions']['density'] = $package_object->dimensions->density;
|
952 |
-
|
953 |
-
$package_info .= $package_object->dimensions->length .
|
954 |
-
'x' . $package_object->dimensions->width .
|
955 |
-
'x' . $package_object->dimensions->height .
|
956 |
-
', ' . $package_object->dimensions->weight . ' lbs. ';
|
957 |
-
|
958 |
-
$i++;
|
959 |
-
}
|
960 |
-
|
961 |
-
return $package_info;
|
962 |
-
}
|
963 |
-
|
964 |
-
protected function _getServiceName($object) {
|
965 |
-
|
966 |
-
if ( $object->shipping->carrier_type == "Small Parcel" ) {
|
967 |
-
return $object->shipping->service;
|
968 |
-
}
|
969 |
-
|
970 |
-
if ( $object->shipping->carrier_type == "Blanket Wrap" ) {
|
971 |
-
return "Standard White Glove Delivery (3-6 weeks)";
|
972 |
-
}
|
973 |
-
|
974 |
-
if ( ( ( $object->shipping->carrier_type == "LTL" ) || ( $object->shipping->carrier_type == "3PL" ) || ( $object->shipping->carrier_type == "Intermodal" ) ) && ($object->delivery->price == 0) ) {
|
975 |
-
return "Curbside Delivery (1-2 weeks)";
|
976 |
-
}
|
977 |
-
|
978 |
-
if ( ( ( $object->shipping->carrier_type == "LTL" ) || ( $object->shipping->carrier_type == "3PL" ) || ( $object->shipping->carrier_type == "Intermodal" ) ) && ($object->delivery->price > 0) ) {
|
979 |
-
return "Expedited White Glove Delivery (2-3 weeks)";
|
980 |
-
}
|
981 |
-
|
982 |
-
if ( $object->shipping->carrier_type == "Home Delivery" ) {
|
983 |
-
return "Home Delivery - " . $object->shipping->service . " (1-2 weeks)";
|
984 |
-
}
|
985 |
-
|
986 |
-
return $object->shipping->service;
|
987 |
-
|
988 |
-
}
|
989 |
-
|
990 |
-
public function getCarrierName($object) {
|
991 |
-
return $object->shipping->carrier_friendly_name;
|
992 |
-
}
|
993 |
-
|
994 |
-
/*
|
995 |
-
1. If carrier_type = "Small Parcel" display name should be what's included in field [Service] (example: Ground)
|
996 |
-
|
997 |
-
2. If carrier_type = "Blanket Wrap" display name should be:
|
998 |
-
"Standard White Glove Delivery (3-6 weeks)"
|
999 |
-
|
1000 |
-
3. If carrier_type = "LTL","3PL","Intermodal" AND delivery field inside [details][price]=$0.00 display name should be:
|
1001 |
-
"Curbside delivery (1-2 weeks)"
|
1002 |
-
|
1003 |
-
4. If carrier_type = "LTL","3PL" "Intermodal" AND delivery field inside [details][price] > $0.00 display name should be:
|
1004 |
-
"Expedited White Glove Delivery (2-3 weeks)"
|
1005 |
-
|
1006 |
-
Additional rule for naming (both frontend and backend):
|
1007 |
-
|
1008 |
-
If carrier_type = "Home Delivery" display name should be:
|
1009 |
-
"Home Delivery - {{
|
1010 |
-
{Service name from received rate}
|
1011 |
-
}} (1-2 weeks)"
|
1012 |
-
==> example: Home Delivery - One Man (1-2 weeks)
|
1013 |
-
|
1014 |
-
*/
|
1015 |
-
|
1016 |
-
public function isTrackingAvailable()
|
1017 |
-
{
|
1018 |
-
return true;
|
1019 |
-
}
|
1020 |
-
|
1021 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Observer.php
DELETED
@@ -1,351 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Observer extends Mage_Core_Model_Abstract
|
3 |
-
{
|
4 |
-
protected function _setAttributeRequired($attributeCode, $is_active) {
|
5 |
-
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode( 'catalog_product', $attributeCode);
|
6 |
-
$attributeModel->setIsRequired($is_active);
|
7 |
-
$attributeModel->save();
|
8 |
-
}
|
9 |
-
|
10 |
-
public function salesOrderPlaceAfter($observer) {
|
11 |
-
$event = $observer->getEvent();
|
12 |
-
$order = $event->getOrder();
|
13 |
-
$orderId = $order->getId();
|
14 |
-
|
15 |
-
/* For accessories */
|
16 |
-
$accessories = Mage::app()->getRequest()->getPost('accessories', array());
|
17 |
-
$helper = Mage::helper('shiphawk_shipping');
|
18 |
-
|
19 |
-
$manual_shipping = Mage::getStoreConfig('carriers/shiphawk_shipping/book_shipment');
|
20 |
-
$shipping_code = $order->getShippingMethod();
|
21 |
-
$shipping_description = $order->getShippingDescription();
|
22 |
-
$check_shiphawk = Mage::helper('shiphawk_shipping')->isShipHawkShipping($shipping_code);
|
23 |
-
if($check_shiphawk !== false) {
|
24 |
-
|
25 |
-
/* For location type */
|
26 |
-
$shLocationType = Mage::getSingleton('checkout/session')->getData('shiphawk_location_type_shipping');
|
27 |
-
|
28 |
-
if (!empty($shLocationType)) $order->setShiphawkLocationType($shLocationType);
|
29 |
-
|
30 |
-
// set ShipHawk rate todo ship to multiply shiping address, only one shipping order save to session
|
31 |
-
$shiphawk_book_id = Mage::getSingleton('core/session')->getShiphawkBookId();
|
32 |
-
|
33 |
-
$multi_zip_code = Mage::getSingleton('core/session')->getMultiZipCode();
|
34 |
-
|
35 |
-
// set ShipHawk rate filter
|
36 |
-
$shiphawkRateFilter = Mage::getSingleton('core/session')->getShiphawkRateFilter();
|
37 |
-
$order->setShiphawkRateFilter($shiphawkRateFilter);
|
38 |
-
|
39 |
-
//shiphawk_shipping_amount
|
40 |
-
if($multi_zip_code == false) {
|
41 |
-
|
42 |
-
$shiphawk_book_id = $helper->getShipHawkCode($shiphawk_book_id, $shipping_code);
|
43 |
-
foreach ($shiphawk_book_id as $rate_id=>$method_data) {
|
44 |
-
//$order->setShiphawkShippingAmount($method_data['price']);
|
45 |
-
$shiphawk_shipping_amount = $method_data['price'];
|
46 |
-
$order->setShiphawkShippingPackageInfo($method_data['packing_info']);
|
47 |
-
}
|
48 |
-
|
49 |
-
}else{
|
50 |
-
//if multi origin shipping
|
51 |
-
$shiphawk_shipping_amount = Mage::getSingleton('core/session')->getSummPrice();
|
52 |
-
$shiphawk_shipping_package_info = Mage::getSingleton('core/session')->getPackageInfo();
|
53 |
-
//$order->setShiphawkShippingAmount($shiphawk_shipping_amount);
|
54 |
-
$order->setShiphawkShippingPackageInfo($shiphawk_shipping_package_info);
|
55 |
-
}
|
56 |
-
|
57 |
-
$order->setShiphawkBookId(serialize($shiphawk_book_id));
|
58 |
-
|
59 |
-
// it's for admin order
|
60 |
-
if (!empty($accessories)) {
|
61 |
-
/* For accessories */
|
62 |
-
$accessoriesPrice = 0;
|
63 |
-
$accessoriesData = array();
|
64 |
-
foreach($accessories as $typeName => $type) {
|
65 |
-
foreach($type as $name => $values) {
|
66 |
-
foreach($values as $key => $value) {
|
67 |
-
$accessoriesData[$typeName][$key]['name'] = $name;
|
68 |
-
$accessoriesData[$typeName][$key]['value'] = (float)$value;
|
69 |
-
|
70 |
-
$accessoriesPrice += (float)$value;
|
71 |
-
}
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
$newAccessoriesPrice = $order->getShippingAmount() + $accessoriesPrice;
|
76 |
-
$newGtandTotal = $order->getGrandTotal() + $accessoriesPrice;
|
77 |
-
|
78 |
-
$order->setShiphawkShippingAccessories(json_encode($accessoriesData));
|
79 |
-
$order->setShippingAmount($newAccessoriesPrice);
|
80 |
-
$order->setBaseShippingAmount($newAccessoriesPrice);
|
81 |
-
$order->setGrandTotal($newGtandTotal);
|
82 |
-
$order->setBaseGrandTotal($newGtandTotal);
|
83 |
-
|
84 |
-
$order->setShiphawkShippingAmount($shiphawk_shipping_amount + $accessoriesPrice);
|
85 |
-
}else{
|
86 |
-
|
87 |
-
// it is for frontend order - accessories saved in checkout_type_onepage_save_order event
|
88 |
-
$accessoriesPriceData = json_decode($order->getData('shiphawk_shipping_accessories'));
|
89 |
-
$accessoriesPrice = $helper->getAccessoriesPrice($accessoriesPriceData);
|
90 |
-
|
91 |
-
$order->setShiphawkShippingAmount($shiphawk_shipping_amount + $accessoriesPrice);
|
92 |
-
}
|
93 |
-
|
94 |
-
$order->save();
|
95 |
-
if(!$manual_shipping) {
|
96 |
-
if ($order->canShip()) {
|
97 |
-
$api = Mage::getModel('shiphawk_shipping/api');
|
98 |
-
$api->saveshipment($orderId);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
Mage::getSingleton('core/session')->unsShiphawkBookId();
|
104 |
-
Mage::getSingleton('core/session')->unsMultiZipCode();
|
105 |
-
Mage::getSingleton('core/session')->unsSummPrice();
|
106 |
-
Mage::getSingleton('core/session')->unsPackageInfo();
|
107 |
-
|
108 |
-
Mage::getSingleton('core/session')->unsetData('admin_accessories_price');
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* For rewrite address collectTotals
|
113 |
-
*
|
114 |
-
* @param $observer
|
115 |
-
*
|
116 |
-
* @version 20150617
|
117 |
-
*/
|
118 |
-
public function recalculationTotals($observer) {
|
119 |
-
$event = $observer->getEvent();
|
120 |
-
$address = $event->getQuoteAddress();
|
121 |
-
|
122 |
-
$session = Mage::getSingleton('checkout/session');
|
123 |
-
$accessories = $session->getData('shipment_accessories');
|
124 |
-
$method = $address->getShippingMethod();
|
125 |
-
|
126 |
-
// we have no accessories on cart page
|
127 |
-
$is_it_cart_page = Mage::helper('shiphawk_shipping')->checkIsItCartPage();
|
128 |
-
|
129 |
-
if (empty($accessories['accessories_price']) || !$method || $is_it_cart_page) {
|
130 |
-
return;
|
131 |
-
}
|
132 |
-
|
133 |
-
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
|
134 |
-
$discount = 0;
|
135 |
-
if(isset($totals['discount'])&&$totals['discount']->getValue()) {
|
136 |
-
$discount = round($totals['discount']->getValue(), 2); //Discount value if applied
|
137 |
-
}
|
138 |
-
|
139 |
-
$accessoriesPrice = (float)$accessories['accessories_price'];
|
140 |
-
$grandTotal = (float)$accessories['grand_total'];
|
141 |
-
$baseGrandTotal = (float)$accessories['base_grand_total'];
|
142 |
-
$shippingAmount = (float)$accessories['shipping_amount'];
|
143 |
-
$baseShippingAmount = (float)$accessories['base_shipping_amount'];
|
144 |
-
|
145 |
-
//$shippingAmount = empty($shippingAmount) ? $address->getShippingAmount() : $shippingAmount;
|
146 |
-
$shippingAmount = $address->getShippingAmount();
|
147 |
-
//$baseShippingAmount = empty($baseShippingAmount) ? $address->getBaseShippingAmount() : $baseShippingAmount;
|
148 |
-
$baseShippingAmount = $address->getBaseShippingAmount();
|
149 |
-
|
150 |
-
$newShippingPrice = $shippingAmount + $accessoriesPrice;
|
151 |
-
$newShippingBasePrice = $baseShippingAmount + $accessoriesPrice;
|
152 |
-
|
153 |
-
$address->setShippingAmount($newShippingPrice);
|
154 |
-
$address->setBaseShippingAmount($baseShippingAmount + $accessoriesPrice);
|
155 |
-
$address->setGrandTotal($grandTotal + $newShippingPrice + ($discount));
|
156 |
-
$address->setBaseGrandTotal($baseGrandTotal + $newShippingBasePrice);
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* For save accessories in checkout session
|
161 |
-
*
|
162 |
-
* @param $observer
|
163 |
-
*
|
164 |
-
* @version 20150617
|
165 |
-
*/
|
166 |
-
public function setAccessories($observer) {
|
167 |
-
$event = $observer->getEvent();
|
168 |
-
$accessories = $event->getRequest()->getPost('accessories', array());
|
169 |
-
$address = $event->getQuote()->getShippingAddress();
|
170 |
-
$grandTotal = $address->getSubtotal();
|
171 |
-
$baseGrandTotal = $address->getBaseSubtotal();
|
172 |
-
$shippingAmount = $address->getShippingInclTax();
|
173 |
-
$baseShippingAmount = $address->getBaseShippingInclTax();
|
174 |
-
$session = Mage::getSingleton('checkout/session');
|
175 |
-
|
176 |
-
if (empty($accessories)) {
|
177 |
-
$session->setData("shipment_accessories", array());
|
178 |
-
return;
|
179 |
-
}
|
180 |
-
|
181 |
-
$accessoriesPrice = 0;
|
182 |
-
$accessoriesData = array();
|
183 |
-
foreach($accessories as $typeName => $type) {
|
184 |
-
foreach($type as $name => $values) {
|
185 |
-
foreach($values as $key => $value) {
|
186 |
-
$accessoriesData[$typeName][$key]['name'] = $name;
|
187 |
-
$accessoriesData[$typeName][$key]['value'] = (float)$value;
|
188 |
-
|
189 |
-
$accessoriesPrice += (float)$value;
|
190 |
-
}
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
$params['data'] = $accessoriesData;
|
195 |
-
$params['grand_total'] = $grandTotal;
|
196 |
-
$params['base_grand_total'] = $baseGrandTotal;
|
197 |
-
$params['accessories_price'] = $accessoriesPrice;
|
198 |
-
$params['shipping_amount'] = $shippingAmount;
|
199 |
-
$params['base_shipping_amount'] = $baseShippingAmount;
|
200 |
-
|
201 |
-
$session->setData("shipment_accessories", $params);
|
202 |
-
$session->setAccessoriesprice($accessoriesPrice);
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* For save accessories in order
|
207 |
-
*
|
208 |
-
* @param $observer
|
209 |
-
*
|
210 |
-
* @version 20150618
|
211 |
-
*/
|
212 |
-
public function saveAccessoriesInOrder($observer) {
|
213 |
-
$event = $observer->getEvent();
|
214 |
-
$order = $event->getOrder();
|
215 |
-
|
216 |
-
$session = Mage::getSingleton('checkout/session');
|
217 |
-
$accessories = $session->getData("shipment_accessories");
|
218 |
-
|
219 |
-
//clear session data
|
220 |
-
$session->unsetData('shipment_accessories');
|
221 |
-
|
222 |
-
if (empty($accessories['accessories_price'])) {
|
223 |
-
return;
|
224 |
-
}
|
225 |
-
|
226 |
-
$order->setShiphawkShippingAccessories(json_encode($accessories['data']));
|
227 |
-
$order->save();
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* For rewrite shipping/method/form.phtml template
|
232 |
-
*
|
233 |
-
* @param $observer
|
234 |
-
*
|
235 |
-
* @version 20150622
|
236 |
-
*/
|
237 |
-
public function changeSippingMethodTemplate($observer) {
|
238 |
-
if ($observer->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Create_Shipping_Method_Form) {
|
239 |
-
$observer->getBlock()->setTemplate('shiphawk/shipping/method/form.phtml')->renderView();
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* For override shipping cost by admin, when he create order
|
245 |
-
*
|
246 |
-
* @param $observer
|
247 |
-
*
|
248 |
-
* @version 20150626
|
249 |
-
*/
|
250 |
-
public function overrideShippingCost($observer) {
|
251 |
-
$event = $observer->getEvent();
|
252 |
-
$order = $event->getOrder();
|
253 |
-
$subTotal = $order->getSubtotal();
|
254 |
-
|
255 |
-
$overrideCost = Mage::app()->getRequest()->getPost('sh_override_shipping_cost', 0);
|
256 |
-
|
257 |
-
if ((floatval($overrideCost) < 0)||($overrideCost === null)||( $overrideCost === "")) {
|
258 |
-
return;
|
259 |
-
}
|
260 |
-
|
261 |
-
$overrideCost = floatval($overrideCost);
|
262 |
-
|
263 |
-
$grandTotal = $subTotal + $overrideCost;
|
264 |
-
|
265 |
-
$order->setShippingAmount($overrideCost);
|
266 |
-
$order->setBaseShippingAmount($overrideCost);
|
267 |
-
$order->setGrandTotal($grandTotal);
|
268 |
-
$order->setBaseGrandTotal($grandTotal);
|
269 |
-
|
270 |
-
$order->save();
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* @param $observer
|
275 |
-
*/
|
276 |
-
public function showShiphawkRateError($observer) {
|
277 |
-
|
278 |
-
$err_text = Mage::getSingleton('core/session')->getShiphawkErrorRate();
|
279 |
-
if($err_text) {
|
280 |
-
Mage::getSingleton('core/session')->getMessages(true); // The true is for clearing them after loading them
|
281 |
-
Mage::getSingleton('core/session')->addError($err_text);
|
282 |
-
}
|
283 |
-
|
284 |
-
Mage::getSingleton('core/session')->unsShiphawkErrorRate();
|
285 |
-
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* Update accessories & shipping price in admin order view
|
290 |
-
* @param $observer
|
291 |
-
*/
|
292 |
-
public function addAccessoriesToTotals($observer) {
|
293 |
-
|
294 |
-
if(!Mage::helper('shiphawk_shipping')->checkIsAdmin()) {
|
295 |
-
return;
|
296 |
-
}
|
297 |
-
|
298 |
-
$event = $observer->getEvent();
|
299 |
-
$address = $event->getQuoteAddress();
|
300 |
-
|
301 |
-
$accessories_price_admin = Mage::getSingleton('core/session')->getData('admin_accessories_price');
|
302 |
-
|
303 |
-
$shiphawk_override_cost = Mage::getSingleton('core/session')->getData('shiphawk_override_cost');
|
304 |
-
|
305 |
-
$shippingAmount = $address->getShippingAmount();
|
306 |
-
|
307 |
-
if(empty($shippingAmount)) {
|
308 |
-
return;
|
309 |
-
}
|
310 |
-
|
311 |
-
$baseShippingAmount = $address->getBaseShippingAmount();
|
312 |
-
|
313 |
-
$grandTotal = $address->getSubtotal();
|
314 |
-
$baseGrandTotal = $address->getBaseSubtotal();
|
315 |
-
|
316 |
-
$newShippingPrice = $shippingAmount + $accessories_price_admin;
|
317 |
-
$newShippingBasePrice = $baseShippingAmount + $accessories_price_admin;
|
318 |
-
|
319 |
-
$totals = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getTotals();
|
320 |
-
$discount = 0;
|
321 |
-
if(isset($totals['discount'])&&$totals['discount']->getValue()) {
|
322 |
-
$discount = round($totals['discount']->getValue(), 2); //Discount value if applied
|
323 |
-
}
|
324 |
-
|
325 |
-
$address->setShippingAmount($newShippingPrice);
|
326 |
-
$address->setBaseShippingAmount($baseShippingAmount + $accessories_price_admin);
|
327 |
-
$address->setGrandTotal($grandTotal + $newShippingPrice + ($discount));
|
328 |
-
$address->setBaseGrandTotal($baseGrandTotal + $newShippingBasePrice);
|
329 |
-
|
330 |
-
Mage::getSingleton('core/session')->unsetData('admin_accessories_price');
|
331 |
-
|
332 |
-
if ((floatval($shiphawk_override_cost) < 0)||($shiphawk_override_cost === null)||( $shiphawk_override_cost === "")) {
|
333 |
-
return;
|
334 |
-
}
|
335 |
-
|
336 |
-
$overrideCost = floatval($shiphawk_override_cost);
|
337 |
-
|
338 |
-
$subTotal = $address->getSubtotal();
|
339 |
-
$grandTotal = $subTotal + $overrideCost;
|
340 |
-
|
341 |
-
|
342 |
-
$address->setShippingAmount($overrideCost);
|
343 |
-
$address->setBaseShippingAmount($overrideCost);
|
344 |
-
$address->setGrandTotal($grandTotal);
|
345 |
-
$address->setBaseGrandTotal($grandTotal);
|
346 |
-
|
347 |
-
Mage::getSingleton('core/session')->unsetData('shiphawk_override_cost');
|
348 |
-
|
349 |
-
}
|
350 |
-
|
351 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Origins.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Origins extends Mage_Core_Model_Abstract
|
3 |
-
{
|
4 |
-
|
5 |
-
protected function _construct()
|
6 |
-
{
|
7 |
-
$this->_init('shiphawk_shipping/origins');
|
8 |
-
}
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Product/Attribute/Source/Location.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Product_Attribute_Source_Location
|
3 |
-
extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Retrieve all attribute options
|
7 |
-
*
|
8 |
-
* @return array
|
9 |
-
*/
|
10 |
-
public function getAllOptions()
|
11 |
-
{
|
12 |
-
$this->_options = array(
|
13 |
-
array(
|
14 |
-
'label' => Mage::helper('catalog')->__('commercial'),
|
15 |
-
'value' => Mage::helper('catalog')->__('commercial')
|
16 |
-
),
|
17 |
-
array(
|
18 |
-
'label' => Mage::helper('catalog')->__('residential'),
|
19 |
-
'value' => Mage::helper('catalog')->__('residential')
|
20 |
-
)
|
21 |
-
);
|
22 |
-
|
23 |
-
return $this->_options;
|
24 |
-
}
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Resource/Origins.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Resource_Origins extends Mage_Core_Model_Mysql4_Abstract
|
3 |
-
{
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_init('shiphawk_shipping/origins', 'id');
|
7 |
-
}
|
8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Resource/Origins/Collection.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Resource_Origins_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
-
{
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_init('shiphawk_shipping/origins');
|
7 |
-
}
|
8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Source/Adminratefilter.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Source_Adminratefilter
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value'=>'consumer', 'label'=>Mage::helper('adminhtml')->__('consumer')),
|
8 |
-
array('value'=>'top_10', 'label'=>Mage::helper('adminhtml')->__('top 10')),
|
9 |
-
);
|
10 |
-
}
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Source/Carriertype.php
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Source_Carriertype
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('All')),
|
8 |
-
array('value'=>'ltl', 'label'=>Mage::helper('adminhtml')->__('ltl')),
|
9 |
-
array('value'=>'blanket wrap', 'label'=>Mage::helper('adminhtml')->__('blanket wrap')),
|
10 |
-
array('value'=>'small parcel', 'label'=>Mage::helper('adminhtml')->__('small parcel')),
|
11 |
-
array('value'=>'vehicle', 'label'=>Mage::helper('adminhtml')->__('vehicle')),
|
12 |
-
array('value'=>'intermodal', 'label'=>Mage::helper('adminhtml')->__('intermodal')),
|
13 |
-
);
|
14 |
-
}
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Source/Freeshipping.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Source_Freeshipping
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value'=>'none', 'label'=>Mage::helper('adminhtml')->__('None')),
|
8 |
-
array('value'=>'cheapest', 'label'=>Mage::helper('adminhtml')->__('Cheapest')),
|
9 |
-
array('value'=>'all', 'label'=>Mage::helper('adminhtml')->__('All'))
|
10 |
-
);
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Source/Gateway.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Source_Gateway
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value'=>'https://shiphawk.com/api/v3/', 'label'=>Mage::helper('adminhtml')->__('Live')),
|
8 |
-
array('value'=>'https://sandbox.shiphawk.com/api/v3/', 'label'=>Mage::helper('adminhtml')->__('Sandbox')),
|
9 |
-
);
|
10 |
-
}
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Source/Location.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Source_Location
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value'=>'commercial', 'label'=>Mage::helper('adminhtml')->__('commercial')),
|
8 |
-
array('value'=>'residential', 'label'=>Mage::helper('adminhtml')->__('residential')),
|
9 |
-
);
|
10 |
-
}
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Source/Ratefilter.php
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Source_Ratefilter
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value'=>'consumer', 'label'=>Mage::helper('adminhtml')->__('consumer')),
|
8 |
-
array('value'=>'best', 'label'=>Mage::helper('adminhtml')->__('best')),
|
9 |
-
/*array('value'=>'min_rate', 'label'=>Mage::helper('adminhtml')->__('min_rate')),
|
10 |
-
array('value'=>'fastest', 'label'=>Mage::helper('adminhtml')->__('fastest')),
|
11 |
-
array('value'=>'asc', 'label'=>Mage::helper('adminhtml')->__('asc')),
|
12 |
-
array('value'=>'desc', 'label'=>Mage::helper('adminhtml')->__('desc')),*/
|
13 |
-
);
|
14 |
-
}
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/Model/Source/Received.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Model_Source_Received
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value'=>0, 'label'=>Mage::helper('adminhtml')->__('customer')),
|
8 |
-
array('value'=>1, 'label'=>Mage::helper('adminhtml')->__('administrator')),
|
9 |
-
);
|
10 |
-
}
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/controllers/Adminhtml/ImportController.php
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Adminhtml_ImportController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
|
5 |
-
public function importAction() {
|
6 |
-
|
7 |
-
$fileimport = Mage::getStoreConfig('carriers/shiphawk_shipping/file_import');
|
8 |
-
|
9 |
-
$urlpath = Mage::getBaseDir('var') . DS . 'shiphawk' . DS.'import' . DS . $fileimport;
|
10 |
-
|
11 |
-
$row = 1;
|
12 |
-
if (($handle = fopen($urlpath, "r")) !== FALSE) {
|
13 |
-
|
14 |
-
while (($data = fgetcsv($handle, 1000, ",", '"')) !== FALSE) {
|
15 |
-
if($row == 1){ $row++; continue; }
|
16 |
-
|
17 |
-
$row++;
|
18 |
-
try {
|
19 |
-
list($id, $shiphawk_origin_firstname, $shiphawk_origin_lastname, $shiphawk_origin_addressline1, $shiphawk_origin_addressline2, $shiphawk_origin_city, $shiphawk_origin_state,
|
20 |
-
$shiphawk_origin_zipcode, $shiphawk_origin_phonenum, $shiphawk_origin_location, $shiphawk_origin_email, $shiphawk_origin_title) = $data;
|
21 |
-
$answer = Mage::getModel('shiphawk_shipping/origins');
|
22 |
-
$answer->setShiphawkOriginFirstname($shiphawk_origin_firstname)
|
23 |
-
->setShiphawkOriginLastname($shiphawk_origin_lastname)
|
24 |
-
->setShiphawkOriginAddressline1($shiphawk_origin_addressline1)
|
25 |
-
->setShiphawkOriginAddressline2($shiphawk_origin_addressline2)
|
26 |
-
->setShiphawkOriginCity($shiphawk_origin_city)
|
27 |
-
->setShiphawkOriginState($shiphawk_origin_state)
|
28 |
-
->setShiphawkOriginZipcode($shiphawk_origin_zipcode)
|
29 |
-
->setShiphawkOriginPhonenum($shiphawk_origin_phonenum)
|
30 |
-
->setShiphawkOriginLocation($shiphawk_origin_location)
|
31 |
-
->setShiphawkOriginEmail($shiphawk_origin_email)
|
32 |
-
->setShiphawkOriginTitle($shiphawk_origin_title)
|
33 |
-
->save();
|
34 |
-
|
35 |
-
|
36 |
-
Mage::app()->getResponse()->setBody('Import successful');
|
37 |
-
|
38 |
-
} catch (Mage_Core_Exception $e) {
|
39 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
40 |
-
Mage::app()->getResponse()->setBody($e->getMessage());
|
41 |
-
} catch (Exception $e) {
|
42 |
-
Mage::logException($e);
|
43 |
-
|
44 |
-
Mage::app()->getResponse()->setBody($e->getMessage());
|
45 |
-
}
|
46 |
-
}
|
47 |
-
fclose($handle);
|
48 |
-
|
49 |
-
}else{
|
50 |
-
Mage::app()->getResponse()->setBody('Please upload file');
|
51 |
-
}
|
52 |
-
|
53 |
-
|
54 |
-
}
|
55 |
-
|
56 |
-
protected function _uploadImportFile() {
|
57 |
-
if ($data = $this->getRequest()->getPost()) {
|
58 |
-
|
59 |
-
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
60 |
-
try {
|
61 |
-
/* Starting upload */
|
62 |
-
$uploader = new Varien_File_Uploader('filename');
|
63 |
-
|
64 |
-
// Any extention would work
|
65 |
-
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
66 |
-
$uploader->setAllowRenameFiles(false);
|
67 |
-
|
68 |
-
// Set the file upload mode
|
69 |
-
// false -> get the file directly in the specified folder
|
70 |
-
// true -> get the file in the product like folders
|
71 |
-
// (file.jpg will go in something like /media/f/i/file.jpg)
|
72 |
-
$uploader->setFilesDispersion(false);
|
73 |
-
|
74 |
-
// We set media as the upload dir
|
75 |
-
$path = Mage::getBaseDir('media') . DS ;
|
76 |
-
$uploader->save($path, $_FILES['filename']['name'] );
|
77 |
-
|
78 |
-
} catch (Exception $e) {
|
79 |
-
|
80 |
-
}
|
81 |
-
|
82 |
-
//this way the name is saved in DB
|
83 |
-
$data['filename'] = $_FILES['filename']['name'];
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/controllers/Adminhtml/OriginsController.php
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Adminhtml_OriginsController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
public function indexAction()
|
5 |
-
{
|
6 |
-
$this->_title($this->__('Shipping Origins'));
|
7 |
-
|
8 |
-
$this->loadLayout();
|
9 |
-
$this->_setActiveMenu('shiphawk_shipping');
|
10 |
-
$this->_addBreadcrumb(Mage::helper('shiphawk_shipping')->__('Shipping Origins'), Mage::helper('shiphawk_shipping')->__('Shipping Origins'));
|
11 |
-
$this->renderLayout();
|
12 |
-
}
|
13 |
-
|
14 |
-
public function newAction()
|
15 |
-
{
|
16 |
-
$this->_title($this->__('Add new Origins'));
|
17 |
-
$this->loadLayout();
|
18 |
-
$this->_setActiveMenu('shiphawk_shipping');
|
19 |
-
$this->_addBreadcrumb(Mage::helper('shiphawk_shipping')->__('Add new Origins'), Mage::helper('shiphawk_shipping')->__('Add new Origins'));
|
20 |
-
$this->renderLayout();
|
21 |
-
}
|
22 |
-
|
23 |
-
public function editAction()
|
24 |
-
{
|
25 |
-
$this->_title($this->__('Edit Origins'));
|
26 |
-
|
27 |
-
$this->loadLayout();
|
28 |
-
$this->_setActiveMenu('shiphawk_shipping');
|
29 |
-
$this->_addBreadcrumb(Mage::helper('shiphawk_shipping')->__('Edit Origins'), Mage::helper('shiphawk_shipping')->__('Edit Origins'));
|
30 |
-
$this->renderLayout();
|
31 |
-
}
|
32 |
-
|
33 |
-
public function deleteAction()
|
34 |
-
{
|
35 |
-
$tipId = $this->getRequest()->getParam('id', false);
|
36 |
-
|
37 |
-
try {
|
38 |
-
Mage::getModel('shiphawk_shipping/origins')->setId($tipId)->delete();
|
39 |
-
|
40 |
-
|
41 |
-
Mage::dispatchEvent('origins_delete_after', array('id'=>$tipId));
|
42 |
-
|
43 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('shiphawk_shipping')->__('origins successfully deleted'));
|
44 |
-
|
45 |
-
return $this->_redirect('*/*/');
|
46 |
-
} catch (Mage_Core_Exception $e){
|
47 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
48 |
-
} catch (Exception $e) {
|
49 |
-
Mage::logException($e);
|
50 |
-
Mage::getSingleton('adminhtml/session')->addError($this->__('Somethings went wrong'));
|
51 |
-
}
|
52 |
-
|
53 |
-
$this->_redirectReferer();
|
54 |
-
}
|
55 |
-
|
56 |
-
public function saveAction()
|
57 |
-
{
|
58 |
-
$data = $this->getRequest()->getPost();
|
59 |
-
|
60 |
-
foreach ($data as $key => $value)
|
61 |
-
{
|
62 |
-
if (is_array($value))
|
63 |
-
{
|
64 |
-
$data[$key] = implode(',',$this->getRequest()->getParam($key));
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
if (!empty($data)) {
|
69 |
-
try {
|
70 |
-
$origins = Mage::getModel('shiphawk_shipping/origins')
|
71 |
-
->setData($data)
|
72 |
-
->save();
|
73 |
-
|
74 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('shiphawk_shipping')->__('origins successfully saved'));
|
75 |
-
} catch (Mage_Core_Exception $e) {
|
76 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
77 |
-
} catch (Exception $e) {
|
78 |
-
Mage::logException($e);
|
79 |
-
Mage::getSingleton('adminhtml/session')->addError($this->__('Somethings went wrong'));
|
80 |
-
}
|
81 |
-
}
|
82 |
-
return $this->_redirect('*/*/');
|
83 |
-
}
|
84 |
-
|
85 |
-
public function gridAction()
|
86 |
-
{
|
87 |
-
$this->loadLayout();
|
88 |
-
$this->getResponse()->setBody(
|
89 |
-
$this->getLayout()->createBlock('shiphawk_shipping/adminhtml_origins_grid')->toHtml()
|
90 |
-
);
|
91 |
-
}
|
92 |
-
|
93 |
-
public function massDeleteAction()
|
94 |
-
{
|
95 |
-
$answersIds = $this->getRequest()->getParam('origins');
|
96 |
-
if(!is_array($answersIds)) {
|
97 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select origin(s).'));
|
98 |
-
} else {
|
99 |
-
try {
|
100 |
-
$answer = Mage::getModel('shiphawk_shipping/origins');
|
101 |
-
foreach ($answersIds as $answerId) {
|
102 |
-
$answer
|
103 |
-
->load($answerId)
|
104 |
-
->delete();
|
105 |
-
|
106 |
-
Mage::dispatchEvent('origins_delete_after', array('id'=>$answerId));
|
107 |
-
}
|
108 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
109 |
-
Mage::helper('adminhtml')->__('Total of %d record(s) were deleted.', count($answersIds))
|
110 |
-
);
|
111 |
-
} catch (Exception $e) {
|
112 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
$this->_redirect('*/*/index');
|
117 |
-
}
|
118 |
-
|
119 |
-
public function exportAction() {
|
120 |
-
/**
|
121 |
-
* Returns generated CSV file
|
122 |
-
*/
|
123 |
-
|
124 |
-
$filename = 'origins.csv';
|
125 |
-
$content = Mage::helper('shiphawk_shipping/origin')->generateQuestList();
|
126 |
-
|
127 |
-
$this->_prepareDownloadResponse($filename, $content);
|
128 |
-
|
129 |
-
}
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/controllers/Adminhtml/ShipmentController.php
DELETED
@@ -1,331 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_Adminhtml_ShipmentController extends Mage_Adminhtml_Controller_Action
|
3 |
-
{
|
4 |
-
/**
|
5 |
-
* Get rate and book shipments order, Manual booking
|
6 |
-
*
|
7 |
-
*
|
8 |
-
* @return null
|
9 |
-
*/
|
10 |
-
public function saveshipmentAction()
|
11 |
-
{
|
12 |
-
$orderId= $this->getRequest()->getParam('order_id');
|
13 |
-
$sUrl = $this->getRequest()->getParam('sUrl');
|
14 |
-
$response = array();
|
15 |
-
$response['error_text'] = null;
|
16 |
-
$response['order_id'] = null;
|
17 |
-
$response['sUrl'] = null;
|
18 |
-
|
19 |
-
try {
|
20 |
-
$order = Mage::getModel('sales/order')->load($orderId);
|
21 |
-
|
22 |
-
$shLocationType = $order->getShiphawkLocationType();
|
23 |
-
|
24 |
-
$shiphawk_rate_data = unserialize($order->getData('shiphawk_book_id')); //rate id
|
25 |
-
|
26 |
-
$api = Mage::getModel('shiphawk_shipping/api');
|
27 |
-
$helper = Mage::helper('shiphawk_shipping');
|
28 |
-
|
29 |
-
$items = Mage::getModel('shiphawk_shipping/carrier')->getShiphawkItems($order);
|
30 |
-
|
31 |
-
$grouped_items_by_zip = Mage::getModel('shiphawk_shipping/carrier')->getGroupedItemsByZip($items);
|
32 |
-
|
33 |
-
$shipping_description = $order->getShippingDescription();
|
34 |
-
|
35 |
-
$is_multi_zip = (count($grouped_items_by_zip) > 1) ? true : false;
|
36 |
-
$is_admin = $helper->checkIsAdmin();
|
37 |
-
|
38 |
-
$rate_filter = Mage::helper('shiphawk_shipping')->getRateFilter($is_admin, $order);
|
39 |
-
|
40 |
-
//$carrier_type = Mage::getStoreConfig('carriers/shiphawk_shipping/carrier_type');
|
41 |
-
|
42 |
-
if($is_multi_zip) {
|
43 |
-
$rate_filter = 'best';
|
44 |
-
}
|
45 |
-
|
46 |
-
$accessories = array();
|
47 |
-
|
48 |
-
foreach($shiphawk_rate_data as $rate_id=>$products_ids) {
|
49 |
-
$is_rate = false;
|
50 |
-
|
51 |
-
if(($is_multi_zip)||($rate_filter == 'best')) {
|
52 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
53 |
-
$from_zip = $products_ids['items'][0]['zip'];
|
54 |
-
$location_type = $products_ids['items'][0]['location_type'];
|
55 |
-
|
56 |
-
$carrier_type = $products_ids['carrier_type'];
|
57 |
-
$self_pack = $products_ids['self_pack'];
|
58 |
-
|
59 |
-
$responceObject = $api->getShiphawkRate($from_zip, $products_ids['to_zip'], $products_ids['items'], $rate_filter, $carrier_type, $location_type, $shLocationType);
|
60 |
-
// get only one method for each group of product
|
61 |
-
if(is_object($responceObject)) {
|
62 |
-
if($responceObject->error) {
|
63 |
-
$shiphawk_error = $responceObject->error;
|
64 |
-
$helper->shlog('ShipHawk response: '. $shiphawk_error);
|
65 |
-
$helper->sendErrorMessageToShipHawk($shiphawk_error);
|
66 |
-
$is_rate = false;
|
67 |
-
}
|
68 |
-
}else{
|
69 |
-
$rate_id = $responceObject[0]->id;
|
70 |
-
$accessories = $responceObject[0]->shipping->carrier_accessorial;
|
71 |
-
$is_rate = true;
|
72 |
-
}
|
73 |
-
|
74 |
-
}else{
|
75 |
-
/* get zipcode and location type from first item in grouped by origin (zipcode) products */
|
76 |
-
$from_zip = $products_ids['items'][0]['zip'];
|
77 |
-
$location_type = $products_ids['items'][0]['location_type'];
|
78 |
-
|
79 |
-
$carrier_type = $products_ids['carrier_type'];
|
80 |
-
|
81 |
-
$self_pack = $products_ids['self_pack'];
|
82 |
-
|
83 |
-
$responceObject = $api->getShiphawkRate($from_zip, $products_ids['to_zip'], $products_ids['items'], $rate_filter, $carrier_type, $location_type, $shLocationType);
|
84 |
-
|
85 |
-
$accessoriesPriceData = json_decode($order->getData('shiphawk_shipping_accessories'));
|
86 |
-
$accessoriesPrice = Mage::helper('shiphawk_shipping')->getAccessoriesPrice($accessoriesPriceData);
|
87 |
-
// ShipHawk Shipping Amount includes accessories price
|
88 |
-
$original_shipping_price = floatval($order->getShiphawkShippingAmount() - $accessoriesPrice);
|
89 |
-
foreach ($responceObject as $responce) {
|
90 |
-
|
91 |
-
// shipping rate price from new response
|
92 |
-
$shipping_price = $helper->getShipHawkPrice($responce, $self_pack);
|
93 |
-
if(round($original_shipping_price,3) == round($shipping_price,3)) {
|
94 |
-
$rate_id = $responce->id;
|
95 |
-
$accessories = $responce->shipping->carrier_accessorial;
|
96 |
-
$is_rate = true;
|
97 |
-
break;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
if($is_rate == true) {
|
103 |
-
// add book
|
104 |
-
$track_data = $api->toBook($order, $rate_id, $products_ids, $accessories, false, $self_pack);
|
105 |
-
|
106 |
-
if (property_exists($track_data, 'error')) {
|
107 |
-
Mage::getSingleton('core/session')->addError("The booking was not successful, please try again later.");
|
108 |
-
$helper->shlog('ShipHawk response: '.$track_data->error);
|
109 |
-
$helper->sendErrorMessageToShipHawk($track_data->error);
|
110 |
-
continue;
|
111 |
-
}
|
112 |
-
|
113 |
-
$shipment = $api->_initShipHawkShipment($order,$products_ids);
|
114 |
-
$shipment->register();
|
115 |
-
$api->_saveShiphawkShipment($shipment, $products_ids['name'], $products_ids['price']);
|
116 |
-
|
117 |
-
// add track
|
118 |
-
if($track_data->details->id) {
|
119 |
-
$api->addTrackNumber($shipment, $track_data->details->id);
|
120 |
-
|
121 |
-
$api->subscribeToTrackingInfo($shipment->getId());
|
122 |
-
}
|
123 |
-
|
124 |
-
$shipmentCreatedMessage = $this->__('The shipment has been created.');
|
125 |
-
$this->_getSession()->addSuccess($shipmentCreatedMessage);
|
126 |
-
}else{
|
127 |
-
//Mage::getSingleton('core/session')->addError("Unfortunately the method that was chosen by a customer during checkout is currently unavailable. Please contact ShipHawk's customer service to manually book this shipment.");
|
128 |
-
Mage::getSingleton('core/session')->setErrorPriceText("Sorry, we can't find the rate identical to the one that this order has. Please select another rate:");
|
129 |
-
|
130 |
-
$response['error_text'] = "Sorry, we can't find the rate identical to the one that this order has. Please select another rate:";
|
131 |
-
$response['order_id'] = $orderId;
|
132 |
-
$response['sUrl'] = $sUrl;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
} catch (Mage_Core_Exception $e) {
|
137 |
-
$this->_getSession()->addError($e->getMessage());
|
138 |
-
//$this->_redirect('adminhtml/sales_order/view', array('order_id' => $orderId));
|
139 |
-
} catch (Exception $e) {
|
140 |
-
Mage::logException($e);
|
141 |
-
$this->_getSession()->addError($this->__('Cannot save shipment.'));
|
142 |
-
// $this->_redirect('adminhtml/sales_order/view', array('order_id' => $orderId));
|
143 |
-
}
|
144 |
-
|
145 |
-
//$this->_redirect('adminhtml/sales_order/view', array('order_id' => $orderId));
|
146 |
-
$this->getResponse()->setBody(json_encode($response));
|
147 |
-
}
|
148 |
-
|
149 |
-
/* Show PopUp for new ShipHawk Shipment */
|
150 |
-
public function newshipmentAction()
|
151 |
-
{
|
152 |
-
$orderId= $this->getRequest()->getParam('order_id');
|
153 |
-
|
154 |
-
try {
|
155 |
-
$order = Mage::getModel('sales/order')->load($orderId);
|
156 |
-
|
157 |
-
$this->loadLayout();
|
158 |
-
|
159 |
-
$this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('shiphawk_shipping/adminhtml_shipment')->setTemplate('shiphawk/shipment.phtml')->setOrder($order));
|
160 |
-
|
161 |
-
$this->renderLayout();
|
162 |
-
|
163 |
-
} catch (Mage_Core_Exception $e) {
|
164 |
-
$this->_getSession()->addError($e->getMessage());
|
165 |
-
|
166 |
-
} catch (Exception $e) {
|
167 |
-
Mage::logException($e);
|
168 |
-
}
|
169 |
-
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Shipment booking in admin for order with no Shiphawk method or for missing rate shipments
|
174 |
-
*/
|
175 |
-
public function newbookAction() {
|
176 |
-
|
177 |
-
$params = $this->getRequest()->getParams();
|
178 |
-
|
179 |
-
$orderId = $params['order_id'];
|
180 |
-
$shiphawk_rate_id = $params['shipping_method'];
|
181 |
-
$is_multi = $params['is_multi'];
|
182 |
-
if(array_key_exists('multi_price', $params) ) {
|
183 |
-
$multi_price = $params['multi_price'];
|
184 |
-
}
|
185 |
-
|
186 |
-
$shipmentCreatedMessage = $this->__('Something went wrong');
|
187 |
-
|
188 |
-
try {
|
189 |
-
$order = Mage::getModel('sales/order')->load($orderId);
|
190 |
-
$shiphawk_rate_data = Mage::getSingleton('core/session')->getData('new_shiphawk_book_id', true);
|
191 |
-
$api = Mage::getModel('shiphawk_shipping/api');
|
192 |
-
$helper = Mage::helper('shiphawk_shipping');
|
193 |
-
|
194 |
-
foreach($shiphawk_rate_data as $rate_id=>$products_ids) {
|
195 |
-
|
196 |
-
// add book
|
197 |
-
if($is_multi == 0) {
|
198 |
-
if($shiphawk_rate_id == $rate_id) {
|
199 |
-
$self_pack = $products_ids['self_pack'];
|
200 |
-
$accessories = array();
|
201 |
-
/* For accessories */
|
202 |
-
$accessoriesPrice = 0;
|
203 |
-
$accessoriesData = array();
|
204 |
-
if(array_key_exists('accessories', $params)) {
|
205 |
-
$accessories = $params['accessories'];
|
206 |
-
if(!empty($accessories)) {
|
207 |
-
foreach($accessories as $typeName => $type) {
|
208 |
-
foreach($type as $name => $values) {
|
209 |
-
foreach($values as $key => $value) {
|
210 |
-
$accessoriesData[$typeName][$key]['name'] = $name;
|
211 |
-
$accessoriesData[$typeName][$key]['value'] = (float)$value;
|
212 |
-
|
213 |
-
$accessoriesPrice += (float)$value;
|
214 |
-
}
|
215 |
-
}
|
216 |
-
}
|
217 |
-
}
|
218 |
-
}
|
219 |
-
|
220 |
-
$track_data = $api->toBook($order,$rate_id,$products_ids, $accessoriesData, true, $self_pack, true);
|
221 |
-
|
222 |
-
if (property_exists($track_data, 'error')) {
|
223 |
-
Mage::getSingleton('core/session')->addError("The booking was not successful, please try again later.");
|
224 |
-
$helper->shlog('ShipHawk response: '.$track_data->error);
|
225 |
-
continue;
|
226 |
-
}
|
227 |
-
|
228 |
-
$order->setShiphawkShippingAmount($products_ids['price'] + $accessoriesPrice); //resave shipping price
|
229 |
-
$order->setShiphawkShippingAccessories(json_encode($accessoriesData)); // resave accessories
|
230 |
-
$order->save();
|
231 |
-
|
232 |
-
$shipment = $api->_initShipHawkShipment($order,$products_ids);
|
233 |
-
$shipment->register();
|
234 |
-
$api->_saveShiphawkShipment($shipment, $products_ids['name'], $products_ids['price']);
|
235 |
-
|
236 |
-
// add track
|
237 |
-
$track_number = $track_data->details->id;
|
238 |
-
|
239 |
-
$api->addTrackNumber($shipment, $track_number);
|
240 |
-
$api->subscribeToTrackingInfo($shipment->getId());
|
241 |
-
|
242 |
-
$shipmentCreatedMessage = $this->__('The shipment has been created.');
|
243 |
-
$this->_getSession()->addSuccess($shipmentCreatedMessage);
|
244 |
-
}
|
245 |
-
}else{
|
246 |
-
$self_pack = $products_ids['self_pack'];
|
247 |
-
$accessories = array();
|
248 |
-
if(array_key_exists('accessories', $params)) {
|
249 |
-
$accessories = $params['accessories'];
|
250 |
-
}
|
251 |
-
$track_data = $api->toBook($order,$rate_id,$products_ids, $accessories, false, $self_pack);
|
252 |
-
|
253 |
-
if (property_exists($track_data, 'error')) {
|
254 |
-
Mage::getSingleton('core/session')->addError("The booking was not successful, please try again later.");
|
255 |
-
$helper->shlog('ShipHawk response: '.$track_data->error);
|
256 |
-
continue;
|
257 |
-
}
|
258 |
-
|
259 |
-
$order->setShiphawkShippingAmount($multi_price);
|
260 |
-
$order->save();
|
261 |
-
|
262 |
-
$shipment = $api->_initShipHawkShipment($order,$products_ids);
|
263 |
-
$shipment->register();
|
264 |
-
$api->_saveShiphawkShipment($shipment, $products_ids['name'], $products_ids['price']);
|
265 |
-
|
266 |
-
// add track
|
267 |
-
$track_number = $track_data->details->id;
|
268 |
-
|
269 |
-
$api->addTrackNumber($shipment, $track_number);
|
270 |
-
$api->subscribeToTrackingInfo($shipment->getId());
|
271 |
-
|
272 |
-
$shipmentCreatedMessage = $this->__("The multi-origin shipment's has been created.");
|
273 |
-
$this->_getSession()->addSuccess($shipmentCreatedMessage);
|
274 |
-
}
|
275 |
-
}
|
276 |
-
|
277 |
-
} catch (Mage_Core_Exception $e) {
|
278 |
-
$this->_getSession()->addError($e->getMessage());
|
279 |
-
|
280 |
-
} catch (Exception $e) {
|
281 |
-
Mage::logException($e);
|
282 |
-
$this->_getSession()->addError($this->__('Cannot save shipment.'));
|
283 |
-
}
|
284 |
-
|
285 |
-
$this->getResponse()->setBody( json_encode($shipmentCreatedMessage) );
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* For set Shiphawk location type value to session
|
290 |
-
*
|
291 |
-
* @version 20150701
|
292 |
-
*/
|
293 |
-
public function setlocationtypeAction() {
|
294 |
-
$locationType = $this->getRequest()->getPost('location_type');
|
295 |
-
|
296 |
-
if (empty($locationType)) {
|
297 |
-
$this->getResponse()->setBody('Result: location type is empty.');
|
298 |
-
return;
|
299 |
-
}
|
300 |
-
|
301 |
-
$locationType = $locationType != 'residential' && $locationType != 'commercial' ? 'residential' : $locationType;
|
302 |
-
|
303 |
-
Mage::getSingleton('checkout/session')->setData('shiphawk_location_type_shipping', $locationType);
|
304 |
-
|
305 |
-
$this->getResponse()->setBody('Result: ok.');
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* Set accessories price for Update Totals button in admin (New order view)
|
310 |
-
*
|
311 |
-
* @version 20150701
|
312 |
-
*/
|
313 |
-
public function setaccessoriespriceAction() {
|
314 |
-
$params = $this->getRequest()->getParams();
|
315 |
-
$accessories_price = $params['accessories_price'];
|
316 |
-
$shiphawk_override_cost = $params['shiphawk_override_cost'];
|
317 |
-
|
318 |
-
/*if (empty($accessories_price)) {
|
319 |
-
$this->getResponse()->setBody('accessories price is empty.');
|
320 |
-
return;
|
321 |
-
}*/
|
322 |
-
|
323 |
-
Mage::getSingleton('core/session')->unsetData('admin_accessories_price');
|
324 |
-
Mage::getSingleton('core/session')->unsetData('shiphawk_override_cost');
|
325 |
-
|
326 |
-
Mage::getSingleton('core/session')->setData('admin_accessories_price', $accessories_price);
|
327 |
-
Mage::getSingleton('core/session')->setData('shiphawk_override_cost', $shiphawk_override_cost);
|
328 |
-
|
329 |
-
//$this->getResponse()->setBody('Result: ok.');
|
330 |
-
}
|
331 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/controllers/IndexController.php
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Shiphawk_Shipping_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
public function trackingAction() {
|
5 |
-
|
6 |
-
$api_key_from_url = $this->getRequest()->getParam('api_key');
|
7 |
-
$data_from_shiphawk = json_decode(file_get_contents('php://input'));
|
8 |
-
$api_key = Mage::helper('shiphawk_shipping')->getApiKey();
|
9 |
-
|
10 |
-
//curl -X POST -H Content-Type:application/json -d '{"event":"shipment.status_update","status":"in_transit","updated_at":"2015-01-14T10:43:16.702-08:00","shipment_id":1010226}' http://shiphawk.devigor.wdgtest.com/index.php/shiphawk/index/tracking?api_key=3331b35952ec7d99338a1cc5c496b55c
|
11 |
-
//curl -X POST -H Content-Type:application/json -d '{"event":"shipment.status_update","status":"in_transit","updated_at":"2015-01-14T10:43:16.702-08:00","shipment_id":1015967}' http://shiphawk.devigor.wdgtest.com/index.php/shiphawk/index/tracking?api_key=e1919f54fb93f63866f06049d6d45751
|
12 |
-
|
13 |
-
$helper = Mage::helper('shiphawk_shipping');
|
14 |
-
if($api_key_from_url == $api_key) {
|
15 |
-
try {
|
16 |
-
$data_from_shiphawk = (array) $data_from_shiphawk;
|
17 |
-
$track_number = $data_from_shiphawk['shipment_id'];
|
18 |
-
$shipment_track = Mage::getResourceModel('sales/order_shipment_track_collection')->addAttributeToFilter('track_number', $track_number)->getFirstItem();
|
19 |
-
|
20 |
-
$shipment = Mage::getModel('sales/order_shipment')->load($shipment_track->getParentId());
|
21 |
-
|
22 |
-
$helper->shlog($data_from_shiphawk, 'shiphawk-tracking.log');
|
23 |
-
|
24 |
-
$shipment_status_updates = Mage::getStoreConfig('carriers/shiphawk_shipping/shipment_status_updates');
|
25 |
-
$updates_tracking_url = Mage::getStoreConfig('carriers/shiphawk_shipping/updates_tracking_url');
|
26 |
-
$comment = '';
|
27 |
-
|
28 |
-
$crated_time = $this->convertDateTome($data_from_shiphawk['updated_at']);
|
29 |
-
|
30 |
-
if($data_from_shiphawk['event'] == 'shipment.status_update') {
|
31 |
-
switch ($data_from_shiphawk['status']) {
|
32 |
-
case 'in_transit':
|
33 |
-
$comment = "Shipment status changed to In Transit (" . $crated_time['date'] . " at " . $crated_time['time'] . "). Your shipment is with the carrier and is in transit.";
|
34 |
-
break;
|
35 |
-
case 'confirmed':
|
36 |
-
$comment = "Shipment status changed to Confirmed (" . $crated_time['date'] . " at " . $crated_time['time'] . "). Your shipment has been successfully confirmed.";
|
37 |
-
break;
|
38 |
-
case 'scheduled_for_pickup':
|
39 |
-
$comment = "Shipment status changed to Scheduled (" . $crated_time['date'] . " at " . $crated_time['time'] . "). Your shipment has been scheduled for pickup.";
|
40 |
-
break;
|
41 |
-
case 'agent_prep':
|
42 |
-
$comment = "Shipment status changed to Agent Prep (" . $crated_time['date'] . " at " . $crated_time['time'] . "). Your shipment is now being professionally prepared for carrier pickup.";
|
43 |
-
break;
|
44 |
-
case 'delivered':
|
45 |
-
$comment = "Shipment status changed to Delivered (" . $crated_time['date'] . " at " . $crated_time['time'] . "). Your shipment has been delivered!";
|
46 |
-
break;
|
47 |
-
case 'cancelled':
|
48 |
-
$comment = "Shipment status changed to Cancelled (" . $crated_time['date'] . " at " . $crated_time['time'] . "). Your shipment has been cancelled successfully.";
|
49 |
-
break;
|
50 |
-
default:
|
51 |
-
$comment = "Status was updated to " . $data_from_shiphawk['status'] . " ". $crated_time['date'] . " at " . $crated_time['time'];
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
$shipment->addComment($comment);
|
56 |
-
if($shipment_status_updates) {
|
57 |
-
$shipment->sendUpdateEmail(true, $comment);
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
if($data_from_shiphawk['event'] == 'shipment.tracking_update') {
|
62 |
-
$comment = $data_from_shiphawk['updated_at'] . 'There is a tracking number available for your shipment - ' . $data_from_shiphawk['tracking_number'];
|
63 |
-
if ($data_from_shiphawk['tracking_url']) {
|
64 |
-
$comment .= ' <a href="' . $data_from_shiphawk['tracking_url'] . '" target="_blank">Click here to track.</a>';
|
65 |
-
}
|
66 |
-
|
67 |
-
|
68 |
-
$shipment->addComment($comment);
|
69 |
-
if($updates_tracking_url) {
|
70 |
-
$shipment->sendUpdateEmail(true, $comment);
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
|
75 |
-
$shipment->save();
|
76 |
-
}catch (Mage_Core_Exception $e) {
|
77 |
-
Mage::logException($e);
|
78 |
-
} catch (Exception $e) {
|
79 |
-
Mage::logException($e);
|
80 |
-
}
|
81 |
-
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
public function convertDateTome ($date_time) {
|
86 |
-
///2015-04-01T15:57:42Z
|
87 |
-
$result = array();
|
88 |
-
$t = explode('T', $date_time);
|
89 |
-
$result['date'] = date("m/d/y", strtotime($t[0]));
|
90 |
-
|
91 |
-
$result['time'] = date("g:i a", strtotime(substr($t[1], 0, -1)));
|
92 |
-
|
93 |
-
return $result;
|
94 |
-
}
|
95 |
-
|
96 |
-
/* suggest items type in product page */
|
97 |
-
public function searchAction() {
|
98 |
-
|
99 |
-
$search_tag = trim(strip_tags($this->getRequest()->getPost('search_tag')));
|
100 |
-
|
101 |
-
$api_key = Mage::helper('shiphawk_shipping')->getApiKey();
|
102 |
-
$api_url = Mage::helper('shiphawk_shipping')->getApiUrl();
|
103 |
-
|
104 |
-
$url_api = $api_url . 'items/search?q='.$search_tag.'&api_key='.$api_key;
|
105 |
-
|
106 |
-
$curl = curl_init();
|
107 |
-
|
108 |
-
curl_setopt_array($curl, array(
|
109 |
-
CURLOPT_RETURNTRANSFER => true,
|
110 |
-
CURLOPT_URL => $url_api,
|
111 |
-
CURLOPT_POST => false
|
112 |
-
));
|
113 |
-
|
114 |
-
$resp = curl_exec($curl);
|
115 |
-
$arr_res = json_decode($resp);
|
116 |
-
|
117 |
-
$responce_array = array();
|
118 |
-
$responce = array();
|
119 |
-
|
120 |
-
$helper = Mage::helper('shiphawk_shipping');
|
121 |
-
|
122 |
-
if(is_object($arr_res)) {
|
123 |
-
if(($arr_res->error)) {
|
124 |
-
$helper->shlog($arr_res->error);
|
125 |
-
$responce_html = '';
|
126 |
-
$responce['shiphawk_error'] = $arr_res->error;
|
127 |
-
}
|
128 |
-
}else{
|
129 |
-
foreach ((array) $arr_res as $el) {
|
130 |
-
$responce_array[$el->id] = $el->name.' ('.$el->category_name. ' - ' . $el->subcategory->name . ')';
|
131 |
-
}
|
132 |
-
|
133 |
-
$responce_html="<ul>";
|
134 |
-
|
135 |
-
foreach($responce_array as $key=>$value) {
|
136 |
-
$responce_html .='<li class="type_link" id='.$key.' onclick="setItemid(this)" >'.$value.'</li>';
|
137 |
-
}
|
138 |
-
|
139 |
-
$responce_html .="</ul>";
|
140 |
-
}
|
141 |
-
$responce['responce_html'] = $responce_html;
|
142 |
-
curl_close($curl);
|
143 |
-
|
144 |
-
$this->getResponse()->setBody( json_encode($responce) );
|
145 |
-
}
|
146 |
-
|
147 |
-
public function originsAction() {
|
148 |
-
$origin_id = trim(strip_tags($this->getRequest()->getPost('origin_id')));
|
149 |
-
|
150 |
-
$is_mass_action = $this->getRequest()->getPost('is_mass_action');
|
151 |
-
|
152 |
-
$origins_collection = $collection = Mage::getModel('shiphawk_shipping/origins')->getCollection();
|
153 |
-
|
154 |
-
$responce = '<select name="product[shiphawk_shipping_origins]" id="shiphawk_shipping_origins">';
|
155 |
-
|
156 |
-
if($is_mass_action == 1) {
|
157 |
-
$responce = '<select name="attributes[shiphawk_shipping_origins]" id="shiphawk_shipping_origins" disabled>';
|
158 |
-
}
|
159 |
-
|
160 |
-
$responce .= '<option value="">Primary origin</option>';
|
161 |
-
|
162 |
-
foreach($origins_collection as $origin) {
|
163 |
-
if ($origin_id != $origin->getId()) {
|
164 |
-
$responce .= '<option value="'.$origin->getId().'">'.$origin->getShiphawkOriginTitle(). '</option>';
|
165 |
-
}else{
|
166 |
-
$responce .= '<option selected value="'.$origin->getId().'">'.$origin->getShiphawkOriginTitle(). '</option>';
|
167 |
-
}
|
168 |
-
}
|
169 |
-
|
170 |
-
$responce .='</select>';
|
171 |
-
|
172 |
-
$this->getResponse()->setBody( json_encode($responce) );
|
173 |
-
}
|
174 |
-
|
175 |
-
public function getbolAction() {
|
176 |
-
|
177 |
-
$shipments_id = $this->getRequest()->getPost('shipments_id');
|
178 |
-
|
179 |
-
$responce_BOL = Mage::helper('shiphawk_shipping')->getBOLurl($shipments_id);
|
180 |
-
|
181 |
-
$responce = array();
|
182 |
-
|
183 |
-
if (property_exists($responce_BOL, 'url')) {
|
184 |
-
|
185 |
-
$path_to_save_bol_pdf = Mage::getBaseDir('media'). DS .'shiphawk'. DS .'bol';
|
186 |
-
$BOLpdf = $path_to_save_bol_pdf . DS . $shipments_id . '.pdf';
|
187 |
-
|
188 |
-
if (file_get_contents($BOLpdf)) {
|
189 |
-
$responce['bol_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . 'media' . DS . 'shiphawk'. DS .'bol' . DS . $shipments_id . '.pdf';
|
190 |
-
$this->getResponse()->setBody( json_encode($responce) );
|
191 |
-
}else{
|
192 |
-
|
193 |
-
file_put_contents($BOLpdf, file_get_contents($responce_BOL->url));
|
194 |
-
|
195 |
-
$responce['bol_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . 'media' . DS . 'shiphawk'. DS .'bol' . DS . $shipments_id . '.pdf';
|
196 |
-
|
197 |
-
$this->getResponse()->setBody( json_encode($responce) );
|
198 |
-
}
|
199 |
-
|
200 |
-
}else{
|
201 |
-
if (property_exists($responce_BOL, 'error')){
|
202 |
-
$responce['shiphawk_error'] = $responce_BOL->error;
|
203 |
-
}
|
204 |
-
|
205 |
-
$this->getResponse()->setBody( json_encode($responce) );
|
206 |
-
|
207 |
-
}
|
208 |
-
|
209 |
-
}
|
210 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/etc/adminhtml.xml
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<menu>
|
4 |
-
<shiphawk_shipping translate="title" module="shiphawk_shipping">
|
5 |
-
<title>Shiphawk Shipping Origins</title>
|
6 |
-
<sort_order>55</sort_order>
|
7 |
-
<children>
|
8 |
-
<origins module="shiphawk_shipping">
|
9 |
-
<title>Manage Shipping Origins</title>
|
10 |
-
<sort_order>30</sort_order>
|
11 |
-
<action>adminhtml/origins</action>
|
12 |
-
</origins>
|
13 |
-
</children>
|
14 |
-
</shiphawk_shipping>
|
15 |
-
</menu>
|
16 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/etc/config.xml
DELETED
@@ -1,237 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Shiphawk_Shipping>
|
5 |
-
<version>1.1.9</version>
|
6 |
-
</Shiphawk_Shipping>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<models>
|
10 |
-
<shiphawk_shipping>
|
11 |
-
<class>Shiphawk_Shipping_Model</class>
|
12 |
-
<resourceModel>shiphawk_resource</resourceModel>
|
13 |
-
</shiphawk_shipping>
|
14 |
-
<shiphawk_resource>
|
15 |
-
<class>Shiphawk_Shipping_Model_Resource</class>
|
16 |
-
<entities>
|
17 |
-
<origins>
|
18 |
-
<table>shiphawk_origins</table>
|
19 |
-
</origins>
|
20 |
-
</entities>
|
21 |
-
</shiphawk_resource>
|
22 |
-
</models>
|
23 |
-
<blocks>
|
24 |
-
<shiphawk_shipping>
|
25 |
-
<class>Shiphawk_Shipping_Block</class>
|
26 |
-
</shiphawk_shipping>
|
27 |
-
<adminhtml>
|
28 |
-
<rewrite>
|
29 |
-
<sales_order_view>Shiphawk_Shipping_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
30 |
-
<sales_order_shipment_view>Shiphawk_Shipping_Block_Adminhtml_Sales_Order_Shipment_View</sales_order_shipment_view>
|
31 |
-
</rewrite>
|
32 |
-
</adminhtml>
|
33 |
-
<shipping>
|
34 |
-
<rewrite>
|
35 |
-
<tracking_popup>Shiphawk_Shipping_Block_Shipping_Tracking_Popup</tracking_popup>
|
36 |
-
</rewrite>
|
37 |
-
</shipping>
|
38 |
-
</blocks>
|
39 |
-
<resources>
|
40 |
-
<shiphawk_setup>
|
41 |
-
<setup>
|
42 |
-
<module>Shiphawk_Shipping</module>
|
43 |
-
</setup>
|
44 |
-
<connection>
|
45 |
-
<use>core_setup</use>
|
46 |
-
</connection>
|
47 |
-
</shiphawk_setup>
|
48 |
-
</resources>
|
49 |
-
<helpers>
|
50 |
-
<shiphawk_shipping>
|
51 |
-
<class>Shiphawk_Shipping_Helper</class>
|
52 |
-
</shiphawk_shipping>
|
53 |
-
</helpers>
|
54 |
-
<events>
|
55 |
-
<sales_order_place_after>
|
56 |
-
<observers>
|
57 |
-
<shiphawk_shipping_order_place>
|
58 |
-
<type>singleton</type>
|
59 |
-
<class>shiphawk_shipping/observer</class>
|
60 |
-
<method>salesOrderPlaceAfter</method>
|
61 |
-
</shiphawk_shipping_order_place>
|
62 |
-
</observers>
|
63 |
-
</sales_order_place_after>
|
64 |
-
<sales_quote_address_collect_totals_after>
|
65 |
-
<observers>
|
66 |
-
<shiphawk_recalculation_totals>
|
67 |
-
<type>singleton</type>
|
68 |
-
<class>shiphawk_shipping/observer</class>
|
69 |
-
<method>recalculationTotals</method>
|
70 |
-
</shiphawk_recalculation_totals>
|
71 |
-
</observers>
|
72 |
-
</sales_quote_address_collect_totals_after>
|
73 |
-
<checkout_controller_onepage_save_shipping_method>
|
74 |
-
<observers>
|
75 |
-
<shiphawk_onepage_save_shipping_method>
|
76 |
-
<type>singleton</type>
|
77 |
-
<class>shiphawk_shipping/observer</class>
|
78 |
-
<method>setAccessories</method>
|
79 |
-
</shiphawk_onepage_save_shipping_method>
|
80 |
-
</observers>
|
81 |
-
</checkout_controller_onepage_save_shipping_method>
|
82 |
-
<checkout_type_onepage_save_order>
|
83 |
-
<observers>
|
84 |
-
<shiphawk_recalculation_totals>
|
85 |
-
<type>singleton</type>
|
86 |
-
<class>shiphawk_shipping/observer</class>
|
87 |
-
<method>saveAccessoriesInOrder</method>
|
88 |
-
</shiphawk_recalculation_totals>
|
89 |
-
</observers>
|
90 |
-
</checkout_type_onepage_save_order>
|
91 |
-
<sales_quote_collect_totals_after>
|
92 |
-
<observers>
|
93 |
-
<show_shiphawk_rate_error>
|
94 |
-
<type>singleton</type>
|
95 |
-
<class>shiphawk_shipping/observer</class>
|
96 |
-
<method>showShiphawkRateError</method>
|
97 |
-
</show_shiphawk_rate_error>
|
98 |
-
</observers>
|
99 |
-
</sales_quote_collect_totals_after>
|
100 |
-
<checkout_controller_onepage_save_shipping_method>
|
101 |
-
<observers>
|
102 |
-
<show_shiphawk_rate_error_controller>
|
103 |
-
<type>singleton</type>
|
104 |
-
<class>shiphawk_shipping/observer</class>
|
105 |
-
<method>showShiphawkRateError</method>
|
106 |
-
</show_shiphawk_rate_error_controller>
|
107 |
-
</observers>
|
108 |
-
</checkout_controller_onepage_save_shipping_method>
|
109 |
-
<sales_quote_address_collect_totals_after>
|
110 |
-
<observers>
|
111 |
-
<shiphawk_addaccessries_totals>
|
112 |
-
<type>singleton</type>
|
113 |
-
<class>shiphawk_shipping/observer</class>
|
114 |
-
<method>addAccessoriesToTotals</method>
|
115 |
-
</shiphawk_addaccessries_totals>
|
116 |
-
</observers>
|
117 |
-
</sales_quote_address_collect_totals_after>
|
118 |
-
</events>
|
119 |
-
<fieldsets>
|
120 |
-
<sales_convert_quote>
|
121 |
-
<shiphawk_api_id>
|
122 |
-
<to_order>*</to_order>
|
123 |
-
</shiphawk_api_id>
|
124 |
-
<shiphawk_shipping_accessories>
|
125 |
-
<to_order>*</to_order>
|
126 |
-
</shiphawk_shipping_accessories>
|
127 |
-
</sales_convert_quote>
|
128 |
-
<sales_convert_order>
|
129 |
-
<shiphawk_shipping_accessories>
|
130 |
-
<to_order>*</to_order>
|
131 |
-
</shiphawk_shipping_accessories>
|
132 |
-
</sales_convert_order>
|
133 |
-
<sales_convert_quote_item>
|
134 |
-
<shiphawk_api_id>
|
135 |
-
<to_order_item>*</to_order_item>
|
136 |
-
</shiphawk_api_id>
|
137 |
-
</sales_convert_quote_item>
|
138 |
-
</fieldsets>
|
139 |
-
<template>
|
140 |
-
<email>
|
141 |
-
<shiphawk_error_email module="shiphawk_shipping">
|
142 |
-
<label>ShipHawk email template</label>
|
143 |
-
<file>shiphawk_error_email.html</file>
|
144 |
-
<type>html</type>
|
145 |
-
</shiphawk_error_email>
|
146 |
-
</email>
|
147 |
-
</template>
|
148 |
-
</global>
|
149 |
-
<frontend>
|
150 |
-
<routers>
|
151 |
-
<Shiphawk_Shipping>
|
152 |
-
<use>standard</use>
|
153 |
-
<args>
|
154 |
-
<module>Shiphawk_Shipping</module>
|
155 |
-
<frontName>shiphawk</frontName>
|
156 |
-
</args>
|
157 |
-
</Shiphawk_Shipping>
|
158 |
-
</routers>
|
159 |
-
<layout>
|
160 |
-
<updates>
|
161 |
-
<shiphawk_shipping>
|
162 |
-
<file>shiphawk.xml</file>
|
163 |
-
</shiphawk_shipping>
|
164 |
-
</updates>
|
165 |
-
</layout>
|
166 |
-
</frontend>
|
167 |
-
<adminhtml>
|
168 |
-
<layout>
|
169 |
-
<updates>
|
170 |
-
<shiphawk_shipping>
|
171 |
-
<file>shiphawk.xml</file>
|
172 |
-
</shiphawk_shipping>
|
173 |
-
</updates>
|
174 |
-
</layout>
|
175 |
-
<events>
|
176 |
-
<core_block_abstract_to_html_before>
|
177 |
-
<observers>
|
178 |
-
<shiphawk_change_create_order_sipping_method_template>
|
179 |
-
<type>singleton</type>
|
180 |
-
<class>shiphawk_shipping/observer</class>
|
181 |
-
<method>changeSippingMethodTemplate</method>
|
182 |
-
</shiphawk_change_create_order_sipping_method_template>
|
183 |
-
</observers>
|
184 |
-
</core_block_abstract_to_html_before>
|
185 |
-
<sales_order_place_after>
|
186 |
-
<observers>
|
187 |
-
<shiphawk_override_shipping_cost>
|
188 |
-
<type>singleton</type>
|
189 |
-
<class>shiphawk_shipping/observer</class>
|
190 |
-
<method>overrideShippingCost</method>
|
191 |
-
</shiphawk_override_shipping_cost>
|
192 |
-
</observers>
|
193 |
-
</sales_order_place_after>
|
194 |
-
</events>
|
195 |
-
</adminhtml>
|
196 |
-
<admin>
|
197 |
-
<routers>
|
198 |
-
<adminhtml>
|
199 |
-
<args>
|
200 |
-
<modules>
|
201 |
-
<shiphawk_shipping before="Mage_Adminhtml">Shiphawk_Shipping_Adminhtml</shiphawk_shipping>
|
202 |
-
</modules>
|
203 |
-
</args>
|
204 |
-
</adminhtml>
|
205 |
-
</routers>
|
206 |
-
</admin>
|
207 |
-
<admin>
|
208 |
-
<routers>
|
209 |
-
<shiphawk_shipping>
|
210 |
-
<use>admin</use>
|
211 |
-
<args>
|
212 |
-
<module>Shiphawk_Shipping</module>
|
213 |
-
<frontName>adminshiphawk</frontName>
|
214 |
-
</args>
|
215 |
-
</shiphawk_shipping>
|
216 |
-
</routers>
|
217 |
-
</admin>
|
218 |
-
<default>
|
219 |
-
<carriers>
|
220 |
-
<shiphawk_shipping>
|
221 |
-
<active>1</active>
|
222 |
-
<hide_on_frontend>0</hide_on_frontend>
|
223 |
-
<updates_tracking_url>0</updates_tracking_url>
|
224 |
-
<shipment_status_updates>0</shipment_status_updates>
|
225 |
-
<enable_log>1</enable_log>
|
226 |
-
<sort_order>10</sort_order>
|
227 |
-
<model>shiphawk_shipping/carrier</model>
|
228 |
-
<item_is_packed>1</item_is_packed>
|
229 |
-
<sort_order>10</sort_order>
|
230 |
-
<sallowspecific>1</sallowspecific>
|
231 |
-
<gateway_url>https://shiphawk.com/api/v1/</gateway_url>
|
232 |
-
<charge_customer_for_packing>1</charge_customer_for_packing>
|
233 |
-
<opt_to_self_pack>0</opt_to_self_pack>
|
234 |
-
</shiphawk_shipping>
|
235 |
-
</carriers>
|
236 |
-
</default>
|
237 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/etc/system.xml
DELETED
@@ -1,359 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<sections>
|
4 |
-
<carriers>
|
5 |
-
<groups>
|
6 |
-
<shiphawk_shipping translate="label">
|
7 |
-
<label>ShipHawk</label>
|
8 |
-
<sort_order>2</sort_order>
|
9 |
-
<show_in_default>1</show_in_default>
|
10 |
-
<show_in_website>0</show_in_website>
|
11 |
-
<show_in_store>0</show_in_store>
|
12 |
-
<fields>
|
13 |
-
<extensions translate="label">
|
14 |
-
<label>Installed aheadWorks Extensions</label>
|
15 |
-
<frontend_type>text</frontend_type>
|
16 |
-
<frontend_model>shiphawk_shipping/version</frontend_model>
|
17 |
-
<sort_order>10</sort_order>
|
18 |
-
<show_in_default>1</show_in_default>
|
19 |
-
<show_in_website>1</show_in_website>
|
20 |
-
<show_in_store>1</show_in_store>
|
21 |
-
</extensions>
|
22 |
-
<active translate="label">
|
23 |
-
<label>Enabled</label>
|
24 |
-
<frontend_type>select</frontend_type>
|
25 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
26 |
-
<sort_order>10</sort_order>
|
27 |
-
<show_in_default>1</show_in_default>
|
28 |
-
<show_in_website>1</show_in_website>
|
29 |
-
<show_in_store>1</show_in_store>
|
30 |
-
</active>
|
31 |
-
<hide_on_frontend translate="label">
|
32 |
-
<label>Hide on frontend?</label>
|
33 |
-
<frontend_type>select</frontend_type>
|
34 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
35 |
-
<sort_order>11</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 |
-
</hide_on_frontend>
|
40 |
-
<hide_accessories_on_frontend translate="label">
|
41 |
-
<label>Accessorials: Hide on frontend?</label>
|
42 |
-
<frontend_type>select</frontend_type>
|
43 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
44 |
-
<sort_order>12</sort_order>
|
45 |
-
<show_in_default>1</show_in_default>
|
46 |
-
<show_in_website>1</show_in_website>
|
47 |
-
<show_in_store>1</show_in_store>
|
48 |
-
</hide_accessories_on_frontend>
|
49 |
-
<enable_log translate="label">
|
50 |
-
<label>Debug Logging?</label>
|
51 |
-
<frontend_type>select</frontend_type>
|
52 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
53 |
-
<sort_order>13</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 |
-
</enable_log>
|
58 |
-
<email_error_to_shiphawk translate="label">
|
59 |
-
<label>Email errors to ShipHawk?</label>
|
60 |
-
<frontend_type>select</frontend_type>
|
61 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
-
<sort_order>14</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 |
-
<depends><enable_log>1</enable_log></depends>
|
67 |
-
</email_error_to_shiphawk>
|
68 |
-
<shiphawk_error_message translate="label">
|
69 |
-
<label>Error message</label>
|
70 |
-
<comment>Error message for when a ShipHawk rate does not return</comment>
|
71 |
-
<frontend_type>text</frontend_type>
|
72 |
-
<sort_order>18</sort_order>
|
73 |
-
<show_in_default>1</show_in_default>
|
74 |
-
<show_in_website>1</show_in_website>
|
75 |
-
<show_in_store>1</show_in_store>
|
76 |
-
</shiphawk_error_message>
|
77 |
-
<api_key translate="label">
|
78 |
-
<label>Api Key</label>
|
79 |
-
<frontend_type>text</frontend_type>
|
80 |
-
<sort_order>20</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 |
-
</api_key>
|
85 |
-
<gateway_url translate="label">
|
86 |
-
<label>Gateway Mode</label>
|
87 |
-
<frontend_type>select</frontend_type>
|
88 |
-
<source_model>shiphawk_shipping/source_gateway</source_model>
|
89 |
-
<sort_order>21</sort_order>
|
90 |
-
<show_in_default>1</show_in_default>
|
91 |
-
<show_in_website>1</show_in_website>
|
92 |
-
<show_in_store>1</show_in_store>
|
93 |
-
</gateway_url>
|
94 |
-
<rate_filter translate="label">
|
95 |
-
<label>Rate Filter</label>
|
96 |
-
<frontend_type>select</frontend_type>
|
97 |
-
<source_model>shiphawk_shipping/source_ratefilter</source_model>
|
98 |
-
<sort_order>22</sort_order>
|
99 |
-
<show_in_default>1</show_in_default>
|
100 |
-
<show_in_website>1</show_in_website>
|
101 |
-
<show_in_store>1</show_in_store>
|
102 |
-
</rate_filter>
|
103 |
-
<admin_rate_filter translate="label">
|
104 |
-
<label>Admin panel rate filter</label>
|
105 |
-
<frontend_type>select</frontend_type>
|
106 |
-
<source_model>shiphawk_shipping/source_adminratefilter</source_model>
|
107 |
-
<sort_order>23</sort_order>
|
108 |
-
<show_in_default>1</show_in_default>
|
109 |
-
<show_in_website>1</show_in_website>
|
110 |
-
<show_in_store>1</show_in_store>
|
111 |
-
</admin_rate_filter>
|
112 |
-
<discount_percentage translate="label">
|
113 |
-
<label>Markup or Discount Percentage</label>
|
114 |
-
<frontend_type>text</frontend_type>
|
115 |
-
<sort_order>24</sort_order>
|
116 |
-
<show_in_default>1</show_in_default>
|
117 |
-
<show_in_website>1</show_in_website>
|
118 |
-
<show_in_store>1</show_in_store>
|
119 |
-
<comment>possible values from -100 to 100</comment>
|
120 |
-
</discount_percentage>
|
121 |
-
<discount_fixed translate="label">
|
122 |
-
<label>Markup or Discount Flat Amount</label>
|
123 |
-
<frontend_type>text</frontend_type>
|
124 |
-
<sort_order>25</sort_order>
|
125 |
-
<show_in_default>1</show_in_default>
|
126 |
-
<show_in_website>1</show_in_website>
|
127 |
-
<show_in_store>1</show_in_store>
|
128 |
-
<comment>possible values from -∞ to ∞</comment>
|
129 |
-
</discount_fixed>
|
130 |
-
<carrier_type translate="label">
|
131 |
-
<label>Carrier Type</label>
|
132 |
-
<frontend_type>multiselect</frontend_type>
|
133 |
-
<source_model>shiphawk_shipping/source_carriertype</source_model>
|
134 |
-
<sort_order>26</sort_order>
|
135 |
-
<show_in_default>1</show_in_default>
|
136 |
-
<show_in_website>1</show_in_website>
|
137 |
-
<show_in_store>1</show_in_store>
|
138 |
-
</carrier_type>
|
139 |
-
<free_method>
|
140 |
-
<label>Free Shipping Method</label>
|
141 |
-
<frontend_type>select</frontend_type>
|
142 |
-
<source_model>shiphawk_shipping/source_freeshipping</source_model>
|
143 |
-
<sort_order>27</sort_order>
|
144 |
-
<show_in_default>1</show_in_default>
|
145 |
-
<show_in_website>1</show_in_website>
|
146 |
-
<show_in_store>1</show_in_store>
|
147 |
-
</free_method>
|
148 |
-
<item_is_packed translate="label">
|
149 |
-
<label>Default packing setting</label>
|
150 |
-
<frontend_type>select</frontend_type>
|
151 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
152 |
-
<sort_order>40</sort_order>
|
153 |
-
<show_in_default>1</show_in_default>
|
154 |
-
<show_in_website>1</show_in_website>
|
155 |
-
<show_in_store>1</show_in_store>
|
156 |
-
</item_is_packed>
|
157 |
-
<opt_to_self_pack translate="label">
|
158 |
-
<label>Opt to Self Pack</label>
|
159 |
-
<frontend_type>select</frontend_type>
|
160 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
161 |
-
<sort_order>41</sort_order>
|
162 |
-
<show_in_default>1</show_in_default>
|
163 |
-
<show_in_website>1</show_in_website>
|
164 |
-
<show_in_store>1</show_in_store>
|
165 |
-
</opt_to_self_pack>
|
166 |
-
<charge_customer_for_packing translate="label">
|
167 |
-
<label>Charge customer for packing</label>
|
168 |
-
<frontend_type>select</frontend_type>
|
169 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
170 |
-
<sort_order>42</sort_order>
|
171 |
-
<show_in_default>1</show_in_default>
|
172 |
-
<show_in_website>1</show_in_website>
|
173 |
-
<show_in_store>1</show_in_store>
|
174 |
-
<comment>This option works only when Opt to Self Pack set to Yes.</comment>
|
175 |
-
<depends><opt_to_self_pack>1</opt_to_self_pack></depends>
|
176 |
-
</charge_customer_for_packing>
|
177 |
-
<shiphawk_custom_packing_price translate="label">
|
178 |
-
<label>Custom Packing Prices?</label>
|
179 |
-
<frontend_type>select</frontend_type>
|
180 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
181 |
-
<sort_order>43</sort_order>
|
182 |
-
<show_in_default>1</show_in_default>
|
183 |
-
<show_in_website>1</show_in_website>
|
184 |
-
<show_in_store>1</show_in_store>
|
185 |
-
</shiphawk_custom_packing_price>
|
186 |
-
<book_shipment translate="label">
|
187 |
-
<label>Manual book shipment</label>
|
188 |
-
<frontend_type>select</frontend_type>
|
189 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
190 |
-
<sort_order>61</sort_order>
|
191 |
-
<show_in_default>1</show_in_default>
|
192 |
-
<show_in_website>1</show_in_website>
|
193 |
-
<show_in_store>1</show_in_store>
|
194 |
-
</book_shipment>
|
195 |
-
<order_received translate="label">
|
196 |
-
<label>Send order receipts to:</label>
|
197 |
-
<frontend_type>select</frontend_type>
|
198 |
-
<source_model>shiphawk_shipping/source_received</source_model>
|
199 |
-
<sort_order>62</sort_order>
|
200 |
-
<show_in_default>1</show_in_default>
|
201 |
-
<show_in_website>1</show_in_website>
|
202 |
-
<show_in_store>1</show_in_store>
|
203 |
-
</order_received>
|
204 |
-
<administrator_email translate="label">
|
205 |
-
<label>Administrator Email</label>
|
206 |
-
<frontend_type>text</frontend_type>
|
207 |
-
<sort_order>63</sort_order>
|
208 |
-
<show_in_default>1</show_in_default>
|
209 |
-
<show_in_website>1</show_in_website>
|
210 |
-
<show_in_store>1</show_in_store>
|
211 |
-
</administrator_email>
|
212 |
-
<shipment_status_updates translate="label">
|
213 |
-
<label>Email status updates to customer?</label>
|
214 |
-
<frontend_type>select</frontend_type>
|
215 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
216 |
-
<comment>There can be many updates for each shipment</comment>
|
217 |
-
<sort_order>64</sort_order>
|
218 |
-
<show_in_default>1</show_in_default>
|
219 |
-
<show_in_website>1</show_in_website>
|
220 |
-
<show_in_store>1</show_in_store>
|
221 |
-
</shipment_status_updates>
|
222 |
-
<updates_tracking_url translate="label">
|
223 |
-
<label>Email tracking URL to customer?</label>
|
224 |
-
<frontend_type>select</frontend_type>
|
225 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
226 |
-
<sort_order>65</sort_order>
|
227 |
-
<show_in_default>1</show_in_default>
|
228 |
-
<show_in_website>1</show_in_website>
|
229 |
-
<show_in_store>1</show_in_store>
|
230 |
-
</updates_tracking_url>
|
231 |
-
<sallowspecific translate="label">
|
232 |
-
<label>Available for specific countries only</label>
|
233 |
-
<frontend_type>select</frontend_type>
|
234 |
-
<frontend_class>shipping-applicable-country</frontend_class>
|
235 |
-
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
236 |
-
<sort_order>70</sort_order>
|
237 |
-
<show_in_default>1</show_in_default>
|
238 |
-
<show_in_website>1</show_in_website>
|
239 |
-
<show_in_store>1</show_in_store>
|
240 |
-
</sallowspecific>
|
241 |
-
<specificcountry translate="label">
|
242 |
-
<label>Ship to Specific Countries</label>
|
243 |
-
<frontend_type>multiselect</frontend_type>
|
244 |
-
<sort_order>71</sort_order>
|
245 |
-
<source_model>adminhtml/system_config_source_country</source_model>
|
246 |
-
<show_in_default>1</show_in_default>
|
247 |
-
<show_in_website>1</show_in_website>
|
248 |
-
<show_in_store>1</show_in_store>
|
249 |
-
<can_be_empty>1</can_be_empty>
|
250 |
-
</specificcountry>
|
251 |
-
<origin_first_name translate="label">
|
252 |
-
<label>Origin First Name</label>
|
253 |
-
<frontend_type>text</frontend_type>
|
254 |
-
<sort_order>80</sort_order>
|
255 |
-
<show_in_default>1</show_in_default>
|
256 |
-
<show_in_website>1</show_in_website>
|
257 |
-
<show_in_store>1</show_in_store>
|
258 |
-
</origin_first_name>
|
259 |
-
<origin_last_name translate="label">
|
260 |
-
<label>Origin Last Name</label>
|
261 |
-
<frontend_type>text</frontend_type>
|
262 |
-
<sort_order>81</sort_order>
|
263 |
-
<show_in_default>1</show_in_default>
|
264 |
-
<show_in_website>1</show_in_website>
|
265 |
-
<show_in_store>1</show_in_store>
|
266 |
-
</origin_last_name>
|
267 |
-
<origin_address translate="label">
|
268 |
-
<label>Origin Address</label>
|
269 |
-
<frontend_type>text</frontend_type>
|
270 |
-
<sort_order>82</sort_order>
|
271 |
-
<show_in_default>1</show_in_default>
|
272 |
-
<show_in_website>1</show_in_website>
|
273 |
-
<show_in_store>1</show_in_store>
|
274 |
-
</origin_address>
|
275 |
-
<origin_address2 translate="label">
|
276 |
-
<label>Origin Address 2</label>
|
277 |
-
<frontend_type>text</frontend_type>
|
278 |
-
<sort_order>83</sort_order>
|
279 |
-
<show_in_default>1</show_in_default>
|
280 |
-
<show_in_website>1</show_in_website>
|
281 |
-
<show_in_store>1</show_in_store>
|
282 |
-
</origin_address2>
|
283 |
-
<origin_city translate="label">
|
284 |
-
<label>Origin City</label>
|
285 |
-
<frontend_type>text</frontend_type>
|
286 |
-
<sort_order>84</sort_order>
|
287 |
-
<show_in_default>1</show_in_default>
|
288 |
-
<show_in_website>1</show_in_website>
|
289 |
-
<show_in_store>1</show_in_store>
|
290 |
-
</origin_city>
|
291 |
-
<origin_state translate="label">
|
292 |
-
<label>Origin State</label>
|
293 |
-
<frontend_type>text</frontend_type>
|
294 |
-
<comment>2 letter abbrev.</comment>
|
295 |
-
<sort_order>85</sort_order>
|
296 |
-
<show_in_default>1</show_in_default>
|
297 |
-
<show_in_website>1</show_in_website>
|
298 |
-
<show_in_store>1</show_in_store>
|
299 |
-
</origin_state>
|
300 |
-
<default_origin translate="label">
|
301 |
-
<label>Default Origin Zipcode </label>
|
302 |
-
<frontend_type>text</frontend_type>
|
303 |
-
<sort_order>86</sort_order>
|
304 |
-
<show_in_default>1</show_in_default>
|
305 |
-
<show_in_website>1</show_in_website>
|
306 |
-
<show_in_store>1</show_in_store>
|
307 |
-
</default_origin>
|
308 |
-
<origin_location_type translate="label">
|
309 |
-
<label>Origin Location Type</label>
|
310 |
-
<frontend_type>select</frontend_type>
|
311 |
-
<source_model>shiphawk_shipping/source_location</source_model>
|
312 |
-
<sort_order>87</sort_order>
|
313 |
-
<show_in_default>1</show_in_default>
|
314 |
-
<show_in_website>1</show_in_website>
|
315 |
-
<show_in_store>1</show_in_store>
|
316 |
-
</origin_location_type>
|
317 |
-
<origin_phone translate="label">
|
318 |
-
<label>Origin Phone</label>
|
319 |
-
<frontend_type>text</frontend_type>
|
320 |
-
<sort_order>88</sort_order>
|
321 |
-
<show_in_default>1</show_in_default>
|
322 |
-
<show_in_website>1</show_in_website>
|
323 |
-
<show_in_store>1</show_in_store>
|
324 |
-
</origin_phone>
|
325 |
-
<origin_email translate="label">
|
326 |
-
<label>Origin Email </label>
|
327 |
-
<frontend_type>text</frontend_type>
|
328 |
-
<sort_order>89</sort_order>
|
329 |
-
<show_in_default>1</show_in_default>
|
330 |
-
<show_in_website>1</show_in_website>
|
331 |
-
<show_in_store>1</show_in_store>
|
332 |
-
</origin_email>
|
333 |
-
<file_import translate="label comment">
|
334 |
-
<label>Import Origins</label>
|
335 |
-
<comment><![CDATA[File saved in <strong><span style="color: red;">var/shiphawk/import</span></strong> folder.]]></comment>
|
336 |
-
<frontend_type>file</frontend_type>
|
337 |
-
<backend_model>adminhtml/system_config_backend_file</backend_model>
|
338 |
-
<upload_dir>var/shiphawk/import</upload_dir>
|
339 |
-
<sort_order>50</sort_order>
|
340 |
-
<show_in_default>1</show_in_default>
|
341 |
-
<show_in_website>0</show_in_website>
|
342 |
-
<show_in_store>0</show_in_store>
|
343 |
-
</file_import>
|
344 |
-
|
345 |
-
<importbutton translate="label">
|
346 |
-
<frontend_type>button</frontend_type>
|
347 |
-
<frontend_model>shiphawk_shipping/adminhtml_system_config_form_button</frontend_model>
|
348 |
-
<sort_order>60</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 |
-
<comment>Upload csv file, before start import</comment>
|
353 |
-
</importbutton>
|
354 |
-
</fields>
|
355 |
-
</shiphawk_shipping>
|
356 |
-
</groups>
|
357 |
-
</carriers>
|
358 |
-
</sections>
|
359 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-install-0.1.0.php
DELETED
@@ -1,269 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$type_of_product_data = array (
|
6 |
-
'attribute_set' => 'Default',
|
7 |
-
'group' => 'ShipHawk Attributes',
|
8 |
-
'label' => 'Type of Item',
|
9 |
-
'visible' => true,
|
10 |
-
'type' => 'varchar',
|
11 |
-
'apply_to' => 'simple',
|
12 |
-
'input' => 'text',
|
13 |
-
'system' => false,
|
14 |
-
'required' => false,
|
15 |
-
'user_defined' => 1,
|
16 |
-
);
|
17 |
-
|
18 |
-
$installer->addAttribute('catalog_product','shiphawk_type_of_product',$type_of_product_data);
|
19 |
-
|
20 |
-
$shiphawk_quantity_data = array (
|
21 |
-
'attribute_set' => 'Default',
|
22 |
-
'group' => 'ShipHawk Attributes',
|
23 |
-
'label' => 'Number of items per Product',
|
24 |
-
'visible' => true,
|
25 |
-
'type' => 'int',
|
26 |
-
'apply_to' => 'simple',
|
27 |
-
'input' => 'text',
|
28 |
-
'default' => 1,
|
29 |
-
'frontend_class' => 'validate-not-negative-number',
|
30 |
-
'system' => false,
|
31 |
-
'required' => false,
|
32 |
-
'user_defined' => 1,
|
33 |
-
);
|
34 |
-
|
35 |
-
$installer->addAttribute('catalog_product','shiphawk_quantity', $shiphawk_quantity_data);
|
36 |
-
|
37 |
-
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'shiphawk_item_is_packed', array(
|
38 |
-
'group' => 'ShipHawk Attributes',
|
39 |
-
'backend' => 'catalog/product_attribute_backend_msrp',
|
40 |
-
'label' => 'Packaged?',
|
41 |
-
'input' => 'select',
|
42 |
-
'source' => 'catalog/product_attribute_source_msrp_type_enabled',
|
43 |
-
'type' => 'varchar',
|
44 |
-
'apply_to' => 'simple',
|
45 |
-
'visible' => true,
|
46 |
-
'required' => false,
|
47 |
-
'user_defined' => 1,
|
48 |
-
'default' => '2',
|
49 |
-
'input_renderer' => 'adminhtml/catalog_product_helper_form_msrp_enabled',
|
50 |
-
'visible_on_front' => false
|
51 |
-
));
|
52 |
-
|
53 |
-
$length_data = array (
|
54 |
-
'attribute_set' => 'Default',
|
55 |
-
'group' => 'ShipHawk Attributes',
|
56 |
-
'label' => 'Length',
|
57 |
-
'visible' => true,
|
58 |
-
'type' => 'varchar',
|
59 |
-
'apply_to' => 'simple',
|
60 |
-
'input' => 'text',
|
61 |
-
'system' => false,
|
62 |
-
'required' => false,
|
63 |
-
'user_defined' => 1,
|
64 |
-
);
|
65 |
-
|
66 |
-
$installer->addAttribute('catalog_product','shiphawk_length',$length_data);
|
67 |
-
|
68 |
-
$width_data = array (
|
69 |
-
'attribute_set' => 'Default',
|
70 |
-
'group' => 'ShipHawk Attributes',
|
71 |
-
'label' => 'Width',
|
72 |
-
'visible' => true,
|
73 |
-
'type' => 'varchar',
|
74 |
-
'apply_to' => 'simple',
|
75 |
-
'input' => 'text',
|
76 |
-
'system' => false,
|
77 |
-
'required' => false,
|
78 |
-
'user_defined' => 1,
|
79 |
-
);
|
80 |
-
|
81 |
-
$installer->addAttribute('catalog_product','shiphawk_width',$width_data);
|
82 |
-
|
83 |
-
$height_data = array (
|
84 |
-
'attribute_set' => 'Default',
|
85 |
-
'group' => 'ShipHawk Attributes',
|
86 |
-
'label' => 'Height',
|
87 |
-
'visible' => true,
|
88 |
-
'type' => 'varchar',
|
89 |
-
'apply_to' => 'simple',
|
90 |
-
'input' => 'text',
|
91 |
-
'system' => false,
|
92 |
-
'required' => false,
|
93 |
-
'user_defined' => 1,
|
94 |
-
);
|
95 |
-
|
96 |
-
$installer->addAttribute('catalog_product','shiphawk_height',$height_data);
|
97 |
-
|
98 |
-
$item_value_data = array (
|
99 |
-
'attribute_set' => 'Default',
|
100 |
-
'group' => 'ShipHawk Attributes',
|
101 |
-
'label' => 'Item Value',
|
102 |
-
'visible' => true,
|
103 |
-
'type' => 'varchar',
|
104 |
-
'apply_to' => 'simple',
|
105 |
-
'frontend_class' => 'validate-number',
|
106 |
-
'input' => 'text',
|
107 |
-
'system' => false,
|
108 |
-
'required' => false,
|
109 |
-
'user_defined' => 1,
|
110 |
-
);
|
111 |
-
|
112 |
-
$installer->addAttribute('catalog_product','shiphawk_item_value', $item_value_data);
|
113 |
-
|
114 |
-
/* use as separator too */
|
115 |
-
$type_of_product_value = array (
|
116 |
-
'attribute_set' => 'Default',
|
117 |
-
'group' => 'ShipHawk Attributes',
|
118 |
-
'label' => 'Origin Contact:',
|
119 |
-
'visible' => true,
|
120 |
-
'type' => 'varchar',
|
121 |
-
'apply_to' => 'simple',
|
122 |
-
'input' => 'text',
|
123 |
-
'system' => false,
|
124 |
-
'required' => false,
|
125 |
-
'user_defined' => 1,
|
126 |
-
);
|
127 |
-
|
128 |
-
$installer->addAttribute('catalog_product','shiphawk_type_of_product_value',$type_of_product_value);
|
129 |
-
|
130 |
-
|
131 |
-
$firstname_origin_data = array (
|
132 |
-
'attribute_set' => 'Default',
|
133 |
-
'group' => 'ShipHawk Attributes',
|
134 |
-
'label' => 'Origin First Name',
|
135 |
-
'visible' => true,
|
136 |
-
'type' => 'varchar',
|
137 |
-
'apply_to' => 'simple',
|
138 |
-
'input' => 'text',
|
139 |
-
'system' => false,
|
140 |
-
'required' => false,
|
141 |
-
'user_defined' => 1,
|
142 |
-
);
|
143 |
-
|
144 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_firstname',$firstname_origin_data);
|
145 |
-
|
146 |
-
$last_name_origin_data = array (
|
147 |
-
'attribute_set' => 'Default',
|
148 |
-
'group' => 'ShipHawk Attributes',
|
149 |
-
'label' => 'Origin Last Name',
|
150 |
-
'visible' => true,
|
151 |
-
'type' => 'varchar',
|
152 |
-
'apply_to' => 'simple',
|
153 |
-
'input' => 'text',
|
154 |
-
'system' => false,
|
155 |
-
'required' => false,
|
156 |
-
'user_defined' => 1,
|
157 |
-
);
|
158 |
-
|
159 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_lastname',$last_name_origin_data);
|
160 |
-
|
161 |
-
$address_line_1_origin_data = array (
|
162 |
-
'attribute_set' => 'Default',
|
163 |
-
'group' => 'ShipHawk Attributes',
|
164 |
-
'label' => 'Origin Address',
|
165 |
-
'visible' => true,
|
166 |
-
'type' => 'varchar',
|
167 |
-
'apply_to' => 'simple',
|
168 |
-
'input' => 'text',
|
169 |
-
'system' => false,
|
170 |
-
'required' => false,
|
171 |
-
'user_defined' => 1,
|
172 |
-
);
|
173 |
-
|
174 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_addressline1',$address_line_1_origin_data);
|
175 |
-
|
176 |
-
$address_line_2_origin_data = array (
|
177 |
-
'attribute_set' => 'Default',
|
178 |
-
'group' => 'ShipHawk Attributes',
|
179 |
-
'label' => 'Origin Address 2',
|
180 |
-
'visible' => true,
|
181 |
-
'type' => 'varchar',
|
182 |
-
'apply_to' => 'simple',
|
183 |
-
'input' => 'text',
|
184 |
-
'system' => false,
|
185 |
-
'required' => false,
|
186 |
-
'user_defined' => 1,
|
187 |
-
);
|
188 |
-
|
189 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_addressline2',$address_line_2_origin_data);
|
190 |
-
|
191 |
-
$city_origin_data = array (
|
192 |
-
'attribute_set' => 'Default',
|
193 |
-
'group' => 'ShipHawk Attributes',
|
194 |
-
'label' => 'Origin City',
|
195 |
-
'visible' => true,
|
196 |
-
'type' => 'varchar',
|
197 |
-
'apply_to' => 'simple',
|
198 |
-
'input' => 'text',
|
199 |
-
'system' => false,
|
200 |
-
'required' => false,
|
201 |
-
'user_defined' => 1,
|
202 |
-
);
|
203 |
-
|
204 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_city',$city_origin_data);
|
205 |
-
|
206 |
-
$state_origin_data = array (
|
207 |
-
'attribute_set' => 'Default',
|
208 |
-
'group' => 'ShipHawk Attributes',
|
209 |
-
'label' => 'State',
|
210 |
-
'visible' => true,
|
211 |
-
'type' => 'varchar',
|
212 |
-
'apply_to' => 'simple',
|
213 |
-
'input' => 'text',
|
214 |
-
'system' => false,
|
215 |
-
'required' => false,
|
216 |
-
'user_defined' => 1,
|
217 |
-
);
|
218 |
-
|
219 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_state',$state_origin_data);
|
220 |
-
|
221 |
-
$zip_code_origin_data = array (
|
222 |
-
'attribute_set' => 'Default',
|
223 |
-
'group' => 'ShipHawk Attributes',
|
224 |
-
'label' => 'Origin Zipcode',
|
225 |
-
'visible' => true,
|
226 |
-
'type' => 'varchar',
|
227 |
-
'apply_to' => 'simple',
|
228 |
-
'input' => 'text',
|
229 |
-
'system' => false,
|
230 |
-
'required' => false,
|
231 |
-
'user_defined' => 1,
|
232 |
-
);
|
233 |
-
|
234 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_zipcode',$zip_code_origin_data);
|
235 |
-
|
236 |
-
$phone_num_origin_data = array (
|
237 |
-
'attribute_set' => 'Default',
|
238 |
-
'group' => 'ShipHawk Attributes',
|
239 |
-
'label' => 'Origin Phone',
|
240 |
-
'visible' => true,
|
241 |
-
'type' => 'varchar',
|
242 |
-
'apply_to' => 'simple',
|
243 |
-
'input' => 'text',
|
244 |
-
'system' => false,
|
245 |
-
'required' => false,
|
246 |
-
'user_defined' => 1,
|
247 |
-
);
|
248 |
-
|
249 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_phonenum',$phone_num_origin_data);
|
250 |
-
|
251 |
-
$location_origin_data = array (
|
252 |
-
'attribute_set' => 'Default',
|
253 |
-
'group' => 'ShipHawk Attributes',
|
254 |
-
'label' => 'Origin Location',
|
255 |
-
'visible' => true,
|
256 |
-
'type' => 'varchar',
|
257 |
-
'apply_to' => 'simple',
|
258 |
-
'option' => array ('value' => array(
|
259 |
-
'commercial' => array('commercial'),
|
260 |
-
'residential' => array('residential'))),
|
261 |
-
'input' => 'select',
|
262 |
-
'system' => false,
|
263 |
-
'required' => false,
|
264 |
-
'user_defined' => 1,
|
265 |
-
);
|
266 |
-
|
267 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_location',$location_origin_data);
|
268 |
-
|
269 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-0.7.0-0.7.1.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/** @var Mage_Eav_Model_Entity_Setup $installer */
|
3 |
-
$installer = Mage::getResourceModel('sales/setup','sales_setup');
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$installer->addAttribute('order', 'shiphawk_book_id', array('type' => 'text', 'input' => 'text'));
|
7 |
-
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order'), 'shiphawk_book_id', 'text');
|
8 |
-
|
9 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.0-1.0.1.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$origin_email = array (
|
6 |
-
'attribute_set' => 'Default',
|
7 |
-
'group' => 'ShipHawk Attributes',
|
8 |
-
'label' => 'Origin Email',
|
9 |
-
'visible' => true,
|
10 |
-
'type' => 'varchar',
|
11 |
-
'apply_to' => 'simple',
|
12 |
-
'input' => 'text',
|
13 |
-
'system' => false,
|
14 |
-
'required' => false,
|
15 |
-
'user_defined' => 1,
|
16 |
-
);
|
17 |
-
|
18 |
-
$installer->addAttribute('catalog_product','shiphawk_origin_email', $origin_email);
|
19 |
-
|
20 |
-
|
21 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.1-1.0.2.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = $this;
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$installer->run("
|
6 |
-
|
7 |
-
-- DROP TABLE IF EXISTS {$this->getTable('shiphawk_shipping/origins')};
|
8 |
-
CREATE TABLE {$this->getTable('shiphawk_shipping/origins')} (
|
9 |
-
`id` int(11) unsigned NOT NULL auto_increment,
|
10 |
-
`shiphawk_origin_firstname` varchar(250) NULL default '',
|
11 |
-
`shiphawk_origin_lastname` varchar(250) NULL default '',
|
12 |
-
`shiphawk_origin_addressline1` varchar(250) NULL default '',
|
13 |
-
`shiphawk_origin_addressline2` varchar(250) NULL default '',
|
14 |
-
`shiphawk_origin_city` varchar(250) NULL default '',
|
15 |
-
`shiphawk_origin_state` varchar(250) NULL default '',
|
16 |
-
`shiphawk_origin_zipcode` varchar(250) NULL default '',
|
17 |
-
`shiphawk_origin_phonenum` varchar(250) NULL default '',
|
18 |
-
`shiphawk_origin_location` varchar(250) NULL default '',
|
19 |
-
`shiphawk_origin_email` varchar(250) NULL default '',
|
20 |
-
`shiphawk_origin_title` varchar(250) NULL default '',
|
21 |
-
|
22 |
-
PRIMARY KEY (`id`)
|
23 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
24 |
-
|
25 |
-
");
|
26 |
-
|
27 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.10-1.0.11.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$data = array (
|
6 |
-
'attribute_set' => 'Default',
|
7 |
-
'group' => 'ShipHawk Attributes',
|
8 |
-
'label' => 'Freight Class',
|
9 |
-
'visible' => true,
|
10 |
-
'type' => 'varchar',
|
11 |
-
'apply_to' => 'simple',
|
12 |
-
'option' => array ('values' => array(
|
13 |
-
0 => '50',
|
14 |
-
1 => '55',
|
15 |
-
2 => '60',
|
16 |
-
3 => '65',
|
17 |
-
4 => '70',
|
18 |
-
5 => '77.5',
|
19 |
-
6 => '85',
|
20 |
-
7 => '92.5',
|
21 |
-
8 => '100',
|
22 |
-
9 => '110',
|
23 |
-
10 => '125',
|
24 |
-
11 => '150',
|
25 |
-
12 => '175',
|
26 |
-
13 => '200',
|
27 |
-
14 => '250',
|
28 |
-
15 => '300',
|
29 |
-
16 => '400',
|
30 |
-
17 => '500'
|
31 |
-
)),
|
32 |
-
'input' => 'select',
|
33 |
-
'system' => false,
|
34 |
-
'required' => false,
|
35 |
-
'user_defined' => 1,
|
36 |
-
);
|
37 |
-
|
38 |
-
$installer->addAttribute('catalog_product', 'shiphawk_freight_class', $data);
|
39 |
-
|
40 |
-
/* for sortOrder */
|
41 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_freight_class', 'frontend_label', 'Freight Class', 7);
|
42 |
-
|
43 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.11-1.0.12.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/** @var Mage_Eav_Model_Entity_Setup $installer */
|
3 |
-
$installer = Mage::getResourceModel('sales/setup','sales_setup');
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$installer->addAttribute('order', 'shiphawk_location_type', array('type' => 'text', 'input' => 'text'));
|
7 |
-
$installer->addAttribute('quote', 'shiphawk_location_type', array('type' => 'text', 'input' => 'text'));
|
8 |
-
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order'), 'shiphawk_location_type', 'text');
|
9 |
-
|
10 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.12-1.0.13.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/** @var Mage_Eav_Model_Entity_Setup $installer */
|
3 |
-
$installer = Mage::getResourceModel('sales/setup','sales_setup');
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$installer->addAttribute('order', 'shiphawk_rate_filter', array('type' => 'text', 'input' => 'text'));
|
7 |
-
$installer->addAttribute('quote', 'shiphawk_rate_filter', array('type' => 'text', 'input' => 'text'));
|
8 |
-
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order'), 'shiphawk_rate_filter', 'text');
|
9 |
-
|
10 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.13-1.1.0.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$percentage = array (
|
6 |
-
'attribute_set' => 'Default',
|
7 |
-
'group' => 'ShipHawk Attributes',
|
8 |
-
'label' => 'Markup or Discount Percentage',
|
9 |
-
'visible' => true,
|
10 |
-
'type' => 'varchar',
|
11 |
-
'apply_to' => 'simple',
|
12 |
-
'input' => 'text',
|
13 |
-
'system' => false,
|
14 |
-
'required' => false,
|
15 |
-
'user_defined' => 1,
|
16 |
-
'note' => 'possible values from -100 to 100'
|
17 |
-
);
|
18 |
-
|
19 |
-
$installer->addAttribute('catalog_product','shiphawk_discount_percentage', $percentage);
|
20 |
-
/* for sortOrder */
|
21 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_discount_percentage', 'frontend_label', 'Markup or Discount Percentage', 7);
|
22 |
-
|
23 |
-
$fixed = array (
|
24 |
-
'attribute_set' => 'Default',
|
25 |
-
'group' => 'ShipHawk Attributes',
|
26 |
-
'label' => 'Markup or Discount Flat Amount',
|
27 |
-
'visible' => true,
|
28 |
-
'type' => 'varchar',
|
29 |
-
'apply_to' => 'simple',
|
30 |
-
'input' => 'text',
|
31 |
-
'system' => false,
|
32 |
-
'required' => false,
|
33 |
-
'user_defined' => 1,
|
34 |
-
'note' => 'possible values from -∞ to ∞'
|
35 |
-
);
|
36 |
-
|
37 |
-
$installer->addAttribute('catalog_product','shiphawk_discount_fixed', $fixed);
|
38 |
-
/* for sortOrder */
|
39 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_discount_fixed', 'frontend_label', 'Markup or Discount Flat Amount', 7);
|
40 |
-
|
41 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.2-1.0.3.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$shipping_origins = array (
|
6 |
-
'attribute_set' => 'Default',
|
7 |
-
'group' => 'ShipHawk Attributes',
|
8 |
-
'label' => 'Shipping Origins',
|
9 |
-
'visible' => true,
|
10 |
-
'type' => 'varchar',
|
11 |
-
'apply_to' => 'simple',
|
12 |
-
'input' => 'text',
|
13 |
-
'system' => false,
|
14 |
-
'required' => false,
|
15 |
-
'user_defined' => 1,
|
16 |
-
);
|
17 |
-
|
18 |
-
$installer->addAttribute('catalog_product','shiphawk_shipping_origins', $shipping_origins);
|
19 |
-
|
20 |
-
|
21 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.4-1.0.5.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/** @var Mage_Eav_Model_Entity_Setup $installer */
|
3 |
-
$installer = Mage::getResourceModel('sales/setup','sales_setup');
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$installer->addAttribute('order', 'shiphawk_shipping_amount', array('type' => 'text', 'input' => 'text'));
|
7 |
-
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order'), 'shiphawk_shipping_amount', 'text');
|
8 |
-
|
9 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.5-1.0.6.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
// Remove Product Attribute
|
5 |
-
|
6 |
-
/*$origins_attributes = array('shiphawk_origin_firstname', 'shiphawk_origin_lastname', 'shiphawk_origin_addressline1', 'shiphawk_origin_addressline2',
|
7 |
-
'shiphawk_origin_city', 'shiphawk_origin_state', 'shiphawk_origin_zipcode', 'shiphawk_origin_phonenum', 'shiphawk_origin_location', 'shiphawk_origin_email');
|
8 |
-
|
9 |
-
foreach($origins_attributes as $code) {
|
10 |
-
$attr = Mage::getModel('catalog/resource_eav_attribute')
|
11 |
-
->loadByCode('catalog_product',$code);
|
12 |
-
if(!(null == $attr->getId())) {
|
13 |
-
//attribute does exist
|
14 |
-
$installer->removeAttribute('catalog_product', $code);
|
15 |
-
}
|
16 |
-
|
17 |
-
}*/
|
18 |
-
|
19 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.6-1.0.7.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = $this;
|
3 |
-
|
4 |
-
$io = new Varien_Io_File();
|
5 |
-
$io->checkAndCreateFolder(Mage::getBaseDir('var').DS.'shiphawk'.DS.'import');
|
6 |
-
|
7 |
-
$installer->startSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.7-1.0.8.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = $this;
|
3 |
-
|
4 |
-
$io = new Varien_Io_File();
|
5 |
-
$io->checkAndCreateFolder(Mage::getBaseDir('media').DS.'shiphawk'.DS.'bol');
|
6 |
-
|
7 |
-
$installer->startSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.8-1.0.9.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/** @var Mage_Eav_Model_Entity_Setup $installer */
|
3 |
-
$installer = Mage::getResourceModel('sales/setup','sales_setup');
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$installer->addAttribute('order', 'shiphawk_shipping_package_info', array('type' => 'text', 'input' => 'text'));
|
7 |
-
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order'), 'shiphawk_shipping_package_info', 'text');
|
8 |
-
|
9 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.0.9-1.0.10.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/** @var Mage_Eav_Model_Entity_Setup $installer */
|
3 |
-
$installer = Mage::getResourceModel('sales/setup','sales_setup');
|
4 |
-
$installer->startSetup();
|
5 |
-
|
6 |
-
$installer->addAttribute('order', 'shiphawk_shipping_accessories', array('type' => 'text', 'input' => 'text'));
|
7 |
-
$installer->addAttribute('quote', 'shiphawk_shipping_accessories', array('type' => 'text', 'input' => 'text'));
|
8 |
-
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order'), 'shiphawk_shipping_accessories', 'text');
|
9 |
-
|
10 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.0-1.1.1.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$data = array (
|
6 |
-
'attribute_set' => 'Default',
|
7 |
-
'group' => 'ShipHawk Attributes',
|
8 |
-
'label' => 'Carrier Type',
|
9 |
-
'visible' => true,
|
10 |
-
'type' => 'varchar',
|
11 |
-
'apply_to' => 'simple',
|
12 |
-
'option' => array ('values' => array(
|
13 |
-
'' => 'All',
|
14 |
-
'ltl' => 'ltl',
|
15 |
-
'blanket wrap' => 'blanket wrap',
|
16 |
-
'small parcel' => 'small parcel',
|
17 |
-
'vehicle' => 'vehicle',
|
18 |
-
'intermodal' => 'intermodal',
|
19 |
-
'local delivery' => 'local delivery',
|
20 |
-
)),
|
21 |
-
'input' => 'select',
|
22 |
-
'system' => false,
|
23 |
-
'required' => false,
|
24 |
-
'user_defined' => 1,
|
25 |
-
);
|
26 |
-
|
27 |
-
$installer->addAttribute('catalog_product', 'shiphawk_carrier_type', $data);
|
28 |
-
|
29 |
-
/* for sortOrder */
|
30 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_carrier_type', 'frontend_label', 'Carrier Type', 7);
|
31 |
-
|
32 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.3-1.1.4.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
// Remove shiphawk_carrier_type dropdown
|
6 |
-
$installer->removeAttribute('catalog_product', 'shiphawk_carrier_type');
|
7 |
-
|
8 |
-
$data = array (
|
9 |
-
'attribute_set' => 'Default',
|
10 |
-
'group' => 'ShipHawk Attributes',
|
11 |
-
'label' => 'Carrier Type',
|
12 |
-
'visible' => true,
|
13 |
-
'type' => 'varchar',
|
14 |
-
'apply_to' => 'simple',
|
15 |
-
'option' => array ('values' => array(
|
16 |
-
'' => 'All',
|
17 |
-
'ltl' => 'ltl',
|
18 |
-
'blanket wrap' => 'blanket wrap',
|
19 |
-
'small parcel' => 'small parcel',
|
20 |
-
'vehicle' => 'vehicle',
|
21 |
-
'intermodal' => 'intermodal',
|
22 |
-
'local delivery' => 'local delivery',
|
23 |
-
)),
|
24 |
-
'input' => 'multiselect',
|
25 |
-
'backend' => 'eav/entity_attribute_backend_array',
|
26 |
-
'system' => false,
|
27 |
-
'required' => false,
|
28 |
-
'user_defined' => 1,
|
29 |
-
);
|
30 |
-
|
31 |
-
$installer->addAttribute('catalog_product', 'shiphawk_carrier_type', $data);
|
32 |
-
|
33 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.4-1.1.5.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_type_of_product', 'frontend_label', 'Type of Item', 1);
|
6 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_quantity', 'frontend_label', 'Number of items per Product', 2);
|
7 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_item_is_packed', 'frontend_label', 'Packaged?', 3);
|
8 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_length', 'frontend_label', 'Length', 4);
|
9 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_width', 'frontend_label', 'Width', 5);
|
10 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_height', 'frontend_label', 'Height', 6);
|
11 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_carrier_type', 'frontend_label', 'Carrier Type', 7);
|
12 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_freight_class', 'frontend_label', 'Freight Class', 8);
|
13 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_item_value', 'frontend_label', 'Item Value', 9);
|
14 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_discount_percentage', 'frontend_label', 'Markup or Discount Percentage', 10);
|
15 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_discount_fixed', 'frontend_label', 'Markup or Discount Flat Amount', 11);
|
16 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_type_of_product_value', 'frontend_label', 'Origin Contact:', 12);
|
17 |
-
|
18 |
-
|
19 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.5.1-1.1.5.3.php
DELETED
@@ -1,44 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Sales
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/* @var $installer Mage_Sales_Model_Entity_Setup */
|
28 |
-
$installer = $this;
|
29 |
-
$installer->startSetup();
|
30 |
-
$installer->getConnection()
|
31 |
-
->addColumn($installer->getTable('sales/shipment'), 'shiphawk_shipping_method_title', array(
|
32 |
-
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
33 |
-
'comment' => 'Shiphawk Shipping Method Title',
|
34 |
-
'length' => '2000'
|
35 |
-
));
|
36 |
-
|
37 |
-
$installer->getConnection()
|
38 |
-
->addColumn($installer->getTable('sales/shipment'), 'shiphawk_shipping_price', array(
|
39 |
-
'type' => Varien_Db_Ddl_Table::TYPE_FLOAT,
|
40 |
-
'comment' => 'Shiphawk Shipping Price'
|
41 |
-
));
|
42 |
-
|
43 |
-
$installer->endSetup();
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.5.3-1.1.6.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_item_is_packed', 'frontend_label', 'Is Product Already Packed?');
|
6 |
-
|
7 |
-
|
8 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Shiphawk/Shipping/sql/shiphawk_setup/mysql4-upgrade-1.1.7-1.1.8.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
|
3 |
-
$installer->startSetup();
|
4 |
-
|
5 |
-
$packing_price = array (
|
6 |
-
'attribute_set' => 'Default',
|
7 |
-
'group' => 'ShipHawk Attributes',
|
8 |
-
'label' => 'Custom Packing Price',
|
9 |
-
'visible' => true,
|
10 |
-
'type' => 'varchar',
|
11 |
-
'apply_to' => 'simple',
|
12 |
-
'input' => 'text',
|
13 |
-
'system' => false,
|
14 |
-
'required' => false,
|
15 |
-
'user_defined' => 1,
|
16 |
-
);
|
17 |
-
|
18 |
-
$installer->addAttribute('catalog_product','shiphawk_custom_packing_price', $packing_price);
|
19 |
-
|
20 |
-
/* for sortOrder */
|
21 |
-
|
22 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_type_of_product', 'frontend_label', 'Type of Item', 10);
|
23 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_quantity', 'frontend_label', 'Number of items per Product', 20);
|
24 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_item_is_packed', 'frontend_label', 'Is Product Already Packed?', 30);
|
25 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_custom_packing_price', 'frontend_label', 'Custom Packing Price', 40);
|
26 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_length', 'frontend_label', 'Length', 50);
|
27 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_width', 'frontend_label', 'Width', 60);
|
28 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_height', 'frontend_label', 'Height', 70);
|
29 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_carrier_type', 'frontend_label', 'Carrier Type', 80);
|
30 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_freight_class', 'frontend_label', 'Freight Class', 90);
|
31 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_item_value', 'frontend_label', 'Item Value', 100);
|
32 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_discount_percentage', 'frontend_label', 'Markup or Discount Percentage', 110);
|
33 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_discount_fixed', 'frontend_label', 'Markup or Discount Flat Amount', 120);
|
34 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_shipping_origins', 'frontend_label', 'Shipping Origins', 121);
|
35 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_type_of_product_value', 'frontend_label', 'Origin Contact:', 125);
|
36 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_firstname', 'frontend_label', 'Origin First Name', 130);
|
37 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_lastname', 'frontend_label', 'Origin Last Name', 140);
|
38 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_addressline1', 'frontend_label', 'Origin Address', 150);
|
39 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_addressline2', 'frontend_label', 'Origin Address 2', 160);
|
40 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_city', 'frontend_label', 'Origin City', 170);
|
41 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_state', 'frontend_label', 'Origin State', 180);
|
42 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_zipcode', 'frontend_label', 'Origin Zipcode', 190);
|
43 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_phonenum', 'frontend_label', 'Origin Phone', 200);
|
44 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_email', 'frontend_label', 'Origin Email', 210);
|
45 |
-
$installer->updateAttribute('catalog_product', 'shiphawk_origin_location', 'frontend_label', 'Origin Location', 220);
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/layout/shiphawk.xml
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
|
4 |
-
<adminhtml_catalog_product_edit>
|
5 |
-
|
6 |
-
<reference name="head">
|
7 |
-
<action method="addItem">
|
8 |
-
<type>js</type>
|
9 |
-
<name>shiphawk/shiphawk.js</name>
|
10 |
-
|
11 |
-
<aParams>id="shiphawkjsfile"</aParams>
|
12 |
-
</action>
|
13 |
-
|
14 |
-
<action method="addItem"><type>js_css</type><name>shiphawk/shiphawk.css</name></action>
|
15 |
-
|
16 |
-
</reference>
|
17 |
-
<reference name="content">
|
18 |
-
<block type="core/template" name="shiphawkjsfile" template="shiphawk/shiphawkjsfile.phtml"/>
|
19 |
-
</reference>
|
20 |
-
</adminhtml_catalog_product_edit>
|
21 |
-
|
22 |
-
<adminhtml_catalog_product_action_attribute_edit>
|
23 |
-
|
24 |
-
<reference name="head">
|
25 |
-
|
26 |
-
<action method="addItem">
|
27 |
-
<type>js</type>
|
28 |
-
<name>shiphawk/shiphawk.js</name>
|
29 |
-
<aParams>id="shiphawkjsfile"</aParams>
|
30 |
-
</action>
|
31 |
-
|
32 |
-
<action method="addItem"><type>js_css</type><name>shiphawk/shiphawk.css</name></action>
|
33 |
-
|
34 |
-
</reference>
|
35 |
-
<reference name="content">
|
36 |
-
<block type="core/template" name="shiphawkjsfile" template="shiphawk/shiphawkjsfile.phtml"/>
|
37 |
-
</reference>
|
38 |
-
</adminhtml_catalog_product_action_attribute_edit>
|
39 |
-
|
40 |
-
<adminhtml_catalog_product_new>
|
41 |
-
<reference name="head">
|
42 |
-
|
43 |
-
<action method="addItem">
|
44 |
-
<type>js</type>
|
45 |
-
<name>shiphawk/shiphawk.js</name>
|
46 |
-
<aParams>id="shiphawkjsfile"</aParams>
|
47 |
-
</action>
|
48 |
-
|
49 |
-
<action method="addItem"><type>js_css</type><name>shiphawk/shiphawk.css</name></action>
|
50 |
-
|
51 |
-
</reference>
|
52 |
-
<reference name="content">
|
53 |
-
<block type="core/template" name="shiphawkjsfile" template="shiphawk/shiphawkjsfile.phtml"/>
|
54 |
-
</reference>
|
55 |
-
</adminhtml_catalog_product_new>
|
56 |
-
|
57 |
-
<adminhtml_sales_order_view>
|
58 |
-
<reference name="head">
|
59 |
-
|
60 |
-
<action method="addJs"><script>shiphawk/shiphawk_shipment.js</script></action>
|
61 |
-
|
62 |
-
<action method="addItem"><type>js_css</type><name>shiphawk/shiphawk.css</name></action>
|
63 |
-
|
64 |
-
<action method="addItem">
|
65 |
-
<type>js_css</type>
|
66 |
-
<name>prototype/windows/themes/default.css</name>
|
67 |
-
</action>
|
68 |
-
<action method="addCss">
|
69 |
-
<name>lib/prototype/windows/themes/magento.css</name>
|
70 |
-
</action>
|
71 |
-
|
72 |
-
</reference>
|
73 |
-
<reference name="content">
|
74 |
-
<block type="core/template" name="shiphawkjsfile" template="shiphawk/shiphawkjsfile.phtml"/>
|
75 |
-
</reference>
|
76 |
-
</adminhtml_sales_order_view>
|
77 |
-
|
78 |
-
<adminhtml_origins_index>
|
79 |
-
<reference name="content">
|
80 |
-
<block type="shiphawk_shipping/adminhtml_origins" name="origins.grid_container" />
|
81 |
-
</reference>
|
82 |
-
</adminhtml_origins_index>
|
83 |
-
|
84 |
-
<adminhtml_origins_new>
|
85 |
-
<update handle="adminhtml_origins_edit"/>
|
86 |
-
</adminhtml_origins_new>
|
87 |
-
|
88 |
-
<adminhtml_origins_edit>
|
89 |
-
<reference name="content">
|
90 |
-
<block type="shiphawk_shipping/adminhtml_origins_edit" name="origins.edit" />
|
91 |
-
</reference>
|
92 |
-
</adminhtml_origins_edit>
|
93 |
-
|
94 |
-
<shiphawk_shipping_adminhtml_shipment_newshipment>
|
95 |
-
<reference name="head">
|
96 |
-
<action method="addItem"><type>js_css</type><name>shiphawk/shiphawk.css</name></action>
|
97 |
-
</reference>
|
98 |
-
</shiphawk_shipping_adminhtml_shipment_newshipment>
|
99 |
-
|
100 |
-
<adminhtml_sales_order_view>
|
101 |
-
<reference name="order_tab_info">
|
102 |
-
<action method="setTemplate">
|
103 |
-
<template>shiphawk/amount.phtml</template>
|
104 |
-
</action>
|
105 |
-
</reference>
|
106 |
-
</adminhtml_sales_order_view>
|
107 |
-
|
108 |
-
<adminhtml_sales_order_shipment_view>
|
109 |
-
<reference name="form">
|
110 |
-
<action method="setTemplate">
|
111 |
-
<template>shiphawk/shipping/form.phtml</template>
|
112 |
-
</action>
|
113 |
-
</reference>
|
114 |
-
<reference name="content">
|
115 |
-
<block type="core/template" name="shiphawkjsfile" template="shiphawk/shiphawkjsfile.phtml"/>
|
116 |
-
</reference>
|
117 |
-
</adminhtml_sales_order_shipment_view>
|
118 |
-
|
119 |
-
<adminhtml_sales_order_create_index>
|
120 |
-
<reference name="head">
|
121 |
-
<action method="addItem">
|
122 |
-
<type>js</type>
|
123 |
-
<name>shiphawk/shiphawk_order.js</name>
|
124 |
-
</action>
|
125 |
-
</reference>
|
126 |
-
</adminhtml_sales_order_create_index>
|
127 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/shiphawk/amount.phtml
DELETED
@@ -1,287 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php /** @var $this Mage_Adminhtml_Block_Sales_Order_View_Tab_Info */ ?>
|
28 |
-
<?php $_order = $this->getOrder() ?>
|
29 |
-
<div>
|
30 |
-
<div id="order-messages">
|
31 |
-
<?php echo $this->getChildHtml('order_messages') ?>
|
32 |
-
</div>
|
33 |
-
<?php echo $this->getChildHtml('order_info') ?>
|
34 |
-
<input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
|
35 |
-
<?php if ($_order->getIsVirtual()): ?>
|
36 |
-
<div class="box-right">
|
37 |
-
<?php else: ?>
|
38 |
-
<div class="box-left">
|
39 |
-
<?php endif; ?>
|
40 |
-
<!--Payment Method-->
|
41 |
-
<div class="entry-edit">
|
42 |
-
<div class="entry-edit-head">
|
43 |
-
<h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
|
44 |
-
</div>
|
45 |
-
<fieldset>
|
46 |
-
<?php echo $this->getPaymentHtml() ?>
|
47 |
-
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
|
48 |
-
</fieldset>
|
49 |
-
</div>
|
50 |
-
</div>
|
51 |
-
<?php if (!$_order->getIsVirtual()): ?>
|
52 |
-
<div class="box-right">
|
53 |
-
<!--Shipping Method-->
|
54 |
-
<div class="entry-edit">
|
55 |
-
<div class="entry-edit-head">
|
56 |
-
<h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping & Handling Information') ?></h4>
|
57 |
-
</div>
|
58 |
-
<fieldset>
|
59 |
-
<?php if ($_order->getTracksCollection()->count()) : ?>
|
60 |
-
<a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
|
61 |
-
<br/>
|
62 |
-
<?php endif; ?>
|
63 |
-
<?php if ($_order->getShippingDescription()): ?>
|
64 |
-
<strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
|
65 |
-
|
66 |
-
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
67 |
-
<?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
|
68 |
-
<?php else: ?>
|
69 |
-
<?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
|
70 |
-
<?php endif; ?>
|
71 |
-
<?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
|
72 |
-
|
73 |
-
<?php echo $_excl; ?>
|
74 |
-
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
75 |
-
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
76 |
-
<?php endif; ?>
|
77 |
-
<?php else: ?>
|
78 |
-
<?php echo $this->helper('sales')->__('No shipping information available'); ?>
|
79 |
-
<?php endif; ?>
|
80 |
-
<?php
|
81 |
-
$shiphawk_shipping_amount = $_order->getShiphawkShippingAmount();
|
82 |
-
$shiphawk_shipping_package_info = $_order->getShiphawkShippingPackageInfo();
|
83 |
-
$shiphawkShippingAccessories = $_order->getShiphawkShippingAccessories();
|
84 |
-
$shiphawkShippingAccessories = !empty($shiphawkShippingAccessories) ? json_decode($shiphawkShippingAccessories, true) : array();
|
85 |
-
?>
|
86 |
-
<?php if ($shiphawk_shipping_amount) : ?>
|
87 |
-
<div class="entry-edit">
|
88 |
-
<div class="entry-edit-head">
|
89 |
-
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('ShipHawk Shipping Amount') ?></h4>
|
90 |
-
</div>
|
91 |
-
<div class="fieldset">
|
92 |
-
<div class="hor-scroll">
|
93 |
-
<table cellspacing="0" class="form-list">
|
94 |
-
<tr>
|
95 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('ShipHawk Shipping Amount') ?></label></td>
|
96 |
-
<td class="value">
|
97 |
-
<?php $currensy_symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?>
|
98 |
-
<?php echo $currensy_symbol . $shiphawk_shipping_amount; ?>
|
99 |
-
</td>
|
100 |
-
</tr>
|
101 |
-
|
102 |
-
</table>
|
103 |
-
</div>
|
104 |
-
</div>
|
105 |
-
<div class="entry-edit-head">
|
106 |
-
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('ShipHawk Shipping Package Info') ?></h4>
|
107 |
-
</div>
|
108 |
-
<div class="fieldset">
|
109 |
-
<div class="hor-scroll">
|
110 |
-
<table cellspacing="0" class="form-list">
|
111 |
-
<tr>
|
112 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('ShipHawk Shipping Package Info') ?></label></td>
|
113 |
-
<td class="value">
|
114 |
-
<?php echo $shiphawk_shipping_package_info; ?>
|
115 |
-
</td>
|
116 |
-
</tr>
|
117 |
-
|
118 |
-
</table>
|
119 |
-
</div>
|
120 |
-
</div>
|
121 |
-
<div class="entry-edit-head">
|
122 |
-
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('ShipHawk Shipping Accessorials') ?></h4>
|
123 |
-
</div>
|
124 |
-
<div class="fieldset">
|
125 |
-
<div class="hor-scroll">
|
126 |
-
<table cellspacing="0" class="form-list">
|
127 |
-
<tr>
|
128 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('ShipHawk Shipping Accessorials') ?></label></td>
|
129 |
-
<td class="value">
|
130 |
-
<?php
|
131 |
-
if (!empty($shiphawkShippingAccessories)) {
|
132 |
-
foreach($shiphawkShippingAccessories as $type => $accessor) {
|
133 |
-
echo '<span style="text-transform: capitalize; font-weight: bold;">' . Mage::helper('sales')->__(str_replace("'", '', $type) . ':') . '</span>';
|
134 |
-
echo '<ul>';
|
135 |
-
|
136 |
-
foreach($accessor as $values) {
|
137 |
-
echo '<li>' . str_replace("'", '', $values['name']) . ' - ' . $currensy_symbol . $values['value'] . '</li>';
|
138 |
-
}
|
139 |
-
|
140 |
-
echo '</ul>';
|
141 |
-
echo '<br/>';
|
142 |
-
}
|
143 |
-
} else {
|
144 |
-
echo Mage::helper('sales')->__('Accessorials are not selected.');
|
145 |
-
}
|
146 |
-
?>
|
147 |
-
</td>
|
148 |
-
</tr>
|
149 |
-
|
150 |
-
</table>
|
151 |
-
</div>
|
152 |
-
</div>
|
153 |
-
<div class="entry-edit-head">
|
154 |
-
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('ShipHawk Location Type') ?></h4>
|
155 |
-
</div>
|
156 |
-
<div class="fieldset">
|
157 |
-
<div class="hor-scroll">
|
158 |
-
<table cellspacing="0" class="form-list">
|
159 |
-
<tr>
|
160 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Location Type') ?></label></td>
|
161 |
-
<td class="value">
|
162 |
-
<?php echo $_order->getShiphawkLocationType();?>
|
163 |
-
</td>
|
164 |
-
</tr>
|
165 |
-
</table>
|
166 |
-
</div>
|
167 |
-
</div>
|
168 |
-
</div>
|
169 |
-
<?php endif; ?>
|
170 |
-
<?php
|
171 |
-
if (!$_order->canShip()) {
|
172 |
-
|
173 |
-
foreach($_order->getShipmentsCollection() as $shipment)
|
174 |
-
{
|
175 |
-
foreach($shipment->getAllTracks() as $tracknum)
|
176 |
-
{
|
177 |
-
$tracknums[]=$tracknum->getNumber();
|
178 |
-
}
|
179 |
-
|
180 |
-
}
|
181 |
-
?>
|
182 |
-
<ul>
|
183 |
-
<?php foreach($tracknums as $ship_num) { ?>
|
184 |
-
<li><a onclick="bolpdf(this)" class="bol_link" style="cursor: pointer" id="<?php echo $ship_num; ?>">Get BOL PDF for <?php echo $ship_num ?> shipment</a></li>
|
185 |
-
<?php } ?>
|
186 |
-
</ul>
|
187 |
-
<?php } ?>
|
188 |
-
|
189 |
-
</fieldset>
|
190 |
-
</div>
|
191 |
-
</div>
|
192 |
-
<?php endif; ?>
|
193 |
-
<div class="clear"></div>
|
194 |
-
<?php echo $this->getGiftOptionsHtml() ?>
|
195 |
-
<div class="clear"></div>
|
196 |
-
<div class="entry-edit">
|
197 |
-
<div class="entry-edit-head">
|
198 |
-
<h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
|
199 |
-
</div>
|
200 |
-
</div>
|
201 |
-
<?php echo $this->getItemsHtml() ?>
|
202 |
-
<div class="clear"></div>
|
203 |
-
|
204 |
-
<div class="box-left">
|
205 |
-
<div class="entry-edit">
|
206 |
-
<div class="entry-edit-head">
|
207 |
-
<h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
|
208 |
-
</div>
|
209 |
-
<fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
|
210 |
-
</div>
|
211 |
-
</div>
|
212 |
-
<div class="box-right entry-edit">
|
213 |
-
<div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
|
214 |
-
<div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
|
215 |
-
</div>
|
216 |
-
<div class="clear"></div>
|
217 |
-
</div>
|
218 |
-
|
219 |
-
<?php echo $this->getChildHtml('popup_window');?>
|
220 |
-
<script type="text/javascript">
|
221 |
-
//<![CDATA[
|
222 |
-
/**
|
223 |
-
* Retrieve gift options tooltip content
|
224 |
-
*/
|
225 |
-
function getGiftOptionsTooltipContent(itemId) {
|
226 |
-
var contentLines = [];
|
227 |
-
var headerLine = null;
|
228 |
-
var contentLine = null;
|
229 |
-
|
230 |
-
$$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
|
231 |
-
if (element.down(0)) {
|
232 |
-
headerLine = element.down(0).innerHTML;
|
233 |
-
contentLine = element.down(0).next().innerHTML;
|
234 |
-
if (contentLine.length > 30) {
|
235 |
-
contentLine = contentLine.slice(0,30) + '...';
|
236 |
-
}
|
237 |
-
contentLines.push(headerLine + ' ' + contentLine);
|
238 |
-
}
|
239 |
-
});
|
240 |
-
return contentLines.join('<br/>');
|
241 |
-
}
|
242 |
-
giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
|
243 |
-
|
244 |
-
function bolpdf(element) {
|
245 |
-
|
246 |
-
var url = 'shiphawk/index/getbol';
|
247 |
-
|
248 |
-
url = baseMagentoUrl + url;
|
249 |
-
|
250 |
-
var parameters = {
|
251 |
-
shipments_id: element.id
|
252 |
-
};
|
253 |
-
|
254 |
-
new Ajax.Request(url, {
|
255 |
-
method: 'post',
|
256 |
-
parameters: parameters,
|
257 |
-
onSuccess: function(transport) {
|
258 |
-
|
259 |
-
responce_html = JSON.parse(transport.responseText);
|
260 |
-
|
261 |
-
|
262 |
-
if(responce_html.shiphawk_error) {
|
263 |
-
|
264 |
-
var error_html = 'ERROR: ' + responce_html.shiphawk_error;
|
265 |
-
alert(error_html);
|
266 |
-
}else{
|
267 |
-
if(responce_html.bol_url) {
|
268 |
-
|
269 |
-
// alert(responce_html.bol_url);
|
270 |
-
//window.location = responce_html.bol_url;
|
271 |
-
|
272 |
-
window.open(
|
273 |
-
responce_html.bol_url,
|
274 |
-
'_blank' // <- This is what makes it open in a new window.
|
275 |
-
);
|
276 |
-
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
},
|
281 |
-
onLoading:function(transport)
|
282 |
-
{
|
283 |
-
}
|
284 |
-
});
|
285 |
-
}
|
286 |
-
//]]>
|
287 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/shiphawk/button.phtml
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* @var $this Shiphawk_Shipping_Block_Adminhtml_System_Config_Form_Button
|
5 |
-
*/
|
6 |
-
?>
|
7 |
-
<script type="text/javascript">
|
8 |
-
//<![CDATA[
|
9 |
-
|
10 |
-
function importcsv() {
|
11 |
-
new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
|
12 |
-
method: 'get',
|
13 |
-
onSuccess: function(transport){
|
14 |
-
|
15 |
-
if (transport.responseText){
|
16 |
-
alert(transport.responseText);
|
17 |
-
}
|
18 |
-
}
|
19 |
-
});
|
20 |
-
}
|
21 |
-
//]]>
|
22 |
-
</script>
|
23 |
-
|
24 |
-
<?php echo $this->getButtonHtml() ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/shiphawk/shiphawkjsfile.phtml
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<script type="text/javascript">
|
2 |
-
//<![CDATA[
|
3 |
-
|
4 |
-
var baseMagentoUrl = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>';
|
5 |
-
|
6 |
-
|
7 |
-
//]]>
|
8 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/shiphawk/shipment.phtml
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$order = $this->getOrder();
|
3 |
-
|
4 |
-
$result = $this->getNewShipHawkRate($order);
|
5 |
-
|
6 |
-
if(($result == null) or ($result['error'])) {
|
7 |
-
if($result['error']) {
|
8 |
-
echo $result['error'];
|
9 |
-
}
|
10 |
-
return;
|
11 |
-
}
|
12 |
-
|
13 |
-
$is_multi_zip = $result['is_multi_zip'];
|
14 |
-
$toOrder = $result['to_order'];
|
15 |
-
$summ_price = $result['summ_price'];
|
16 |
-
$rate_filter = $result['rate_filter'];
|
17 |
-
$name_service = $result['name_service'];
|
18 |
-
|
19 |
-
$order_id = $order->getId();
|
20 |
-
$currency_symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
21 |
-
|
22 |
-
$error_text = Mage::getSingleton('core/session')->getData('error_price_text', true); // clear data after get
|
23 |
-
?>
|
24 |
-
<?php if(!empty($error_text)) { ?>
|
25 |
-
<div id="error_text_"><?php echo $error_text ?></div>
|
26 |
-
<?php } ?>
|
27 |
-
<form class="my-form" name="shiphawk_form" id="shiphawk_form">
|
28 |
-
<input type="hidden" value="<?php echo $order_id ?>" name="order_id">
|
29 |
-
<input type="hidden" value="<?php echo $is_multi_zip ?>" name="is_multi">
|
30 |
-
|
31 |
-
<?php if ($is_multi_zip == 0) { ?>
|
32 |
-
<ul>
|
33 |
-
<?php foreach ($toOrder as $rate_id=>$shipments_data ) {
|
34 |
-
$shipment_value = 'shiphawk_shipping_' . $shipments_data['name'];
|
35 |
-
$shipment_id = 's_method_shiphawk_shipping_' . $shipments_data['name'];
|
36 |
-
$shipping_price = $shipments_data['price'];
|
37 |
-
$carrier_accessorial = (array) $shipments_data['carrier_accessorial'];
|
38 |
-
$_radioProperty = 'name="shipping_method" type="radio" class="shipping-ratios" data-rate="' .$rate_id . '"';
|
39 |
-
?>
|
40 |
-
<li>
|
41 |
-
<input <?php echo $_radioProperty ?> value="<?php echo $rate_id ?>" id="<?php echo $shipment_id ?>" class="shipping-ratios">
|
42 |
-
<label for="<?php echo $shipment_id ?>"><?php echo $shipments_data['carrier'] . ' - '. $shipments_data['name'] . ' ' ?><span class="price"><?php echo ' - ' . $currency_symbol . $shipping_price ?></span></label>
|
43 |
-
</li>
|
44 |
-
<?php foreach ($carrier_accessorial as $type => $accessories): ?>
|
45 |
-
<?php if (count($accessories) > 0) { ?>
|
46 |
-
<span style="text-transform: capitalize; font-weight: bold; display: none; padding-left: 16px"
|
47 |
-
class="shipping-ratio-origins shipping-ratio-<?php echo $rate_id; ?>-origins"><?php echo $type ?></span>
|
48 |
-
<?php } ?>
|
49 |
-
<?php foreach ($accessories as $accessor): ?>
|
50 |
-
<li class="shipping-ratio-origins shipping-ratio-<?php echo $rate_id; ?>-origins"
|
51 |
-
style="display: none; padding-left: 16px;">
|
52 |
-
<input id="<?php echo $accessor->id . '-' . $rate_id; ?>"
|
53 |
-
type="checkbox" value="<?php echo $accessor->price ?>"
|
54 |
-
name="accessories[<?php echo $type ?>]['<?php echo $accessor->accessorial_type . ' (' . $accessor->accessorial_options . ')'; ?>']['<?php echo $accessor->id ?>']"
|
55 |
-
class="checkbox accessor"/>
|
56 |
-
<label for="<?php echo $accessor->id . '-' . $rate_id; ?>"
|
57 |
-
class="shipping-ratio-origins-label"><?php echo $accessor->accessorial_type . ' (' . $accessor->accessorial_options . ')' . ' + ' . '$' . $accessor->price ?></label>
|
58 |
-
</li>
|
59 |
-
<?php endforeach; ?>
|
60 |
-
<?php endforeach; ?>
|
61 |
-
|
62 |
-
<?php } ?>
|
63 |
-
</ul>
|
64 |
-
<?php }else{?>
|
65 |
-
<ul>
|
66 |
-
<li>
|
67 |
-
<input type="hidden" value="<?php echo $summ_price ?>" name="multi_price">
|
68 |
-
<input checked name="shipping_method" type="radio" value="<?php echo $name_service ?>" id="<?php echo 'multi_origin' ?>" class="radio">
|
69 |
-
<label for="<?php echo 'multi_origin' ?>"><?php echo $name_service . ' ' ?><span class="price"><?php echo ' - ' . $currency_symbol . $summ_price ?></span></label>
|
70 |
-
</li>
|
71 |
-
|
72 |
-
</ul>
|
73 |
-
<?php } ?>
|
74 |
-
<input type="button" class="submitshiphawk_button" value="ShipHawk Shipment" id="submitshiphawk" />
|
75 |
-
<span id="formLoader" style="display:none;"> </span>
|
76 |
-
</form>
|
77 |
-
|
78 |
-
<div id="formSuccess" style="display:none;"> </div>
|
79 |
-
|
80 |
-
|
81 |
-
<script type="text/javascript">
|
82 |
-
//<![CDATA[
|
83 |
-
|
84 |
-
var postUrl = '<?php echo Mage::helper("adminhtml")->getUrl("adminshiphawk/adminhtml_shipment/newbook"); ?>';
|
85 |
-
|
86 |
-
function doAjax() {
|
87 |
-
|
88 |
-
new Ajax.Request(postUrl, {
|
89 |
-
method: 'post',
|
90 |
-
parameters: $('shiphawk_form').serialize(),
|
91 |
-
onSuccess: function(transport) {
|
92 |
-
responce_html = JSON.parse(transport.responseText);
|
93 |
-
Element.hide($('shiphawk_form'));
|
94 |
-
$('loading-mask').hide();
|
95 |
-
$('formSuccess').show();
|
96 |
-
$('formSuccess').update(responce_html);
|
97 |
-
$('error_text_').hide();
|
98 |
-
|
99 |
-
setTimeout('parent.location.reload()', 2000);
|
100 |
-
},
|
101 |
-
onComplete:function(request, json) {
|
102 |
-
Element.hide($('shiphawk_form'));
|
103 |
-
responce_html = JSON.parse(transport.responseText);
|
104 |
-
$('formSuccess').show();
|
105 |
-
$('formSuccess').update(responce_html);
|
106 |
-
}
|
107 |
-
});
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
new Event.observe($('submitshiphawk'), 'click', function(e){
|
112 |
-
e.stop();
|
113 |
-
doAjax();
|
114 |
-
});
|
115 |
-
|
116 |
-
/* For couple rates */
|
117 |
-
|
118 |
-
$$("input.shipping-ratios").invoke('observe', 'change', function() {
|
119 |
-
$$('.shipping-ratio-origins').invoke('hide');
|
120 |
-
$$('.shipping-ratio-origins input[type=checkbox]').invoke('setValue', false);
|
121 |
-
|
122 |
-
var ratioId = $$("input.shipping-ratios:checked").invoke('readAttribute' ,'data-rate');
|
123 |
-
showOrigins(ratioId);
|
124 |
-
});
|
125 |
-
|
126 |
-
/* For checked rate */
|
127 |
-
|
128 |
-
if ($$("input.shipping-ratios:checked").length > 0) {
|
129 |
-
var ratioId = $$("input.shipping-ratios:checked").invoke('readAttribute' ,'data-rate');
|
130 |
-
showOrigins(ratioId);
|
131 |
-
}
|
132 |
-
|
133 |
-
function showOrigins(id) {
|
134 |
-
$$('.shipping-ratio-' + id + '-origins').invoke('show');
|
135 |
-
}
|
136 |
-
//]]>
|
137 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/shiphawk/shipping/form.phtml
DELETED
@@ -1,193 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php $_order = $this->getShipment()->getOrder() ?>
|
28 |
-
<?php echo $this->getChildHtml('order_info') ?>
|
29 |
-
|
30 |
-
<div class="box-left">
|
31 |
-
<!--Billing Address-->
|
32 |
-
<div class="entry-edit">
|
33 |
-
<div class="entry-edit-head">
|
34 |
-
<h4 class="icon-head head-payment-method"><?php echo $this->helper('sales')->__('Payment Information') ?></h4>
|
35 |
-
</div>
|
36 |
-
<fieldset>
|
37 |
-
<div><?php echo $this->getChildHtml('order_payment') ?></div>
|
38 |
-
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
|
39 |
-
</fieldset>
|
40 |
-
</div>
|
41 |
-
</div>
|
42 |
-
<div class="box-right">
|
43 |
-
<!--Shipping Address-->
|
44 |
-
<div class="entry-edit">
|
45 |
-
<div class="entry-edit-head">
|
46 |
-
<h4 class="icon-head head-shipping-method"><?php echo $this->helper('sales')->__('Shipping and Tracking Information') ?></h4>
|
47 |
-
</div>
|
48 |
-
<fieldset>
|
49 |
-
<div>
|
50 |
-
<?php if($this->getShipment()->getTracksCollection()->count()): ?>
|
51 |
-
<a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($this->getShipment()) ?>','trackshipment','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track this shipment') ?>"><?php echo $this->__('Track this shipment') ?></a>
|
52 |
-
<br/>
|
53 |
-
<?php endif; ?>
|
54 |
-
<strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
|
55 |
-
<?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
|
56 |
-
|
57 |
-
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
58 |
-
<?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
|
59 |
-
<?php else: ?>
|
60 |
-
<?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
|
61 |
-
<?php endif; ?>
|
62 |
-
<?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
|
63 |
-
|
64 |
-
<?php echo $_excl; ?>
|
65 |
-
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
66 |
-
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
67 |
-
<?php endif; ?>
|
68 |
-
</div>
|
69 |
-
|
70 |
-
|
71 |
-
<?php
|
72 |
-
$shipment = $this->getShipment();
|
73 |
-
$shipment_price = $shipment->getShiphawkShippingPrice();
|
74 |
-
$accessoriesPriceData = json_decode($_order->getData('shiphawk_shipping_accessories'));
|
75 |
-
$accessoriesPrice = Mage::helper('shiphawk_shipping')->getAccessoriesPrice($accessoriesPriceData);
|
76 |
-
$shipment_price = $shipment_price + $accessoriesPrice;
|
77 |
-
$shiphawkShipmentTitle = $shipment->getShiphawkShippingMethodTitle();
|
78 |
-
?>
|
79 |
-
<?php if(!empty($shiphawkShipmentTitle)) { ?>
|
80 |
-
<div style=" margin: 10px 0 0;"><strong><?php echo $this->__('Current ShipHawk Shipment Price (incl. accessories):'); ?></strong></div>
|
81 |
-
<div>
|
82 |
-
<strong><?php echo $this->escapeHtml($shiphawkShipmentTitle) ?></strong>
|
83 |
-
<?php $currensy_symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?>
|
84 |
-
<?php echo ': ' . $currensy_symbol . $shipment_price; ?>
|
85 |
-
|
86 |
-
</div>
|
87 |
-
<?php } ?>
|
88 |
-
<?php if ($this->canCreateShippingLabel()): ?>
|
89 |
-
<div style="text-align: center; margin: 10px 0;">
|
90 |
-
<?php echo $this->getCreateLabelButton()?>
|
91 |
-
<?php if ($this->getShipment()->getShippingLabel()): ?>
|
92 |
-
<?php echo $this->getPrintLabelButton() ?>
|
93 |
-
<?php endif ?>
|
94 |
-
<?php if ($this->getShipment()->getPackages()): ?>
|
95 |
-
<?php echo $this->getShowPackagesButton() ?>
|
96 |
-
<?php endif ?>
|
97 |
-
</div>
|
98 |
-
<?php endif ?>
|
99 |
-
|
100 |
-
<?php
|
101 |
-
|
102 |
-
foreach($shipment->getAllTracks() as $tracknum)
|
103 |
-
{
|
104 |
-
$tracknums[]=$tracknum->getNumber();
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
?>
|
109 |
-
<ul>
|
110 |
-
<?php foreach($tracknums as $ship_num) { ?>
|
111 |
-
<li><a onclick="bolpdf(this)" class="bol_link" style="cursor: pointer" id="<?php echo $ship_num; ?>">Get BOL PDF for <?php echo $ship_num ?> shipment</a></li>
|
112 |
-
<?php } ?>
|
113 |
-
</ul>
|
114 |
-
|
115 |
-
<div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
|
116 |
-
</fieldset>
|
117 |
-
<?php echo $this->getChildHtml('shipment_packaging') ?>
|
118 |
-
<script type="text/javascript">
|
119 |
-
//<![CDATA[
|
120 |
-
function bolpdf(element) {
|
121 |
-
|
122 |
-
var url = 'shiphawk/index/getbol';
|
123 |
-
|
124 |
-
url = baseMagentoUrl + url;
|
125 |
-
|
126 |
-
var parameters = {
|
127 |
-
shipments_id: element.id
|
128 |
-
};
|
129 |
-
|
130 |
-
new Ajax.Request(url, {
|
131 |
-
method: 'post',
|
132 |
-
parameters: parameters,
|
133 |
-
onSuccess: function(transport) {
|
134 |
-
|
135 |
-
responce_html = JSON.parse(transport.responseText);
|
136 |
-
|
137 |
-
if(responce_html.shiphawk_error) {
|
138 |
-
|
139 |
-
var error_html = 'ERROR: ' + responce_html.shiphawk_error;
|
140 |
-
alert(error_html);
|
141 |
-
}else{
|
142 |
-
if(responce_html.bol_url) {
|
143 |
-
|
144 |
-
// alert(responce_html.bol_url);
|
145 |
-
//window.location = responce_html.bol_url;
|
146 |
-
|
147 |
-
window.open(
|
148 |
-
responce_html.bol_url,
|
149 |
-
'_blank' // <- This is what makes it open in a new window.
|
150 |
-
);
|
151 |
-
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
},
|
156 |
-
onLoading:function(transport)
|
157 |
-
{
|
158 |
-
}
|
159 |
-
});
|
160 |
-
}
|
161 |
-
document.observe("dom:loaded", function() {
|
162 |
-
setTimeout(function(){
|
163 |
-
packaging.setConfirmPackagingCallback(function(){
|
164 |
-
packaging.sendCreateLabelRequest();
|
165 |
-
});
|
166 |
-
packaging.setLabelCreatedCallback(function(response){
|
167 |
-
setLocation("<?php echo $this->getUrl(
|
168 |
-
'*/sales_order_shipment/view',
|
169 |
-
array('shipment_id' => $this->getShipment()->getId())
|
170 |
-
); ?>");
|
171 |
-
});
|
172 |
-
}, 500);
|
173 |
-
});
|
174 |
-
//]]>
|
175 |
-
</script>
|
176 |
-
</div>
|
177 |
-
</div>
|
178 |
-
<div class="clear"></div>
|
179 |
-
|
180 |
-
<div class="entry-edit">
|
181 |
-
<div class="entry-edit-head">
|
182 |
-
<h4 class="icon-head head-products"><?php echo $this->helper('sales')->__('Items Shipped') ?></h4>
|
183 |
-
</div>
|
184 |
-
</div>
|
185 |
-
|
186 |
-
<?php echo $this->getChildHtml('shipment_items') ?>
|
187 |
-
<?php echo $this->getChildHtml('shipment_packed') ?>
|
188 |
-
|
189 |
-
<div class="box-left entry-edit">
|
190 |
-
<div class="entry-edit-head"><h4><?php echo $this->__('Shipment History') ?></h4></div>
|
191 |
-
<fieldset><?php echo $this->getChildHtml('order_comments') ?></fieldset>
|
192 |
-
</div>
|
193 |
-
<div class="clear"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/shiphawk/shipping/method/form.phtml
DELETED
@@ -1,268 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php /** @var $this Mage_Adminhtml_Block_Sales_Order_Create_Shipping_Method_Form */ ?>
|
28 |
-
<style>
|
29 |
-
.shipping-ratio-origins {
|
30 |
-
padding-left: 17px;
|
31 |
-
}
|
32 |
-
|
33 |
-
span.shipping-ratio-origins {
|
34 |
-
padding-left: 16px;
|
35 |
-
}
|
36 |
-
</style>
|
37 |
-
<?php $_shippingRateGroups = $this->getShippingRates(); ?>
|
38 |
-
<?php if ($_shippingRateGroups): ?>
|
39 |
-
<div id="order-shipping-method-choose" style="display:none">
|
40 |
-
<dl class="shipment-methods">
|
41 |
-
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
|
42 |
-
<dt><strong><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></strong></dt>
|
43 |
-
<dd>
|
44 |
-
<ul>
|
45 |
-
<?php foreach ($_rates as $_rate): ?>
|
46 |
-
<?php
|
47 |
-
// $_radioProperty = 'name="order[shipping_method]" type="radio" onclick="order.setShippingMethod(this.value)"'
|
48 |
-
$_radioProperty = 'name="order[shipping_method]" type="radio" class="shipping-ratios" data-rate="' .$_rate->getRateId() . '"';
|
49 |
-
?>
|
50 |
-
<?php $_code=$_rate->getCode() ?>
|
51 |
-
<li>
|
52 |
-
<?php if ($_rate->getErrorMessage()): ?>
|
53 |
-
<ul class="messages">
|
54 |
-
<li class="error-msg"><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li>
|
55 |
-
</ul>
|
56 |
-
<?php else: ?>
|
57 |
-
<?php $_checked = $this->isMethodActive($_code) ? 'checked="checked"' : '' ?>
|
58 |
-
<input <?php echo $_radioProperty ?> value="<?php echo $_code ?>" id="s_method_<?php echo $_code ?>" <?php echo $_checked ?>/>
|
59 |
-
<label class="normal" for="s_method_<?php echo $_code ?>">
|
60 |
-
<?php echo $this->escapeHtml($_rate->getMethodTitle() ? $_rate->getMethodTitle() : $_rate->getMethodDescription()) ?> -
|
61 |
-
<strong>
|
62 |
-
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
63 |
-
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
64 |
-
|
65 |
-
<?php echo $_excl; ?>
|
66 |
-
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
67 |
-
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
68 |
-
<?php endif; ?>
|
69 |
-
</strong>
|
70 |
-
</label>
|
71 |
-
<?php endif ?>
|
72 |
-
</li>
|
73 |
-
<!-- For ShipHawk accessories -->
|
74 |
-
<?php $shipHawkDescription = unserialize($_rate->getMethodDescription());?>
|
75 |
-
<?php if ($shipHawkDescription): ?>
|
76 |
-
<?php foreach ($shipHawkDescription as $type => $accessories): ?>
|
77 |
-
<?php if (count($accessories) > 0) { ?>
|
78 |
-
<span style="text-transform: capitalize; font-weight: bold; display: none;"
|
79 |
-
class="shipping-ratio-origins shipping-ratio-<?php echo $_rate->getRateId(); ?>-origins"><?php echo $type ?></span>
|
80 |
-
<?php } ?>
|
81 |
-
<?php foreach ($accessories as $accessor): ?>
|
82 |
-
<li class="shipping-ratio-origins shipping-ratio-<?php echo $_rate->getRateId(); ?>-origins"
|
83 |
-
style="display: none;">
|
84 |
-
<input id="<?php echo $accessor->id . '-' . $_rate->getRateId(); ?>"
|
85 |
-
type="checkbox" value="<?php echo $accessor->price ?>"
|
86 |
-
name="accessories[<?php echo $type ?>]['<?php echo $accessor->accessorial_type . ' (' . $accessor->accessorial_options . ')'; ?>']['<?php echo $accessor->id ?>']"
|
87 |
-
class="checkbox accessor"/>
|
88 |
-
<label for="<?php echo $accessor->id . '-' . $_rate->getRateId(); ?>"
|
89 |
-
class="shipping-ratio-origins-label"><?php echo $accessor->accessorial_type . ' (' . $accessor->accessorial_options . ')' . ' + ' . '$' . $accessor->price ?></label>
|
90 |
-
</li>
|
91 |
-
<?php endforeach; ?>
|
92 |
-
<?php endforeach; ?>
|
93 |
-
<?php endif ?>
|
94 |
-
<?php endforeach; ?>
|
95 |
-
</ul>
|
96 |
-
</dd>
|
97 |
-
<?php endforeach; ?>
|
98 |
-
</dl>
|
99 |
-
<div>
|
100 |
-
<table class="form-list" cellspacing="0">
|
101 |
-
<tr>
|
102 |
-
<td class="label"><label for="sh-override-shipping-cost">Override Shipping Cost:</label></td>
|
103 |
-
<td class="value"><input id="sh-override-shipping-cost" type="text" value="" class="input-text validate-number" name="sh_override_shipping_cost" placeholder="Enter Dollar Amount"/></td>
|
104 |
-
</tr>
|
105 |
-
</table>
|
106 |
-
</div>
|
107 |
-
<div class="form-buttons" style="float: none; text-align: right;"> <!-- sales_quote__collect_totals_after -->
|
108 |
-
<button class="add" type="button" onclick="updateTotalsAccessories();"><span><?php echo Mage::helper('sales')->__('Update Grand Total');?></span></button>
|
109 |
-
</div>
|
110 |
-
</div>
|
111 |
-
<?php if ($_rate = $this->getActiveMethodRate()): ?>
|
112 |
-
<div id="order-shipping-method-info">
|
113 |
-
<strong><?php echo $this->escapeHtml($this->getCarrierName($_rate->getCarrier())) ?></strong><br/>
|
114 |
-
<?php echo $this->escapeHtml($_rate->getMethodTitle() ? $_rate->getMethodTitle() : $_rate->getMethodDescription()) ?> -
|
115 |
-
<strong>
|
116 |
-
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
117 |
-
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
118 |
-
|
119 |
-
<?php echo $_excl; ?>
|
120 |
-
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
121 |
-
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
122 |
-
<?php endif; ?>
|
123 |
-
</strong>
|
124 |
-
<!--input type="text" class="input-text" style="width:70px"/-->
|
125 |
-
<br/>
|
126 |
-
<a href="#" onclick="$('order-shipping-method-info').hide();$('order-shipping-method-choose').show();return false">
|
127 |
-
<?php echo Mage::helper('sales')->__('Click to change shipping method') ?>
|
128 |
-
</a>
|
129 |
-
</div>
|
130 |
-
<?php else: ?>
|
131 |
-
<script type="text/javascript">$('order-shipping-method-choose').show();</script>
|
132 |
-
<?php endif; ?>
|
133 |
-
<?php elseif($this->getIsRateRequest()): ?>
|
134 |
-
<strong><?php echo Mage::helper('sales')->__('Sorry, no quotes are available for this order at this time.') ?></strong>
|
135 |
-
<?php else: ?>
|
136 |
-
<div id="order-shipping-method-summary">
|
137 |
-
<a href="#" onclick="order.loadShippingRates();return false">
|
138 |
-
<?php echo Mage::helper('sales')->__('Get shipping methods and rates') ?>
|
139 |
-
</a>
|
140 |
-
<input type="hidden" name="order[has_shipping]" value="" class="required-entry" />
|
141 |
-
</div>
|
142 |
-
<?php endif; ?>
|
143 |
-
<!--For reload accessories-->
|
144 |
-
<div id="order-shipping-method-summary-hidden" style="display: none;">
|
145 |
-
<a href="#" onclick="order.loadShippingRates();return false">
|
146 |
-
<?php echo Mage::helper('sales')->__('Get shipping methods and rates') ?>
|
147 |
-
</a>
|
148 |
-
</div>
|
149 |
-
<div style="display:none;" id="shipping-method-overlay" class="overlay"><span><?php echo $this->__('Shipping method selection is not applicable') ?></span></div>
|
150 |
-
<script type="text/javascript">
|
151 |
-
order.overlay('shipping-method-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
|
152 |
-
order.overlay('address-shipping-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
|
153 |
-
|
154 |
-
/* For couple rates */
|
155 |
-
|
156 |
-
$$("input.shipping-ratios").invoke('observe', 'change', function() {
|
157 |
-
$$('.shipping-ratio-origins').invoke('hide');
|
158 |
-
$$('.shipping-ratio-origins input[type=checkbox]').invoke('setValue', false);
|
159 |
-
|
160 |
-
var ratioId = $$("input.shipping-ratios:checked").invoke('readAttribute' ,'data-rate');
|
161 |
-
showOrigins(ratioId);
|
162 |
-
});
|
163 |
-
|
164 |
-
/* For checked rate */
|
165 |
-
|
166 |
-
if ($$("input.shipping-ratios:checked").length > 0) {
|
167 |
-
var ratioId = $$("input.shipping-ratios:checked").invoke('readAttribute' ,'data-rate');
|
168 |
-
showOrigins(ratioId);
|
169 |
-
}
|
170 |
-
|
171 |
-
function showOrigins(id) {
|
172 |
-
$$('.shipping-ratio-' + id + '-origins').invoke('show');
|
173 |
-
}
|
174 |
-
|
175 |
-
var ajaxUrl = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>';
|
176 |
-
|
177 |
-
/* fol location type */
|
178 |
-
var locationSelect = '<tr>' +
|
179 |
-
'<td class="label"><label for="shiphawk-shipping-location-type">Location Type<span class="required">*</span></label></td>' +
|
180 |
-
'<td class="value">' +
|
181 |
-
'<select id="shiphawk-shipping-location-type" class="select required-entry validate-select" onchange="setShiphawkLocationType();">' +
|
182 |
-
'<option value="residential">Residential</option>' +
|
183 |
-
'<option value="commercial">Commercial</option>' +
|
184 |
-
'</select>' +
|
185 |
-
'</td>' +
|
186 |
-
'</tr>';
|
187 |
-
|
188 |
-
if ($('shiphawk-shipping-location-type') === null) {
|
189 |
-
$$('#order-shipping_address_fields .content .form-list tbody')[0].insert({before: locationSelect});
|
190 |
-
}
|
191 |
-
|
192 |
-
setShiphawkLocationType();
|
193 |
-
|
194 |
-
function setShiphawkLocationType() {
|
195 |
-
var element = $('shiphawk-shipping-location-type');
|
196 |
-
var index = element.selectedIndex;
|
197 |
-
var indexVal = element.options[index].value;
|
198 |
-
|
199 |
-
var url = ajaxUrl + 'index.php/adminshiphawk/adminhtml_shipment/setlocationtype';
|
200 |
-
|
201 |
-
var parameters = {
|
202 |
-
location_type: indexVal
|
203 |
-
};
|
204 |
-
|
205 |
-
new Ajax.Request(url, {
|
206 |
-
method: 'post',
|
207 |
-
parameters: parameters,
|
208 |
-
onSuccess: function(transport) {
|
209 |
-
|
210 |
-
},
|
211 |
-
onLoading:function(transport)
|
212 |
-
{
|
213 |
-
}
|
214 |
-
});
|
215 |
-
|
216 |
-
return;
|
217 |
-
}
|
218 |
-
|
219 |
-
function updateTotalsAccessories() {
|
220 |
-
var accessories_checked_array = $$('.accessor:checked');
|
221 |
-
var accessories_price;
|
222 |
-
|
223 |
-
var shiphawk_override_cost = $('sh-override-shipping-cost').value;
|
224 |
-
|
225 |
-
if (typeof accessories_checked_array != 'undefined' && accessories_checked_array.length > 0) {
|
226 |
-
accessories_price = accessories_checked_array.invoke('readAttribute' ,'value').reduce(function(previousValue, currentValue, index, array) {
|
227 |
-
return parseFloat(previousValue) + parseFloat(currentValue);
|
228 |
-
});
|
229 |
-
}
|
230 |
-
|
231 |
-
var url = ajaxUrl + 'index.php/adminshiphawk/adminhtml_shipment/setaccessoriesprice';
|
232 |
-
|
233 |
-
var parameters = {
|
234 |
-
accessories_price: accessories_price,
|
235 |
-
shiphawk_override_cost: shiphawk_override_cost
|
236 |
-
};
|
237 |
-
|
238 |
-
new Ajax.Request(url, {
|
239 |
-
method: 'post',
|
240 |
-
parameters: parameters,
|
241 |
-
onSuccess: function(transport) {
|
242 |
-
|
243 |
-
},
|
244 |
-
onComplete:function(transport)
|
245 |
-
{
|
246 |
-
order.setShippingMethod($$('input.shipping-ratios:checked').invoke('readAttribute' ,'value'));
|
247 |
-
|
248 |
-
setTimeout(function(){
|
249 |
-
if (typeof accessories_checked_array != 'undefined' && accessories_checked_array.length > 0) {
|
250 |
-
accessories_checked_array.forEach(function(el) {
|
251 |
-
$(el.id).checked = true;
|
252 |
-
});
|
253 |
-
}
|
254 |
-
|
255 |
-
$('sh-override-shipping-cost').value = shiphawk_override_cost;
|
256 |
-
$('sh-override-shipping-cost').innerHTML = shiphawk_override_cost;
|
257 |
-
}, 3000);
|
258 |
-
}
|
259 |
-
});
|
260 |
-
|
261 |
-
}
|
262 |
-
|
263 |
-
if ($('order-shipping-method-choose')) {
|
264 |
-
|
265 |
-
$('order-shipping-method-choose').show();
|
266 |
-
}
|
267 |
-
|
268 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/shiphawk.xml
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="1.0.0">
|
3 |
-
<shipping_tracking_popup translate="label">
|
4 |
-
<reference name="content">
|
5 |
-
<reference name="shipping.tracking.popup">
|
6 |
-
<action method="setTemplate"><template>shiphawk/popup.phtml</template></action>
|
7 |
-
</reference>
|
8 |
-
</reference>
|
9 |
-
</shipping_tracking_popup>
|
10 |
-
<checkout_onepage_index translate="label">
|
11 |
-
<reference name="head">
|
12 |
-
<action method="addCss"><file>shiphawk/css/sh-style.css</file></action>
|
13 |
-
</reference>
|
14 |
-
<reference name="checkout.onepage.billing">
|
15 |
-
<action method="setTemplate">
|
16 |
-
<template>shiphawk/checkout/onepage/billing.phtml</template>
|
17 |
-
</action>
|
18 |
-
</reference>
|
19 |
-
<reference name="checkout.onepage.shipping">
|
20 |
-
<action method="setTemplate">
|
21 |
-
<template>shiphawk/checkout/onepage/shipping.phtml</template>
|
22 |
-
</action>
|
23 |
-
</reference>
|
24 |
-
</checkout_onepage_index>
|
25 |
-
<checkout_onepage_shippingmethod>
|
26 |
-
<reference name="root">
|
27 |
-
<action method="setTemplate">
|
28 |
-
<template>shiphawk/checkout/onepage/shipping_method/available.phtml</template>
|
29 |
-
</action>
|
30 |
-
</reference>
|
31 |
-
</checkout_onepage_shippingmethod>
|
32 |
-
<checkout_onepage_review translate="label">
|
33 |
-
<reference name="checkout.onepage.review.info.totals">
|
34 |
-
<action method="setTemplate">
|
35 |
-
<template>shiphawk/checkout/onepage/review/totals.phtml</template>
|
36 |
-
</action>
|
37 |
-
</reference>
|
38 |
-
</checkout_onepage_review>
|
39 |
-
<checkout_onepage_progress_shipping_method>
|
40 |
-
<reference name="root">
|
41 |
-
<action method="setTemplate">
|
42 |
-
<template>shiphawk/checkout/onepage/progress/shipping_method.phtml</template>
|
43 |
-
</action>
|
44 |
-
</reference>
|
45 |
-
</checkout_onepage_progress_shipping_method>
|
46 |
-
<checkout_onepage_progress_billing>
|
47 |
-
<reference name="root">
|
48 |
-
<action method="setTemplate">
|
49 |
-
<template>shiphawk/checkout/onepage/progress/billing.phtml</template>
|
50 |
-
</action>
|
51 |
-
</reference>
|
52 |
-
</checkout_onepage_progress_billing>
|
53 |
-
<checkout_onepage_progress_shipping>
|
54 |
-
<reference name="root">
|
55 |
-
<action method="setTemplate">
|
56 |
-
<template>shiphawk/checkout/onepage/progress/shipping.phtml</template>
|
57 |
-
</action>
|
58 |
-
</reference>
|
59 |
-
</checkout_onepage_progress_shipping>
|
60 |
-
</layout>
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/checkout/onepage/billing.phtml
DELETED
@@ -1,227 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<form id="co-billing-form" action="">
|
28 |
-
<fieldset>
|
29 |
-
<ul class="form-list">
|
30 |
-
<?php if ($this->customerHasAddresses()): ?>
|
31 |
-
<li class="wide">
|
32 |
-
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
|
33 |
-
<div class="input-box">
|
34 |
-
<?php echo $this->getAddressesHtmlSelect('billing') ?>
|
35 |
-
</div>
|
36 |
-
</li>
|
37 |
-
<?php endif; ?>
|
38 |
-
<li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
|
39 |
-
<fieldset>
|
40 |
-
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
|
41 |
-
<ul>
|
42 |
-
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
|
43 |
-
<li class="fields">
|
44 |
-
<div class="field">
|
45 |
-
<label for="billing:company"><?php echo $this->__('Company') ?></label>
|
46 |
-
<div class="input-box">
|
47 |
-
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
48 |
-
</div>
|
49 |
-
</div>
|
50 |
-
<?php if(!$this->isCustomerLoggedIn()): ?>
|
51 |
-
<div class="field">
|
52 |
-
<label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
53 |
-
<div class="input-box">
|
54 |
-
<input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
55 |
-
</div>
|
56 |
-
</div>
|
57 |
-
<?php endif; ?>
|
58 |
-
</li>
|
59 |
-
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
60 |
-
<li class="wide">
|
61 |
-
<label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
62 |
-
<div class="input-box">
|
63 |
-
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
64 |
-
</div>
|
65 |
-
</li>
|
66 |
-
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
67 |
-
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
68 |
-
<li class="wide">
|
69 |
-
<div class="input-box">
|
70 |
-
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
71 |
-
</div>
|
72 |
-
</li>
|
73 |
-
<?php endfor; ?>
|
74 |
-
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
75 |
-
<li class="wide">
|
76 |
-
<label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
|
77 |
-
<div class="input-box">
|
78 |
-
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
79 |
-
</div>
|
80 |
-
</li>
|
81 |
-
<?php endif; ?>
|
82 |
-
<li class="fields">
|
83 |
-
<div class="field">
|
84 |
-
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
85 |
-
<div class="input-box">
|
86 |
-
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
|
87 |
-
</div>
|
88 |
-
</div>
|
89 |
-
<div class="field">
|
90 |
-
<label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
91 |
-
<div class="input-box">
|
92 |
-
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
93 |
-
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
94 |
-
</select>
|
95 |
-
<script type="text/javascript">
|
96 |
-
//<![CDATA[
|
97 |
-
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
98 |
-
//]]>
|
99 |
-
</script>
|
100 |
-
<input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
101 |
-
</div>
|
102 |
-
</div>
|
103 |
-
</li>
|
104 |
-
<li class="fields">
|
105 |
-
<div class="field">
|
106 |
-
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
107 |
-
<div class="input-box">
|
108 |
-
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
109 |
-
</div>
|
110 |
-
</div>
|
111 |
-
<div class="field">
|
112 |
-
<label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
113 |
-
<div class="input-box">
|
114 |
-
<?php echo $this->getCountryHtmlSelect('billing') ?>
|
115 |
-
</div>
|
116 |
-
</div>
|
117 |
-
</li>
|
118 |
-
<li class="fields">
|
119 |
-
<div class="field">
|
120 |
-
<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
121 |
-
<div class="input-box">
|
122 |
-
<input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
|
123 |
-
</div>
|
124 |
-
</div>
|
125 |
-
<div class="field">
|
126 |
-
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
|
127 |
-
<div class="input-box">
|
128 |
-
<input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
|
129 |
-
</div>
|
130 |
-
</div>
|
131 |
-
</li>
|
132 |
-
<li class="fields">
|
133 |
-
<div class="field">
|
134 |
-
<label for="billing:shiphawk-location-type"><?php echo $this->__('Location Type') ?></label>
|
135 |
-
<div class="input-box">
|
136 |
-
<select id="billing:shiphawk-location-type" type="text" name="billing[shiphawk_location_type]" class="validate-select" title="<?php echo $this->__('Location Type') ?>">
|
137 |
-
<option value="residential"><?php echo $this->__('Residential') ?></option>
|
138 |
-
<option value="commercial"><?php echo $this->__('Commercial') ?></option>
|
139 |
-
</select>
|
140 |
-
</div>
|
141 |
-
</div>
|
142 |
-
</li>
|
143 |
-
<?php if(!$this->isCustomerLoggedIn()): ?>
|
144 |
-
|
145 |
-
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
146 |
-
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
147 |
-
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
|
148 |
-
<li class="fields">
|
149 |
-
<?php if ($_dob->isEnabled()): ?>
|
150 |
-
<div class="field">
|
151 |
-
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
152 |
-
</div>
|
153 |
-
<?php endif; ?>
|
154 |
-
<?php if ($_gender->isEnabled()): ?>
|
155 |
-
<div class="field">
|
156 |
-
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
157 |
-
</div>
|
158 |
-
<?php endif ?>
|
159 |
-
</li>
|
160 |
-
<?php endif ?>
|
161 |
-
|
162 |
-
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
|
163 |
-
<?php if ($_taxvat->isEnabled()): ?>
|
164 |
-
<li>
|
165 |
-
<?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
166 |
-
</li>
|
167 |
-
<?php endif ?>
|
168 |
-
|
169 |
-
<li class="fields" id="register-customer-password">
|
170 |
-
<div class="field">
|
171 |
-
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
172 |
-
<div class="input-box">
|
173 |
-
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
174 |
-
</div>
|
175 |
-
</div>
|
176 |
-
<div class="field">
|
177 |
-
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
178 |
-
<div class="input-box">
|
179 |
-
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
|
180 |
-
</div>
|
181 |
-
</div>
|
182 |
-
</li>
|
183 |
-
<?php endif; ?>
|
184 |
-
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
185 |
-
<li class="control">
|
186 |
-
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
|
187 |
-
</li>
|
188 |
-
<?php else:?>
|
189 |
-
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
190 |
-
<?php endif; ?>
|
191 |
-
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
192 |
-
</ul>
|
193 |
-
</fieldset>
|
194 |
-
</li>
|
195 |
-
<?php /* Extensions placeholder */ ?>
|
196 |
-
<?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
|
197 |
-
<?php if ($this->canShip()): ?>
|
198 |
-
<li class="control">
|
199 |
-
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
|
200 |
-
<li class="control">
|
201 |
-
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
|
202 |
-
</li>
|
203 |
-
<?php endif; ?>
|
204 |
-
</ul>
|
205 |
-
<?php if (!$this->canShip()): ?>
|
206 |
-
<input type="hidden" name="billing[use_for_shipping]" value="1" />
|
207 |
-
<?php endif; ?>
|
208 |
-
<div class="buttons-set" id="billing-buttons-container">
|
209 |
-
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
210 |
-
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
211 |
-
<span class="please-wait" id="billing-please-wait" style="display:none;">
|
212 |
-
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
213 |
-
</span>
|
214 |
-
</div>
|
215 |
-
</fieldset>
|
216 |
-
</form>
|
217 |
-
<script type="text/javascript">
|
218 |
-
//<![CDATA[
|
219 |
-
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
220 |
-
var billingForm = new VarienForm('co-billing-form');
|
221 |
-
|
222 |
-
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
223 |
-
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
224 |
-
|
225 |
-
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
|
226 |
-
//]]>
|
227 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/checkout/onepage/progress/billing.phtml
DELETED
@@ -1,44 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php if ($this->getCheckout()->getStepData('billing', 'complete')): ?>
|
28 |
-
<dt class="complete">
|
29 |
-
<?php echo $this->__('Billing Address') ?><span class="changelink"> <span class="separator">|</span> <a
|
30 |
-
href="#billing"
|
31 |
-
onclick="checkout.changeSection('opc-billing'); return false;"><?php echo $this->__('Change') ?></a></span>
|
32 |
-
</dt>
|
33 |
-
<dd class="complete">
|
34 |
-
<address><?php echo $this->getBilling()->format('html') ?></address>
|
35 |
-
<?php $shLocationType = Mage::getSingleton('checkout/session')->getData('shiphawk_location_type_billing'); ?>
|
36 |
-
<?php if (!empty($shLocationType)):?>
|
37 |
-
<?php echo $shLocationType;?>
|
38 |
-
<?php endif;?>
|
39 |
-
</dd>
|
40 |
-
<?php else: ?>
|
41 |
-
<dt>
|
42 |
-
<?php echo $this->__('Billing Address') ?>
|
43 |
-
</dt>
|
44 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/checkout/onepage/progress/shipping.phtml
DELETED
@@ -1,48 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php if ($this->getCheckout()->getStepData('shipping', 'complete')): ?>
|
28 |
-
<?php $completeClass = $this->getCheckout()->getStepData('shipping', 'complete') ? 'complete' : ''; ?>
|
29 |
-
<dt class="<?php echo $completeClass ?>">
|
30 |
-
<?php echo $this->__('Shipping Address') ?> <span class="changelink"><span class="separator">|</span> <a
|
31 |
-
href="#payment"
|
32 |
-
onclick="checkout.changeSection('opc-shipping');return false;"><?php echo $this->__('Change') ?></a></span>
|
33 |
-
</dt>
|
34 |
-
<dd class="<?php echo $completeClass ?>">
|
35 |
-
<?php if ($this->getCheckout()->getStepData('shipping', 'complete')): ?>
|
36 |
-
<address><?php echo $this->getShipping()->format('html') ?></address>
|
37 |
-
<?php endif; ?>
|
38 |
-
<?php $shLocationType = Mage::getSingleton('checkout/session')->getData('shiphawk_location_type_shipping'); ?>
|
39 |
-
<?php if (!empty($shLocationType)):?>
|
40 |
-
<?php echo $shLocationType;?>
|
41 |
-
<?php endif;?>
|
42 |
-
</dd>
|
43 |
-
<?php else: ?>
|
44 |
-
<dt>
|
45 |
-
<?php echo $this->__('Shipping Address') ?>
|
46 |
-
</dt>
|
47 |
-
<?php endif; ?>
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/checkout/onepage/progress/shipping_method.phtml
DELETED
@@ -1,74 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php if ($this->getCheckout()->getStepData('shipping_method', 'complete')): ?>
|
28 |
-
<dt class="complete">
|
29 |
-
<?php echo $this->__('Shipping Method') ?> <span class="changelink"><span class="separator">|</span> <a
|
30 |
-
href="#shipping_method"
|
31 |
-
onclick="checkout.changeSection('opc-shipping_method'); return false;"><?php echo $this->__('Change') ?></a></span>
|
32 |
-
</dt>
|
33 |
-
<dd class="complete">
|
34 |
-
<?php if ($this->getShippingMethod()): ?>
|
35 |
-
<?php echo $this->getShippingDescription() ?>
|
36 |
-
|
37 |
-
<?php $_excl = $this->getShippingPriceExclTax(); ?>
|
38 |
-
<?php $_incl = $this->getShippingPriceInclTax(); ?>
|
39 |
-
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
40 |
-
<?php echo $_incl; ?>
|
41 |
-
<?php else: ?>
|
42 |
-
<?php echo $_excl; ?>
|
43 |
-
<?php endif; ?>
|
44 |
-
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
45 |
-
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
46 |
-
<?php endif; ?>
|
47 |
-
<!-- For accessories -->
|
48 |
-
<?php
|
49 |
-
$session = Mage::getSingleton('checkout/session');
|
50 |
-
$accessories = $session->getData("shipment_accessories");
|
51 |
-
$currensySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
52 |
-
?>
|
53 |
-
<?php if (!empty($accessories['data'])):?>
|
54 |
-
<p><?php echo $this->__('Accessorials:');?></p>
|
55 |
-
<?php foreach($accessories['data'] as $type => $accessor):?>
|
56 |
-
<span class="shipping-ratio-origins-type"><?php echo str_replace("'", '' , $type);?></span>
|
57 |
-
<ul>
|
58 |
-
<?php foreach($accessor as $values):?>
|
59 |
-
<li><?php echo str_replace("'", '', $values['name'] . ' - ' . $currensySymbol . $values['value']);?></li>
|
60 |
-
<?php endforeach;?>
|
61 |
-
</ul>
|
62 |
-
<br/>
|
63 |
-
<?php endforeach;?>
|
64 |
-
<?php endif;?>
|
65 |
-
<?php else: ?>
|
66 |
-
<?php echo $this->__('Shipping method has not been selected yet') ?>
|
67 |
-
<?php endif; ?>
|
68 |
-
</dd>
|
69 |
-
<?php else: ?>
|
70 |
-
<dt>
|
71 |
-
<?php echo $this->__('Shipping Method') ?>
|
72 |
-
</dt>
|
73 |
-
<?php endif; ?>
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/checkout/onepage/review/totals.phtml
DELETED
@@ -1,70 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @see Mage_Checkout_Block_Cart_Totals
|
29 |
-
*/
|
30 |
-
?>
|
31 |
-
<?php if ($this->getTotals()): ?>
|
32 |
-
<tfoot>
|
33 |
-
<?php $_colspan = $this->helper('tax')->displayCartBothPrices() ? 5 : 3; ?>
|
34 |
-
<?php echo $this->renderTotals(null, $_colspan); ?>
|
35 |
-
<!-- For accessories -->
|
36 |
-
<?php
|
37 |
-
$session = Mage::getSingleton('checkout/session');
|
38 |
-
$accessories = $session->getData("shipment_accessories");
|
39 |
-
$currensySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
40 |
-
?>
|
41 |
-
<?php if (!empty($accessories['data'])):?>
|
42 |
-
<tr>
|
43 |
-
<td class="a-right" colspan="3">
|
44 |
-
<?php echo $this->helper('sales')->__('Accessorials:') ?><br/>
|
45 |
-
<?php foreach($accessories['data'] as $type => $accessor):?>
|
46 |
-
<span class="shipping-ratio-origins-type"><?php echo str_replace("'", '', $type);?></span>
|
47 |
-
<ul>
|
48 |
-
<?php foreach($accessor as $values):?>
|
49 |
-
<li><?php echo str_replace("'", '', $values['name'] . ' - ' . $currensySymbol . $values['value']);?></li>
|
50 |
-
<?php endforeach;?>
|
51 |
-
</ul>
|
52 |
-
<br/>
|
53 |
-
<?php endforeach;?>
|
54 |
-
</td>
|
55 |
-
<td class="a-right"></td>
|
56 |
-
</tr>
|
57 |
-
<?php endif;?>
|
58 |
-
<?php echo $this->renderTotals('footer', $_colspan); ?>
|
59 |
-
<?php if ($this->needDisplayBaseGrandtotal()):?>
|
60 |
-
<tr>
|
61 |
-
<td class="a-right" colspan="<?php echo $_colspan; ?>">
|
62 |
-
<small><?php echo $this->helper('sales')->__('Your credit card will be charged for') ?></small>
|
63 |
-
</td>
|
64 |
-
<td class="a-right">
|
65 |
-
<small><?php echo $this->displayBaseGrandtotal() ?></small>
|
66 |
-
</td>
|
67 |
-
</tr>
|
68 |
-
<?php endif?>
|
69 |
-
</tfoot>
|
70 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/checkout/onepage/shipping.phtml
DELETED
@@ -1,167 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<form action="" id="co-shipping-form">
|
28 |
-
<ul class="form-list">
|
29 |
-
<?php if ($this->customerHasAddresses()): ?>
|
30 |
-
<li class="wide">
|
31 |
-
<label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
|
32 |
-
<div class="input-box">
|
33 |
-
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
|
34 |
-
</div>
|
35 |
-
</li>
|
36 |
-
<?php endif ?>
|
37 |
-
<li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
|
38 |
-
<fieldset>
|
39 |
-
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
|
40 |
-
<ul>
|
41 |
-
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
|
42 |
-
<li class="fields">
|
43 |
-
<div class="fields">
|
44 |
-
<label for="shipping:company"><?php echo $this->__('Company') ?></label>
|
45 |
-
<div class="input-box">
|
46 |
-
<input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
|
47 |
-
</div>
|
48 |
-
</div>
|
49 |
-
</li>
|
50 |
-
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
51 |
-
<li class="wide">
|
52 |
-
<label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
53 |
-
<div class="input-box">
|
54 |
-
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
55 |
-
</div>
|
56 |
-
</li>
|
57 |
-
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
58 |
-
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
59 |
-
<li class="wide">
|
60 |
-
<div class="input-box">
|
61 |
-
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
62 |
-
</div>
|
63 |
-
</li>
|
64 |
-
<?php endfor; ?>
|
65 |
-
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
66 |
-
<li class="wide">
|
67 |
-
<label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
|
68 |
-
<div class="input-box">
|
69 |
-
<input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
70 |
-
</div>
|
71 |
-
</li>
|
72 |
-
<?php endif; ?>
|
73 |
-
<li class="fields">
|
74 |
-
<div class="field">
|
75 |
-
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
76 |
-
<div class="input-box">
|
77 |
-
<input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
|
78 |
-
</div>
|
79 |
-
</div>
|
80 |
-
<div class="field">
|
81 |
-
<label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
82 |
-
<div class="input-box">
|
83 |
-
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
84 |
-
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
85 |
-
</select>
|
86 |
-
<script type="text/javascript">
|
87 |
-
//<![CDATA[
|
88 |
-
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
89 |
-
//]]>
|
90 |
-
</script>
|
91 |
-
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
92 |
-
</div>
|
93 |
-
</div>
|
94 |
-
</li>
|
95 |
-
<li class="fields">
|
96 |
-
<div class="field">
|
97 |
-
<label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
98 |
-
<div class="input-box">
|
99 |
-
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
|
100 |
-
</div>
|
101 |
-
</div>
|
102 |
-
<div class="field">
|
103 |
-
<label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
104 |
-
<div class="input-box">
|
105 |
-
<?php echo $this->getCountryHtmlSelect('shipping') ?>
|
106 |
-
</div>
|
107 |
-
</div>
|
108 |
-
</li>
|
109 |
-
<li class="fields">
|
110 |
-
<div class="field">
|
111 |
-
<label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
112 |
-
<div class="input-box">
|
113 |
-
<input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
114 |
-
</div>
|
115 |
-
</div>
|
116 |
-
<div class="field">
|
117 |
-
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
|
118 |
-
<div class="input-box">
|
119 |
-
<input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
|
120 |
-
</div>
|
121 |
-
</div>
|
122 |
-
</li>
|
123 |
-
<li class="fields">
|
124 |
-
<div class="field">
|
125 |
-
<label for="shipping:shiphawk-location-type"><?php echo $this->__('Location Type') ?></label>
|
126 |
-
<div class="input-box">
|
127 |
-
<select id="shipping:shiphawk-location-type" type="text" name="shipping[shiphawk_location_type]" class="validate-select">
|
128 |
-
<option value="residential"><?php echo $this->__('Residential') ?></option>
|
129 |
-
<option value="commercial"><?php echo $this->__('Commercial') ?></option>
|
130 |
-
</select>
|
131 |
-
</div>
|
132 |
-
</div>
|
133 |
-
</li>
|
134 |
-
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
135 |
-
<li class="control">
|
136 |
-
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
137 |
-
<?php else:?>
|
138 |
-
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
139 |
-
<?php endif;?>
|
140 |
-
</ul>
|
141 |
-
</fieldset>
|
142 |
-
</li>
|
143 |
-
<li class="control">
|
144 |
-
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
|
145 |
-
</li>
|
146 |
-
</ul>
|
147 |
-
<div class="buttons-set" id="shipping-buttons-container">
|
148 |
-
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
149 |
-
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
150 |
-
<button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
151 |
-
<span id="shipping-please-wait" class="please-wait" style="display:none;">
|
152 |
-
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
153 |
-
</span>
|
154 |
-
</div>
|
155 |
-
</form>
|
156 |
-
<script type="text/javascript">
|
157 |
-
//<![CDATA[
|
158 |
-
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
159 |
-
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
160 |
-
var shippingForm = new VarienForm('co-shipping-form');
|
161 |
-
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
162 |
-
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
163 |
-
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
164 |
-
|
165 |
-
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
|
166 |
-
//]]>
|
167 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/checkout/onepage/shipping_method/available.phtml
DELETED
@@ -1,157 +0,0 @@
|
|
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@magento.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.magento.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php /** @var $this Mage_Checkout_Block_Onepage_Shipping_Method_Available */ ?>
|
28 |
-
<?php $_shippingRateGroups = $this->getShippingRates();
|
29 |
-
$hideAccessoriesOnFrontend = Mage::getStoreConfig('carriers/shiphawk_shipping/hide_accessories_on_frontend');
|
30 |
-
/*$quote = Mage::getSingleton('checkout/session')->getQuote();
|
31 |
-
|
32 |
-
$address = $quote->getShippingAddress();
|
33 |
-
$address->addTotal(array(
|
34 |
-
'code' => 'sssss',
|
35 |
-
'title' => 'Accesorials 1',
|
36 |
-
'value' => 50
|
37 |
-
));
|
38 |
-
|
39 |
-
$address->save();
|
40 |
-
|
41 |
-
$tt = $address->getTotals();*/
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
//$quote->setTotalsCollectedFlag(false)->collectTotals();
|
46 |
-
|
47 |
-
?>
|
48 |
-
<?php if (!$_shippingRateGroups): ?>
|
49 |
-
<p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
|
50 |
-
<?php else: ?>
|
51 |
-
<dl class="sp-methods">
|
52 |
-
<?php $shippingCodePrice = array(); ?>
|
53 |
-
<?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
|
54 |
-
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
|
55 |
-
<dd>
|
56 |
-
<ul>
|
57 |
-
<?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
|
58 |
-
<?php $shippingCodePrice[] = "'".$_rate->getCode()."':".(float)$_rate->getPrice(); ?>
|
59 |
-
<li>
|
60 |
-
<?php if ($_rate->getErrorMessage()): ?>
|
61 |
-
<ul class="messages"><li class="error-msg"><ul><li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li></ul></li></ul>
|
62 |
-
<?php else: ?>
|
63 |
-
<?php if ($_sole) : ?>
|
64 |
-
<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" class="shipping-ratios" data-rate="<?php echo $_rate->getRateId();?>"/></span>
|
65 |
-
<?php else: ?>
|
66 |
-
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio shipping-ratios" data-rate="<?php echo $_rate->getRateId();?>"/>
|
67 |
-
|
68 |
-
<?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
|
69 |
-
<script type="text/javascript">
|
70 |
-
//<![CDATA[
|
71 |
-
lastPrice = <?php echo (float)$_rate->getPrice(); ?>;
|
72 |
-
//]]>
|
73 |
-
</script>
|
74 |
-
<?php endif; ?>
|
75 |
-
|
76 |
-
<?php endif; ?>
|
77 |
-
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
|
78 |
-
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
79 |
-
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
80 |
-
<?php echo $_excl; ?>
|
81 |
-
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
82 |
-
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
83 |
-
<?php endif; ?>
|
84 |
-
</label>
|
85 |
-
<?php endif ?>
|
86 |
-
</li>
|
87 |
-
<?php if (!$hideAccessoriesOnFrontend):?>
|
88 |
-
<?php if($_rate->method_description){ ?>
|
89 |
-
<?php $methodDescription = unserialize($_rate->method_description); ?>
|
90 |
-
|
91 |
-
<?php
|
92 |
-
if($_rate->method_description && !empty($methodDescription->destination)): ?>
|
93 |
-
<span class="shipping-ratio-origins shipping-ratio-<?php echo $_rate->getRateId();?>-origins">Destination:</span>
|
94 |
-
<?php foreach($methodDescription->destination as $origin_acc) {?>
|
95 |
-
<li class="shipping-ratio-origins shipping-ratio-<?php echo $_rate->getRateId();?>-origins">
|
96 |
-
<input id="<?php echo $origin_acc->id . '-' . $_rate->getRateId(); ?>" type="checkbox" value="<?php echo $origin_acc->price ?>" name="accessories['destination']['<?php echo $origin_acc->accessorial_type . ' (' . $origin_acc->accessorial_options . ')';?>']['<?php echo $origin_acc->id; ?>']" class="checkbox" />
|
97 |
-
<label for="<?php echo $origin_acc->id . '-' . $_rate->getRateId(); ?>" class="shipping-ratio-origins-label"><?php echo $origin_acc->accessorial_type . ' (' . $origin_acc->accessorial_options . ')' . ' + ' . '$' . $origin_acc->price ?></label>
|
98 |
-
</li>
|
99 |
-
<?php }
|
100 |
-
endif; ?>
|
101 |
-
<?php } ?>
|
102 |
-
<?php endif;?>
|
103 |
-
<?php endforeach; ?>
|
104 |
-
</ul>
|
105 |
-
</dd>
|
106 |
-
<?php endforeach; ?>
|
107 |
-
</dl>
|
108 |
-
<script type="text/javascript">
|
109 |
-
//<![CDATA[
|
110 |
-
<?php if (!empty($shippingCodePrice)): ?>
|
111 |
-
var shippingCodePrice = {<?php echo implode(',',$shippingCodePrice); ?>};
|
112 |
-
<?php endif; ?>
|
113 |
-
|
114 |
-
$$('input[type="radio"][name="shipping_method"]').each(function(el){
|
115 |
-
Event.observe(el, 'click', function(){
|
116 |
-
if (el.checked == true) {
|
117 |
-
var getShippingCode = el.getValue();
|
118 |
-
<?php if (!empty($shippingCodePrice)): ?>
|
119 |
-
var newPrice = shippingCodePrice[getShippingCode];
|
120 |
-
if (!lastPrice) {
|
121 |
-
lastPrice = newPrice;
|
122 |
-
quoteBaseGrandTotal += newPrice;
|
123 |
-
}
|
124 |
-
if (newPrice != lastPrice) {
|
125 |
-
quoteBaseGrandTotal += (newPrice-lastPrice);
|
126 |
-
lastPrice = newPrice;
|
127 |
-
}
|
128 |
-
<?php endif; ?>
|
129 |
-
checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
|
130 |
-
return false;
|
131 |
-
}
|
132 |
-
});
|
133 |
-
});
|
134 |
-
|
135 |
-
/* For couple rates */
|
136 |
-
jQuery("input.shipping-ratios").change(function() {
|
137 |
-
jQuery('.shipping-ratio-origins').hide();
|
138 |
-
jQuery('.shipping-ratio-origins input[type=checkbox]').prop('checked', false);
|
139 |
-
|
140 |
-
var ratioId = jQuery("input.shipping-ratios:checked").data('rate');
|
141 |
-
|
142 |
-
showOrigins(ratioId);
|
143 |
-
});
|
144 |
-
|
145 |
-
/* For checked rate */
|
146 |
-
if (jQuery("input.shipping-ratios:checked").length > 0) {
|
147 |
-
var id = jQuery("input.shipping-ratios:checked").data('rate');
|
148 |
-
|
149 |
-
showOrigins(id);
|
150 |
-
};
|
151 |
-
|
152 |
-
function showOrigins(id) {
|
153 |
-
jQuery('.shipping-ratio-' + id + '-origins').show();
|
154 |
-
};
|
155 |
-
//]]>
|
156 |
-
</script>
|
157 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/shiphawk/popup.phtml
DELETED
@@ -1,244 +0,0 @@
|
|
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) 2014 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php /** @var $this Mage_Shipping_Block_Tracking_Popup */ ?>
|
28 |
-
<?php $_results = $this->getTrackingInfo();
|
29 |
-
/*$shippingInfoModel = Mage::getModel('shipping/info')->loadByHash($this->getRequest()->getParam('hash'));
|
30 |
-
|
31 |
-
$ship_id = $shippingInfoModel->getData('ship_id');
|
32 |
-
|
33 |
-
if($ship_id) {
|
34 |
-
$shipment = Mage::getModel('sales/order_shipment')->load($ship_id);
|
35 |
-
|
36 |
-
|
37 |
-
}else{
|
38 |
-
//order view
|
39 |
-
foreach($_results as $key=>$value) {
|
40 |
-
//get only for first shippment
|
41 |
-
$shipment = Mage::getModel('sales/order_shipment')->loadByIncrementId($key);
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
-
$tracks = $shipment->getTracksCollection();
|
47 |
-
|
48 |
-
|
49 |
-
$trackingNumbers = array();
|
50 |
-
foreach ($tracks as $track){
|
51 |
-
$trackingNumbers[] = $track->getNumber();
|
52 |
-
}*/
|
53 |
-
|
54 |
-
$api = Mage::getModel('shiphawk_shipping/api');
|
55 |
-
?>
|
56 |
-
<div class="page-title title-buttons">
|
57 |
-
<h1><?php echo $this->__('Tracking Information'); ?></h1>
|
58 |
-
<button class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
|
59 |
-
</div>
|
60 |
-
<?php if(sizeof($_results)>0): ?>
|
61 |
-
<?php foreach($_results as $shipid => $_result): ?>
|
62 |
-
<?php if($shipid): ?>
|
63 |
-
<h2 class="sub-title"><?php echo $this->__('Shipment #') . $shipid; ?></h2>
|
64 |
-
<?php endif; ?>
|
65 |
-
<?php
|
66 |
-
$shipment = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipid);
|
67 |
-
|
68 |
-
$tracks = $shipment->getTracksCollection();
|
69 |
-
|
70 |
-
|
71 |
-
$trackingNumbers = array();
|
72 |
-
foreach ($tracks as $track){
|
73 |
-
$trackingNumbers[] = $track->getNumber();
|
74 |
-
}
|
75 |
-
|
76 |
-
foreach($trackingNumbers as $trackNumber) {
|
77 |
-
$trackResult = $api->getShipmentStatus($trackNumber);
|
78 |
-
|
79 |
-
switch ($trackResult->status) {
|
80 |
-
case 'in_transit':
|
81 |
-
$comment = "Shipment status is: In Transit. Your shipment is with the carrier and is in transit.";
|
82 |
-
break;
|
83 |
-
case 'confirmed':
|
84 |
-
$comment = "Shipment status is: Confirmed. Your shipment has been successfully confirmed.";
|
85 |
-
break;
|
86 |
-
case 'scheduled_for_pickup':
|
87 |
-
$comment = "Shipment status is: Scheduled. Your shipment has been scheduled for pickup.";
|
88 |
-
break;
|
89 |
-
case 'agent_prep':
|
90 |
-
$comment = "Shipment status is: Agent Prep. Your shipment is now being professionally prepared for carrier pickup.";
|
91 |
-
break;
|
92 |
-
case 'delivered':
|
93 |
-
$comment = "Shipment status is: Delivered. Your shipment has been delivered!";
|
94 |
-
break;
|
95 |
-
case 'cancelled':
|
96 |
-
$comment = "Shipment status is: Cancelled. Your shipment has been cancelled successfully.";
|
97 |
-
break;
|
98 |
-
default: $comment = "Shipment status is: " . $trackResult->status . ". ";
|
99 |
-
}
|
100 |
-
|
101 |
-
echo '<div>' . $comment . '</div>';
|
102 |
-
}
|
103 |
-
?>
|
104 |
-
<?php if(sizeof($_result)>0): ?>
|
105 |
-
<?php $rowCount = sizeof($_result); $counter = 1; ?>
|
106 |
-
<?php $_id = 0; foreach($_result as $track): ?>
|
107 |
-
<table class="tracking-table-popup data-table" id="tracking-table-popup-<?php echo $_id ?>">
|
108 |
-
<col width="15%" />
|
109 |
-
<col />
|
110 |
-
<tbody>
|
111 |
-
<?php if(is_object($track)): ?>
|
112 |
-
<tr>
|
113 |
-
<th class="label"><?php echo $this->__('Tracking Number:'); ?></th>
|
114 |
-
<td class="value"><?php echo $this->escapeHtml($track->getTracking()); ?></td>
|
115 |
-
</tr>
|
116 |
-
<?php if ($track->getCarrierTitle()): ?>
|
117 |
-
<tr>
|
118 |
-
<th class="label"><?php echo $this->__('Carrier:'); ?></th>
|
119 |
-
<td class="value"><?php echo $this->escapeHtml($track->getCarrierTitle()); ?></td>
|
120 |
-
</tr>
|
121 |
-
<?php endif; ?>
|
122 |
-
<?php if($track->getErrorMessage()): ?>
|
123 |
-
<tr>
|
124 |
-
<th class="label"><?php echo $this->__('Error:'); ?></th>
|
125 |
-
<td class="error"><?php echo $this->__('Tracking information is currently not available. Please '); if ($this->getContactUsEnabled()) : ?><a href="<?php echo $this->getContactUs() ?>" title="<?php echo $this->__('contact us') ?>" onclick="this.target='_blank'"><?php echo $this->__('contact us') ?></a><?php echo $this->__(' for more information or '); endif; echo $this->__('email us at '); ?><a href="mailto:<?php echo $this->getStoreSupportEmail() ?>"><?php echo $this->getStoreSupportEmail() ?></a></td>
|
126 |
-
</tr>
|
127 |
-
<?php elseif($track->getTrackSummary()): ?>
|
128 |
-
<tr>
|
129 |
-
<th class="label"><?php echo $this->__('Info:'); ?></th>
|
130 |
-
<td class="value"><?php echo $track->getTrackSummary(); ?></td>
|
131 |
-
</tr>
|
132 |
-
<?php elseif($track->getUrl()): ?>
|
133 |
-
<tr>
|
134 |
-
<th class="label"><?php echo $this->__('Track:'); ?></th>
|
135 |
-
<td class="value">
|
136 |
-
<a href="<?php echo $this->escapeHtml($track->getUrl()); ?>" onclick="this.target='_blank'"><?php echo $this->__('View Details'); ?></a></td>
|
137 |
-
</tr>
|
138 |
-
<?php else: ?>
|
139 |
-
<?php if ($track->getStatus()): ?>
|
140 |
-
<tr>
|
141 |
-
<th class="label"><?php echo $this->__('Status:'); ?></th>
|
142 |
-
<td class="value"><?php echo $track->getStatus(); ?></td>
|
143 |
-
</tr>
|
144 |
-
<?php endif; ?>
|
145 |
-
|
146 |
-
<?php if ($track->getDeliverydate()): ?>
|
147 |
-
<tr>
|
148 |
-
<th class="label"><?php echo $this->__('Delivered on:'); ?></th>
|
149 |
-
<td class="value"><?php echo $this->formatDeliveryDateTime($track->getDeliverydate(),$track->getDeliverytime()); ?></td>
|
150 |
-
</tr>
|
151 |
-
<?php endif; ?>
|
152 |
-
|
153 |
-
<?php if ($track->getSignedby()): ?>
|
154 |
-
<tr>
|
155 |
-
<th class="label"><?php echo $this->__('Signed by:'); ?></th>
|
156 |
-
<td class="value"><?php echo $track->getSignedby(); ?></td>
|
157 |
-
</tr>
|
158 |
-
<?php endif; ?>
|
159 |
-
|
160 |
-
<?php if ($track->getDeliveryLocation()): ?>
|
161 |
-
<tr>
|
162 |
-
<th class="label"><?php echo $this->__('Delivered to:'); ?></th>
|
163 |
-
<td class="value"><?php echo $track->getDeliveryLocation(); ?></td>
|
164 |
-
</tr>
|
165 |
-
<?php endif; ?>
|
166 |
-
|
167 |
-
<?php if ($track->getShippedDate()): ?>
|
168 |
-
<tr>
|
169 |
-
<th class="label"><?php echo $this->__('Shipped or billed on:'); ?></th>
|
170 |
-
<td class="value"><?php echo $track->getShippedDate(); ?></td>
|
171 |
-
</tr>
|
172 |
-
<?php endif; ?>
|
173 |
-
|
174 |
-
<?php if ($track->getService()): ?>
|
175 |
-
<tr>
|
176 |
-
<th class="label"><?php echo $this->__('Service Type:'); ?></th>
|
177 |
-
<td class="value"><?php echo $track->getService(); ?></td>
|
178 |
-
</tr>
|
179 |
-
<?php endif; ?>
|
180 |
-
|
181 |
-
<?php if ($track->getWeight()): ?>
|
182 |
-
<tr>
|
183 |
-
<th class="label"><?php echo $this->__('Weight:'); ?></th>
|
184 |
-
<td class="value"><?php echo $track->getWeight(); ?></td>
|
185 |
-
</tr>
|
186 |
-
<?php endif; ?>
|
187 |
-
<?php endif; ?>
|
188 |
-
<?php elseif(isset($track['title']) && isset($track['number']) && $track['number']): ?>
|
189 |
-
<!--if the tracking is custom value-->
|
190 |
-
<tr>
|
191 |
-
<th class="label"><?php echo ($track['title'] ? $this->escapeHtml($track['title']) : $this->__('N/A')); ?>:</th>
|
192 |
-
<td class="value"><?php echo (isset($track['number']) ? $this->escapeHtml($track['number']) : ''); ?></td>
|
193 |
-
</tr>
|
194 |
-
<?php endif; ?>
|
195 |
-
</tbody>
|
196 |
-
</table>
|
197 |
-
<script type="text/javascript">decorateTable('tracking-table-popup-<?php echo $_id++ ?>');</script>
|
198 |
-
<?php if (is_object($track) && sizeof($track->getProgressdetail())>0): ?>
|
199 |
-
<br />
|
200 |
-
<table class="data-table" id="track-history-table-<?php echo $track->getTracking(); ?>">
|
201 |
-
<col />
|
202 |
-
<col width="1" />
|
203 |
-
<col width="1" />
|
204 |
-
<col />
|
205 |
-
<thead>
|
206 |
-
<tr>
|
207 |
-
<th><?php echo $this->__('Location') ?></th>
|
208 |
-
<th><?php echo $this->__('Date') ?></th>
|
209 |
-
<th><?php echo $this->__('Local Time') ?></th>
|
210 |
-
<th><?php echo $this->__('Description') ?></th>
|
211 |
-
</tr>
|
212 |
-
</thead>
|
213 |
-
<tbody>
|
214 |
-
<?php foreach($track->getProgressdetail() as $_detail): ?>
|
215 |
-
<?php $_detailDate = (isset($_detail['deliverydate']) ? $this->formatDeliveryDate($_detail['deliverydate']) : '') ?>
|
216 |
-
<?php $_detailTime = (isset($_detail['deliverytime']) ? $this->formatDeliveryTime($_detail['deliverytime'], $_detail['deliverydate']) : '') ?>
|
217 |
-
<tr>
|
218 |
-
<td><?php echo (isset($_detail['deliverylocation']) ? $_detail['deliverylocation'] : ''); ?></td>
|
219 |
-
<td><span class="nobr"><?php echo $_detailDate ?></span></td>
|
220 |
-
<td><span class="nobr"><?php echo $_detailTime ?></span></td>
|
221 |
-
<td><?php echo (isset($_detail['activity']) ? $_detail['activity'] : '') ?></td>
|
222 |
-
</tr>
|
223 |
-
<?php endforeach; ?>
|
224 |
-
</tbody>
|
225 |
-
</table>
|
226 |
-
<script type="text/javascript">decorateTable('track-history-table-<?php echo $track->getTracking(); ?>');</script>
|
227 |
-
<?php endif; ?>
|
228 |
-
<div class="divider"></div>
|
229 |
-
<?php if($counter!=$rowCount): ?>
|
230 |
-
<?php endif; ?>
|
231 |
-
<?php $counter++; ?>
|
232 |
-
<!--end for each tracking information-->
|
233 |
-
<?php endforeach; ?>
|
234 |
-
<?php else: ?>
|
235 |
-
<p><?php echo $this->__('There is no tracking available for this shipment.'); ?></p>
|
236 |
-
<?php endif; ?>
|
237 |
-
|
238 |
-
<?php endforeach; ?>
|
239 |
-
<?php else: ?>
|
240 |
-
<p><?php echo $this->__('There is no tracking available.'); ?></p>
|
241 |
-
<?php endif; ?>
|
242 |
-
<div class="buttons-set">
|
243 |
-
<button type="button" title="<?php echo $this->__('Close Window') ?>" class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
|
244 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/Shiphawk_Shipping.xml
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Shiphawk_Shipping>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
<depends>
|
8 |
-
<Mage_Shipping />
|
9 |
-
</depends>
|
10 |
-
</Shiphawk_Shipping>
|
11 |
-
</modules>
|
12 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/locale/en_US/template/email/shiphawk_error_email.html
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<!--@subject New Magento Error Log Requires Your Attention. @-->
|
2 |
-
<table cellpadding="0" cellspacing="0" border="0">
|
3 |
-
<tr>
|
4 |
-
<td class="action-content">
|
5 |
-
{{var store.getFrontendName()}}
|
6 |
-
<p>
|
7 |
-
API key: {{var shiphawk_api_key}}
|
8 |
-
</p>
|
9 |
-
<p>
|
10 |
-
{{var shiphawk_error_log}}
|
11 |
-
</p>
|
12 |
-
<p>
|
13 |
-
If you have any questions, please feel free to contact us at
|
14 |
-
<a href="mailto:{{var store_email}}">{{var store_email}}</a>
|
15 |
-
|
16 |
-
</p>
|
17 |
-
</td>
|
18 |
-
</tr>
|
19 |
-
</table>
|
20 |
-
|
21 |
-
{{template config_path="design/email/footer"}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/shiphawk/shiphawk.css
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
#shiphawk_type_of_product_value {
|
2 |
-
display: none;
|
3 |
-
}
|
4 |
-
|
5 |
-
.type_link:hover {
|
6 |
-
text-decoration: underline;
|
7 |
-
cursor: pointer;
|
8 |
-
}
|
9 |
-
|
10 |
-
#type_product {
|
11 |
-
position: absolute;
|
12 |
-
z-index: 99;
|
13 |
-
background-color: #ffffff;
|
14 |
-
}
|
15 |
-
|
16 |
-
.shiphawk-shipping-adminhtml-shipment-newshipment .wrapper .header, .shiphawk-shipping-adminhtml-shipment-newshipment .wrapper .footer, .shiphawk-shipping-adminhtml-shipment-newshipment .wrapper .notification-global {
|
17 |
-
display: none!important;
|
18 |
-
}
|
19 |
-
.shiphawk-shipping-adminhtml-shipment-newshipment .wrapper .middle {
|
20 |
-
min-height: 200px!important;
|
21 |
-
}
|
22 |
-
.shiphawk-shipping-adminhtml-shipment-newshipment .wrapper {
|
23 |
-
min-height: 200px!important;
|
24 |
-
min-width:360px!important;
|
25 |
-
}
|
26 |
-
|
27 |
-
.submitshiphawk_button {
|
28 |
-
margin-top: 20px;
|
29 |
-
padding: 2px;
|
30 |
-
}
|
31 |
-
|
32 |
-
label[for=shiphawk_origin_firstname]:after, label[for=shiphawk_origin_lastname]:after, label[for=shiphawk_origin_addressline1]:after, label[for=shiphawk_origin_city]:after,
|
33 |
-
label[for=shiphawk_origin_state]:after, label[for=shiphawk_origin_zipcode]:after, label[for=shiphawk_origin_phonenum]:after, label[for=shiphawk_origin_email]:after,
|
34 |
-
label[for=shiphawk_origin_location]:after {
|
35 |
-
color: red;
|
36 |
-
content: "*";
|
37 |
-
}
|
38 |
-
|
39 |
-
#error_text_ {
|
40 |
-
padding: 10px 10px 10px 0;
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/shiphawk/shiphawk.js
DELETED
@@ -1,171 +0,0 @@
|
|
1 |
-
document.observe("dom:loaded", function() {
|
2 |
-
function insertAfter(referenceNode, newNode) {
|
3 |
-
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
4 |
-
}
|
5 |
-
|
6 |
-
function updateInput() {
|
7 |
-
var shiphawk_shipping_origins = document.getElementById("shiphawk_shipping_origins");
|
8 |
-
var is_mass_action = 0;
|
9 |
-
|
10 |
-
// check is it mass edit attribute action
|
11 |
-
if (document.URL.indexOf('catalog_product_action_attribute') > 0) {
|
12 |
-
is_mass_action = 1;
|
13 |
-
}
|
14 |
-
var url = 'shiphawk/index/origins';
|
15 |
-
|
16 |
-
url = baseMagentoUrl + url;
|
17 |
-
var parameters = {
|
18 |
-
origin_id: shiphawk_shipping_origins.value,
|
19 |
-
is_mass_action : is_mass_action
|
20 |
-
};
|
21 |
-
|
22 |
-
new Ajax.Request(url, {
|
23 |
-
method: 'post',
|
24 |
-
parameters: parameters,
|
25 |
-
onSuccess: function(transport) {
|
26 |
-
|
27 |
-
responce_html = JSON.parse(transport.responseText);
|
28 |
-
|
29 |
-
var el = document.createElement("div");
|
30 |
-
|
31 |
-
el.id = "origins_select";
|
32 |
-
|
33 |
-
el.update(responce_html);
|
34 |
-
|
35 |
-
shiphawk_shipping_origins.parentNode.replaceChild(el, shiphawk_shipping_origins);
|
36 |
-
|
37 |
-
},
|
38 |
-
onLoading:function(transport)
|
39 |
-
{
|
40 |
-
|
41 |
-
}
|
42 |
-
});
|
43 |
-
}
|
44 |
-
|
45 |
-
updateInput();
|
46 |
-
|
47 |
-
var origin_fields = new Array($('shiphawk_origin_firstname'), $('shiphawk_origin_lastname'), $('shiphawk_origin_addressline1'),
|
48 |
-
$('shiphawk_origin_city'), $('shiphawk_origin_state'), $('shiphawk_origin_zipcode'), $('shiphawk_origin_phonenum'),
|
49 |
-
$('shiphawk_origin_email'), $('shiphawk_origin_location'));
|
50 |
-
|
51 |
-
function setOriginRequiredFields() {
|
52 |
-
origin_fields.forEach(function(item, i, arr) {
|
53 |
-
//item.addClassName('required-entry');
|
54 |
-
item.observe('keyup', function(event){
|
55 |
-
if($('shiphawk_shipping_origins').value == '') {
|
56 |
-
|
57 |
-
_addRequiredClass( origin_fields );
|
58 |
-
}
|
59 |
-
});
|
60 |
-
|
61 |
-
});
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
function _addRequiredClass( origin_fields ) {
|
66 |
-
|
67 |
-
origin_fields.forEach(function(item, i, arr) {
|
68 |
-
if(!item.hasClassName('required-entry')){
|
69 |
-
item.addClassName('required-entry');
|
70 |
-
}
|
71 |
-
});
|
72 |
-
}
|
73 |
-
|
74 |
-
function _removeRequiredClass( origin_fields ) {
|
75 |
-
|
76 |
-
origin_fields.forEach(function(item, i, arr) {
|
77 |
-
if(item.hasClassName('required-entry')){
|
78 |
-
item.removeClassName('required-entry');
|
79 |
-
}
|
80 |
-
});
|
81 |
-
}
|
82 |
-
|
83 |
-
function _checkIfAllRequeredEmpty( origin_fields ) {
|
84 |
-
var k = 0;
|
85 |
-
origin_fields.forEach(function(item, i, arr) {
|
86 |
-
if(item.value){
|
87 |
-
k = k + 1;
|
88 |
-
}
|
89 |
-
});
|
90 |
-
|
91 |
-
if ((k != 9)&&(k>0)) {
|
92 |
-
_addRequiredClass( origin_fields );
|
93 |
-
}else{
|
94 |
-
_removeRequiredClass( origin_fields );
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
origin_fields.forEach(function(item) {
|
99 |
-
item.onchange = function(){
|
100 |
-
_checkIfAllRequeredEmpty( origin_fields );
|
101 |
-
};
|
102 |
-
});
|
103 |
-
|
104 |
-
//setOriginRequiredFields();
|
105 |
-
_checkIfAllRequeredEmpty( origin_fields );
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
var el = document.createElement("div");
|
110 |
-
|
111 |
-
el.id = "type_product";
|
112 |
-
var shiphawk_type_of_product = document.getElementById("shiphawk_type_of_product");
|
113 |
-
|
114 |
-
insertAfter(shiphawk_type_of_product, el);
|
115 |
-
|
116 |
-
var typeloader;
|
117 |
-
$('shiphawk_type_of_product').observe('keyup', function(event){
|
118 |
-
clearTimeout(typeloader);
|
119 |
-
typeloader = setTimeout(function(){ respondToClick(event); }, 750);
|
120 |
-
});
|
121 |
-
|
122 |
-
function respondToClick(event) {
|
123 |
-
|
124 |
-
var element = event.element();
|
125 |
-
|
126 |
-
var minlength = 3;
|
127 |
-
|
128 |
-
var url = 'shiphawk/index/search';
|
129 |
-
|
130 |
-
url = baseMagentoUrl + url;
|
131 |
-
var parameters = {
|
132 |
-
search_tag: element.value
|
133 |
-
};
|
134 |
-
|
135 |
-
if(element.value.length >= minlength ) {
|
136 |
-
new Ajax.Request(url, {
|
137 |
-
method: 'post',
|
138 |
-
parameters: parameters,
|
139 |
-
onSuccess: function(transport) {
|
140 |
-
|
141 |
-
responce_html = JSON.parse(transport.responseText);
|
142 |
-
|
143 |
-
if(responce_html.shiphawk_error) {
|
144 |
-
alert(responce_html.shiphawk_error);
|
145 |
-
}else{
|
146 |
-
if(responce_html.responce_html) {
|
147 |
-
$('type_product').update(responce_html.responce_html);
|
148 |
-
$('type_product').show();
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
},
|
153 |
-
onLoading:function(transport)
|
154 |
-
{
|
155 |
-
}
|
156 |
-
});
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
});
|
161 |
-
function setItemid(el) {
|
162 |
-
$('shiphawk_type_of_product').value = el.innerHTML;
|
163 |
-
|
164 |
-
if ($('shiphawk_type_of_product_value').disabled == true) {
|
165 |
-
$('shiphawk_type_of_product_value').disabled = false;
|
166 |
-
}
|
167 |
-
|
168 |
-
$('shiphawk_type_of_product_value').value = el.id;
|
169 |
-
|
170 |
-
$('type_product').hide();
|
171 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/shiphawk/shiphawk_order.js
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
Event.observe(window, "load", function(){
|
2 |
-
if ($('order-shipping-method-choose') !== null) {
|
3 |
-
$('order-shipping-method-choose').hide();
|
4 |
-
$('order-shipping-method-summary-hidden').show();
|
5 |
-
}
|
6 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
js/shiphawk/shiphawk_shipment.js
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
function showPopup(sUrl) {
|
2 |
-
oPopup = new Window({
|
3 |
-
id:'popup_window',
|
4 |
-
className: 'magento',
|
5 |
-
url: sUrl,
|
6 |
-
width: 480,
|
7 |
-
height: 390,
|
8 |
-
minimizable: false,
|
9 |
-
maximizable: false,
|
10 |
-
showEffectOptions: {
|
11 |
-
duration: 0.4
|
12 |
-
},
|
13 |
-
hideEffectOptions:{
|
14 |
-
duration: 0.4
|
15 |
-
},
|
16 |
-
destroyOnClose: true
|
17 |
-
});
|
18 |
-
oPopup.setZIndex(999);
|
19 |
-
oPopup.showCenter(true);
|
20 |
-
}
|
21 |
-
|
22 |
-
function closePopup() {
|
23 |
-
Windows.close('popup_window');
|
24 |
-
}
|
25 |
-
|
26 |
-
function reBook(postUrl, order_id, sUrl) {
|
27 |
-
var parameters = {
|
28 |
-
order_id: order_id,
|
29 |
-
sUrl: sUrl
|
30 |
-
};
|
31 |
-
|
32 |
-
new Ajax.Request(postUrl, {
|
33 |
-
method: 'post',
|
34 |
-
parameters: parameters,
|
35 |
-
onSuccess: function(transport) {
|
36 |
-
responce_html = JSON.parse(transport.responseText);
|
37 |
-
if(responce_html.sUrl) {
|
38 |
-
$('loading-mask').hide();
|
39 |
-
showPopup(responce_html.sUrl);
|
40 |
-
}else{
|
41 |
-
$('loading-mask').hide();
|
42 |
-
location.reload();
|
43 |
-
}
|
44 |
-
},
|
45 |
-
onComplete:function(request, json) {
|
46 |
-
responce_html = JSON.parse(transport.responseText);
|
47 |
-
$('loading-mask').hide();
|
48 |
-
}
|
49 |
-
});
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,36 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ShipHawk</name>
|
4 |
-
<version>
|
5 |
-
<stability>
|
6 |
-
<license
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary
|
10 |
-
<description>
|
11 |
-
|
12 |
-
ShipHawk
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
In new version were added features: 
|
17 |
-
- Origin can be set using per product attributes, per origin (one origin for several products) or using single origin from System/Configuration;
|
18 |
-
- Per-product markup/subsidize details;
|
19 |
-
- Accessorials ordering on frontend and admin panel;
|
20 |
-
- Ability to override rate in admin panel;
|
21 |
-
- Multi "Carrier Type" products logic;
|
22 |
-
- Free shipping settings in the System/Configuration: Free Shipping Method (None, Cheapest, All) for Free shipping coupon.
|
23 |
-
- Functionality 'Opt to Self Pack' and 'Charge customer for packing' logic. 
|
24 |
-
- Functionality ‘Custom packing price’ logic: admin is able to specify that a product has a custom packing price; added ‘Custom packing price’ field in the product level. Custom packing price considers ‘Number of items’ per Product. If there is > 1 product in the cart, then end customer can see rate containing sum of custom packing prices. If there is only one product in the cart, then end customer can see rate containing custom packing price.
|
25 |
-
- Tracking updates are displaying on the order under "Comments History".
|
26 |
-
- All log messages are written by one function.
|
27 |
-

|
28 |
-
</description>
|
29 |
-
<notes>v1.1.9 is ShipHawk's initial production release for Magento clients that allows interaction with ShipHawk test and production environments.</notes>
|
30 |
-
<authors><author><name>Mikel Richardson</name><user>MAG002779924</user><email>mikel@shiphawk.com</email></author></authors>
|
31 |
-
<date>2015-10-06</date>
|
32 |
-
<time>12:39:29</time>
|
33 |
-
<contents><target name="magecommunity"><dir name="Shiphawk"><dir name="Shipping"><dir name="Block"><dir name="Adminhtml"><dir name="Origins"><dir name="Edit"><file name="Form.php" hash="fc372c73fac12c592d40ff9ae9297381"/></dir><file name="Edit.php" hash="1202b50bc520ebf18bfbb033280f1ddf"/><file name="Grid.php" hash="9af28e730d7c476f1c8a5254402d8429"/></dir><file name="Origins.php" hash="748725e017dcbca92de4adf9de59d23f"/><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="View.php" hash="49b1612a21244178d517eecd492beaca"/></dir><file name="View.php" hash="fc8f1e2607f7ced87edb73dad8d515c3"/></dir></dir><file name="Shipment.php" hash="77e0feeda9046bb8152d83eb22b1b053"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="fbffbfa54f05d2da4cf380ffec35e38f"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><dir name="Helper"><dir name="Form"><file name="Disabled.php" hash="05adb96db0b68dc900174c4fefa3b39d"/><file name="Type.php" hash="4dd966de022cc9fc6d69dc5e0ecb4726"/></dir></dir></dir></dir><dir name="Shipping"><dir name="Tracking"><file name="Popup.php" hash="73358c38983dc18b6ccb4420e98a7043"/></dir></dir><file name="Version.php" hash="f91bc825ee1b6225e727c825e72ece71"/></dir><dir name="Helper"><file name="Data.php" hash="85793812e18dfce341395bec0533bae9"/><file name="Origin.php" hash="5a1ef27d1cb4db9ccb4a4a9f0c29c10e"/></dir><dir name="Model"><file name="Api.php" hash="bb094afb2115f0dac5626629d933bdb2"/><file name="Carrier.php" hash="db57f62d838edfbe5adc96265d9d9143"/><file name="Observer.php" hash="ef0bcffc51cc2ac7c3acd94f9103a786"/><file name="Origins.php" hash="763f9064fcbf04f3cd873553a0002625"/><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="Location.php" hash="e8cefabd60ff8ef6b09559c35ae4ff8c"/></dir></dir></dir><dir name="Resource"><dir name="Origins"><file name="Collection.php" hash="8aa8fb73c9db05975621106940b6519f"/></dir><file name="Origins.php" hash="e8c73d70433c1c4b21deca7b2baf1374"/></dir><dir name="Source"><file name="Adminratefilter.php" hash="e6096208ee165e06b016fcbc64b1a545"/><file name="Carriertype.php" hash="b2311da4909f59060bb60df14c7a5c59"/><file name="Freeshipping.php" hash="f35aa4a9483d2bdae1e3b60ce27b0f55"/><file name="Gateway.php" hash="1fa95fb657bc67f2973dd7e55a1046ad"/><file name="Location.php" hash="222ee55e43cc161204bc05e1a08b3db6"/><file name="Ratefilter.php" hash="56ed7f5059d2f9804387915eaa4f4b3b"/><file name="Received.php" hash="6d50e8c1fe6e13c971ba63348e98aac0"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ImportController.php" hash="6207c7ac200e882eb44b25b7e2587415"/><file name="OriginsController.php" hash="0f1e6e724f555bc0efd631257584779c"/><file name="ShipmentController.php" hash="31ba401f5ae4f2e0ab292e6abdde2dab"/></dir><file name="IndexController.php" hash="9f44fe9bda9b290cccfed823bf9970d0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="ceec9868f5c072336c97aebd7da0dc03"/><file name="config.xml" hash="7615c271719e1f27c0f0872f963a9fe9"/><file name="system.xml" hash="c11bb02d77b03a3894fe4e9bb98cc99f"/></dir><dir name="sql"><dir name="shiphawk_setup"><file name="mysql4-install-0.1.0.php" hash="951c03164740882fac36a0ccd6bec66f"/><file name="mysql4-upgrade-0.7.0-0.7.1.php" hash="eb3f0b3185cce381ea63a0d7fa4c76c6"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="a8d2ffa83e57b6983aadc84a800fd233"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="14ee57a3dbd6262796dfa53ac334b60e"/><file name="mysql4-upgrade-1.0.10-1.0.11.php" hash="535c9a3e34e9b26cdce3a99a7f56671b"/><file name="mysql4-upgrade-1.0.11-1.0.12.php" hash="e27f74deda031e8c221c838f44ff8002"/><file name="mysql4-upgrade-1.0.12-1.0.13.php" hash="65f1c19944d7c86f1acbb05e7627d622"/><file name="mysql4-upgrade-1.0.13-1.1.0.php" hash="e3ae5cb573422d100dee9c55de15533c"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="4ff24d716c62172ef4b85d18b91934c0"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="ba820664a791ed852b9238e113a41be9"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="054fd8d6946d5fd02b5943bfd2a73fad"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="e9fca7a2e71ae27cf8e66c27bed7274b"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="868c422c61c17dd39a948fcdaa1b58ac"/><file name="mysql4-upgrade-1.0.8-1.0.9.php" hash="5f545c7ec60cb16810ce96fdc9686ac7"/><file name="mysql4-upgrade-1.0.9-1.0.10.php" hash="3a8a2a44ce08382e40b809e3108ca795"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="5037a768822190cea8e08fdc8ab8f483"/><file name="mysql4-upgrade-1.1.3-1.1.4.php" hash="1d0088f0dce6b6e9c88627c996f486b6"/><file name="mysql4-upgrade-1.1.4-1.1.5.php" hash="dbc6cb1d4e8d204ac8d08820c7d62824"/><file name="mysql4-upgrade-1.1.5.1-1.1.5.3.php" hash="fffb846c7c16cdeecd9ce796ce2f8795"/><file name="mysql4-upgrade-1.1.5.3-1.1.6.php" hash="0ab1729e8311494b71fd1b50bd8f421e"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="669e5188d858ba37a854a6f0705086e0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="shiphawk.xml" hash="b83a40d4875b26cb97bea0f7a82d3d5a"/></dir><dir name="template"><dir name="shiphawk"><file name="amount.phtml" hash="9e390f9aedf13ffa61f92242bf610039"/><file name="button.phtml" hash="93558631aa6de44825ecba21816a882e"/><file name="shiphawkjsfile.phtml" hash="259319e703bdc2334aa3a0e940938448"/><file name="shipment.phtml" hash="bddff258ac35b4d9a8755e2dd5feb559"/><dir name="shipping"><file name="form.phtml" hash="8d3e96290e01b500eac769e40650968e"/><dir name="method"><file name="form.phtml" hash="003f794718b96e3cb9039b18d8e184e5"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="shiphawk.xml" hash="3f605ddf9891c7d7981e423a6e635d8f"/></dir><dir name="template"><dir name="shiphawk"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="11f25905c0f1b4cfb9083efe615e70f9"/><dir name="progress"><file name="billing.phtml" hash="cbb9c68a7069d8603c5cc577300724b5"/><file name="shipping.phtml" hash="d6dcfcf8a54601a42276d69ce9231868"/><file name="shipping_method.phtml" hash="3e93f77b5d1a5566f6b310e8bbd16d2e"/></dir><dir name="review"><file name="totals.phtml" hash="ea4e221ec355e6cb09c591b11c7c271b"/></dir><file name="shipping.phtml" hash="07f95cd8d3a84319701d17868ea4666f"/><dir name="shipping_method"><file name="available.phtml" hash="a8666c4ced8514ace09a3f1ec60bd1ce"/></dir></dir></dir><file name="popup.phtml" hash="fa91ebcc1832255d9dba57a111e7f29a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Shiphawk_Shipping.xml" hash="7ba90cc41d3b8113ec7bfde2dd683346"/></dir></target><target name="mageweb"><dir name="js"><dir name="shiphawk"><file name="shiphawk.css" hash="970c267202a419d9634af147bcfbcb21"/><file name="shiphawk.js" hash="7a942e966f639809d5d05f92ab4c8505"/><file name="shiphawk_order.js" hash="cef5a7d47cd41592a1191f7a043e59b2"/><file name="shiphawk_shipment.js" hash="feaefbb5a0e6dfa40558c0baca24b72b"/></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="shiphawk_error_email.html" hash="0fc96cfc750065c0f3db2737b1a2573d"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="shiphawk"><dir name="css"><file name="sh-style.css" hash="73a115c47b27ea50047d2ee006a1586d"/></dir></dir></dir></dir></dir></target></contents>
|
34 |
<compatible/>
|
35 |
-
<dependencies><required><php><min>5.1
|
36 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ShipHawk</name>
|
4 |
+
<version>2.0.0</version>
|
5 |
+
<stability>alpha</stability>
|
6 |
+
<license>free</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>-</summary>
|
10 |
+
<description>-</description>
|
11 |
+
<notes>-</notes>
|
12 |
+
<authors><author><name>ShipHawk</name><user>MAG002779924</user><email>mikel@shiphawk.com</email></author></authors>
|
13 |
+
<date>2016-06-14</date>
|
14 |
+
<time>23:52:32</time>
|
15 |
+
<contents><target name="mageetc"><dir name="."><file name="Shiphawk_Order.xml" hash=""/><file name="Shiphawk_Shipping.xml" hash=""/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="mages"><dir name="shiphawk"><file name="shiphawkicon.png" hash=""/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Shiphawk"><dir name="MyCarrier"><dir name="Model"><file name="Carrier.php" hash="4870fdb6200fb9f0370c2789072af9b5"/></dir><dir name="etc"><file name="config.xml" hash="6c79463b2a9d70f83020b21b8ab8f830"/><file name="system.xml" hash="5db176acade31f82578f55dc2f1babd2"/></dir></dir><dir name="Order"><dir name="Block"><dir name="System"><file name="Link.php" hash="c44c95b4b5f8b1d87038d9707a970737"/></dir></dir><dir name="Helper"><file name="Data.php" hash="1a2f8a93a310d337787a34c3d6f1ecbb"/></dir><dir name="Model"><dir name="Command"><file name="ChangeStatus.php" hash="f9b2e53cad39ba7d602948f46feeebc9"/><file name="CheckConfiguration.php" hash="7665245cf9f348e7e89fb27ef58175bc"/><file name="SendOrder.php" hash="44db22fb4bf285822e104a759bc4add3"/></dir><dir name="Cron"><file name="ProcessOrderForLast14Days.php" hash="b9559a7b8c90df810c8fb412883e9fbe"/></dir><dir name="Observer"><file name="Config.php" hash="e44707a0586a18fea8a69646ff21b74a"/><file name="Order.php" hash="d92b7b9a80faf66e044bee7650e4a779"/></dir><dir name="Source"><file name="Gateway.php" hash="dc0a5460921b1ef8e65a462c6485cf49"/></dir><file name="StatusMapper.php" hash="45807c1a7f87acffdb8fde23405433d5"/></dir><dir name="etc"><file name="config.xml" hash="45f8db84d11d7ba8b8df2319a06e59dc"/><file name="system.xml" hash="bb27d60d36aa676324802d56d252ddd5"/></dir></dir></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.1</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/frontend/base/default/shiphawk/css/sh-style.css
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
.shipping-ratio-origins {
|
2 |
-
display: none;
|
3 |
-
}
|
4 |
-
|
5 |
-
.shipping-ratio-origins {
|
6 |
-
padding-left: 25px;
|
7 |
-
}
|
8 |
-
|
9 |
-
span.shipping-ratio-origins {
|
10 |
-
padding-left: 40px;
|
11 |
-
}
|
12 |
-
|
13 |
-
.shipping-ratio-origins-label {
|
14 |
-
background-color: transparent!important;
|
15 |
-
}
|
16 |
-
|
17 |
-
.shipping-ratio-origins-type {
|
18 |
-
text-transform: capitalize;
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|